94 lines
2.4 KiB
C
94 lines
2.4 KiB
C
#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__ */
|