Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
/*=========================================================================
*
* DLGAbout.cpp - implementation of about dialog box class
*
* Version 1.0
* Revision date
*
*=======================================================================*/
#include "stdafx.h"
#include "DlgAbout.h"
/*
=======================================================================================
CAboutDlg dialog
=======================================================================================
*/
/****************************************************************************
* Description: constructor
*
* Parameters: pParent : parent window
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/) : CDialog(CAboutDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAboutDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
/****************************************************************************
* Description: message map
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*
=======================================================================================
CAboutDlg message handlers
=======================================================================================
*/
/****************************************************************************
* Description: WM_INITDIALOG
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE;
}
/****************************************************************************
* Description: WM_DESTROY
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CAboutDlg::OnDestroy()
{
CDialog::OnDestroy();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,864 @@
/*=========================================================================
*
* DlgMain4.cpp - implementation file for main window class
* Configuration functions
*
* Version 1.0
* Revision date
*
*=======================================================================*/
#include <io.h>
#include <fcntl.h>
#include "stdafx.h"
#include "DlgMain.h"
#include "system.h"
#include "print.h"
#include "IniData.h"
//---------------------------------------------------------------------------
//==================================================//
// DIRECTORIES CONFIGS //
//==================================================//
/****************************************************************************
* Description:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vInitDirCombo ()
{
xString sIdent;
char *p_Char1;
int i, j=0;
// init directory combo
strcpy(g_szConfDirs[0], "Default");
strcpy(sIdent, g_stInitialData.szConfDirs);
if (strcmp(sIdent, ""))
{
p_Char1=sIdent;
j=1;
while( (*p_Char1 != ',') && (*p_Char1 != 0))
{
i=0;
while( (*p_Char1 != ',') && (*p_Char1 != 0))
{
g_szConfDirs[j][i]=*p_Char1;
p_Char1++;
i++;
}
g_szConfDirs[j][i] = '\0';
if (*p_Char1 == 0) break;
p_Char1++;
j++;
}
g_iNbConfDirs = j+1;
}
else
g_iNbConfDirs = 1;
for (i=0; i<g_iNbConfDirs; i++)
m_oComboChooseDir.AddString(_T(g_szConfDirs[i]));
if (!strcmp(g_szDirConfig, ""))
{
// find current config
GetPrivateProfileString("CurrentConfigs", "Directories", "", sIdent, 100, g_szIniFile);
i = m_oComboChooseDir.FindStringExact(-1, sIdent);
g_iCurrentIndexDir = (i != -1) ? i : 0;
m_oComboChooseDir.SetCurSel(g_iCurrentIndexDir);
// directory config
GetPrivateProfileString( "CurrentConfigs", "DirMode", "Standard", sIdent, 10, g_szIniFile );
g_bStandardConfig = stricmp(sIdent, "Custom");
}
else
{
g_bStandardConfig = !strcmp(g_szDirConfig, "Default");
i = m_oComboChooseDir.FindStringExact(-1, g_szDirConfig);
g_iCurrentIndexDir = (i != -1) ? i : 0;
m_oComboChooseDir.SetCurSel(g_iCurrentIndexDir);
}
m_fn_vUpdateForDirConfig();
}
/****************************************************************************
* Description: Set the default directory configuration
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vSetDefaultDirConfig()
{
xString sRaw;
switch (g_iRaw)
{
case 0:
strcpy(sRaw, g_stInitialData.szRawData);
break;
case 1:
strcpy(sRaw, g_stInitialData.szRawSpecific1);
break;
case 2:
strcpy(sRaw, g_stInitialData.szRawSpecific2);
break;
}
sprintf(g_stInitialDirData.szAnims, "%s\\World\\Graphics\\Anims", sRaw);
sprintf(g_stInitialDirData.szBanks, "%s\\World\\Graphics\\Objects\\Banks", sRaw);
sprintf(g_stInitialDirData.szClasses, "%s\\World\\Graphics\\Objects\\Classes", sRaw);
sprintf(g_stInitialDirData.szFamilies, "%s\\World\\Families", sRaw);
sprintf(g_stInitialDirData.szLevels, "%s\\World\\Levels", sRaw);
sprintf(g_stInitialDirData.szTextures, "%s\\World\\Textures", sRaw);
m_fn_vUpdateDirectories() ;
m_fn_vResetSelection();
}
/****************************************************************************
* Description: set the window text for the types and the global variables for types
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vUpdateForDirConfig()
{
char szDir1[_MAX_PATH];
// update directory panel
m_oConfigPanel.SetCurSel((g_bStandardConfig) ? 0 : 1);
g_iCurrentIndexDir = m_oComboChooseDir.GetCurSel();
if (g_iCurrentIndexDir)
{
if (strcmp(g_stInitialData.szConfDirs, ""))
{
GetCurrentDirectory( MAX_PATH, szDir1 );
SetCurrentDirectory( g_szInitialDirectory );
//read the Configs.ini file
fn_IniData_vGetDatasFromConfigDirsFile( TRUE, g_szConfDirs[g_iCurrentIndexDir] );
m_fn_vUpdateDirectories() ;
SetCurrentDirectory( szDir1 );
m_fn_vResetSelection();
}
}
else
m_fn_vSetDefaultDirConfig();
}
/****************************************************************************
* Description: set the window text for the types and the global variables for types
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vUpdateDirectories()
{
GetDlgItem(IDC_EDIT_ANIMS)->SetWindowText(g_stInitialDirData.szAnims);
GetDlgItem(IDC_EDIT_BANKS)->SetWindowText(g_stInitialDirData.szBanks);
GetDlgItem(IDC_EDIT_CLASSES)->SetWindowText(g_stInitialDirData.szClasses);
GetDlgItem(IDC_EDIT_FAMILIES)->SetWindowText(g_stInitialDirData.szFamilies);
GetDlgItem(IDC_EDIT_LEVELS)->SetWindowText(g_stInitialDirData.szLevels);
GetDlgItem(IDC_EDIT_TEXTURES)->SetWindowText(g_stInitialDirData.szTextures);
strcpy(g_szAnims, g_stInitialDirData.szAnims);
strcpy(g_szBanks, g_stInitialDirData.szBanks);
strcpy(g_szClasses, g_stInitialDirData.szClasses);
strcpy(g_szFamilies, g_stInitialDirData.szFamilies);
strcpy(g_szLevels, g_stInitialDirData.szLevels);
strcpy(g_szTextures, g_stInitialDirData.szTextures);
}
/****************************************************************************
* Description:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vRegisterAllPaths (int iNumConfig)
{
fn_IniData_vSetConfigDirPath( g_szConfDirs[iNumConfig], "Anims", g_szAnims);
fn_IniData_vSetConfigDirPath( g_szConfDirs[iNumConfig], "Banks", g_szBanks);
fn_IniData_vSetConfigDirPath( g_szConfDirs[iNumConfig], "Classes", g_szClasses);
fn_IniData_vSetConfigDirPath( g_szConfDirs[iNumConfig], "Families", g_szFamilies);
fn_IniData_vSetConfigDirPath( g_szConfDirs[iNumConfig], "Levels", g_szLevels);
fn_IniData_vSetConfigDirPath( g_szConfDirs[iNumConfig], "Textures", g_szTextures);
}
//==================================================//
// SELECTIONS CONFIGS //
//==================================================//
/****************************************************************************
* Description:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vInitSelectCombo ()
{
xString sIdent;
char *p_Char1;
int i, j=0;
// init selection combo
strcpy(g_szConfSelects[0], "Default");
strcpy(sIdent, g_stInitialData.szConfSelects);
if (strcmp(sIdent, ""))
{
p_Char1=sIdent;
j=1;
while( (*p_Char1 != ',') && (*p_Char1 != 0))
{
i=0;
while( (*p_Char1 != ',') && (*p_Char1 != 0))
{
g_szConfSelects[j][i]=*p_Char1;
p_Char1++;
i++;
}
g_szConfSelects[j][i] = '\0';
if (*p_Char1 == 0) break;
p_Char1++;
j++;
}
g_iNbConfSelects = j+1;
}
else
g_iNbConfSelects = 1;
for (i=0; i<g_iNbConfSelects; i++)
m_oComboChooseSelect.AddString(_T(g_szConfSelects[i]));
// find current config
if (!strcmp(g_szSelectConfig, ""))
GetPrivateProfileString("CurrentConfigs", "Selections", "", sIdent, 100, g_szIniFile);
else
strcpy(sIdent, g_szSelectConfig);
i = m_oComboChooseSelect.FindStringExact(-1, sIdent);
g_iCurrentIndexSelect = (i != -1) ? i : 0;
m_oComboChooseSelect.SetCurSel(g_iCurrentIndexSelect);
m_fn_vUpdateForSelectConfig();
}
/****************************************************************************
* Description: Set the default selection configuration
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vSetDefaultSelectConfig()
{
m_fn_vResetSelection();
}
/****************************************************************************
* Description:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vUpdateForSelectConfig()
{
OnClearAll();
g_iNbAnimsObj = 0;
g_iNbBanksObj = 0;
g_iNbClassesObj = 0;
g_iNbFamiliesObj = 0;
g_iNbLevelsObj = 0;
g_iNbTexturesObj = 0;
g_bChangeComboSelect = FALSE;
if (strcmp(g_stInitialData.szConfSelects, ""))
{
GI_Type *p_oType;
xString szDir1;
GetCurrentDirectory( MAX_PATH, szDir1 );
SetCurrentDirectory( g_szInitialDirectory );
g_iCurrentIndexSelect = m_oComboChooseSelect.GetCurSel();
if (g_iCurrentIndexSelect)
{
//read the ConfigControls.ini file
fn_IniData_vGetDatasFromConfigSelectFile( TRUE, g_szConfSelects[g_iCurrentIndexSelect] );
//update the selection
m_fn_vUpdateSelectLists();
m_fn_vUpdateSelections();
}
else
m_fn_vSetDefaultSelectConfig();
// update buttons state
m_fn_vEnableButtonAll();
m_fn_vEnableButtonConvert();
// update type list
m_oListType->SetCurSel(0);
OnSelchangeListType() ;
// update selection buttons
p_oType = (m_oListType->GetCount() > 0) ? (GI_Type *)m_oListType->GetItemData(0) : NULL;
m_oSelectList.EnableWindow(p_oType && (p_oType->m_iSelected!=m_oListObject->GetCount()));
m_oClearList.EnableWindow(p_oType && (p_oType->m_iSelected>0));
// update object list
m_oListObject->Invalidate(TRUE);
SetCurrentDirectory( szDir1 );
}
}
/****************************************************************************
* Description: set all objects
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vUpdateSelectLists()
{
m_fn_vUpdateSelectListForType("Anims", g_stInitialSelectData.szAnims, &g_iNbAnimsObj);
m_fn_vUpdateSelectListForType("Banks", g_stInitialSelectData.szBanks, &g_iNbBanksObj);
m_fn_vUpdateSelectListForType("Classes", g_stInitialSelectData.szClasses, &g_iNbClassesObj);
m_fn_vUpdateSelectListForType("Families", g_stInitialSelectData.szFamilies, &g_iNbFamiliesObj);
m_fn_vUpdateSelectListForType("Levels", g_stInitialSelectData.szLevels, &g_iNbLevelsObj);
m_fn_vUpdateSelectListForType("Textures", g_stInitialSelectData.szTextures, &g_iNbTexturesObj);
}
/****************************************************************************
* Description: Select all types
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vUpdateSelections()
{
m_fn_vUpdateSelectionForType("Anims", g_iNbAnimsObj);
m_fn_vUpdateSelectionForType("Banks", g_iNbBanksObj);
m_fn_vUpdateSelectionForType("Classes", g_iNbClassesObj);
m_fn_vUpdateSelectionForType("Families", g_iNbFamiliesObj);
m_fn_vUpdateSelectionForType("Levels", g_iNbLevelsObj);
m_fn_vUpdateSelectionForType("Textures", g_iNbTexturesObj);
}
/****************************************************************************
* Description: set all selections and types from the second panel
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vRegisterSelections (int iNumConfig)
{
m_fn_vRegisterSelectionForType(g_szConfSelects[iNumConfig], "Anims");
m_fn_vRegisterSelectionForType(g_szConfSelects[iNumConfig], "Banks");
m_fn_vRegisterSelectionForType(g_szConfSelects[iNumConfig], "Classes");
m_fn_vRegisterSelectionForType(g_szConfSelects[iNumConfig], "Families");
m_fn_vRegisterSelectionForType(g_szConfSelects[iNumConfig], "Levels");
m_fn_vRegisterSelectionForType(g_szConfSelects[iNumConfig], "Textures");
}
/****************************************************************************
* Description: update the selection list for the given type
*
* Parameters: szObjects : the string with all the objects separated by ,
* szType : type
* iNbObjects : the number of the objects for the type
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vUpdateSelectListForType (char *szType, char *szObjects, int *iNbObjects)
{
int i, j;
char *p_Char1, sIdent[256];
strcpy(sIdent, szObjects);
if (strcmp(sIdent, ""))
{
p_Char1=sIdent;
j=0;
while( (*p_Char1 != ',') && (*p_Char1 != 0))
{
i=0;
while( (*p_Char1 != ',') && (*p_Char1 != 0))
{
if (!stricmp(szType, "Anims"))
g_szAnimsObj[j][i]=*p_Char1;
if (!stricmp(szType, "Banks"))
g_szBanksObj[j][i]=*p_Char1;
if (!stricmp(szType, "Classes"))
g_szClassesObj[j][i]=*p_Char1;
if (!stricmp(szType, "Families"))
g_szFamiliesObj[j][i]=*p_Char1;
if (!stricmp(szType, "Levels"))
g_szLevelsObj[j][i]=*p_Char1;
if (!stricmp(szType, "Textures"))
g_szTexturesObj[j][i]=*p_Char1;
p_Char1++;
i++;
}
if (!stricmp(szType, "Anims"))
g_szAnimsObj[j][i]='\0';
if (!stricmp(szType, "Banks"))
g_szBanksObj[j][i]='\0';
if (!stricmp(szType, "Classes"))
g_szClassesObj[j][i]='\0';
if (!stricmp(szType, "Families"))
g_szFamiliesObj[j][i]='\0';
if (!stricmp(szType, "Levels"))
g_szLevelsObj[j][i]='\0';
if (!stricmp(szType, "Textures"))
g_szTexturesObj[j][i]='\0';
if (*p_Char1 == 0) break;
p_Char1++;
j++;
}
*iNbObjects = j+1;
}
}
/****************************************************************************
* Description: Select the objects for the type
*
* Parameters: szType : type
* g_iNb : number of objects
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vUpdateSelectionForType (char *szType, int g_iNb )
{
int j;
int i, iIndex;
GI_Item *p_oItem;
GI_Type *p_oType;
iIndex= m_oListType->FindStringExact( -1, szType );
if (iIndex != CB_ERR)
{
m_oListType->SetCurSel(iIndex);
p_oType = (GI_Type *)m_oListType->GetItemData( iIndex );
OnSelchangeListType() ;
j=0;
for (i=0; i<g_iNb; i++)
{
if (!stricmp(szType, "Anims"))
iIndex= m_oListObject->FindStringExact( -1, g_szAnimsObj[i] );
if (!stricmp(szType, "Banks"))
iIndex= m_oListObject->FindStringExact( -1, g_szBanksObj[i] );
if (!stricmp(szType, "Classes"))
iIndex= m_oListObject->FindStringExact( -1, g_szClassesObj[i] );
if (!stricmp(szType, "Families"))
iIndex= m_oListObject->FindStringExact( -1, g_szFamiliesObj[i] );
if (!stricmp(szType, "Levels"))
iIndex= m_oListObject->FindStringExact( -1, g_szLevelsObj[i] );
if (!stricmp(szType, "Textures"))
iIndex= m_oListObject->FindStringExact( -1, g_szTexturesObj[i] );
if (iIndex == LB_ERR)
{ j++;
continue;
}
p_oItem = (GI_Item *)m_oListObject->GetItemData( iIndex );
if (!p_oItem->m_bActived)
{
p_oType->m_iSelected++;
m_iCountOfSelections++;
}
p_oItem->m_bActived = TRUE;
}
}
}
/****************************************************************************
* Description: Get the selection list for the given type
*
* Parameters: szType : name of configuration
* szName : type
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vRegisterSelectionForType (char *szName, char *szType)
{
xString szPath;
strcpy(szPath, "");
// read the current selection
m_fn_vReadCurrentSelection();
if (!stricmp(szType, "Anims") && g_iNbAnimsObj)
{
for (int i=0; i<g_iNbAnimsObj-1; i++)
{ strcat(szPath, g_szAnimsObj[i]);
if (g_iNbAnimsObj != 1) strcat(szPath, ",");
}
if (g_iNbAnimsObj != -1) strcat(szPath, g_szAnimsObj[g_iNbAnimsObj-1]);
}
if (!stricmp(szType, "Banks") && g_iNbBanksObj)
{
for (int i=0; i<g_iNbBanksObj-1; i++)
{ strcat(szPath, g_szBanksObj[i]);
if (g_iNbBanksObj != 1) strcat(szPath, ",");
}
if (g_iNbBanksObj != -1) strcat(szPath, g_szBanksObj[g_iNbBanksObj-1]);
}
if (!stricmp(szType, "Classes") && g_iNbClassesObj)
{
for (int i=0; i<g_iNbClassesObj-1; i++)
{ strcat(szPath, g_szClassesObj[i]);
if (g_iNbClassesObj != 1) strcat(szPath, ",");
}
if (g_iNbClassesObj != -1) strcat(szPath, g_szClassesObj[g_iNbClassesObj-1]);
}
if (!stricmp(szType, "Families") && g_iNbFamiliesObj)
{
for (int i=0; i<g_iNbFamiliesObj-1; i++)
{ strcat(szPath, g_szFamiliesObj[i]);
if (g_iNbFamiliesObj != 1) strcat(szPath, ",");
}
if (g_iNbFamiliesObj != -1) strcat(szPath, g_szFamiliesObj[g_iNbFamiliesObj-1]);
}
if (!stricmp(szType, "Levels") && g_iNbLevelsObj)
{
for (int i=0; i<g_iNbLevelsObj-1; i++)
{ strcat(szPath, g_szLevelsObj[i]);
if (g_iNbLevelsObj != 1) strcat(szPath, ",");
}
if (g_iNbLevelsObj != -1) strcat(szPath, g_szLevelsObj[g_iNbLevelsObj-1]);
}
if (!stricmp(szType, "Textures") && g_iNbTexturesObj)
{
for (int i=0; i<g_iNbTexturesObj-1; i++)
{ strcat(szPath, g_szTexturesObj[i]);
if (g_iNbTexturesObj != 1) strcat(szPath, ",");
}
if (g_iNbTexturesObj != -1) strcat(szPath, g_szTexturesObj[g_iNbTexturesObj-1]);
}
fn_IniData_vSetSelectConfigValues( szName, szType, szPath );
}
/****************************************************************************
* Description: Read the current selection and update the lists
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vReadCurrentSelection ()
{
int i;
g_iNbAnimsObj=0;
g_iNbBanksObj=0;
g_iNbClassesObj=0;
g_iNbFamiliesObj=0;
g_iNbLevelsObj=0;
g_iNbTexturesObj=0;
// anims
if (m_p_oTypeAnims && m_p_oTypeAnims->m_iSelected)
{
for (i=0; i<m_p_oTypeAnims->m_oList.GetCount(); i++)
{
GI_Item * p_oItem = m_p_oTypeAnims->m_oList.RemoveHead();
if (p_oItem->m_bActived)
{ strcpy(g_szAnimsObj[g_iNbAnimsObj], p_oItem->m_fn_p_oGetName());
g_iNbAnimsObj++;
}
m_p_oTypeAnims->m_oList.AddTail(p_oItem);
}
}
// banks
if (m_p_oTypeBanks && m_p_oTypeBanks->m_iSelected)
{
for (i=0; i<m_p_oTypeBanks->m_oList.GetCount(); i++)
{
GI_Item * p_oItem = m_p_oTypeBanks->m_oList.RemoveHead();
if (p_oItem->m_bActived)
{ strcpy(g_szBanksObj[g_iNbBanksObj], p_oItem->m_fn_p_oGetName());
g_iNbBanksObj++;
}
m_p_oTypeBanks->m_oList.AddTail(p_oItem);
}
}
// classes
if (m_p_oTypeClasses && m_p_oTypeClasses->m_iSelected)
{
for (i=0; i<m_p_oTypeClasses->m_oList.GetCount(); i++)
{
GI_Item * p_oItem = m_p_oTypeClasses->m_oList.RemoveHead();
if (p_oItem->m_bActived)
{ strcpy(g_szClassesObj[g_iNbClassesObj], p_oItem->m_fn_p_oGetName());
g_iNbClassesObj++;
}
m_p_oTypeClasses->m_oList.AddTail(p_oItem);
}
}
// families
if (m_p_oTypeFamilies && m_p_oTypeFamilies->m_iSelected)
{
for (i=0; i<m_p_oTypeFamilies->m_oList.GetCount(); i++)
{
GI_Item * p_oItem = m_p_oTypeFamilies->m_oList.RemoveHead();
if (p_oItem->m_bActived)
{ strcpy(g_szFamiliesObj[g_iNbFamiliesObj], p_oItem->m_fn_p_oGetName());
g_iNbFamiliesObj++;
}
m_p_oTypeFamilies->m_oList.AddTail(p_oItem);
}
}
// levels
if (m_p_oTypeLevels && m_p_oTypeLevels->m_iSelected)
{
for (i=0; i<m_p_oTypeLevels->m_oList.GetCount(); i++)
{
GI_Item * p_oItem = m_p_oTypeLevels->m_oList.RemoveHead();
if (p_oItem->m_bActived)
{ strcpy(g_szLevelsObj[g_iNbLevelsObj], p_oItem->m_fn_p_oGetName());
g_iNbLevelsObj++;
}
m_p_oTypeLevels->m_oList.AddTail(p_oItem);
}
}
// textures
if (m_p_oTypeTextures && m_p_oTypeTextures->m_iSelected)
{
for (i=0; i<m_p_oTypeTextures->m_oList.GetCount(); i++)
{
GI_Item * p_oItem = m_p_oTypeTextures->m_oList.RemoveHead();
if (p_oItem->m_bActived)
{ strcpy(g_szTexturesObj[g_iNbTexturesObj], p_oItem->m_fn_p_oGetName());
g_iNbTexturesObj++;
}
m_p_oTypeTextures->m_oList.AddTail(p_oItem);
}
}
}
//==================================================//
// OPTIONS CONFIGS //
//==================================================//
/****************************************************************************
* Description:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vInitOptionCombo ()
{
xString sIdent;
char *p_Char1;
int i, j=0;
// init option combo
strcpy(g_szConfOptions[0], "Default");
strcpy(sIdent, g_stInitialData.szConfOptions);
if (strcmp(sIdent, ""))
{
p_Char1=sIdent;
j=1;
while( (*p_Char1 != ',') && (*p_Char1 != 0))
{
i=0;
while( (*p_Char1 != ',') && (*p_Char1 != 0))
{
g_szConfOptions[j][i]=*p_Char1;
p_Char1++;
i++;
}
g_szConfOptions[j][i] = '\0';
if (*p_Char1 == 0) break;
p_Char1++;
j++;
}
g_iNbConfOptions = j+1;
}
else
g_iNbConfOptions = 1;
for (i=0; i<g_iNbConfOptions; i++)
m_oComboChooseOption.AddString(_T(g_szConfOptions[i]));
// find current config
if (!strcmp(g_szOptionConfig, ""))
GetPrivateProfileString("CurrentConfigs", "Options", "", sIdent, 100, g_szIniFile);
else
strcpy(sIdent, g_szOptionConfig);
i = m_oComboChooseOption.FindStringExact(-1, sIdent);
g_iCurrentIndexOption = (i != -1) ? i : 0;
m_oComboChooseOption.SetCurSel(g_iCurrentIndexOption);
m_fn_vUpdateForOptionConfig();
}
/****************************************************************************
* Description:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vSetDefaultOptionConfig()
{
char szOption[10];
// conflict options
if (!strcmp(g_szIgnoreZoo, ""))
GetPrivateProfileString( "Options", "IgnoreZoo", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szIgnoreZoo, "1") ? "FALSE" : "TRUE");
g_bIgnoreZoo = stricmp(szOption, "FALSE");
if (!strcmp(g_szIgnoreSct, ""))
GetPrivateProfileString( "Options", "IgnoreSct", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szIgnoreSct, "1") ? "FALSE" : "TRUE");
g_bIgnoreSct = stricmp(szOption, "FALSE");
if (!strcmp(g_szIgnoreSpo, ""))
GetPrivateProfileString( "Options", "IgnoreSpo", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szIgnoreSpo, "1") ? "FALSE" : "TRUE");
g_bIgnoreSpo = stricmp(szOption, "FALSE");
if (!strcmp(g_szIgnoreGmt, ""))
GetPrivateProfileString( "Options", "IgnoreGmt", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szIgnoreGmt, "1") ? "FALSE" : "TRUE");
g_bIgnoreGmt = stricmp(szOption, "FALSE");
if (!strcmp(g_szIgnoreVmt, ""))
GetPrivateProfileString( "Options", "IgnoreTex", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szIgnoreVmt, "1") ? "FALSE" : "TRUE");
g_bIgnoreTex = stricmp(szOption, "FALSE");
// conversion options
if (!strcmp(g_szCopyAnims, ""))
GetPrivateProfileString( "Conversion", "CopyAnims", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szCopyAnims, "1") ? "FALSE" : "TRUE");
g_bCopyAnims = stricmp(szOption, "FALSE");
if (!strcmp(g_szCopyTextures, ""))
GetPrivateProfileString( "Conversion", "CopyTextures", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szCopyTextures, "1") ? "FALSE" : "TRUE");
g_bCopyTextures = stricmp(szOption, "FALSE");
if (!strcmp(g_szGenerateRLI, ""))
GetPrivateProfileString( "Conversion", "GenerateRLI", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szGenerateRLI, "1") ? "FALSE" : "TRUE");
g_bGenerateRLI = stricmp(szOption, "FALSE");
if (!strcmp(g_szUpdateGameDSC, ""))
GetPrivateProfileString( "Conversion", "UpdateGameDSC", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szUpdateGameDSC, "1") ? "FALSE" : "TRUE");
g_bUpdateGameDSC = stricmp(szOption, "FALSE");
if (!strcmp(g_szCreateBasicFamily, ""))
GetPrivateProfileString( "Conversion", "CreateBasicFamily", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szCreateBasicFamily, "1") ? "FALSE" : "TRUE");
g_bCreateBasicFamily = !stricmp(szOption, "TRUE");
// erase options
if (!strcmp(g_szEraseDuplicated, ""))
GetPrivateProfileString( "Erase", "EraseDuplicated", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szEraseDuplicated, "1") ? "FALSE" : "TRUE");
g_bEraseDuplicated = !stricmp(szOption, "TRUE");
if (!strcmp(g_szEraseUnused, ""))
GetPrivateProfileString( "Erase", "EraseUnused", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szEraseUnused, "1") ? "FALSE" : "TRUE");
g_bEraseUnused = !stricmp(szOption, "TRUE");
// family options
if (!strcmp(g_szForceCommon, ""))
GetPrivateProfileString( "Family", "CommonFamily", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szForceCommon, "1") ? "FALSE" : "TRUE");
g_bCommonFamily = stricmp(szOption, "FALSE");
if (!strcmp(g_szForceSpecific, ""))
GetPrivateProfileString( "Family", "SpecificFamily", "TRUE", szOption, 10, g_szIniFile );
else
strcpy(szOption, strcmp(g_szForceSpecific, "1") ? "FALSE" : "TRUE");
g_bSpecificFamily = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Family", "AskFamily", "TRUE", szOption, 10, g_szIniFile );
g_bAskFamily = stricmp(szOption, "FALSE");
m_fn_vSetOptions();
}
/****************************************************************************
* Description:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vUpdateForOptionConfig()
{
g_bChangeComboOption = FALSE;
if (strcmp(g_stInitialData.szConfOptions, ""))
{
xString szDir1;
GetCurrentDirectory( MAX_PATH, szDir1 );
SetCurrentDirectory( g_szInitialDirectory );
g_iCurrentIndexOption = m_oComboChooseOption.GetCurSel();
if (g_iCurrentIndexOption)
{
//read the ConfigControls.ini file
fn_IniData_vGetDatasFromConfigOptionsFile(TRUE, g_szConfOptions[g_iCurrentIndexOption]);
m_fn_vSetOptions();
}
else
m_fn_vSetDefaultOptionConfig();
SetCurrentDirectory( szDir1 );
}
}
/****************************************************************************
* Description: set all options and types from the second panel
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgMain::m_fn_vRegisterAllOptions (int iNumConfig)
{
fn_IniData_vSetOptionConfigValues( g_bIgnoreZoo, "IgnoreZoo", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bIgnoreSct, "IgnoreSct", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bIgnoreSpo, "IgnoreSpo", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bIgnoreGmt, "IgnoreGmt", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bIgnoreTex, "IgnoreTex", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bCopyAnims, "CopyAnims", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bCopyTextures, "CopyTextures", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bGenerateRLI, "GenerateRLI", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bUpdateGameDSC, "UpdateGameDSC", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bCreateBasicFamily, "CreateBasicFamily", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bEraseDuplicated, "EraseDuplicated", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bEraseUnused, "EraseUnused", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bSpecificFamily, "SpecificFamily", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bCommonFamily, "CommonFamily", g_szConfOptions[iNumConfig]);
fn_IniData_vSetOptionConfigValues( g_bAskFamily, "AskFamily", g_szConfOptions[iNumConfig]);
}

View File

@@ -0,0 +1,141 @@
/*=========================================================================
*
* DLGWarning.cpp - implementation file for warning dialog box class
*
* Version 1.0
* Revision date
*
*=======================================================================*/
#include "stdafx.h"
#include "DlgWarning.h"
#include "print.h"
/*
=======================================================================================
CDlgWarning dialog
=======================================================================================
*/
/****************************************************************************
* Description: constructor
*
* Parameters: pParent : parent window
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
CDlgWarning::CDlgWarning(CWnd* pParent /*=NULL*/) : CDialog(CDlgWarning::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgWarning)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
/****************************************************************************
* Description: message map
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
BEGIN_MESSAGE_MAP(CDlgWarning, CDialog)
//{{AFX_MSG_MAP(CDlgWarning)
ON_BN_CLICKED(IDC_WARNING_CHECKAPPLYALL, OnApplyAll)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*
=======================================================================================
CDlgWarning message handlers
=======================================================================================
*/
/****************************************************************************
* Description: WM_INITDIALOG
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
BOOL CDlgWarning::OnInitDialog()
{
CDialog::OnInitDialog();
if (!g_bApplyAll)
((CButton *)GetDlgItem(IDC_WARNING_CHECKAPPLYALL))->SetCheck(0);
else
((CButton *)GetDlgItem(IDC_WARNING_CHECKAPPLYALL))->SetCheck(1);
m_oStatic=(CStatic *)GetDlgItem(IDC_WARNING_STATICMESSAGE);
m_oStatic->SetWindowText(m_sMes);
GetDlgItem(IDOK)->SetWindowText(m_sOK);
GetDlgItem(IDCANCEL)->SetWindowText(m_sCancel);
return TRUE;
}
/****************************************************************************
* Description: WM_DESTROY
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgWarning::OnDestroy()
{
CDialog::OnDestroy();
}
/****************************************************************************
* Description: Handle function for message BN_CLICKED on ApplyAll button
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgWarning::OnApplyAll()
{
g_bApplyAll = ((CButton *)GetDlgItem(IDC_WARNING_CHECKAPPLYALL))->GetCheck();
}
/****************************************************************************
* Description: Build the text of the warning message
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CDlgWarning::m_fn_vBuildTextMessage (tdeWarningMode eMode, char *sName)
{
switch (eMode)
{
case E_ForceCommon :
strcpy(m_sMes, "Some specific files already exist for the family ");
strcat(m_sMes, sName);
strcat(m_sMes, ".\nAre you sure you want to convert it as a common one? \n");
strcat(m_sMes, "There is a risk of incoherence.");
strcpy(m_sOK, "Force Common");
strcpy(m_sCancel, "Cancel Conversion");
break;
case E_ForceSpecific :
strcpy(m_sMes, "The family ");
strcat(m_sMes, sName);
strcat(m_sMes, " was a common one. \n\n Do you want it to become a specific one?");
strcpy(m_sOK, "Force Specific");
strcpy(m_sCancel, "Keep Common");
break;
}
}

View File

@@ -0,0 +1,37 @@
/*=========================================================================
*
* GIItem.cpp - Implementation of the GI_Item class
*
* Version 1.0
* Revision date
*
*=======================================================================*/
#include "stdafx.h"
#include "GIItem.h"
/****************************************************************************
* Description: constructor
*
* Parameters: bAct : activation flag
* szName : name of the item
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
GI_Item::GI_Item (BOOL bAct, char *szName)
{
m_bActived = bAct;
strcpy(m_szName, szName);
}
/****************************************************************************
* Description: destructor
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
GI_Item::~GI_Item()
{
}

View File

@@ -0,0 +1,39 @@
/*=========================================================================
*
* GIType.cpp - Implementation of the GI_Type class
*
* Version 1.0
* Revision date
*
*=======================================================================*/
#include "stdafx.h"
#include "GIType.h"
/****************************************************************************
* Description: constructor
*
* Parameters: szName : name of the item
* _iSelected : selection flag
* _xTextColor : color of the item
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
GI_Type::GI_Type(char *szName, int _iSelected, COLORREF _xTextColor)
{
strcpy(m_szName, szName);
m_iSelected = _iSelected;
m_xTextColor = _xTextColor;
}
/****************************************************************************
* Description: destructor
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
GI_Type::~GI_Type()
{
}

View File

@@ -0,0 +1,229 @@
/*=========================================================================
*
* GraphInter.cpp - main implementation file for the graphic interface
*
* Version 1.0
* Revision date
*
*=======================================================================*/
#include "stdafx.h"
#include "GraphInter.h"
#include "print.h"
#include "DlgMain.h"
#include "IniData.h"
#include "Help.h"
//--- Global statics --------------------------------------------------------
// The one and only CGraphInterApp object
CGraphInterApp theApp;
// CGraphInterApp initialization
CRichEditCtrl* p_oRichEditRes;
CHARFORMAT* p_stCharFormatRes;
CRichEditCtrl* p_oRichEditCom;
CHARFORMAT* p_stCharFormatCom;
CWinThread* p_ThMain;
//--------------------------------------------------------------------
/****************************************************************************
* Description: message map
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
BEGIN_MESSAGE_MAP(CGraphInterApp, CWinApp)
//{{AFX_MSG_MAP(CGraphInterApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/****************************************************************************
* Description: constructor
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
CGraphInterApp::CGraphInterApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/****************************************************************************
* Description: init the application instance
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
BOOL CGraphInterApp::InitInstance()
{
char szHelpFile[256];
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// compute the name of the context help file
GetCurrentDirectory(256, szHelpFile);
strcat(szHelpFile, "\\");
strcat(szHelpFile, C_szCxtHelpFile);
// update the current context help file
fn_vChangeContextHelpFile(szHelpFile);
// create the dialog for the application
CDlgMain dlg;
m_pMainWnd = &dlg;
p_oRichEditCom = &dlg.m_oRichEditCom;
p_stCharFormatCom = &dlg.m_stCharFormatCom;
p_oRichEditRes = &dlg.m_oRichEditRes;
p_stCharFormatRes = &dlg.m_stCharFormatRes;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
/****************************************************************************
* Description: update the name of the context help file
*
* Parameters: _szString : string to display
* _Line : type of the line (normal, warning, error)
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CGraphInterApp::fn_vChangeContextHelpFile (char *szNewName)
{
free((void*)m_pszHelpFilePath);
m_pszHelpFilePath=_tcsdup(_T(szNewName));
}
/****************************************************************************
* Description: display a string in the result window
*
* Parameters: _szString : string to display
* _Line : type of the line (normal, warning, error)
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_vAfxOutputStringRes( char* _szString, char _Line)
{
fn_ComRes_vWriteLine( _szString, _Line ,p_oRichEditRes, p_stCharFormatRes);
}
/****************************************************************************
* Description: display a string in the command window
*
* Parameters: _szString : string to display
* _Line : type of the line (normal, warning, error)
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_vAfxOutputStringCom( char* _szString, char _Line)
{
char szSingleLine[256];
char *p_szNextCom, *p_szCurrentCom;
char *p_szNextLine, *p_szCurrentLine;
BOOL bTitle, bLastLine, bLastCom = FALSE;
int iLineIndex = 0, iCommandIndex = 0;
p_szCurrentCom = _szString;
while (p_szCurrentCom)
{
// update pointers
p_szNextCom = strstr(p_szCurrentCom+2, "##");
p_szCurrentLine = p_szCurrentCom+2;
// update flags
bTitle = TRUE;
bLastCom = (p_szNextCom == NULL);
bLastLine = FALSE;
while (p_szCurrentLine)
{
// update command index
g_iCommandIndex[iLineIndex] = iCommandIndex;
p_szNextLine = strchr(p_szCurrentLine+1, '-');
if (!p_szNextLine)
{
bLastLine = TRUE;
if (!p_szNextCom)
p_szNextLine = p_szCurrentLine + strlen(p_szCurrentLine);
else
p_szNextLine = p_szNextCom;
}
else if (!bLastCom && (p_szNextLine > p_szNextCom))
{
bLastLine = TRUE;
p_szNextLine = p_szNextCom;
}
int nLenght = p_szNextLine - p_szCurrentLine;
memset(szSingleLine, 0, 256);
strcpy(szSingleLine, (bTitle ? " " : " "));
strncat(szSingleLine, p_szCurrentLine, nLenght);
if (szSingleLine[strlen(szSingleLine) - 1] != '\n')
strcat(szSingleLine+nLenght, "\n");
if (bTitle)
fn_ComRes_vWriteLine( szSingleLine, C_ComRes_cTitleLine ,p_oRichEditCom, p_stCharFormatCom);
else
fn_ComRes_vWriteLine( szSingleLine, C_ComRes_cNormalLine ,p_oRichEditCom, p_stCharFormatCom);
p_szCurrentLine = bLastLine ? NULL : p_szNextLine;
iLineIndex++;
bTitle = FALSE;
}
g_iCommandIndex[iLineIndex] = iCommandIndex;
p_szCurrentCom = p_szNextCom;
iCommandIndex++;
}
// fn_ComRes_vWriteLine( _szString, _Line ,p_oRichEditCom, p_stCharFormatCom);
}

View File

@@ -0,0 +1,829 @@
/*=========================================================================
*
* IniData.cpp - general functions for saving, loading
*
* Version 1.0
* Revision date
*
*=======================================================================*/
#include <io.h>
#include <sys/stat.h>
#include "stdafx.h"
#include "IniData.h"
#include "print.h"
//--- Global defines --------------------------------------------------------
tdstWindowsPosSize g_stWinPosSize;
tdstInitialValue g_stInitialData;
tdstInitialDirValue g_stInitialDirData;
tdstInitialSelectValue g_stInitialSelectData;
tdstInitialOptionValue g_stInitialOptionData;
char g_szIniFile[MAX_PATH];
char g_szIniConfDirFile[MAX_PATH];
char g_szIniConfSelectFile[MAX_PATH];
char g_szIniConfOptionFile[MAX_PATH];
//--- Global Statics --------------------------------------------------------
tdstInitialValue g_stDefaultData = // default value for data
{
"d:\\GameData", // default temp path for game data(computed)
"d:\\RawData", // default temp path for raw data(computed)
"Textures", // default temp path for Textures(computed)
"Default", // default temp path for Default(computed)
"Rayman", // default temp for Version(computed)
"Update ModifLst.txt", // default temp for ModifLst(computed)
"", // default temp path for game specific1(computed)
"", // default temp path for game specific2(computed)
"", // default temp path for raw specific1(computed)
"", // default temp path for raw specific2(computed)
"", // default temp path for family(computed)
"RawSpecific1", // default temp name for raw specific1(computed)
"RawSpecific2", // default temp name for raw specific2(computed)
"GameSpecific1", // default temp name for game specific1(computed)
"GameSpecific2", // default temp name for game specific2(computed)
"",
"",
"none", // default game data path (computed if none)
"none", // default raw data path (computed if none)
"none", // default Textures path (computed if none)
"none", // default Default path (computed if none)
"none", // default Version (computed if none)
"none", // default ModifLst (computed if none)
"none", // default game data specific1 (computed if none)
"none", // default game data specific2 (computed if none)
"none", // default raw data specific1 (computed if none)
"none", // default raw data specific1 (computed if none)
"none", // default path for family (computed if none)
"none", // default name for raw specific1 (computed if none)
"none", // default name for raw specific2 (computed if none)
"none", // default name for game specific1 (computed if none)
"none", // default name for game specific2 (computed if none)
"none",
"none",
};
tdstInitialDirValue g_stDefaultDirData =
{
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
tdstInitialOptionValue g_stDefaultOptionData =
{
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
tdstInitialSelectValue g_stDefaultSelectData =
{
"",
"",
"",
"",
"",
"",
};
//--- Macros -----------------------------------------------------------
// Macro to bound size of a rect
#define M_vVerifyRect( _p_stRect, _iMinWidth, _iMinHeight )\
{\
if (_p_stRect->right - _p_stRect->left + 1 < _iMinWidth )\
_p_stRect->right = _p_stRect->left + _iMinWidth ;\
if (_p_stRect->bottom - _p_stRect->top + 1 < _iMinHeight )\
_p_stRect->bottom = _p_stRect->top + _iMinHeight;\
}
//--------------------------------------------------------------------
/****************************************************************************
* Description: write the path for Game Data Directory in the .ini file
*
* Parameters: _szPath : path to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetGameData( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "General directories", "PathGameData", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: write the path for Game Specific1 Directory in the .ini file
*
* Parameters: _szPath : path to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetGameSpecific1( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "General directories", "PathGameSpecific1", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: write the path for Game Specific2 Directory in the .ini file
*
* Parameters: _szPath : path to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetGameSpecific2( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "General directories", "PathGameSpecific2", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: write the path for Raw Data Directory in the .ini file
*
* Parameters: _szPath : path to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetRawData( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "General directories", "PathRawData", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: write the path for Raw Specific1 Directory in the .ini file
*
* Parameters: _szPath : path to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetRawSpecific1( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "General directories", "PathRawSpecific1", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: write the path for Raw Specific2 Directory in the .ini file
*
* Parameters: _szPath : path to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetRawSpecific2( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "General directories", "PathRawSpecific2", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: Set the entry in the .ini file for the RawSpecific1
*
* Parameters: _szPath : name to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetRawSp1( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "Name", "RawSpecific1", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: Set the entry in the .ini file for the RawSpecific2
*
* Parameters: _szPath : name to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetRawSp2( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "Name", "RawSpecific2", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: Set the entry in the .ini file for the GameSpecific1
*
* Parameters: _szPath : name to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetGameSp1( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "Name", "GameSpecific1", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: Set the entry in the .ini file for the GameSpecific2
*
* Parameters: _szPath : name to write
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetGameSp2( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "Name", "GameSpecific2", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: Get all datas saved in the .ini file
*
* Parameters: _bFirst : intialisation file
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vGetDatasFromFile( BOOL _bFirst )
{
if (_bFirst)
{
GetCurrentDirectory( MAX_PATH, g_szIniFile );
if (g_szIniFile[strlen(g_szIniFile) - 1] != '\\')
strcat( g_szIniFile, "\\");
strcat( g_szIniFile, C_szIniFile );
// set all ini data with default data
memcpy( &g_stInitialData, &g_stDefaultData, sizeof( tdstInitialValue ) );
}
// get the informations for name of the executable, local path, game data, rawdata, textures and default directories
GetPrivateProfileString( "Name", "RawSpecific1", g_stDefaultData.szRawSp1, g_stInitialData.szRawSp1, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "Name", "RawSpecific2", g_stDefaultData.szRawSp2, g_stInitialData.szRawSp2, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "Name", "GameSpecific1", g_stDefaultData.szGameSp1, g_stInitialData.szGameSp1, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "Name", "GameSpecific2", g_stDefaultData.szGameSp2, g_stInitialData.szGameSp2, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "General directories", "PathRawData", g_stDefaultData.szRawData, g_stInitialData.szRawData, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "General directories", "PathRawSpecific1", g_stDefaultData.szRawSpecific1, g_stInitialData.szRawSpecific1, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "General directories", "PathRawSpecific2", g_stDefaultData.szRawSpecific2, g_stInitialData.szRawSpecific2, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "General directories", "PathGameData", g_stDefaultData.szGameData, g_stInitialData.szGameData, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "General directories", "PathGameSpecific1", g_stDefaultData.szGameSpecific1, g_stInitialData.szGameSpecific1, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "General directories", "PathGameSpecific2", g_stDefaultData.szGameSpecific2, g_stInitialData.szGameSpecific2, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "MainOptions", "Version", g_stDefaultData.szVersion, g_stInitialData.szVersion, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "SpecificFiles", "Family", g_stDefaultData.szFamily, g_stInitialData.szFamily, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "Configurations", "ConfigDirs", g_stDefaultData.szConfDirs, g_stInitialData.szConfDirs, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "Configurations", "ConfigSelects", g_stDefaultData.szConfSelects, g_stInitialData.szConfSelects, MAX_PATH, g_szIniFile );
GetPrivateProfileString( "Configurations", "ConfigOptions", g_stDefaultData.szConfOptions, g_stInitialData.szConfOptions, MAX_PATH, g_szIniFile );
// set executable name, local path, Game Data path, RawData path, Textures path, Default path
HANDLE hHandle;
WIN32_FIND_DATA stFindFileData;
memset(&stFindFileData,0,sizeof(stFindFileData));
hHandle = FindFirstFile(g_szIniFile, &stFindFileData);
//return a boolean for telling if some files *.* exists in the directory or not
if( hHandle == INVALID_HANDLE_VALUE)
{ char _szMessage[50];
sprintf(_szMessage, "The %s file does not exist, so the datas will be taken from the Default structure!", g_szIniFile);
AfxMessageBox( _szMessage, MB_OK | MB_ICONSTOP );
}
FindClose(hHandle);
if (strcmp( g_stInitialData.szGameData, g_stDefaultData.szGameData) == 0)
strcpy( g_stInitialData.szGameData, g_stInitialData.szTempGameData);
if (strcmp( g_stInitialData.szRawData, g_stDefaultData.szRawData) == 0)
strcpy( g_stInitialData.szRawData, g_stInitialData.szTempRawData);
if (strcmp( g_stInitialData.szTextures, g_stDefaultData.szTextures) == 0)
strcpy( g_stInitialData.szTextures, g_stInitialData.szTempTextures);
if (strcmp( g_stInitialData.szDefault, g_stDefaultData.szDefault) == 0)
strcpy( g_stInitialData.szDefault, g_stInitialData.szTempDefault);
if (strcmp( g_stInitialData.szVersion, g_stDefaultData.szVersion) == 0)
strcpy( g_stInitialData.szVersion, g_stInitialData.szTempVersion);
if (strcmp( g_stInitialData.szModifLst, g_stDefaultData.szModifLst) == 0)
strcpy( g_stInitialData.szModifLst, g_stInitialData.szTempModifLst);
if (strcmp( g_stInitialData.szGameSpecific1, g_stDefaultData.szGameSpecific1) == 0)
strcpy( g_stInitialData.szGameSpecific1, g_stInitialData.szTempGameSpecific1);
if (strcmp( g_stInitialData.szGameSpecific2, g_stDefaultData.szGameSpecific2) == 0)
strcpy( g_stInitialData.szGameSpecific2, g_stInitialData.szTempGameSpecific2);
if (strcmp( g_stInitialData.szRawSpecific1, g_stDefaultData.szRawSpecific1) == 0)
strcpy( g_stInitialData.szRawSpecific1, g_stInitialData.szTempRawSpecific1);
if (strcmp( g_stInitialData.szRawSpecific2, g_stDefaultData.szRawSpecific2) == 0)
strcpy( g_stInitialData.szRawSpecific2, g_stInitialData.szTempRawSpecific2);
if (strcmp( g_stInitialData.szFamily, g_stDefaultData.szFamily) == 0)
strcpy( g_stInitialData.szFamily, g_stInitialData.szTempFamily);
if (strcmp( g_stInitialData.szRawSp1, g_stDefaultData.szRawSp1) == 0)
strcpy( g_stInitialData.szRawSp1, g_stInitialData.szTempRawSp1);
if (strcmp( g_stInitialData.szRawSp2, g_stDefaultData.szRawSp2) == 0)
strcpy( g_stInitialData.szRawSp2, g_stInitialData.szTempRawSp2);
if (strcmp( g_stInitialData.szGameSp1, g_stDefaultData.szGameSp1) == 0)
strcpy( g_stInitialData.szGameSp1, g_stInitialData.szTempGameSp1);
if (strcmp( g_stInitialData.szGameSp2, g_stDefaultData.szGameSp2) == 0)
strcpy( g_stInitialData.szGameSp2, g_stInitialData.szTempGameSp2);
if (strcmp( g_stInitialData.szConfDirs, g_stDefaultData.szConfDirs) == 0)
strcpy( g_stInitialData.szConfDirs, g_stInitialData.szTempConfDirs);
if (strcmp( g_stInitialData.szConfSelects, g_stDefaultData.szConfSelects) == 0)
strcpy( g_stInitialData.szConfSelects, g_stInitialData.szTempConfSelects);
if (strcmp( g_stInitialData.szConfOptions, g_stDefaultData.szConfOptions) == 0)
strcpy( g_stInitialData.szConfOptions, g_stInitialData.szTempConfOptions);
g_bRaymanII = stricmp(g_stInitialData.szVersion, "Rayman");
// Get the position and the size of the main window
fn_IniData_vGetWindowPosSize();
// Get the options
char szOption[10];
// main options
GetPrivateProfileString( "MainOptions", "UpdateLst", "FALSE", szOption, 10, g_szIniFile );
g_bModifLst = !stricmp(szOption, "TRUE");
GetPrivateProfileString( "MainOptions", "IgnoreMdf", "FALSE", szOption, 10, g_szIniFile );
g_bEraseMdf = !stricmp(szOption, "TRUE");
// ignore options
GetPrivateProfileString( "Options", "IgnoreZoo", "TRUE", szOption, 10, g_szIniFile );
g_bIgnoreZoo = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Options", "IgnoreSct", "TRUE", szOption, 10, g_szIniFile );
g_bIgnoreSct = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Options", "IgnoreSpo", "TRUE", szOption, 10, g_szIniFile );
g_bIgnoreSpo = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Options", "IgnoreGmt", "TRUE", szOption, 10, g_szIniFile );
g_bIgnoreGmt = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Options", "IgnoreTex", "TRUE", szOption, 10, g_szIniFile );
g_bIgnoreTex = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Options", "IgnoreMod", "TRUE", szOption, 10, g_szIniFile );
g_bEraseMdf = stricmp(szOption, "FALSE");
// conversion options
GetPrivateProfileString( "Conversion", "CopyAnims", "TRUE", szOption, 10, g_szIniFile );
g_bCopyAnims = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Conversion", "CopyTextures", "TRUE", szOption, 10, g_szIniFile );
g_bCopyTextures = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Conversion", "GenerateRLI", "TRUE", szOption, 10, g_szIniFile );
g_bGenerateRLI = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Conversion", "UpdateGameDSC", "TRUE", szOption, 10, g_szIniFile );
g_bUpdateGameDSC = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Conversion", "CreateBasicFamily", "FALSE", szOption, 10, g_szIniFile );
g_bCreateBasicFamily = !stricmp(szOption, "TRUE");
// erase options
GetPrivateProfileString( "Erase", "EraseDuplicated", "FALSE", szOption, 10, g_szIniFile );
g_bEraseDuplicated = !stricmp(szOption, "TRUE");
GetPrivateProfileString( "Erase", "EraseUnused", "FALSE", szOption, 10, g_szIniFile );
g_bEraseUnused = !stricmp(szOption, "TRUE");
// family options
GetPrivateProfileString( "Family", "CommonFamily", "TRUE", szOption, 10, g_szIniFile );
g_bCommonFamily = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Family", "SpecificFamily", "TRUE", szOption, 10, g_szIniFile );
g_bSpecificFamily = stricmp(szOption, "FALSE");
GetPrivateProfileString( "Family", "AskFamily", "TRUE", szOption, 10, g_szIniFile );
g_bAskFamily = stricmp(szOption, "FALSE");
}
/****************************************************************************
* Description: Get data from the Configs.ini file
*
* Parameters: _bFirst : TRUE if first time
* szTag : name of the config
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vGetDatasFromConfigDirsFile( BOOL _bFirst, char *szTag )
{
if (_bFirst)
{
GetCurrentDirectory( MAX_PATH, g_szIniConfDirFile );
if (g_szIniConfDirFile[strlen(g_szIniConfDirFile) - 1] != '\\')
strcat( g_szIniConfDirFile, "\\");
strcat( g_szIniConfDirFile, C_szIniConfDirFile );
// set all ini data with default data
memcpy( &g_stInitialDirData, &g_stDefaultDirData, sizeof( tdstInitialDirValue ) );
}
GetPrivateProfileString( szTag, "Anims", g_stDefaultDirData.szAnims, g_stInitialDirData.szAnims, MAX_PATH, g_szIniConfDirFile );
GetPrivateProfileString( szTag, "Banks", g_stDefaultDirData.szBanks, g_stInitialDirData.szBanks, MAX_PATH, g_szIniConfDirFile );
GetPrivateProfileString( szTag, "Classes", g_stDefaultDirData.szClasses, g_stInitialDirData.szClasses, MAX_PATH, g_szIniConfDirFile );
GetPrivateProfileString( szTag, "Families", g_stDefaultDirData.szFamilies, g_stInitialDirData.szFamilies, MAX_PATH, g_szIniConfDirFile );
GetPrivateProfileString( szTag, "Levels", g_stDefaultDirData.szLevels, g_stInitialDirData.szLevels, MAX_PATH, g_szIniConfDirFile );
GetPrivateProfileString( szTag, "Textures", g_stDefaultDirData.szTextures, g_stInitialDirData.szTextures, MAX_PATH, g_szIniConfDirFile );
HANDLE hHandle;
WIN32_FIND_DATA stFindFileData;
memset(&stFindFileData,0,sizeof(stFindFileData));
hHandle = FindFirstFile(g_szIniConfDirFile, &stFindFileData);
//return a boolean for telling if some files *.* exists in the directory or not
if( hHandle == INVALID_HANDLE_VALUE)
{ char _szMessage[50];
sprintf(_szMessage, "The %s file does not exist, so the datas will be taken from the Default structure!", g_szIniConfDirFile);
AfxMessageBox( _szMessage, MB_OK | MB_ICONSTOP );
}
FindClose(hHandle);
if (strcmp( g_stInitialDirData.szAnims, g_stDefaultDirData.szAnims) == 0)
strcpy( g_stInitialDirData.szAnims, g_stInitialDirData.szTempAnims);
if (strcmp( g_stInitialDirData.szBanks, g_stDefaultDirData.szBanks) == 0)
strcpy( g_stInitialDirData.szBanks, g_stInitialDirData.szTempBanks);
if (strcmp( g_stInitialDirData.szClasses, g_stDefaultDirData.szClasses) == 0)
strcpy( g_stInitialDirData.szClasses, g_stInitialDirData.szTempClasses);
if (strcmp( g_stInitialDirData.szFamilies, g_stDefaultDirData.szFamilies) == 0)
strcpy( g_stInitialDirData.szFamilies, g_stInitialDirData.szTempFamilies);
if (strcmp( g_stInitialDirData.szLevels, g_stDefaultDirData.szLevels) == 0)
strcpy( g_stInitialDirData.szLevels, g_stInitialDirData.szTempLevels);
if (strcmp( g_stInitialDirData.szTextures, g_stDefaultDirData.szTextures) == 0)
strcpy( g_stInitialDirData.szTextures, g_stInitialDirData.szTempTextures);
}
/****************************************************************************
* Description: Set the Config entry in the GIData.ini file
*
* Parameters: _szPath : names of the configs ("Name1,Name2,Name3,...")
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetConfigDirNames( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "Configurations", "ConfigDirs", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: Set the dir entry in the Configs.ini file
*
* Parameters: szConf : name of the config
* szDirName : name of the type
* zsPath : path to register
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetConfigDirPath( char* szConf, char *szDirName, char *_szPath )
{
if (_access( g_szIniConfDirFile, 2) == -1)
_chmod ( g_szIniConfDirFile, _S_IWRITE );
WritePrivateProfileString( szConf, szDirName, _szPath, g_szIniConfDirFile );
}
/****************************************************************************
* Description: Get data from ConfigControls file
*
* Parameters: _bFirst : TRUE if first time
* szTag : name of the config
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vGetDatasFromConfigSelectFile( BOOL _bFirst, char *szTag )
{
if (_bFirst)
{
GetCurrentDirectory( MAX_PATH, g_szIniConfSelectFile );
if (g_szIniConfSelectFile[strlen(g_szIniConfSelectFile) - 1] != '\\')
strcat( g_szIniConfSelectFile, "\\");
strcat( g_szIniConfSelectFile, C_szIniConfSelectFile );
// set all ini data with default data
memcpy( &g_stInitialSelectData, &g_stDefaultSelectData, sizeof( tdstInitialSelectValue ) );
}
GetPrivateProfileString( szTag, "Anims", g_stDefaultSelectData.szAnims, g_stInitialSelectData.szAnims, MAX_PATH, g_szIniConfSelectFile );
GetPrivateProfileString( szTag, "Banks", g_stDefaultSelectData.szBanks, g_stInitialSelectData.szBanks, MAX_PATH, g_szIniConfSelectFile );
GetPrivateProfileString( szTag, "Classes", g_stDefaultSelectData.szClasses, g_stInitialSelectData.szClasses, MAX_PATH, g_szIniConfSelectFile );
GetPrivateProfileString( szTag, "Families", g_stDefaultSelectData.szFamilies, g_stInitialSelectData.szFamilies, MAX_PATH, g_szIniConfSelectFile );
GetPrivateProfileString( szTag, "Levels", g_stDefaultSelectData.szLevels, g_stInitialSelectData.szLevels, MAX_PATH, g_szIniConfSelectFile );
GetPrivateProfileString( szTag, "Textures", g_stDefaultSelectData.szTextures, g_stInitialSelectData.szTextures, MAX_PATH, g_szIniConfSelectFile );
}
/****************************************************************************
* Description: Set the ConfigControls entry in the GIData.ini file
*
* Parameters: szPath : names of the configs ("Name1,Name2,Name3,...")
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetSelectConfigNames( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "Configurations", "ConfigSelects", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: Set the type entry in the ConfigSelects.ini file
*
* Parameters: szName : section name
* szType : name of the type
* szPath : names to register ("Name1,Name2,Name3,...")
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetSelectConfigValues( char *szName, char *szType, char *szPath )
{
if (_access( g_szIniConfOptionFile, 2) == -1)
_chmod ( g_szIniConfOptionFile, _S_IWRITE );
WritePrivateProfileString( szName, szType, szPath, g_szIniConfSelectFile );
}
/****************************************************************************
* Description: Get data from ConfigControls file
*
* Parameters: _bFirst : TRUE if first time
* szTag : name of the config
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vGetDatasFromConfigOptionsFile( BOOL _bFirst, char *szTag )
{
char szOption[10];
if (_bFirst)
{
GetCurrentDirectory( MAX_PATH, g_szIniConfOptionFile );
if (g_szIniConfOptionFile[strlen(g_szIniConfOptionFile) - 1] != '\\')
strcat( g_szIniConfOptionFile, "\\");
strcat( g_szIniConfOptionFile, C_szIniConfOptionFile );
// set all ini data with default data
memcpy( &g_stInitialOptionData, &g_stDefaultOptionData, sizeof( tdstInitialOptionValue ) );
}
GetPrivateProfileString( szTag, "IgnoreZoo", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bIgnoreZoo = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "IgnoreSct", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bIgnoreSct = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "IgnoreSpo", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bIgnoreSpo = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "IgnoreGmt", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bIgnoreGmt = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "IgnoreTex", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bIgnoreTex = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "CopyAnims", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bCopyAnims = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "CopyTextures", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bCopyTextures = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "GenerateRLI", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bGenerateRLI = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "UpdateGameDSC", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bUpdateGameDSC = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "CreateBasicFamily", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bCreateBasicFamily = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "EraseDuplicated", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bEraseDuplicated = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "EraseUnused", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bEraseUnused = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "CommonFamily", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bCommonFamily = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "SpecificFamily", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bSpecificFamily = stricmp(szOption, "FALSE");
GetPrivateProfileString( szTag, "AskFamily", "TRUE", szOption, 10, g_szIniConfOptionFile );
g_bAskFamily = stricmp(szOption, "FALSE");
}
/****************************************************************************
* Description: Set the ConfigControls entry in the GIData.ini file
*
* Parameters: szPath : names of the configs ("Name1,Name2,Name3,...")
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetOptionConfigNames( char *_szPath )
{
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
WritePrivateProfileString( "Configurations", "ConfigOptions", _szPath, g_szIniFile );
}
/****************************************************************************
* Description: Set the entry in the ConfigControls.ini file
*
* Parameters: bSetIgnore : state of the control
* szName : name of the control
* szNew : section name
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vSetOptionConfigValues( BOOL bSetIgnore, char *szName, char *szNew )
{
if (_access( g_szIniConfOptionFile, 2) == -1)
_chmod ( g_szIniConfOptionFile, _S_IWRITE );
WritePrivateProfileString( szNew, szName, bSetIgnore ? "TRUE" : "FALSE", g_szIniConfOptionFile );
}
/****************************************************************************
* Description: Get the position and the size of the main window from the .ini file
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vGetWindowPosSize( void )
{
char szString[100];
GetPrivateProfileString( "WinPref", "Main", "", szString, 100, g_szIniFile );
fn_IniData_vStudyRect( szString, &g_stWinPosSize.stMainPos );
M_vVerifyRect( (&g_stWinPosSize.stMainPos), C_iMainWindowWidth, C_iMainWindowHeight );
}
/****************************************************************************
* Description: Save the new position and size of the main window
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vWriteWindowPosSize( void )
{
char szValue[50];
RECT *p_stRect;
if (_access( g_szIniFile, 2) == -1)
_chmod ( g_szIniFile, _S_IWRITE );
//writing the new values for the position and size of the main window
p_stRect = &g_stWinPosSize.stMainPos;
sprintf( szValue, "(%4d,%4d,%4d,%4d)", p_stRect->left, p_stRect->top, p_stRect->right, p_stRect->bottom );
WritePrivateProfileString( "WinPref", "Main ", szValue, g_szIniFile );
}
/****************************************************************************
* Description: Verify that the values are correct (can be integers)
*
* Parameters: _szString : string containing the values
* _p_stRect : result rectangle
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_IniData_vStudyRect( char *_szString, RECT *_p_stRect )
{
char *p_szValue[5], *p_szEnd;
char cVal;
//study if the values can be integers
memset( _p_stRect, 0, sizeof( RECT ) );
if ( (p_szValue[0] = strchr(_szString, '(' )) == NULL)
return;
if ( (p_szValue[1] = strchr (++p_szValue[0], ',')) == NULL)
return;
if ( (p_szValue[2] = strchr (++p_szValue[1], ',')) == NULL)
return;
if ( (p_szValue[3] = strchr (++p_szValue[2], ',')) == NULL)
return;
p_szValue[3] ++;
p_szValue[4] = _szString + strlen( _szString );
for (cVal = 0; cVal < 4; cVal ++)
{
while ( !isdigit(*p_szValue[cVal]) )
{
if (p_szValue[cVal] == p_szValue[cVal+1])
return;
p_szValue[cVal]++;
}
p_szEnd = p_szValue[cVal] + 1;
while ( isdigit(*p_szEnd))
{
if (p_szEnd == p_szValue[cVal+1])
return;
p_szEnd++;
}
*p_szEnd = 0;
}
//convert to integer the ascii values
_p_stRect->left = atoi( p_szValue[0] );
_p_stRect->top = atoi( p_szValue[1] );
_p_stRect->right = atoi( p_szValue[2] );
_p_stRect->bottom = atoi( p_szValue[3] );
}
/****************************************************************************
* Description: Delete all the text in the rich edir box control
*
* Parameters: _oRichEdit : pointer to the control
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_ComRes_vDeleteLines( CRichEditCtrl *_oRichEdit)
{
//delete the content of the rich edit control (result and command)
_oRichEdit->SetWindowText( "" );
}
/****************************************************************************
* Description: Delete all the text in the rich edir box control
*
* Parameters: szLine : line to write
* cLineType : type of the line (normal, warning, error)
* _oRichEdit : pointer to the control
* _stCharFormat : format of the line
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void fn_ComRes_vWriteLine( char *szLine, char cLineType ,CRichEditCtrl* _oRichEdit, CHARFORMAT* _stCharFormat)
{
long lOldLength;
long lNewLength;
long lSize;
_stCharFormat->crTextColor = gs_a_xLineColor[ cLineType ];
_stCharFormat->dwMask = CFM_BOLD | CFM_COLOR;
if (cLineType == C_ComRes_cTitleLine)
_stCharFormat->dwEffects |= CFE_BOLD;
else
_stCharFormat->dwEffects &= ~CFE_BOLD;
// write a line in the rich edit control
// with different color (red or black) for Ok or for Error
lOldLength = _oRichEdit->GetTextLength();
lNewLength = lOldLength + strlen( szLine );
lSize = _oRichEdit->GetLimitText();
if (lNewLength > lSize)
{
lSize += 10000;
_oRichEdit->LimitText( lSize );
}
_oRichEdit->SetSel( lOldLength, lOldLength );
_oRichEdit->ReplaceSel( szLine );
_oRichEdit->SetSel( lOldLength, -1 );
_oRichEdit->SetSelectionCharFormat( *_stCharFormat );
_oRichEdit->SetSel( lNewLength, lNewLength );
_oRichEdit->RedrawWindow(NULL,NULL, RDW_INVALIDATE |RDW_FRAME| RDW_UPDATENOW );
}

View File

@@ -0,0 +1,146 @@
/*=========================================================================
*
* MainFrm.cpp - implementation of the CMainFrame class
*
* Version 1.0
* Revision date
*
*=======================================================================*/
#include "stdafx.h"
#include "MainFrm.h"
#include "resource.h"
//--- Global statics --------------------------------------------------------
static UINT indicators[] =
{
ID_SEPARATOR,
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
/****************************************************************************
* Description: message map
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/****************************************************************************
* Description: constructor
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
/****************************************************************************
* Description: destructor
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
/****************************************************************************
* Description: prepare the creation of the window (default)
*
* Parameters: cs : contains the initialisation parameters
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFrameWnd::PreCreateWindow(cs);
}
#ifdef _DEBUG
/****************************************************************************
* Description: validity check (default)
*
* Parameters:
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
/****************************************************************************
* Description: dump function (default)
*
* Parameters: dc : dump context
*---------------------------------------------------------------------------
* Revision date: Author:
*****************************************************************************/
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// GraphInter.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"