/*========================================================================= * mnubase.c : MEmory management of the menus * * Version 1.0 * Creation date 27/05/97 * Revision date * * That file needs to be compatible for all platforms. * * (c) Ubi R&D 1997 *=======================================================================*/ /* *======================================================================= Modifications: *=======================================================================*/ /*#include "fonhdls.h"*/ #include "ACP_Base.h" #include "ToolsCPA.h" #include "fonerm.h" #include "fonmem.h" static unsigned long gs_ulFontTextMemorySize; //FB300699 #ifdef U64 #ifndef FINAL_VERSION #define CHECK_STRING #endif #endif /**************************************************************************/ void *FON_fn_p_vAllocInBloc(enum e_ucFONStaticBlocks eBloc,unsigned long lSize) { void *p_vPointer; /* Note : should not use Mmg_M_BigBoundSize !!*/ /* Mmg_M_BigBoundSize (lSize , C_uwAllocSize);*/ Mmg_M_SetModeAlloc4Ch(FON,(unsigned char)eBloc,C_ucMmgDefaultChannel); MMG_fn_vAddMemoryInfo (MMG_C_lTypeGAM , MMG_C_lSubTypeFont , NULL); p_vPointer = Mmg_fn_p_vAlloc4Ch(lSize,C_ucMmgDefaultChannel); #ifndef CHECK_STRING if (p_vPointer==NULL) M_FONFatalError(E_uwFONMemoryError); memset(p_vPointer,0,lSize); #endif return (p_vPointer); } /**************************************************************************/ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ void *FON_fn_p_vReallocInBloc(enum e_ucFONStaticBlocks eBloc,void *p_vPointer,unsigned long lSize) { Mmg_M_SetModeAlloc4Ch(FON,(unsigned char)eBloc,C_ucMmgDefaultChannel); p_vPointer = Mmg_fn_p_vRealloc4Ch(p_vPointer,lSize,C_ucMmgDefaultChannel); if (p_vPointer==NULL) M_FONFatalError(E_uwFONMemoryError); return (p_vPointer); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ /**************************************************************************/ //XB 21/04/99 //#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ //End XB void FON_fn_vFreeInBloc(enum e_ucFONStaticBlocks eBloc,void *p_vPointer) { Mmg_M_SetModeAlloc4Ch(FON,(unsigned char)eBloc,C_ucMmgDefaultChannel); MMG_fn_vAddMemoryInfo (MMG_C_lTypeGAM , MMG_C_lSubTypeFont , NULL); Mmg_fn_vFree4Ch(p_vPointer,C_ucMmgDefaultChannel); } //XB 21/04/99 //#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ //End XB /**************************************************************************/ void FON_fn_vFirstInitFONMemory(unsigned long _ulFontTextMemorySize) { Erm_M_InitErrMsg(FON); /* Init the error module*/ Mmg_M_InitMmg(FON); #if !defined(U64) /**** Check the ACP memory module ****/ Mmg_fn_cCheckAlignmentValidity(); Mmg_M_InitBlock(FON,E_ucFONTextMemoryBlock,_ulFontTextMemorySize); #else /* !U64 */ #ifdef CHECK_MEMORY Mmg_M_InitSpecificBlock(FON,E_ucFONTextMemoryBlock, _ulFontTextMemorySize, 10000, 4, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag); #else /* CHECK_MEMORY */ //XB 21/04/99 //Mmg_M_InitSpecificBlock(FON,E_ucFONTextMemoryBlock, _ulFontTextMemorySize, 10000, 4, C_BlockWithoutFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag); Mmg_M_InitSpecificBlock(FON,E_ucFONTextMemoryBlock, _ulFontTextMemorySize, 10000, 4, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag); //End XB #endif /* CHECK_MEMORY */ #endif /* U64 */ /**** Save memory size (for reinit) ****/ gs_ulFontTextMemorySize = _ulFontTextMemorySize; } /**************************************************************************/ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ void FON_fn_vDesinitFONMemory(void) { /*Mmg_M_FreeBlock(FON,E_ucFONMemoryBlock);*/ /*Mmg_M_DeleteBlock(FON,E_ucFONMemoryBlock);*/ Mmg_M_FreeBlock(FON,E_ucFONTextMemoryBlock); Mmg_M_DeleteBlock(FON,E_ucFONTextMemoryBlock); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ /**************************************************************************/ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ void FON_fn_vReinitFONMemory(void) { /**** free the block*/ Mmg_M_FreeBlock(FON,E_ucFONTextMemoryBlock); Mmg_M_DeleteBlock(FON,E_ucFONTextMemoryBlock); /**** Check the ACP memory module ****/ Mmg_fn_cCheckAlignmentValidity(); /**** Reinit the block*/ Mmg_M_InitBlock(FON,E_ucFONTextMemoryBlock,gs_ulFontTextMemorySize); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ /**************************************************************************/ #if !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS) void FON_PrintUsedStaticMemory(void) { Mmg_M_PrintUsedStaticMemoryInModule(FON); } #endif /* !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS) */ /**************************************************************************/ /*XB*/ #ifdef CHECK_MEMORY void FON_CheckMemory(void) { Mmg_M_CheckMemory(FON); } #endif /* CHECK_MEMORY */ /*End XB*/ /**************************************************************************/ /* XB 02/06/99 */ #ifndef FINAL_VERSION unsigned long FON_fn_ulGetUsedStaticMemory(void) { return Mmg_M_GetUsedStaticMemory(FON); } #endif /* FINAL_VERSION */ /* End XB 02/06/99 */ /**************************************************************************/