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,155 @@
#if !defined(__ErmSAI_h__)
#define __ErmSAI_h__
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
#include "SAI_Ver.h"
/***************************************/
/**** Error macros (using ACPerror) ****/
/***************************************/
#define M_SAIFatalError(ErrorNum) \
{ \
if (ErrorNum>E_uwSAIFatalErr&&ErrorNum<E_uwSAIStartOfWarning) \
{ \
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
Erm_M_UpdateLastError(SAI,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
} \
else \
{ \
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
Erm_M_UpdateLastError(SAI,C_ucErmDefaultChannel,E_uwSAIFatalErrorNotAFatalError,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
} \
}
#define M_SAIInformationError(ErrorNum) \
{ \
if (ErrorNum>E_uwSAIStartOfInformationWarning&&ErrorNum<E_uwSAIErrNumber) \
{ \
Erm_M_UpdateLastError(SAI,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmNoOpenInfoWindow,C_ucNeverStopForDebug, NULL);\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
} \
else \
{ \
M_SAIFatalError(E_uwSAIInformationErrorIsNotAInformationError); \
} \
}
#define M_SAIWarningError(ErrorNum) \
{ \
if (ErrorNum>E_uwSAIStartOfWarning&&ErrorNum<E_uwSAIStartOfInformationWarning) \
{ \
Erm_M_UpdateLastError(SAI,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
} \
else \
{ \
M_SAIFatalError(E_uwSAIWarningErrorIsNotAWarningError); \
} \
}
#define __FATAL_ERR_INPUT__
#define __INFORMATION_ERR_INPUT__ /**** Treat as a level 1 warning ****/
#define __WARNING_ERR_INPUT__ /**** Treat as a level 2 warning ****/
enum e_uwSAIErrNumber
{
E_uwSAIFatalErr,
#if defined(__FATAL_ERR_INPUT__)
/**** Error's errors ****/
E_uwSAIFatalErrorNotAFatalError,
E_uwSAIInformationErrorIsNotAInformationError,
E_uwSAIWarningErrorIsNotAWarningError,
E_uwSAI_CreateAListEntry,
E_uwSAI_SaveTableAndCurrentValue,
E_uwSAI_ArrayCantChangeSize,
E_uwSAI_InvalidSaveMode,
#endif /*__FATAL_ERR_INPUT__*/
E_uwSAIStartOfWarning,
#if defined(__WARNING_ERR_INPUT__)
E_uwSAI_SaveCurrentAndInitOther,
E_uwSAI_SaveDynamicPointer,
E_uwSAI_LoadDynamicPointer,
#endif /*__WARNING_ERR_INPUT__*/
E_uwSAIStartOfInformationWarning,
#if defined(__INFORMATION_ERR_INPUT__)
#endif /*__INFORMATION_ERR_INPUT__*/
E_uwSAIErrNumber,
};
/*------------------*/
/* Global Variables*/
/*------------------*/
#undef EXTERN
#undef extern
#undef LOCAL
#if !defined(D_SAI_Input_VariableDefine)
#define EXTERN extern /*external declaration*/
#define LOCAL /*replace by nothing : we have to declare*/
#else /* D_SAI_Input_VariableDefine */
#define EXTERN /*replace by nothing : we have to declare*/
#define LOCAL /*replace by nothing : we have to declare*/
#endif /* D_SAI_Input_VariableDefine */
EXTERN unsigned char g_ucSAIModuleId /* number of identification of the Game module*/
#if defined(D_SAI_Input_VariableDefine)
= C_ucModuleNotInitialized
#endif /* D_SAI_Input_VariableDefine */
;
#if defined(__ERROR_STRINGS__)
EXTERN CPA_EXPORT char * g_a_szSAIInformationModule []
#if defined(D_SAI_Input_VariableDefine) && !defined(CPA_WANTS_IMPORT)
= {C_szSAIVersion, C_szSAIFullName, C_szSAIDate}
#endif /* D_SAI_Input_VariableDefine && CPA_WANTS_IMPORT */
;
EXTERN char * g_szSAIModuleName /* Obliged syntax 'sz'+[Abbreviation of ModuleName]+'ModuleName'*/
#if defined(D_SAI_Input_VariableDefine)
= {"SAI"}
#endif /* D_SAI_Input_VariableDefine */
;
EXTERN tdstErrorMsg g_a_stSAITabErr[] /* Obliged syntax 'a_sz'+[Abbreviation of ModuleName]+'TabErr'*/
#if defined(D_SAI_Input_VariableDefine)
=
{
#if defined(__FATAL_ERR_INPUT__)
/**** Error's errors ****/
E_uwSAIFatalErrorNotAFatalError,"M_SAIFatalError : try to raise a warning or an information",
E_uwSAIInformationErrorIsNotAInformationError,"M_SAIInformationError : try to raise a fatal or a warning",
E_uwSAIWarningErrorIsNotAWarningError,"M_SAIWarningError : try to raise a fatal or a information",
E_uwSAI_CreateAListEntry,"SAI_fn_hCreateAListEntry : not enough memory.",
E_uwSAI_SaveTableAndCurrentValue,"SAI_fn_eVerifyFlags : can't used SAI_eSaveTableValue and SAI_eSaveCurrentValue in the same time.",
E_uwSAI_ArrayCantChangeSize,"A array entry can not change its size.",
E_uwSAI_InvalidSaveMode,"Invalid save mode.",
#endif /*__FATAL_ERR_INPUT__*/
#ifdef __WARNING_ERR_INPUT__
E_uwSAI_SaveCurrentAndInitOther,"SAI_fn_eVerifyFlags : use SAI_eSaveCurrentValue and SAI_eInitWhenMapLoaded or SAI_eInitWhenReinitTheMap or SAI_eInitWhenPlayerDead can not run correctly.",
E_uwSAI_SaveDynamicPointer,"Save dynamic pointer (can not run correctly)",
E_uwSAI_LoadDynamicPointer,"Load dynamic pointer (can not run correctly)",
#endif /*__WARNING_ERR_INPUT__*/
#ifdef __INFORMATION_ERR_INPUT__
#endif /*__INFORMATION_ERR_INPUT__*/
0xffff,"\0"/*fin*/
}
#endif /* D_SAI_Input_VariableDefine */
;
#endif /* __ERROR_STRINGS__ */
#undef EXTERN
#undef extern
#endif /* !__ErmSAI_h__ */

View File

@@ -0,0 +1,48 @@
/*#define SAI_D_DebugMalloc*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC - Oliv' */
#include "SaiCPA.h"
#include "mmgSai.h"
/**************************************************************************/
void SAI_fn_vMemoryLogFile(void *p_vPointer,unsigned char ucAction,char *szFile,unsigned long ulLine)
{
#if defined(_DEBUG)&& defined(SAI_D_DebugMalloc)
static unsigned long SAI_s_ulNumberOfAllocation = 0;
FILE *p_stFile;
char szFileName[30];
unsigned short uwBlocId;
void *p_vBeginBloc;
Mmg_fn_vWhereIs((void*)p_vPointer,&uwBlocId,&p_vBeginBloc);
sprintf(szFileName,"Mem%04x.log",uwBlocId);
if ((p_stFile = fopen(szFileName,"rt"))!=NULL)
fclose(p_stFile);
else
SAI_s_ulNumberOfAllocation = 0;
p_stFile = fopen(szFileName,"at");
if (p_stFile!=NULL)
{
if (ucAction==SAI_C_ActionMalloc)
{
SAI_s_ulNumberOfAllocation++;
fprintf(p_stFile,"Malloc : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",SAI_s_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
}
if (ucAction==SAI_C_ActionRealloc)
{
fprintf(p_stFile,"Realloc : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",SAI_s_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
}
else if (ucAction==SAI_C_ActionFree)
{
SAI_s_ulNumberOfAllocation--;
fprintf(p_stFile,"Free : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",SAI_s_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
}
fclose(p_stFile);
}
#endif /* _DEBUG && SAI_D_DebugMalloc */
}
/**************************************************************************/
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC - Oliv' */

View File

@@ -0,0 +1,93 @@
#ifndef __MmgSai_h__
#define __MmgSai_h__
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
#undef EXTERN
#undef extern
#if !defined(D_SAI_Input_VariableDefine)
#define EXTERN extern
#else
#define EXTERN
#endif /* D_SAI_Input_VariableDefine */
enum e_ucGameStaticBlocks{
E_ucSAIFixMemory,
E_ucSAILevelMemory,
E_ucSAIMaxBlocksNb /* maximum number of static block, You have to follow this syntax 'E_uc+ Abbreviation Module +MaxBlocksNb'*/
};
#define C_ucSAIFirstBlockMemory E_ucSAIFixMemory
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
EXTERN tdstBlockInfo g_a_stSAIBlocksInfo[E_ucSAIMaxBlocksNb];
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifdef __DYNAMIC_MALLOC_ALLOWED__
#ifdef __DEBUG_MALLOC_MODE__
EXTERN tdstDynInfo g_stSAIDynInfo;
#endif /* __DEBUG_MALLOC_MODE__ */
#endif /* __DYNAMIC_MALLOC_ALLOWED__ */
void SAI_fn_vMemoryLogFile(void *p_vPointer,unsigned char ucAction,char *szFile,unsigned long ulLine);
#define SAI_C_ActionMalloc 0
#define SAI_C_ActionRealloc 1
#define SAI_C_ActionFree 2
EXTERN unsigned char SAI_g_ucMemoryBlockUsed;
#define M_SAIChooseMemoryBlock() Mmg_M_SetModeAlloc4Ch(SAI,(unsigned char)SAI_g_ucMemoryBlockUsed,C_ucMmgDefaultChannel)
/* Oliv' */
#if !defined(U64)
#define M_SAIAlloc(Var, cast, ucSize)\
{\
M_SAIChooseMemoryBlock();\
Var = (cast) Mmg_fn_p_vAlloc4Ch(ucSize,C_ucMmgDefaultChannel);\
SAI_fn_vMemoryLogFile(Var,SAI_C_ActionMalloc,__FILE__,__LINE__); \
}
#define M_SAIReAlloc(Var,AdrScr,cast, ucSize)\
{\
M_SAIChooseMemoryBlock();\
Var = (cast) Mmg_fn_p_vRealloc4Ch(AdrScr,ucSize,C_ucMmgDefaultChannel);\
SAI_fn_vMemoryLogFile(Var,SAI_C_ActionRealloc,__FILE__,__LINE__); \
}
#define M_SAIFree(p_cAdr) \
{\
SAI_fn_vMemoryLogFile(p_cAdr,SAI_C_ActionFree,__FILE__,__LINE__); \
M_SAIChooseMemoryBlock();\
Mmg_fn_vFree4Ch(p_cAdr,C_ucMmgDefaultChannel);\
p_cAdr=NULL; \
}
#else /* U64 */
#include "GLD/Specif/DisplMsg.h"
#if defined(FINAL_VERSION)
#define M_SAIAlloc(Var, cast, ucSize)\
{\
M_SAIChooseMemoryBlock();\
Var = (cast) Mmg_fn_p_vAlloc4Ch(ucSize,C_ucMmgDefaultChannel);\
}
#else /* FINAL_VERSION */
#define M_SAIAlloc(Var, cast, ucSize)\
{\
g_ucModuleIdForDebug=3;\
M_SAIChooseMemoryBlock();\
Var = (cast) Mmg_fn_p_vAlloc4Ch(ucSize,C_ucMmgDefaultChannel);\
g_ucModuleIdForDebug=0xff; \
}
#endif /* FINAL_VERSION */
#endif /*U64*/
#endif /* __MmgSai_h__ */

View File

@@ -0,0 +1,303 @@
#include "SaiCPA.h"
#include "MmgSai.h"
#include "ErmSai.h"
#include "Sai_Enum.h"
#include "Sai_Pub.h"
#include "Sai_str.h"
#include "Sai_Priv.h"
#include "Sai_Save.h"
#include "cmp.h"
/* To avoid using compressed file in debug mode */
/* (uncompressed files are easier to view :-)*/
#ifdef _DEBUG
#undef SAVEGAME_COMPRESSION
#else
#define SAVEGAME_COMPRESSION
#endif
/**************************************************************************/
unsigned char SAI_fn_ucSaveAllGameTableValues(struct SAI_tdstInternalStructure_ *p_stInternalStructure,char *_szFileName,SAI_tdeFlags _eFlags)
{
unsigned char bReturn = SAI_TRUE;
SAI_tdxHandleToListEntry hListEntry = p_stInternalStructure -> p_stFirstEntry;
FILE *p_stTempFile;
#ifdef SAVEGAME_COMPRESSION
char szTempFile[_MAX_PATH];
sprintf(szTempFile,"%s/TT.tmp",fn_szGetTempDataPath());
DeleteFile(szTempFile);
FIL_fn_bValidatePath(".",_szFileName);
p_stTempFile = fopen(szTempFile,"wb");
#else /* SAVEGAME_COMPRESSION */
FIL_fn_bValidatePath(".",_szFileName);
p_stTempFile = fopen(_szFileName,"wb");
#endif /* SAVEGAME_COMPRESSION */
if (p_stTempFile!=NULL)
{
SAI_fn_vClearBooleanBuffer();
while (hListEntry)
{
if ((hListEntry->eFlags&(_eFlags)))
SAI_fn_ucSaveGameTableValue(hListEntry,p_stTempFile);
hListEntry = hListEntry -> p_stNextEntry;
}
SAI_fn_vFlushBooleanBuffer( p_stTempFile );
fclose(p_stTempFile);
#ifndef _DEBUG
CMP_fn_vCompressFileIn(szTempFile,_szFileName,D_CMP_DIFF);
#endif
}
else
bReturn = SAI_FALSE;
#ifdef SAVEGAME_COMPRESSION
DeleteFile(szTempFile);
#endif /* SAVEGAME_COMPRESSION */
return(bReturn);
}
/**************************************************************************/
unsigned char SAI_fn_ucSaveGameTableValue(SAI_tdxHandleToListEntry hListEntry,FILE *_p_stFile)
{
unsigned char bReturn = SAI_TRUE;
switch( hListEntry->eFlags & C_TypesFlags )
{
/* GuS : Save a boolean */
/* (WARNING: all boolean entries must be at the end of the list, no other data should be saved AFTER booleans,*/
/* More over, the list must be saved from the first element to the last one.)*/
case SAI_eType1:
if (hListEntry->eFlags&SAI_ePlayerSaveTableValue||hListEntry->eFlags&SAI_eLevelSaveTableValue)
SAI_fn_vSaveBoolean(
hListEntry->uData.stBooleanData.ucCharData,
hListEntry->uData.stBooleanData.ucBitPosition,
_p_stFile );
else if(hListEntry->eFlags&SAI_ePlayerSaveCurrentValue||hListEntry->eFlags&SAI_eLevelSaveCurrentValue)
SAI_fn_vSaveBoolean(
*(unsigned char *)hListEntry->p_vDataPointer,
hListEntry->uData.stBooleanData.ucBitPosition,
_p_stFile );
else
M_SAIFatalError(E_uwSAI_InvalidSaveMode);
break;
case SAI_eType8:
if (hListEntry->eFlags&SAI_ePlayerSaveTableValue||hListEntry->eFlags&SAI_eLevelSaveTableValue)
fwrite(&hListEntry->uData.ucCharData,1,sizeof(unsigned char),_p_stFile);
else if(hListEntry->eFlags&SAI_ePlayerSaveCurrentValue||hListEntry->eFlags&SAI_eLevelSaveCurrentValue)
fwrite(hListEntry->p_vDataPointer,1,sizeof(unsigned char),_p_stFile);
else
M_SAIFatalError(E_uwSAI_InvalidSaveMode);
break;
case SAI_eType16:
if (hListEntry->eFlags&SAI_ePlayerSaveTableValue||hListEntry->eFlags&SAI_eLevelSaveTableValue)
fwrite(&hListEntry->uData.uwShortData,1,sizeof(unsigned short),_p_stFile);
else if(hListEntry->eFlags&SAI_ePlayerSaveCurrentValue||hListEntry->eFlags&SAI_eLevelSaveCurrentValue)
fwrite(hListEntry->p_vDataPointer,1,sizeof(unsigned short),_p_stFile);
else
M_SAIFatalError(E_uwSAI_InvalidSaveMode);
break;
case SAI_eType32:
if (hListEntry->eFlags&SAI_ePlayerSaveTableValue||hListEntry->eFlags&SAI_eLevelSaveTableValue)
fwrite(&hListEntry->uData.ulLongData,1,sizeof(unsigned long),_p_stFile);
else if(hListEntry->eFlags&SAI_ePlayerSaveCurrentValue||hListEntry->eFlags&SAI_eLevelSaveCurrentValue)
fwrite(hListEntry->p_vDataPointer,1,sizeof(unsigned long),_p_stFile);
else
M_SAIFatalError(E_uwSAI_InvalidSaveMode);
break;
case SAI_eType64:
if (hListEntry->eFlags&SAI_ePlayerSaveTableValue||hListEntry->eFlags&SAI_eLevelSaveTableValue)
fwrite(&hListEntry->uData.i64Long64Data,1,sizeof(tdLong64),_p_stFile);
else if(hListEntry->eFlags&SAI_ePlayerSaveCurrentValue||hListEntry->eFlags&SAI_eLevelSaveCurrentValue)
fwrite(hListEntry->p_vDataPointer,1,sizeof(tdLong64),_p_stFile);
else
M_SAIFatalError(E_uwSAI_InvalidSaveMode);
break;
case SAI_eTypePointer:
if (hListEntry->eFlags&SAI_ePlayerSaveTableValue||hListEntry->eFlags&SAI_eLevelSaveTableValue)
{
fwrite(&hListEntry->uData.stPointerData.uwBlocAndModuleID,1,sizeof(unsigned short),_p_stFile);
fwrite(&hListEntry->uData.stPointerData.p_vPointer,1,sizeof(void *),_p_stFile);
}
else if(hListEntry->eFlags&SAI_ePlayerSaveCurrentValue||hListEntry->eFlags&SAI_eLevelSaveCurrentValue)
{
void *p_vBeginBloc;
unsigned short uwBlocId;
void *p_vPointer = (void*)(*((void**)hListEntry->p_vDataPointer));
if (p_vPointer!=NULL)
{
Mmg_fn_vWhereIs((void*)p_vPointer,&uwBlocId,&p_vBeginBloc);
if (uwBlocId==0xffff)
p_vPointer = (void*)p_vPointer;
else
p_vPointer = (void*)(((long)p_vPointer)-(long)p_vBeginBloc);
}
else
uwBlocId = 0xffff;
fwrite(&uwBlocId,1,sizeof(unsigned short),_p_stFile);
fwrite(&p_vPointer,1,sizeof(void *),_p_stFile);
}
else
M_SAIFatalError(E_uwSAI_InvalidSaveMode);
break;
case SAI_eTypeXX:
if (hListEntry->eFlags&SAI_ePlayerSaveTableValue||hListEntry->eFlags&SAI_eLevelSaveTableValue)
fwrite(hListEntry->uData.stArrayData.p_ucPointer,hListEntry->uData.stArrayData.ulArraySize,sizeof(unsigned char),_p_stFile);
else if(hListEntry->eFlags&SAI_ePlayerSaveCurrentValue||hListEntry->eFlags&SAI_eLevelSaveCurrentValue)
fwrite(hListEntry->p_vDataPointer,hListEntry->uData.stArrayData.ulArraySize,sizeof(unsigned char),_p_stFile);
else
M_SAIFatalError(E_uwSAI_InvalidSaveMode);
break;
default:
bReturn = SAI_FALSE;
break;
}
return(bReturn);
}
/**************************************************************************/
unsigned char SAI_fn_ucLoadGameTableValue( SAI_tdxHandleToListEntry hListEntry, FILE *_p_stFile )
{
unsigned char bReturn = SAI_TRUE;
if (!feof(_p_stFile))
{
switch( hListEntry->eFlags & C_TypesFlags )
{
case SAI_eType1:
hListEntry->uData.stBooleanData.ucCharData =
(unsigned char)(SAI_fn_cLoadBoolean( _p_stFile ) << hListEntry->uData.stBooleanData.ucBitPosition);
break;
case SAI_eType8:
fread(&hListEntry->uData.ucCharData,1,sizeof(hListEntry->uData.ucCharData),_p_stFile);
break;
case SAI_eType16:
fread(&hListEntry->uData.uwShortData,1,sizeof(hListEntry->uData.uwShortData),_p_stFile);
break;
case SAI_eType32:
fread(&hListEntry->uData.ulLongData,1,sizeof(hListEntry->uData.ulLongData),_p_stFile);
break;
case SAI_eType64:
fread(&hListEntry->uData.i64Long64Data,1,sizeof(hListEntry->uData.i64Long64Data),_p_stFile);
break;
case SAI_eTypePointer:
fread(&hListEntry->uData.stPointerData.uwBlocAndModuleID,1,sizeof(hListEntry->uData.stPointerData.uwBlocAndModuleID),_p_stFile);
fread(&hListEntry->uData.stPointerData.p_vPointer,1,sizeof(hListEntry->uData.stPointerData.p_vPointer),_p_stFile);
break;
case SAI_eTypeXX:
fread(hListEntry->uData.stArrayData.p_ucPointer,hListEntry->uData.stArrayData.ulArraySize,sizeof(*hListEntry->uData.stArrayData.p_ucPointer),_p_stFile);
break;
default:
bReturn = SAI_FALSE;
break;
}
}
return(bReturn);
}
/**************************************************************************/
unsigned char SAI_fn_ucLoadAllGameTableValues(
struct SAI_tdstInternalStructure_ *p_stInternalStructure,
char *_szFileName,
SAI_tdeFlags _eFlags )
{
unsigned char bReturn = SAI_FALSE;
SAI_tdxHandleToListEntry hListEntry = p_stInternalStructure -> p_stFirstEntry;
FILE *p_stTempFile;
#ifdef SAVEGAME_COMPRESSION
char szTempFile[_MAX_PATH];
sprintf(szTempFile,"%s/TT.tmp",fn_szGetTempDataPath());
DeleteFile(szTempFile);
if (CMP_fn_bExpandFileIn(_szFileName,szTempFile,D_CMP_DIFF))
{
p_stTempFile = fopen(szTempFile,"rb");
#else /* SAVEGAME_COMPRESSION */
p_stTempFile = fopen(_szFileName,"rb");
#endif /* SAVEGAME_COMPRESSION */
if (p_stTempFile!=NULL)
{
SAI_fn_vClearBooleanBuffer();
while (hListEntry)
{
if( hListEntry->eFlags & _eFlags )
SAI_fn_ucLoadGameTableValue( hListEntry, p_stTempFile );
hListEntry = hListEntry -> p_stNextEntry;
}
fclose(p_stTempFile);
bReturn = SAI_TRUE;
}
#ifdef SAVEGAME_COMPRESSION
}
DeleteFile(szTempFile);
#endif
return(bReturn);
}
/**************************************************************************/
/* GuS*/
/* To optimize saving of boolean data, all booleans are grouped by 8 in a char.*/
/* To achieve this, saving is bufferised into one char witch is written to file*/
/* only when it is full.*/
static unsigned char g_ucBooleanBuffer = 0;
static unsigned char g_ucCurrentPosition = 0; /* Next bit to be read or set (0..7)*/
void SAI_fn_vSaveBoolean( unsigned char _ucData, unsigned char _ucBitPosition, FILE *_p_stFile )
{
g_ucBooleanBuffer |= ((_ucData >> _ucBitPosition) & (unsigned char)1 ) << g_ucCurrentPosition;
g_ucCurrentPosition++;
if( g_ucCurrentPosition > 7 )
SAI_fn_vFlushBooleanBuffer( _p_stFile );
}
/**************************************************************************/
/* GuS*/
/* Function for reading boolean previously saved with SAI_fn_vSaveBoolean.*/
/* Return one boolean in the first (lowest) bit of a char.*/
/* Return -1 if end of file is reached.*/
char SAI_fn_cLoadBoolean( FILE *_p_stFile )
{
if( g_ucCurrentPosition == 0 || g_ucCurrentPosition > 7 )
{
if( fread( &g_ucBooleanBuffer, 1, sizeof(unsigned char), _p_stFile ) == 0 ) return -1;
g_ucCurrentPosition = 0;
}
return (unsigned char)((g_ucBooleanBuffer >> (g_ucCurrentPosition++)) & 1);
}
/**************************************************************************/
void SAI_fn_vClearBooleanBuffer()
{
g_ucBooleanBuffer = 0;
g_ucCurrentPosition = 0;
}
/**************************************************************************/
void SAI_fn_vFlushBooleanBuffer( FILE *_p_stFile )
{
if( g_ucCurrentPosition )
{
fwrite( &g_ucBooleanBuffer, 1, sizeof(unsigned char), _p_stFile );
g_ucBooleanBuffer = 0;
g_ucCurrentPosition = 0;
}
}
/**************************************************************************/

View File

@@ -0,0 +1,361 @@
#include "SaiCPA.h"
#include "MmgSai.h"
#include "ErmSai.h"
#include "Sai_Enum.h"
#include "Sai_Pub.h"
#include "Sai_str.h"
#include "Sai_Priv.h"
/**************************************************************************/
SAI_tdxHandleToListEntry SAI_fn_hCreateAListEntry(void)
{
SAI_tdxHandleToListEntry hListEntry;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSAI , MMG_C_lSubTypeSAI , 0 );
M_SAIAlloc(hListEntry,SAI_tdxHandleToListEntry,sizeof(struct SAI_tdstListEntry_));
if (hListEntry==NULL)
M_SAIFatalError(E_uwSAI_CreateAListEntry);
memset(hListEntry,0,sizeof(struct SAI_tdstListEntry_));
hListEntry->ucMemoryLevel = SAI_g_ucMemoryBlockUsed;
return(hListEntry);
}
/**************************************************************************/
void SAI_fn_vIsolateAllListEntryByMemoryLevel(struct SAI_tdstInternalStructure_ *p_stInternalStructure,unsigned char ucMemoryLevel)
{
SAI_tdstListEntry * p_stPreviousListEntry = NULL;
SAI_tdstListEntry * p_stListEntry = p_stInternalStructure -> p_stFirstEntry;
while (p_stListEntry)
{
if (p_stListEntry -> ucMemoryLevel == ucMemoryLevel)
{
/* Remove the entry*/
if (p_stPreviousListEntry) p_stPreviousListEntry -> p_stNextEntry = p_stListEntry -> p_stNextEntry;
else p_stInternalStructure -> p_stFirstEntry = p_stListEntry -> p_stNextEntry;
if( p_stListEntry -> p_stNextEntry == NULL )
p_stInternalStructure->p_stLastEntry = p_stPreviousListEntry;
#ifdef _DEBUG
/* GuS*/
p_stInternalStructure->ulNumberOfEntries--;
#endif
}
else p_stPreviousListEntry = p_stListEntry;
p_stListEntry = p_stListEntry -> p_stNextEntry;
}
Mmg_M_FreeBlock( SAI, ucMemoryLevel );
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void SAI_fn_vDeleteAListEntry(SAI_tdxHandleToListEntry hListEntry)
{
/*M_SAIFree(hListEntry);*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
SAI_tdeFlags SAI_fn_eVerifyFlags(SAI_tdeFlags eFlags)
{
/**** Empty the type flags ****/
eFlags&=C_UserFlags;
if ( (eFlags&SAI_ePlayerSaveTableValue&&eFlags&SAI_ePlayerSaveCurrentValue)
||(eFlags&SAI_eLevelSaveTableValue&&eFlags&SAI_eLevelSaveCurrentValue)
)
{
M_SAIFatalError(E_uwSAI_SaveTableAndCurrentValue);
}
if (eFlags&SAI_ePlayerSaveTableValue||eFlags&SAI_ePlayerSaveCurrentValue)
/**** DFM ****/
eFlags|=SAI_eInitWhenPlayerGameSavedLoaded;
if (eFlags&SAI_eLevelSaveTableValue||eFlags&SAI_eLevelSaveCurrentValue)
/**** DFM ****/
eFlags|=SAI_eInitWhenLevelGameSavedLoaded;
if (eFlags&SAI_ePlayerSaveCurrentValue||eFlags&SAI_eLevelSaveCurrentValue)
{
if (eFlags&(SAI_eInitWhenMapLoaded|SAI_eInitWhenReinitTheMap|SAI_eInitWhenPlayerDead))
M_SAIWarningError(E_uwSAI_SaveCurrentAndInitOther);
}
return(eFlags);
}
/**************************************************************************/
SAI_tdxHandleToListEntry fn_hSearchAnElementInList(struct SAI_tdstInternalStructure_ *p_stInternalStructure,void *p_vData,SAI_tdeFlags eUserFlags)
{
SAI_tdxHandleToListEntry hListEntry = p_stInternalStructure -> p_stFirstEntry;;
while (hListEntry)
{
if (hListEntry->p_vDataPointer==p_vData&&(hListEntry->eFlags&C_UserFlags)==eUserFlags)
return(hListEntry);
hListEntry = hListEntry -> p_stNextEntry;
}
return(NULL);
}
/**************************************************************************/
unsigned char SAI_fn_bFreeAnElementFromList(struct SAI_tdstInternalStructure_ *p_stInternalStructure,void *p_stData,SAI_tdeFlags eUserFlags)
{
SAI_tdstListEntry * p_stPreviousListEntry = NULL;
SAI_tdstListEntry * p_stListEntry = p_stInternalStructure -> p_stFirstEntry;
unsigned char bFound = FALSE;
eUserFlags = SAI_fn_eVerifyFlags(eUserFlags);
while (p_stListEntry)
{
if (p_stListEntry -> p_vDataPointer == p_stData && (p_stListEntry -> eFlags & C_UserFlags) == eUserFlags)
{
bFound = TRUE;
break;
}
p_stPreviousListEntry = p_stListEntry;
p_stListEntry = p_stListEntry -> p_stNextEntry;
}
if (bFound)
{
/* If there is a data, free the data*/
/* not used since block without free
if ((p_stListEntry -> eFlags & C_TypesFlags) == SAI_eTypeXX)
{
M_SAIFree (p_stListEntry -> uData . stArrayData . p_ucPointer);
}
*/
/* Remove the entry from the list*/
if (p_stPreviousListEntry) p_stPreviousListEntry -> p_stNextEntry = p_stListEntry -> p_stNextEntry;
else p_stInternalStructure -> p_stFirstEntry = p_stListEntry -> p_stNextEntry;
if( p_stListEntry -> p_stNextEntry == NULL )
p_stInternalStructure->p_stLastEntry = p_stPreviousListEntry;
#ifdef _DEBUG
/* GuS*/
p_stInternalStructure->ulNumberOfEntries--;
#endif
/* Free the entry*/
/*SAI_fn_vDeleteAListEntry (p_stListEntry);*/
}
return bFound;
}
/**************************************************************************/
unsigned char SAI_fn_bInsertAnElementInList(struct SAI_tdstInternalStructure_ *p_stInternalStructure,void *p_stData,unsigned long ulSizeOfData,SAI_tdeFlags eTypeOfData,SAI_tdeFlags eUserFlags)
{
unsigned char bReturn = SAI_TRUE;
SAI_tdxHandleToListEntry hListEntry;
unsigned short uwBlocId;
void *p_vBeginBloc;
eUserFlags=SAI_fn_eVerifyFlags(eUserFlags);
if ((hListEntry=fn_hSearchAnElementInList(p_stInternalStructure,p_stData,eUserFlags))==NULL)
{
hListEntry = SAI_fn_hCreateAListEntry();
/* GuS 17/10/98 : Bool entries are created at the end of the list.*/
/* With this method, all bool entries will be grouped at the end of the list */
/* (=> game save is easier)*/
#ifndef U64 /* Oliv' - 07/07/1999 */
if( eTypeOfData == SAI_eType1 )
{
hListEntry -> p_stNextEntry = NULL;
if( p_stInternalStructure->p_stLastEntry )
p_stInternalStructure->p_stLastEntry->p_stNextEntry = hListEntry;
else
p_stInternalStructure -> p_stFirstEntry = hListEntry;
p_stInternalStructure->p_stLastEntry = hListEntry;
}
else
#endif /* U64 */
{
/* Insert the element at the head of the list*/
hListEntry -> p_stNextEntry = p_stInternalStructure -> p_stFirstEntry;
p_stInternalStructure -> p_stFirstEntry = hListEntry;
if( ! p_stInternalStructure -> p_stLastEntry )
p_stInternalStructure -> p_stLastEntry = hListEntry;
}
#ifdef _DEBUG
p_stInternalStructure->ulNumberOfEntries++;
#endif
}
hListEntry->p_vDataPointer = p_stData;
switch(eTypeOfData)
{
/* Oliv', then GuS*/
#ifndef U64 /* Oliv' - 07/07/1999 */
case SAI_eType1:
hListEntry->eFlags = (SAI_tdeFlags) (eUserFlags|SAI_eType1);
hListEntry->uData.stBooleanData.ucBitPosition = SAI_fn_ucComputeBitPosition( (unsigned char)ulSizeOfData );
/* Save masked value*/
hListEntry->uData.stBooleanData.ucCharData = (unsigned char)(*(unsigned char*)p_stData & (unsigned char)ulSizeOfData);
break;
#endif /* U64 */
/* EndOfOliv', then GuS*/
case SAI_eType8:
hListEntry->eFlags = (SAI_tdeFlags) (eUserFlags|SAI_eType8);
hListEntry->uData.ucCharData = *(unsigned char*)p_stData;
break;
case SAI_eType16:
hListEntry->eFlags = (SAI_tdeFlags) (eUserFlags|SAI_eType16);
hListEntry->uData.uwShortData = *(unsigned short*)p_stData;
break;
case SAI_eType32:
hListEntry->eFlags = (SAI_tdeFlags) (eUserFlags|SAI_eType32);
hListEntry->uData.ulLongData = *(unsigned long*)p_stData;
break;
case SAI_eType64:
hListEntry->eFlags = (SAI_tdeFlags) (eUserFlags|SAI_eType64);
hListEntry->uData.i64Long64Data = *(tdLong64*)p_stData;
break;
case SAI_eTypePointer:
hListEntry->eFlags = (SAI_tdeFlags) (eUserFlags|SAI_eTypePointer);
if (*(void**)p_stData!=NULL)
{
Mmg_fn_vWhereIs (*(void**)p_stData,&uwBlocId,&p_vBeginBloc);
hListEntry->uData.stPointerData.uwBlocAndModuleID = uwBlocId;
if (uwBlocId==0xffff)
hListEntry->uData.stPointerData.p_vPointer = (void*)*(long *)p_stData;
else
hListEntry->uData.stPointerData.p_vPointer = (void*)((*(long*)p_stData)-(long)p_vBeginBloc);
}
else
{
hListEntry->uData.stPointerData.uwBlocAndModuleID = 0xffff;
hListEntry->uData.stPointerData.p_vPointer = NULL;
}
break;
case SAI_eTypeXX:
hListEntry->eFlags = (SAI_tdeFlags) (eUserFlags|SAI_eTypeXX);
if (hListEntry->uData.stArrayData.p_ucPointer==NULL)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSAI , MMG_C_lSubTypeSAI , 0 );
M_SAIAlloc(hListEntry->uData.stArrayData.p_ucPointer,unsigned char*,ulSizeOfData);
if (hListEntry->uData.stArrayData.p_ucPointer==NULL)
{
M_SAIFatalError(E_uwSAI_CreateAListEntry);
}
hListEntry->uData.stArrayData.ulArraySize = ulSizeOfData;
}
if (hListEntry->uData.stArrayData.ulArraySize==ulSizeOfData)
memcpy(hListEntry->uData.stArrayData.p_ucPointer,(char *)p_stData,ulSizeOfData);
else
M_SAIFatalError(E_uwSAI_ArrayCantChangeSize);
break;
default:
/* ANNECY AV {*/
/*LST2_M_StaticIsolate(hListEntry);*/
/*SAI_fn_vDeleteAListEntry(hListEntry);*/
/* END ANNECY AV }*/
bReturn = SAI_FALSE;
break;
}
return(bReturn);
}
/**************************************************************************/
unsigned char SAI_fn_bRestoreAnElementFromList(SAI_tdxHandleToListEntry hListEntry)
{
unsigned char bReturn = SAI_TRUE;
void *p_vBeginBloc;
switch(hListEntry->eFlags&C_TypesFlags)
{
#ifndef U64 /* Oliv' - 07/07/1999 */
case SAI_eType1:
*(char*)hListEntry->p_vDataPointer &= ~(hListEntry->uData.stBooleanData.ucCharData);
*(char*)hListEntry->p_vDataPointer |= hListEntry->uData.stBooleanData.ucCharData;
break;
#endif /* U64 */
case SAI_eType8:
*(char*)hListEntry->p_vDataPointer = hListEntry->uData.ucCharData;
//osSyncPrintf( "Restoring %02x from 0x%x to 0x%x\n", hListEntry->uData.ucCharData, &hListEntry->uData.ucCharData, hListEntry->p_vDataPointer );
break;
case SAI_eType16:
*(short*)hListEntry->p_vDataPointer = hListEntry->uData.uwShortData;
break;
case SAI_eType32:
*(long*)hListEntry->p_vDataPointer = hListEntry->uData.ulLongData;
break;
case SAI_eType64:
*(tdLong64*)hListEntry->p_vDataPointer = hListEntry->uData.i64Long64Data;
break;
case SAI_eTypePointer:
if (hListEntry->uData.stPointerData.uwBlocAndModuleID==0xffff)
*(void**)hListEntry->p_vDataPointer = hListEntry->uData.stPointerData.p_vPointer;
else
{
p_vBeginBloc = Mmg_fn_p_vGiveTheBeginingAddress(hListEntry->uData.stPointerData.uwBlocAndModuleID);
*(void**)hListEntry->p_vDataPointer = (void *)((long)p_vBeginBloc+(long)hListEntry->uData.stPointerData.p_vPointer);
}
break;
case SAI_eTypeXX:
memcpy((char *)hListEntry->p_vDataPointer,hListEntry->uData.stArrayData.p_ucPointer,hListEntry->uData.stArrayData.ulArraySize);
break;
default:
bReturn = SAI_FALSE;
break;
}
return(bReturn);
}
/**************************************************************************/
unsigned char SAI_fn_bInitAllTableWhen(struct SAI_tdstInternalStructure_ *p_stInternalStructure,SAI_tdeFlags eUserFlags)
{
SAI_tdxHandleToListEntry hListEntry = p_stInternalStructure -> p_stFirstEntry;
while (hListEntry)
{
if ((hListEntry->eFlags&eUserFlags)==eUserFlags)
SAI_fn_bRestoreAnElementFromList(hListEntry);
hListEntry = hListEntry -> p_stNextEntry;
}
return SAI_TRUE;
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char SAI_fn_bInitOneTableElementWhen(struct SAI_tdstInternalStructure_ *p_stInternalStructure,void *_p_vValue,SAI_tdeFlags eUserFlags)
{
unsigned char bReturn = SAI_FALSE;
SAI_tdxHandleToListEntry hListEntry = NULL;
if ((hListEntry=fn_hSearchAnElementInList(p_stInternalStructure,_p_vValue,eUserFlags))!=NULL)
{
bReturn = SAI_TRUE;
SAI_fn_bRestoreAnElementFromList(hListEntry);
}
return(bReturn);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* GuS : return the position of the first bit set to 1 in _ucMask (the lowest bit set).*/
/* The return value is between 0 and 7 if a bit is set, or > 7 if no bit is set in _ucMask*/
unsigned char SAI_fn_ucComputeBitPosition( unsigned char _ucMask )
{
unsigned char i;
for( i = 0; i < 8; i++ )
{
if( _ucMask & 0x01 ) return i;
_ucMask >>= 1;
}
return 10;
}

View File

@@ -0,0 +1,28 @@
#if !defined(__SAI_Priv_h__)
#define __SAI_Priv_h__
#include "CPA_Expt.h"
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
SAI_tdxHandleToListEntry SAI_fn_hCreateAListEntry(void);
void SAI_fn_vIsolateAllListEntryByMemoryLevel(struct SAI_tdstInternalStructure_ *p_stInternalStructure,unsigned char ucMemoryLevel);
void SAI_fn_vDeleteAListEntry(SAI_tdxHandleToListEntry hListEntry);
SAI_tdxHandleToListEntry fn_hSearchAnElementInList(struct SAI_tdstInternalStructure_ *p_stInternalStructure,void *p_vData,SAI_tdeFlags eUserFlags);
SAI_tdeFlags SAI_fn_eVerifyFlags(SAI_tdeFlags eFlags);
unsigned char SAI_fn_bFreeAnElementFromList(struct SAI_tdstInternalStructure_ *p_stInternalStructure,void *p_stData,SAI_tdeFlags eUserFlags);
unsigned char SAI_fn_bInsertAnElementInList(struct SAI_tdstInternalStructure_ *p_stInternalStructure,void *p_stData,unsigned long ulSizeOfData,SAI_tdeFlags eTypeOfData,SAI_tdeFlags eUserFlags);
unsigned char SAI_fn_bRestoreAnElementFromList(SAI_tdxHandleToListEntry hListEntry);
unsigned char SAI_fn_bInitAllTableWhen(struct SAI_tdstInternalStructure_ *p_stInternalStructure,SAI_tdeFlags eUserFlags);
unsigned char SAI_fn_bInitOneTableElementWhen(struct SAI_tdstInternalStructure_ *p_stInternalStructure,void *_p_vValue,SAI_tdeFlags eUserFlags);
unsigned char SAI_fn_ucComputeBitPosition( unsigned char _ucMask );
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif /* __SAI_Priv_h__ */

View File

@@ -0,0 +1,194 @@
#include "SaiCPA.h"
#include "MmgSai.h"
#include "ErmSai.h"
#include "Sai_Enum.h"
#include "Sai_str.h"
#include "Sai_Pub.h"
#include "Sai_Priv.h"
#include "Sai_Save.h"
/**************************************************************************/
#ifndef U64 /* Oliv' - 07/07/1999 */
unsigned char SAI_fn_bInsertBoolInTable(void *_p_vValue, unsigned char ucMask, SAI_tdeFlags _eFlags)
{
#if defined(U64)
/* write a short in SAI, with :*/
/* high part (1 octet) == the mask (1,2,4 or 8 but not higher, because only 2 bits are available to save mask)*/
/* low part (1 octet) == the octet that contains the bit, at its right position, and not masked*/
unsigned short usValue;
assert(ucMask <= 8);
usValue = ucMask;
usValue <<= 8;
usValue |= ((*((unsigned char*)_p_vValue))&0xff);
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,2,SAI_eType1,_eFlags));
#else
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,ucMask,SAI_eType1,_eFlags));
#endif
}
#endif /* U64 */
/**************************************************************************/
unsigned char SAI_fn_bInsertCharInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,1,SAI_eType8,_eFlags));
}
/**************************************************************************/
unsigned char SAI_fn_bInsertShortInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,2,SAI_eType16,_eFlags));
}
/**************************************************************************/
unsigned char SAI_fn_bInsertLongInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,4,SAI_eType32,_eFlags));
}
/**************************************************************************/
unsigned char SAI_fn_bInsertFloatInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,4,SAI_eType32,_eFlags));
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char SAI_fn_bInsertDoubleInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,8,SAI_eType64,_eFlags));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
unsigned char SAI_fn_bInsertPointerInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,8,SAI_eTypePointer,_eFlags));
}
/**************************************************************************/
unsigned char SAI_fn_bInsertMTHRealInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
#if defined(MTH_RealIsFloat)
return(SAI_fn_bInsertFloatInTable(_p_vValue,_eFlags));
#elif defined(MTH_RealIsDouble)
return(SAI_fn_bInsertDoubleInTable(_p_vValue,_eFlags));
#elif defined(MTH_RealIsFixed16_16)
return(SAI_fn_bInsertLongInTable(_p_vValue,_eFlags));
#else
#error Unknown MTH_tdxReal define
#endif
}
/**************************************************************************/
unsigned char SAI_fn_bInsertMTHVectorInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
#if defined(MTH_RealIsFloat)
return(SAI_fn_bInsertArrayInTable(_p_vValue,3*4,_eFlags));
#elif defined(MTH_RealIsDouble)
return(SAI_fn_bInsertArrayInTable(_p_vValue,3*8,_eFlags));
#elif defined(MTH_RealIsFixed16_16)
return(SAI_fn_bInsertArrayInTable(_p_vValue,3*8,_eFlags));
#else
#error Unknown MTH_tdxReal define
#endif
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char SAI_fn_bInsertMTHMatrixInTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
#if defined(MTH_RealIsFloat)
return(SAI_fn_bInsertArrayInTable(_p_vValue,9*4,_eFlags));
#elif defined(MTH_RealIsDouble)
return(SAI_fn_bInsertArrayInTable(_p_vValue,9*8,_eFlags));
#elif defined(MTH_RealIsFixed16_16)
return(SAI_fn_bInsertArrayInTable(_p_vValue,9*8,_eFlags));
#else
#error Unknown MTH_tdxReal define
#endif
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
unsigned char SAI_fn_bRemoveValueFromTable(void *_p_vValue, SAI_tdeFlags _eFlags)
{
return(SAI_fn_bFreeAnElementFromList(&SAI_g_stInternalStructure,_p_vValue,_eFlags));
}
/**************************************************************************/
void *SAI_fn_p_vGetTableValuePointerOf(void *_p_vValue, SAI_tdeFlags _eFlags)
{
void *p_vReturn = NULL;
SAI_tdxHandleToListEntry hListEntry;
SAI_tdeFlags eIntarnalFlags;
eIntarnalFlags=SAI_fn_eVerifyFlags(_eFlags);
if ((hListEntry=fn_hSearchAnElementInList(&SAI_g_stInternalStructure,_p_vValue,eIntarnalFlags))!=NULL)
{
switch(hListEntry->eFlags&C_TypesFlags)
{
#ifndef U64 /* Oliv' - 07/07/1999 */
case SAI_eType1:
#endif /* U64 */
case SAI_eType8:
p_vReturn = (void *)&hListEntry->uData.ucCharData;
break;
case SAI_eType16:
p_vReturn = (void *)&hListEntry->uData.uwShortData;
break;
case SAI_eType32:
p_vReturn = (void *)&hListEntry->uData.ulLongData;
break;
case SAI_eType64:
p_vReturn = (void *)&hListEntry->uData.i64Long64Data;
break;
case SAI_eTypePointer:
p_vReturn = (void *)&hListEntry->uData.stPointerData.p_vPointer;
break;
case SAI_eTypeXX:
p_vReturn = (void *)hListEntry->uData.stArrayData.p_ucPointer;
break;
default:
p_vReturn = (void *)NULL;
break;
}
}
return(p_vReturn);
}
/**************************************************************************/
unsigned char SAI_fn_bInsertArrayInTable(void *_p_vValue, unsigned long _ulSize, SAI_tdeFlags _eFlags)
{
return(SAI_fn_bInsertAnElementInList(&SAI_g_stInternalStructure,_p_vValue,_ulSize,SAI_eTypeXX,_eFlags));
}
/**************************************************************************/
unsigned char SAI_fn_bInitAllWhen(SAI_tdeFlags _eUserFlags)
{
return(SAI_fn_bInitAllTableWhen(&SAI_g_stInternalStructure,_eUserFlags));
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char SAI_fn_bInitOneValueWhen(void *_p_vValue, SAI_tdeFlags _eUserFlags)
{
return(SAI_fn_bInitOneTableElementWhen(&SAI_g_stInternalStructure,_p_vValue,_eUserFlags));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
unsigned char SAI_fn_ucPlayerSaveValues(char *_szFileName)
{
return(SAI_fn_ucSaveAllGameTableValues(&SAI_g_stInternalStructure,_szFileName,SAI_ePlayerSaveTableValue|SAI_ePlayerSaveCurrentValue));
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char SAI_fn_ucLevelSaveValues(char *_szFileName)
{
return(SAI_fn_ucSaveAllGameTableValues(&SAI_g_stInternalStructure,_szFileName,SAI_eLevelSaveTableValue|SAI_eLevelSaveCurrentValue));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
unsigned char SAI_fn_ucLoadPlayerValues(char *_szFileName)
{
return SAI_fn_ucLoadAllGameTableValues( &SAI_g_stInternalStructure, _szFileName, SAI_ePlayerSaveTableValue|SAI_ePlayerSaveCurrentValue );
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char SAI_fn_ucLoadLevelValues(char *_szFileName)
{
return SAI_fn_ucLoadAllGameTableValues( &SAI_g_stInternalStructure, _szFileName, SAI_eLevelSaveTableValue|SAI_eLevelSaveCurrentValue );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,20 @@
#if !defined(__SAI_Save_h__)
#define __SAI_Save_h__
#include "CPA_Expt.h"
unsigned char SAI_fn_ucSaveAllGameTableValues(struct SAI_tdstInternalStructure_ *p_stInternalStructure,char *_szFileName,SAI_tdeFlags _eFlags);
unsigned char SAI_fn_ucSaveGameTableValue(SAI_tdxHandleToListEntry hListEntry,FILE *_p_stFile);
unsigned char SAI_fn_ucLoadAllGameTableValues(
struct SAI_tdstInternalStructure_ *p_stInternalStructure,
char *_szFileName,
SAI_tdeFlags _eFlags );
unsigned char SAI_fn_ucLoadGameTableValue( SAI_tdxHandleToListEntry hListEntry, FILE *_p_stFile );
void SAI_fn_vSaveBoolean( unsigned char _ucData, unsigned char _ucBitPosition, FILE *_p_stFile );
char SAI_fn_cLoadBoolean( FILE *_p_stFile );
void SAI_fn_vClearBooleanBuffer();
void SAI_fn_vFlushBooleanBuffer( FILE *_p_stFile );
#endif /* __SAI_Save_h__ */

View File

@@ -0,0 +1,9 @@
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
#define C_szSAIVersion "SAI V5.0.0" /* The format is XXX Va.b.c with Xxx is the Tag of the module */
#define C_szSAIFullName "Save and initialisation" /* the complete and clear name of the module */
#define C_szSAIDate "Aug 04 1997" /* The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/

View File

@@ -0,0 +1,82 @@
#if !defined(__SAI_struc_h__)
#define __SAI_struc_h__
#include "cpa_std.h"
#undef EXTERN
#undef extern
#if !defined(D_SAI_Input_VariableDefine)
#define EXTERN extern
#else
#define EXTERN
#endif /* D_SAI_Input_VariableDefine */
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
typedef __int64 tdLong64;
/*LST2_M_StaticUseListOf(SAI_tdxHandleToListEntry);*/
typedef struct tdstPointerData_
{
void *p_vPointer;
unsigned short uwBlocAndModuleID;
} tdstPointerData;
typedef struct tdstArrayData_
{
unsigned char *p_ucPointer;
unsigned long ulArraySize;
} tdstArrayData;
typedef struct tdstBooleanData_
{
unsigned char ucBitPosition;
unsigned char ucCharData;
} tdstBooleanData;
union SAI_tduData_
{
unsigned char ucCharData;
unsigned short uwShortData;
unsigned long ulLongData;
tdLong64 i64Long64Data;
struct tdstPointerData_ stPointerData;
struct tdstArrayData_ stArrayData;
struct tdstBooleanData_ stBooleanData;
};
typedef struct SAI_tdstListEntry_
{
struct SAI_tdstListEntry_ * p_stNextEntry; /* Pointer to the next entry (single-link list)*/
void *p_vDataPointer;
union SAI_tduData_ uData;
SAI_tdeFlags eFlags;
unsigned char ucMemoryLevel;
unsigned char ucDummy; /* To align the structure*/
} SAI_tdstListEntry;
typedef SAI_tdstListEntry *SAI_tdxHandleToListEntry;
typedef struct SAI_tdstInternalStructure_
{
#ifdef _DEBUG
unsigned long ulNumberOfEntries;
#endif
struct SAI_tdstListEntry_ * p_stFirstEntry; /* Pointer to the first entry (single-link list)*/
struct SAI_tdstListEntry_ * p_stLastEntry; /* Pointer to the last entry. */
/* (To insert some elements at the end of the list)*/
} SAI_tdstInternalStructure;
EXTERN struct SAI_tdstInternalStructure_ SAI_g_stInternalStructure;
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif /* __SAI_struc_h__ */

View File

@@ -0,0 +1,181 @@
# Microsoft Developer Studio Project File - Name="Sai" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=Sai - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Sai.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Sai.mak" CFG="Sai - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Sai - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "Sai - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "Sai - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/SAI", OBEAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "Sai - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /Zp4 /W4 /WX /GX /O2 /I "x:\Cpa\Public" /I "x:\Cpa\Public\Sai" /I "x:\cpa\tempgrp\sai" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\cpa\lib\SaiP5_vr.lib"
!ELSEIF "$(CFG)" == "Sai - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /Zp4 /MD /W4 /WX /GX /Z7 /Od /I "x:\Cpa\Public" /I "x:\Cpa\Public\Sai" /I "x:\cpa\tempgrp\sai" /D "_DEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\cpa\lib\SaiP5_vd.lib"
!ELSEIF "$(CFG)" == "Sai - Win32 Retail"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Sai___Wi"
# PROP BASE Intermediate_Dir "Sai___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /Zp4 /MD /W4 /WX /GX /O2 /I "x:\Cpa\Public" /I "x:\Cpa\Public\Sai" /I "x:\cpa\tempgrp\sai" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "VISUAL" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /Zp4 /W4 /WX /GX /O2 /I "x:\Cpa\Public" /I "x:\Cpa\Public\Sai" /I "x:\cpa\tempgrp\sai" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "RETAIL" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\cpa\lib\SaiP5_vr.lib"
# ADD LIB32 /nologo /out:"x:\cpa\lib\SaiP5_vf.lib"
!ENDIF
# Begin Target
# Name "Sai - Win32 Release"
# Name "Sai - Win32 Debug"
# Name "Sai - Win32 Retail"
# Begin Group "Sources"
# PROP Default_Filter ".c"
# Begin Source File
SOURCE=.\MmgSai.c
# End Source File
# Begin Source File
SOURCE=.\Sai_main.c
# End Source File
# Begin Source File
SOURCE=.\SAI_Priv.c
# End Source File
# Begin Source File
SOURCE=.\SAI_Pub.c
# End Source File
# Begin Source File
SOURCE=.\P5\SAI_Save.c
# End Source File
# End Group
# Begin Group "Include"
# PROP Default_Filter ".h"
# Begin Source File
SOURCE=.\ErmSai.h
# End Source File
# Begin Source File
SOURCE=.\MmgSai.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\SAI.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\Sai\SAI_Enum.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\Sai\Sai_main.h
# End Source File
# Begin Source File
SOURCE=.\SAI_Priv.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\Sai\SAI_Pub.h
# End Source File
# Begin Source File
SOURCE=.\SAI_Save.h
# End Source File
# Begin Source File
SOURCE=.\SAI_str.h
# End Source File
# Begin Source File
SOURCE=.\SAI_Ver.h
# End Source File
# Begin Source File
SOURCE=.\SaiCPA.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\Sai.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,356 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Sai"
ProjectGUID="{810BC3DA-9095-43F8-A77A-E69ABB133ECE}"
SccProjectName="&quot;$/cpa/tempgrp/SAI&quot;, OBEAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="x:\cpa\libd"
IntermediateDirectory=".\Tmp\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\Cpa\Public,x:\Cpa\Public\Sai,x:\cpa\tempgrp\sai"
PreprocessorDefinitions="_DEBUG;VISUAL;WIN32;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT"
RuntimeLibrary="3"
StructMemberAlignment="3"
PrecompiledHeaderFile=".\Tmp\Debug/Sai.pch"
AssemblerListingLocation=".\Tmp\Debug/"
ObjectFile=".\Tmp\Debug/"
ProgramDataBaseFileName=".\Tmp\Debug/"
WarningLevel="4"
WarnAsError="TRUE"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\cpa\libd\SaiP5_vd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\Cpa\Public,x:\Cpa\Public\Sai,x:\cpa\tempgrp\sai"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;USE_PROFILER"
StringPooling="TRUE"
RuntimeLibrary="4"
StructMemberAlignment="3"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Tmp\Release/Sai.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="4"
WarnAsError="TRUE"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\cpa\lib\SaiP5_vr.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Retail|Win32"
OutputDirectory="x:/cpa/lib"
IntermediateDirectory=".\tmp/retail"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\Cpa\Public,x:\Cpa\Public\Sai,x:\cpa\tempgrp\sai"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;RETAIL"
StringPooling="TRUE"
RuntimeLibrary="4"
StructMemberAlignment="3"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\tmp/retail/Sai.pch"
AssemblerListingLocation=".\tmp/retail/"
ObjectFile=".\tmp/retail/"
ProgramDataBaseFileName=".\tmp/retail/"
WarningLevel="4"
WarnAsError="TRUE"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\cpa\lib\SaiP5_vf.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Sources"
Filter=".c">
<File
RelativePath="MmgSai.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Sai_main.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="SAI_Priv.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="SAI_Pub.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="P5\SAI_Save.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Include"
Filter=".h">
<File
RelativePath="ErmSai.h">
</File>
<File
RelativePath="MmgSai.h">
</File>
<File
RelativePath="..\..\Public\SAI.h">
</File>
<File
RelativePath="..\..\Public\Sai\SAI_Enum.h">
</File>
<File
RelativePath="..\..\Public\Sai\Sai_main.h">
</File>
<File
RelativePath="SAI_Priv.h">
</File>
<File
RelativePath="..\..\Public\Sai\SAI_Pub.h">
</File>
<File
RelativePath="SAI_Save.h">
</File>
<File
RelativePath="SAI_str.h">
</File>
<File
RelativePath="SAI_Ver.h">
</File>
<File
RelativePath="SaiCPA.h">
</File>
</Filter>
<File
RelativePath="Sai.mak">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,46 @@
#if !defined(__SAICPA_H__)
#define __SAICPA_H__
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
/****************************************
* Here is the list of disabled WARNING *
****************************************/
#if defined(VISUAL)
#pragma warning(disable:4010) /** single-line comment contains line-continuation character **/
#pragma warning(disable:4032) /** formal parameter 1 has different type when promoted **/
#pragma warning(disable:4100) /** unreferenced formal parameter **/
#pragma warning(disable:4115) /** named type definition in parentheses **/
#pragma warning(disable:4127) /** conditional expression is constant **/
#pragma warning(disable:4201) /** nonstandard extension used : nameless struct/union **/
#pragma warning(disable:4214) /** nonstandard extension used : bit field types other than int **/
#pragma warning(disable:4310) /** cast truncates constant value **/
#pragma warning(disable:4514) /** unreferenced inline function has been removed **/
#pragma warning(disable:4702) /** unreachable code **/
#pragma warning(disable:4711) /** selected for automatic inline expansion **/
#endif /* VISUAL */
#define HieFriend
#include "ACP_Base.h"
#include "CPA_Expt.h"
#include "CPA_Std.h"
#include "MMG.h"
#include "ERM.h"
#include "LST.h"
/*XB980506*/
/*#include "CMP.h"*/
/*End XB*/
/* Oliv' - Portage v15*/
#ifndef U64
#include "DPT.h"
#endif
/* EndOfOliv'*/
#include "LST.h"
#include "FIL.h"
#endif /* SAICPA_H__ */

View File

@@ -0,0 +1,111 @@
/*#define SAI_D_DebugMalloc*/
#define D_SAI_Input_VariableDefine
#include "SaiCPA.h"
#include "MmgSai.h"
#include "ErmSai.h"
#include "Sai_Enum.h"
#include "Sai_str.h"
#include "Sai_Main.h"
#include "Sai_Pub.h"
#include "Sai_Priv.h"
/**************************************************************************/
void SAI_fn_vFirstInit()
{
Erm_M_InitErrMsg(SAI);
Mmg_M_InitMmg(SAI);
Mmg_fn_cCheckAlignmentValidity();
#ifdef _DEBUG
SAI_g_stInternalStructure . ulNumberOfEntries = 0;
#endif
SAI_g_stInternalStructure . p_stFirstEntry = NULL;
SAI_g_stInternalStructure . p_stLastEntry = NULL;
}
/**************************************************************************/
void SAI_fn_vInitFixMemory(unsigned long _ulMemSize)
{
#ifdef CHECK_MEMORY
Mmg_M_InitSpecificBlock(SAI,E_ucSAIFixMemory, _ulMemSize, C_ulDefaultMaxNbStaticMalloc, 4, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#else /* CHECK_MEMORY */
Mmg_M_InitSpecificBlock(SAI,E_ucSAIFixMemory, _ulMemSize, C_ulDefaultMaxNbStaticMalloc, 4, C_BlockWithoutFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#endif /* CHECK_MEMORY */
}
/**************************************************************************/
void SAI_fn_vInitLevelMemory(unsigned long _ulMemSize)
{
#ifdef CHECK_MEMORY
Mmg_M_InitSpecificBlock(SAI,E_ucSAILevelMemory, _ulMemSize, C_ulDefaultMaxNbStaticMalloc, 4, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#else /* CHECK_MEMORY */
Mmg_M_InitSpecificBlock(SAI,E_ucSAILevelMemory, _ulMemSize, C_ulDefaultMaxNbStaticMalloc, 4, C_BlockWithoutFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#endif /* CHECK_MEMORY */
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void SAI_fn_vDeleteFixMemory(void)
{
SAI_fn_vIsolateAllListEntryByMemoryLevel(&SAI_g_stInternalStructure,E_ucSAIFixMemory);
Mmg_M_DeleteBlock(SAI,E_ucSAIFixMemory);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
void SAI_fn_vDeleteLevelMemory(void)
{
SAI_fn_vIsolateAllListEntryByMemoryLevel(&SAI_g_stInternalStructure,E_ucSAILevelMemory);
Mmg_M_DeleteBlock(SAI,E_ucSAILevelMemory);
}
/**************************************************************************/
/* GuS 23/10/98*/
/* Same as DeleteLevelMemory, except that SAI block is not deleted.*/
/* Used in binary mode.*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void SAI_fn_vFreeLevelMemory()
{
SAI_fn_vIsolateAllListEntryByMemoryLevel(&SAI_g_stInternalStructure,E_ucSAILevelMemory);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
void SAI_fn_vSAIUseFixMemory(void)
{
SAI_g_ucMemoryBlockUsed = E_ucSAIFixMemory;
}
/**************************************************************************/
void SAI_fn_vSAIUseLevelMemory(void)
{
SAI_g_ucMemoryBlockUsed = E_ucSAILevelMemory;
}
/**************************************************************************/
#if !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS)
void SAI_PrintUsedStaticMemory(void)
{
Mmg_M_PrintUsedStaticMemoryInModule(SAI);
}
#endif /* !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS) */
/**************************************************************************/
/**************************************************************************/
/*XB*/
#ifdef CHECK_MEMORY
void SAI_CheckMemory(void)
{
Mmg_M_CheckMemory(SAI);
}
#endif /* CHECK_MEMORY */
/*End XB*/
/**************************************************************************/
/* XB 02/06/99 */
#ifndef FINAL_VERSION
unsigned long SAI_fn_ulGetUsedStaticMemory(void)
{
return Mmg_M_GetUsedStaticMemory(SAI);
}
#endif /* FINAL_VERSION */
/* End XB 02/06/99 */

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[Sai.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project