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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,168 @@
# Microsoft Developer Studio Project File - Name="MMG" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=MMG - 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 "Mmg.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 "Mmg.mak" CFG="MMG - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "MMG - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "MMG - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "MMG - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE "MMG - Win32 Debug Protected" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/MMG", WLDAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "MMG - 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 /W3 /GX /O2 /I "x:\cpa\Public" /I "x:\cpa\tempgrp\mmg" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /YX /FD /c
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\MMGP5_vr.lib"
!ELSEIF "$(CFG)" == "MMG - 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 /W3 /GX /Z7 /Od /I "x:\cpa\public" /I "x:\cpa\tempgrp\mmg" /D "_DEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /YX /FD /c
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\MMGP5_vd.lib"
!ELSEIF "$(CFG)" == "MMG - Win32 Retail"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "MMG___Wi"
# PROP BASE Intermediate_Dir "MMG___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 /MD /W3 /GX /Od /I "x:\cpa\Public" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "VISUAL" /D "CPA_WANTS_EXPORT" /D "_AFXDLL" /D "RAYII" /D "USE_PROFILER" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "x:\cpa\Public" /I "x:\cpa\tempgrp\mmg" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "RETAIL" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\cpa\lib\MMGP5_vr.lib"
# ADD LIB32 /nologo /out:"x:\cpa\lib\MMGP5_vf.lib"
!ELSEIF "$(CFG)" == "MMG - Win32 Debug Protected"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "MMG___Wi"
# PROP BASE Intermediate_Dir "MMG___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "tmp\protected"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /I "x:\cpa\Public" /D "_DEBUG" /D "__DEBUG_MALLOC_MODE__" /D "WIN32" /D "_WINDOWS" /D "VISUAL" /D "CPA_WANTS_EXPORT" /D "RAYII" /YX /FD /c
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "x:\cpa\Public" /I "x:\cpa\tempgrp\mmg" /D "_DEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /D "__DEBUG_MALLOC_MODE__" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\cpa\lib\MMGP5_vp.lib"
# ADD LIB32 /nologo /out:"x:\cpa\lib\MMGP5_vp.lib"
!ENDIF
# Begin Target
# Name "MMG - Win32 Release"
# Name "MMG - Win32 Debug"
# Name "MMG - Win32 Retail"
# Name "MMG - Win32 Debug Protected"
# Begin Group "inc"
# PROP Default_Filter "*.h"
# Begin Source File
SOURCE=..\..\Public\Mmg\CpaMmg.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\Mmg\ErrMmg.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\MMG.h
# End Source File
# Begin Source File
SOURCE=.\PrivMmg.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MMG\RastMmg.h
# End Source File
# End Group
# Begin Group "src"
# PROP Default_Filter "*.c"
# Begin Source File
SOURCE=.\CpaMmg.c
# End Source File
# Begin Source File
SOURCE=.\Specif\PC_Mmg.c
# End Source File
# Begin Source File
SOURCE=.\Specif\RastMmg.c
# End Source File
# End Group
# Begin Source File
SOURCE=.\Mmg.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,350 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="MMG"
ProjectGUID="{4F69C5D2-A45E-4D84-BE8B-F743B1342A06}"
SccProjectName="&quot;$/cpa/tempgrp/MMG&quot;, WLDAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug Protected|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\tmp\protected"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="x:\cpa\Public,x:\cpa\tempgrp\mmg"
PreprocessorDefinitions="_DEBUG;VISUAL;WIN32;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;__DEBUG_MALLOC_MODE__"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\tmp\protected/Mmg.pch"
AssemblerListingLocation=".\tmp\protected/"
ObjectFile=".\tmp\protected/"
ProgramDataBaseFileName=".\tmp\protected/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\cpa\lib\MMGP5_vp.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"
AdditionalIncludeDirectories="x:\cpa\Public,x:\cpa\tempgrp\mmg"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;RETAIL"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\tmp/retail/Mmg.pch"
AssemblerListingLocation=".\tmp/retail/"
ObjectFile=".\tmp/retail/"
ProgramDataBaseFileName=".\tmp/retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\cpa\lib\MMGP5_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>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="x:\cpa\Public,x:\cpa\tempgrp\mmg"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;USE_PROFILER"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Tmp\Release/Mmg.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\cpa\lib\MMGP5_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="Debug|Win32"
OutputDirectory="x:\CPa\Libd"
IntermediateDirectory=".\Tmp\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="x:\cpa\public,x:\cpa\tempgrp\mmg"
PreprocessorDefinitions="_DEBUG;VISUAL;WIN32;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Tmp\Debug/Mmg.pch"
AssemblerListingLocation=".\Tmp\Debug/"
ObjectFile=".\Tmp\Debug/"
ProgramDataBaseFileName=".\Tmp\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\CPa\Libd\MMGP5_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>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="inc"
Filter="*.h">
<File
RelativePath="..\..\Public\Mmg\CpaMmg.h">
</File>
<File
RelativePath="..\..\Public\Mmg\ErrMmg.h">
</File>
<File
RelativePath="..\..\Public\MMG.h">
</File>
<File
RelativePath="PrivMmg.h">
</File>
<File
RelativePath="..\..\public\MMG\RastMmg.h">
</File>
</Filter>
<Filter
Name="src"
Filter="*.c">
<File
RelativePath="CpaMmg.c">
<FileConfiguration
Name="Debug Protected|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Specif\PC_Mmg.c">
<FileConfiguration
Name="Debug Protected|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Specif\RastMmg.c">
<FileConfiguration
Name="Debug Protected|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<File
RelativePath="Mmg.mak">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,166 @@
/* ##H_FILE#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : PrivMmg.h
DESCRIPTION : This a private header file in witch there are all the traget(define) that
you can change as you like inside of the library.
Without any problem for the outsidethis file contain all functions and
macros used to allocate memory
VERSION : 5.1.0/Pierrick Crepy/Creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*#define D_CheckSystemForBlockWithoutFree*/
#ifdef U64
#undef __DEBUG_MALLOC_MODE__
/*#undef D_CheckSystemForBlockWithoutFree /*not now */
#endif
#ifdef __DEBUG_MALLOC_MODE__
#define __ADD_PLACE_FOR_DEBUG_INFORMATION__
#endif /*__DEBUG_MALLOC_MODE__*/
/* ##CONSTANTE#--------------------------------------------------------------------------
Constantes declaration
---------------------------------------------------------------------------------------*/
/* multi thread management*/
#define C_ucMmgInvalidGroup (0xFF)
#ifdef __DEBUG_MALLOC_MODE__
#define C_ucMallocHeaderSize (2) /*unitAlloc : size + DebugKey*/
#define C_ucMallocFooterSize (1) /*unitAlloc : DebugKey*/
#define C_ucOptimizedMallocHeaderSize (1) /*unitAlloc : size */
#define C_ucOptimizedMallocFooterSize (0) /*Nothing*/
#else
#define C_ucMallocHeaderSize (1) /*unitAlloc : size */
#define C_ucMallocFooterSize (0) /*Nothing*/
#endif /*__DEBUG_MALLOC_MODE__*/
#define C_ucFreeHeaderSize (2) /*unitAlloc : Size + Next*/
#define C_uaCleanKey (0XAAAAAAAA)
#define C_uaCleanKeyForBlockWithoutFree (0XAA)
#ifdef __DEBUG_MALLOC_MODE__
#define C_ucDebugInformationLoss (C_ucMallocHeaderSize - C_ucOptimizedMallocHeaderSize + C_ucMallocFooterSize - C_ucOptimizedMallocFooterSize)
/* the check keys around malloc*/
#define C_uaBeginKey (0XB123456B) /* B for Begin*/
#define C_uaEndKey (0XE123456E) /* E for End*/
#endif /*__DEBUG_MALLOC_MODE__*/
/* For the block without Free.*/
#define C_FirstFreeValueForBlockWithoutFree ((char *)0XFFFFFFFF)
#define C_TypeOfOverflowCheckKeyForBlockWithoutFree unsigned long
#define C_ulOverflowCheckKey (0XE123456E) /* E for End*/
#ifdef __DEBUG_MALLOC_MODE__
/* for debug and statistic*/
#define C_ucNbPrintedColumn (150) /* number of column that we can display or for the log file*/
#define C_ucNbColumnForHisto (79)
#endif /*__DEBUG_MALLOC_MODE__*/
#ifdef __DEBUG_MALLOC_MODE__
/* for debug and statistic*/
#define C_szMmgLogFileName "Memory.log"/* name of the file used to print debug & statistic information*/
#define C_ucNbMaxFile 255 /* Number maximum of the file using any allocation functions.*/
#endif /*__DEBUG_MALLOC_MODE__*/
/* ##TYPEDEF#----------------------------------------------------------------------------
Types definition
---------------------------------------------------------------------------------------*/
/* ##-#################################################### */
/* tdstInformationHeaderOfBolckWithoutFree */
/* ####################################################### */
typedef struct tdstInformationHeaderOfBolckWithoutFree_{
unsigned char ucBoundededHeaderSize;/* size of this header with alignement*/
unsigned char ucAlignment;
unsigned char ucMode;
}tdstInformationHeaderOfBolckWithoutFree;
/* ##-########################### */
/* tdstMallocInfo */
/* ############################## */
#ifdef __DEBUG_MALLOC_MODE__
typedef struct tdstMallocInfo_{
char * p_cBeginMalloc;
char * p_cEndMalloc;
} tdstMallocInfo;
#else /*__DEBUG_MALLOC_MODE__*/
typedef void tdstMallocInfo;
#endif /*__DEBUG_MALLOC_MODE__*/
/* ##-########################### */
/* tdstBlockInfoPriv */
/* ############################## */
typedef struct tdstBlockInfoPriv_{
char * p_cBeginBlock;
char * p_cEndBlock;
char * p_cFirstFree;
char * p_cMaxMem;
#ifdef __DEBUG_MALLOC_MODE__
unsigned long ulCountMallocBeforeMaxMem;/* the number of allocation before MaxMen (including the allocation who generated this MaxMem address)*/
unsigned long ulCountFreeBeforeMaxMem;
tdstMallocInfo *d_stMallocInfo;
unsigned long ulMaxNbStaticMalloc; /*Nb of maximum allocations*/
unsigned long ulNbMalloc; /* number of malloc used now*/
unsigned long ulNbTotalMalloc; /* cumul*/
unsigned short uwNbFree; /* number of free used now*/
unsigned short ulNbTotalFree; /* cumul*/
unsigned short ulNbTotalRealloc; /* cumul*/
#endif /*__DEBUG_MALLOC_MODE__*/
}tdstBlockInfoPriv;
/* ##-########################### */
/* tdstDynInfo */
/* ############################## */
#if defined (__DYNAMIC_MALLOC_ALLOWED__) && defined (__DEBUG_MALLOC_MODE__)
typedef struct tdstDynInfo_{
tdstMallocInfo *d_stDynamicMallocInfo;
unsigned long ulMaxNbDynamicMalloc;
unsigned long ulNbDynamicMalloc;/* Actual number*/
unsigned short ulNbTotalDynamicMalloc;
unsigned short ulNbTotalDynamicFree;
unsigned short ulNbTotalDynamicRealloc;
}tdstDynInfo;
#else
typedef void tdstDynInfo;
#endif /*defined (__DYNAMIC_MALLOC_ALLOWED__) && defined (__DEBUG_MALLOC_MODE__)*/
/*//////////*/
/* Macros //*/
/*//////////*/
#ifdef __DEBUG_MALLOC_MODE__
/* ##M#===================================================================================
NAME : Mmg_M_InitDynInfo
DESCRIPTION : init a structure info for dynamic allocation
INPUT : dynamic info structure
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_InitDynInfo(p_stMyDynInfo)\
/* ------------------- only used in Mmg_M_InitMmg when __DYNAMIC_MALLOC_ALLOWED__ is defined*/\
{\
(p_stMyDynInfo)->ulNbDynamicMalloc = 0;/* Actual number */\
(p_stMyDynInfo)->ulNbTotalDynamicMalloc =0;\
(p_stMyDynInfo)->ulNbTotalDynamicFree =0;\
(p_stMyDynInfo)->ulNbTotalDynamicRealloc =0;\
}
#else /*__DEBUG_MALLOC_MODE__*/
#define Mmg_M_InitDynInfo(p_stMyDynInfo) /*Nothing to do*/
#endif /*__DEBUG_MALLOC_MODE__*/
/* ##M#===================================================================================
NAME : Mmg_M_UpdateLastErrorWithoutMessage
DESCRIPTION : Raise an error without window message
INPUT : error Id
text message
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_UpdateLastErrorWithoutMessage(uwMyErr, szPersonalTxt) Erm_M_UpdateLastError (Mmg, C_ucErmDefaultChannel, uwMyErr, C_lErmNoDebugData, C_ucErmNoOpenInfoWindow, C_ucNeverStopForDebug, szPersonalTxt);

View File

@@ -0,0 +1,184 @@
/* ##C_FILE#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : CpaMmg.c
DESCRIPTION : this file contain all functions used to allocate memory :
Initialisation of the module
Initialisation of a static bloc
switch between dynamic and static mode
Allocate/ReAllocate/Free Memory
Check function for debugging
Destroy a static bloc
Destroy the module
VERSION : 5.1.0/Pierrick Crepy/Creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* ##INCLUDE#----------------------------------------------------------------------------
Includes Files
---------------------------------------------------------------------------------------*/
#include "ERM.h"
#include "MMG/CpaMmg.h"
#include "..\PrivMmg.h"
/* ##F#===================================================================================
NAME : Mmg_fn_vPrintUsedStaticMemory
DESCRIPTION : this function print the state of the statsic memory in
the file C_szErrorLogFileName
INPUT : Module Id
poniter on a block structure
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
void Mmg_fn_vPrintUsedStaticMemory(unsigned char ucModuleId, struct tdstBlockInfoPriv_ * a_stMyBlockInfo, unsigned char ucModuleMaxBlocksNb){
unsigned char ucBlockId;
char szTxt[200];
unsigned long ulNbMalloc;
unsigned long ulNbFree;
tdstBlockInfoPriv *p_stMyBlockInfo;
unitAlloc * p_uaPtr;
unitAlloc * p_uaFreePtr;
unitAlloc uaTotalAllocatedSize;
unitAlloc uaTotalFreeSize;
unitAlloc uaRemainSpace;
unitAlloc uaBlockSize;
unitAlloc uaMaxUsed;
sprintf (szTxt, "\n===> Print the used Static memory on ");
Erm_M_GetModuleInformation (szTxt+strlen(szTxt), ucModuleId);
sprintf (szTxt+strlen(szTxt), " : <===\n");
Erm_fn_v_Printsz (szTxt);
#ifdef __DEBUG_MALLOC_MODE__
Erm_fn_v_Printsz ("===> With __DEBUG_MALLOC_MODE__ <===\n\n");
#else /*__DEBUG_MALLOC_MODE__*/
Erm_fn_v_Printsz ("===> Without __DEBUG_MALLOC_MODE__ <===\n\n");
#endif /*__DEBUG_MALLOC_MODE__*/
sprintf( szTxt, "Module Id = %d\n", ucModuleId );
Erm_fn_v_Printsz( szTxt );
if( a_stMyBlockInfo == NULL )
{
Erm_fn_v_Printsz( "\tThe info are not valid !!!\n" );
return;
}
for (ucBlockId=0; ucBlockId<ucModuleMaxBlocksNb; ucBlockId++){
p_stMyBlockInfo = a_stMyBlockInfo + ucBlockId;
sprintf(szTxt, "\tThe block #%d:\n", ucBlockId);
Erm_fn_v_Printsz (szTxt);
/*Block whithout Free.*/
if ((p_stMyBlockInfo->p_cBeginBlock != C_p_cBlockNotValidKey) &&
(p_stMyBlockInfo->p_cFirstFree == C_FirstFreeValueForBlockWithoutFree)
){
uaBlockSize = p_stMyBlockInfo->p_cEndBlock - p_stMyBlockInfo->p_cBeginBlock +1;
uaMaxUsed = p_stMyBlockInfo->p_cMaxMem - p_stMyBlockInfo->p_cBeginBlock +1;
#ifdef D_CheckSystemForBlockWithoutFree
uaMaxUsed -= (((tdstInformationHeaderOfBolckWithoutFree *)p_stMyBlockInfo->p_cBeginBlock)->ucBoundededHeaderSize);
uaBlockSize -= (((tdstInformationHeaderOfBolckWithoutFree *)p_stMyBlockInfo->p_cBeginBlock)->ucBoundededHeaderSize);
#endif /*D_CheckSystemForBlockWithoutFree*/
Erm_fn_v_Printsz ("\t\t --> MaxMen status: The higher address used in this block without Free\n");
sprintf (szTxt, "\t\t\t -> %.2f%%%% used i.e %ldb (%.2fKb; %.2fMb) / %ldb (%.2fKb; %.2fMb)\n",
((float)uaMaxUsed * 100 / (float)uaBlockSize),
(unsigned long)uaMaxUsed, (float)uaMaxUsed/1024, (float)uaMaxUsed/(1024*1024),
(unsigned long)uaBlockSize, (float)uaBlockSize/1024, (float)uaBlockSize/(1024*1024)
);
Erm_fn_v_Printsz (szTxt);
continue;/* go to the next Block (ucBlockId)*/
}
p_uaPtr=(unitAlloc *)p_stMyBlockInfo->p_cBeginBlock;
p_uaFreePtr = (unitAlloc *)p_stMyBlockInfo->p_cFirstFree;
uaTotalAllocatedSize = 0;
uaTotalFreeSize = 0;
ulNbFree = 0;
ulNbMalloc =0;
while (p_uaPtr < (unitAlloc *)p_stMyBlockInfo->p_cEndBlock){/* scan all malloc*/
if (p_uaFreePtr == p_uaPtr){/* it's a free */
if (((unitAlloc *) *(p_uaFreePtr+1)) != (unitAlloc *) 0){
/* not the last free*/
p_uaFreePtr = (unitAlloc *) *(p_uaFreePtr+1); /* go to the next free*/
ulNbFree++;
uaTotalFreeSize += *p_uaPtr;
}
}
else{/* this is a malloc*/
uaTotalAllocatedSize += *p_uaPtr;
ulNbMalloc++;
}
p_uaPtr += *(p_uaPtr);
}/*end of while*/
if (p_uaPtr != (unitAlloc *)(p_stMyBlockInfo->p_cEndBlock + 1)){
Erm_fn_v_Printsz ("\t\t --> not valid (should be not initialized)\n");
}
else {
uaBlockSize = p_stMyBlockInfo->p_cEndBlock - p_stMyBlockInfo->p_cBeginBlock +1;
uaMaxUsed = p_stMyBlockInfo->p_cMaxMem - p_stMyBlockInfo->p_cBeginBlock +1;
if ( (unitAlloc *) (p_uaFreePtr) == (unitAlloc *) NULL){
/*all the space is used !!*/
uaRemainSpace = 0;
}
else {
uaRemainSpace = ((*p_uaFreePtr)<<C_uwShiftAllocSize);
}
#ifdef __DEBUG_MALLOC_MODE__
uaBlockSize -= (p_stMyBlockInfo->ulMaxNbStaticMalloc*(C_ucDebugInformationLoss<<C_uwShiftAllocSize));
uaMaxUsed -= ( (p_stMyBlockInfo->ulCountMallocBeforeMaxMem * C_ucDebugInformationLoss)) << C_uwShiftAllocSize;
uaTotalAllocatedSize -= ( (ulNbMalloc * C_ucDebugInformationLoss));
#endif /*__DEBUG_MALLOC_MODE__*/
uaTotalAllocatedSize <<= C_uwShiftAllocSize;
uaTotalFreeSize <<= C_uwShiftAllocSize;
Erm_fn_v_Printsz ("\t\t --> MaxMen status: The higher allocation\n");
sprintf (szTxt, "\t\t\t -> %.2f%%%% used i.e %ldb (%.2fKb; %.2fMb) / %ldb (%.2fKb; %.2fMb)\n",
((float)uaMaxUsed * 100 / (float)uaBlockSize),
(unsigned long)uaMaxUsed, (float)uaMaxUsed/1024, (float)uaMaxUsed/(1024*1024),
(unsigned long)uaBlockSize, (float)uaBlockSize/1024, (float)uaBlockSize/(1024*1024)
);
Erm_fn_v_Printsz (szTxt);
#ifdef __DEBUG_MALLOC_MODE__
sprintf (szTxt, "\t\t\t -> With %d allocation(s) & %d free(s)\n", p_stMyBlockInfo->ulCountMallocBeforeMaxMem, p_stMyBlockInfo->ulCountFreeBeforeMaxMem);
Erm_fn_v_Printsz (szTxt);
#endif /*__DEBUG_MALLOC_MODE__*/
Erm_fn_v_Printsz ("\t\t --> Current status:\n");
sprintf (szTxt, "\t\t\t ->%.2f%%%% used for allocation, i.e %ldb (%.2fKb; %.2fMb) / %ldb (%.2fKb; %.2fMb)\n",
((float)uaTotalAllocatedSize * 100 / (float)uaBlockSize),
(unsigned long)uaTotalAllocatedSize, (float)uaTotalAllocatedSize/1024, (float)uaTotalAllocatedSize/(1024*1024),
(unsigned long)uaBlockSize, (float)uaBlockSize/1024, (float)uaBlockSize/(1024*1024)
);
Erm_fn_v_Printsz (szTxt);
#ifndef __DEBUG_MALLOC_MODE__
sprintf (szTxt, "\t\t\t ->%.2f%%%% lost for the management of free, i.e %ldb (%.2fKb; %.2fMb) / %ldb (%.2fKb; %.2fMb)\n",
((float)uaTotalFreeSize * 100 / (float)uaBlockSize),
(unsigned long)uaTotalFreeSize, (float)uaTotalFreeSize/1024, (float)uaTotalFreeSize/(1024*1024),
(unsigned long)uaBlockSize, (float)uaBlockSize/1024, (float)uaBlockSize/(1024*1024)
);
Erm_fn_v_Printsz (szTxt);
sprintf (szTxt, "\t\t\t ->%.2f%%%% remain i.e %ldb (%.2fKb; %.2fMb) / %ldb (%.2fKb; %.2fMb)\n",
((float)uaRemainSpace * 100 / (float)uaBlockSize),
(unsigned long)uaRemainSpace, (float)uaRemainSpace/1024, (float)uaRemainSpace/(1024*1024),
(unsigned long)uaBlockSize, (float)uaBlockSize/1024, (float)uaBlockSize/(1024*1024)
);
Erm_fn_v_Printsz (szTxt);
#endif /*__DEBUG_MALLOC_MODE__*/
sprintf (szTxt, "\t\t\t -> There are %d allocation(s) & %d free(s)\n", ulNbMalloc, ulNbFree);
Erm_fn_v_Printsz (szTxt);
}
}/* end of the for block*/
}/* Mmg_fn_vPrintUsedStaticMemory*/

View File

@@ -0,0 +1,945 @@
/****************************************************************
* *
* RastMmg.c *
* *
* Functions to have a dump of the memory used type by type *
* *
* Author : Alexis Vaisse *
* *
****************************************************************/
#if (defined(USE_PROFILER) && !defined(U64))
#ifdef WIN32
#include <windows.h>
#include <assert.h>
#include <malloc.h>
#endif
#include "MMG/CpaMmg.h"
#include "MMG/RastMmg.h"
#include "PrivMmg.h"
#undef assert
#define assert(a) if ((a) == FALSE) { _asm { int 3 } }
/* --- Definition of the structures ---*/
typedef struct stObjectMemoryInformation_
{
long lNumberOfBlock; /* Number of allocated blocks*/
long lNumberOfStructure; /* Number of structures (a structure can have one or several blocks)*/
long lRequestedMemory; /* Number of bytes for the requested memory*/
long lAllocatedMemory; /* Number of bytes for the allocated memory*/
long lFreedMemory; /* Number of bytes for the freed memory*/
void * p_vObject; /* The object that is using this block (an actor for instance)*/
} tdstObjectMemoryInformation;
typedef struct stSubTypeMemoryInformation_
{
char * szSubTypeName; /* The name of the sub-type*/
long lMemoryChannel; /* The memory channel where the memory is allocated*/
long lTotalNumberOfBlock; /* The number of allocated blocks for all the objects of this sub-type*/
long lTotalNumberOfStructure; /* The number of all allocated structures for all objects of this sub-type*/
long lTotalRequestedMemory; /* The requested memory for all the objects of this sub-type*/
long lTotalAllocatedMemory; /* The allocated memory for all the objects of this sub-type*/
long lTotalFreedMemory; /* The freed memory for all the objects of this sub-type*/
long lNumberOfObject; /* The number of objects of this sub-type*/
long lNumberOfUsedObject; /* The number of used objects of this sub-type*/
tdstObjectMemoryInformation * a_tdstObjectMemory; /* An array of all the object memory informations of this sub-type*/
} tdstSubTypeMemoryInformation;
typedef struct stTypeMemoryInformation_
{
char * szTypeName; /* The name of the type*/
long lTotalNumberOfBlock; /* The number of allocated blocks for all the sub-types of this type*/
long lTotalNumberOfStructure; /* The number of allocated structures for all the sub-types of this type*/
long lTotalRequestedMemory; /* The requested memory for all the sub-types of this type*/
long lTotalAllocatedMemory; /* The allocated memory for all the sub-types of this type*/
long lTotalFreedMemory; /* The freed memory for all the sub-types of this type*/
long lNumberOfSubType; /* The number of sub-type of this type*/
tdstSubTypeMemoryInformation * a_tdstSubTypeMemory; /* An array of all the sub-type memory information of this type*/
} tdstTypeMemoryInformation;
/* --- Definition of the variables ---*/
#define C_lDefaultType 0
#define C_lDefaultSubType 0
#define C_p_vDefaultObject ((void *) 0)
#define C_szFileNameForMemoryDump "MemoryDump.htm"
long g_lNumberOfType = 0; /* The number of type*/
tdstTypeMemoryInformation * g_a_tdstTypeMemory = NULL; /* A global variable for all the type memory information*/
long g_lType = C_lDefaultType; /* | These five variables are used*/
long g_lSubType = C_lDefaultSubType; /* | to store information about*/
void * g_p_vObject = C_p_vDefaultObject; /* | the next memory allocation*/
unsigned char g_ucForOneAllocation = TRUE; /* |*/
unsigned char g_ucFirstAllocation = TRUE; /* |*/
/****************************************/
/* MMG_fn_vInitMemoryRasterDeclaration*/
/* Must be called once at the beginning of the game*/
/****************************************/
void MMG_fn_vInitMemoryRasterDeclaration (void)
{
/*#ifdef ACTIVE_EDITOR*/
#define C_lNbActors 1024
/*#else*/
/* #define C_lNbActors 256*/
/*#endif*/
/* Initialization of the memory raster*/
MMG_fn_vInitMemoryRaster (25); /* 25types used*/
MMG_fn_vInitTypeForMemoryRaster (0 , "Not declared allocation" , 1); /* Type 0 has 1 sub-type*/
MMG_fn_vInitSubTypeForMemoryRaster (0 , 0 , "Not declared allocation" , 1); /* Sub-type 0-0 can have 1 object*/
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeScript , "Script" , 1); /* Type 1 has 1 sub-type*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeScript , MMG_C_lSubTypeScript , "Script" , 1); /* Sub-type 1-0 can have 1 object*/
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeMiniStructure , "Mini-structure" , 14); /* Type 2 has 14 sub-types*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubType3dData , "MS 3dData" , C_lNbActors); /* Sub-type 2- 0 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeStdGame , "MS StdGame" , C_lNbActors); /* Sub-type 2- 1 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeDynamics , "MS Dynamics" , C_lNbActors); /* Sub-type 2- 2 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeBrain , "MS Brain" , C_lNbActors); /* Sub-type 2- 3 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeCineInfo , "MS CineInfo" , C_lNbActors); /* Sub-type 2- 4 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeCollSet , "MS CollSet" , C_lNbActors); /* Sub-type 2- 5 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSWay , "MS Way" , C_lNbActors); /* Sub-type 2- 6 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeLight , "MS Light" , C_lNbActors); /* Sub-type 2- 7 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeSectInfo , "MS SectInfo" , C_lNbActors); /* Sub-type 2- 8 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMicro , "MS Micro" , C_lNbActors); /* Sub-type 2- 9 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypePrtSrc , "MS PrtSrc" , C_lNbActors); /* Sub-type 2-10 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMSSound , "MS Sound" , C_lNbActors); /* Sub-type 2-11 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeAnimEffect, "MS AnimEffect" , C_lNbActors); /* Sub-type 2-12 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMagnet , "MS Magnet" , C_lNbActors); /* Sub-type 2-13 can have C_lNbActors objects*/
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeFamily , "Family" , 14); /* Type 3 has 14 sub-types*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeFamily , "Family" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeState , "State" , C_lNbActors); /* Sub-type 3- 0 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , "Animation" , C_lNbActors); /* Sub-type 3- 0 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeTransition , "Transition" , C_lNbActors); /* Sub-type 3- 0 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeProhibit , "Prohibit" , C_lNbActors); /* Sub-type 3- 0 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeTBLList , "ObjectsTableList" , C_lNbActors); /* Sub-type 3- 0 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , "ObjectTableElement" , C_lNbActors); /* Sub-type 3- 0 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeTBLEvent , "ObjectTableEvent" , C_lNbActors); /* Sub-type 3- 0 can have C_lNbActors objects*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeZdxListElement , "ZdxListElement" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeZdxIndexListElement , "ZdxIndexListElement" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeGeometricZdxListElement , "GeometricZdxListElement" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeZoneSetListElement , "ZoneSetListElement" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeCsaListElement , "CsaListElement" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFamily , MMG_C_lSubTypeZoneSetEncapsulation , "ZoneSetEncapsulation" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeAI , "AI" , 24); /* Type 4 has 23 sub-types*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeMind , "Mind" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeMacro , "Macro" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeNodeMacro , "NodeMacro" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeComport , "Comport" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeRule , "Rule" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeNodeInterpret , "Interpret" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeActionTableEntry , "ActionTableEntry" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeActionTable , "ActionTable" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeModel , "Model" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeScriptAI , "ScriptAI" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeIntelligence , "Intelligence" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeDsgVarInfo , "DsgVarInfo" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeDsgVar , "DsgVar" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeDsgMemBuffer , "DsgMemBuffer" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeDsgMem , "DsgMem" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeNodeString , "NodeString" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeNodeVector , "NodeVector" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeListOfArc , "ListOfArc" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeArc , "Arc" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeNameOfGraph , "NameOfGraph" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeNameOfGraphSection , "NameOfGraphSection" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeGraph , "Graph" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeGraphNode , "GraphNode" , 1); /* Sub-type 3- 0 can have 1 object*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeAI , MMG_C_lSubTypeAIDEBUG , "AIDebug" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypePosition , "Position" , 1); /* Type 4 has 23 sub-types*/
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypePosition , MMG_C_lSubTypePosition , "Position" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeSuperObject , "Super-Object" , 2);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSuperObject , MMG_C_lSubTypeSuperObject , "Super-Object" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSuperObject , MMG_C_lSubTypeSuperObjectTable , "Super-Object table" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeSector , "Sector" , 9);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeSuperObject , "Sector" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeGraphicElement , "Graphic Element" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeCollisionElement , "Collision Element" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeCharacterElement , "Character Element" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeActiveElement , "Active Element" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeSoundElement , "Sound Element" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeDNMLightElement , "Dynamic Light" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeStaticLightElement , "Static Light" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSector , MMG_C_lSubTypeSoundEvent , "Sound Event" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeGeometricObject , "GEO" , 21);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypePointsNormals , "Normales points" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeIndexUsedByElement , "IndexByElement" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeMainObject , "Main Object" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeListOfElementType , "List Of ElementTypes" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeListOfElement , "List Of Element" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeListOfPoint , "List Of Points" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeListOfEdge , "List Of Edges" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeListOfEdgeMaterial , "List Of Edges Material" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypePointsMaterial , "List Of Points Material" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeParallelBox , "Parallel Box" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeRotativeSprite , "Rotative Sprite" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeBoundingSphere , "Bounding Sphere" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementSprite , "Element Sprite" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementIT , "Element Indexed triangles" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementFaceMap , "Element FaceMap" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementTMeshes , "Element TMeshes" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementPoint , "Element Point" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementLine , "Element Line" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementSphere , "Element Sphere" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementAlignedBox , "Element Aligned Box" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementCone , "Element Cone" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeSAI , "SAI" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeSAI , MMG_C_lSubTypeSAI , "SAI" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeIPT , "IPT" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeIPT , MMG_C_lSubTypeIPT , "IPT" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeFile , "File" , 5);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFile , MMG_C_lSubTypeBmpFile , "Bmp file" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFile , MMG_C_lSubTypeConcatFile , "Concat file" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFile , MMG_C_lSubTypeGfFile , "Gf file" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFile , MMG_C_lSubTypeTgaFile , "Tga file" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeFile , MMG_C_lSubTypeMiscellaneousFile , "Miscellaneous file" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeGMT , "GameMaterial" , 4);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGMT , MMG_C_lSubTypeCollideMaterial , "Collide Material" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGMT , MMG_C_lSubTypeFor3DOS , "3DOS" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGMT , MMG_C_lSubTypeForA3D , "A3D" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGMT , MMG_C_lSubTypeMain , "Main" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeMOR , "Morphing" , 2);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMOR , MMG_C_lSubTypeElement , "Element" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMOR , MMG_C_lSubTypePO , "PO" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeISI , "ISI" , 4);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeISI , MMG_C_lSubTypeLOD , "LOD" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeISI , MMG_C_lSubTypeArray , "Array" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeISI , MMG_C_lSubTypeStruct , "Struct" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeISI , MMG_C_lSubTypeBlendRLI , "BlendRLI" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeInterpol , "Interpol" , 14);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeA3dGENERAL , "A3dGENERAL" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeVectors , "Vectors" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeQuaternions , "Quaternions" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeHierarchies , "Hierarchy" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeNTTO , "NTTO" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeOnlyFrames , "Only Frames" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeChannels , "Channels" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeFrames , "Frames" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeFramesKF , "FramesKF" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeKeyFrames , "Key Frames" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeEvents , "Events" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeMorphData , "Morph Data" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeSpeedCuttedAnim , "Cutted Anim" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeInterpol , MMG_C_lSubTypeSpeedMatrix , "Speed Matrix" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeVignette , "Vignette" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeVignette , MMG_C_lSubTypeVignette , "Vignette" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeGAM , "GAM" , 16);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypePlayer , "Player" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeCSO , "CSO" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeLipSynchro , "LipSynchro" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeSnapShot , "SnapShot" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeBinAnim , "BinAnim" ,C_lNbActors);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeListOfMaps , "List of Maps" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeMorphChannelList , "Morph Channels List" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeMorphList , "Morph List" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeAlwaysActiveChar , "Always Active char" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeFont , "Font" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeMainChar , "Main Char" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeEngineObject , "Engine Object" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeAlwaysGenerator , "Always Generator" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeAlwaysModel , "Always Model" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , "ObjectType Element" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGAM , MMG_C_lSubTypeViewPortArray , "ViewPortArray" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeGLI , "GLI" , 12);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeTexture , "Texture" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeGlobal , "Global" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeZBufferForLight , "ZBufferForLight" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeGliLight , "Light" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypePolice , "Police" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeZList , "ZList" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeCamera , "Camera" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeMaterial , "Material" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeAnimatedTexture , "Animated texture" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeMipMapping , "Mip-mapping" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeVisualSet , "Visual set" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeGLI , MMG_C_lSubTypeRLI , "RLI" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeOctree , "Octree" , 7);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeOctree , MMG_C_lSubTypeElementBaseTable , "Element base table" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeOctree , MMG_C_lSubTypeFaceIndex , "Face index" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeOctree , MMG_C_lSubTypeTaggedPointTable , "Tagged point table" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeOctree , MMG_C_lSubTypeTaggedFaceTable , "Tagged face table" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeOctree , MMG_C_lSubTypeOctreeNode , "Octree node" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeOctree , MMG_C_lSubTypeFaceIndexList , "Face index list" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeOctree , MMG_C_lSubTypeOctreeStructure , "Octree structure" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypePO , "Physical objet" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypePO , MMG_C_lSubTypePOStructure , "PO structure" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypePCS , "Physical CollSet" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypePCS , MMG_C_lSubTypePCSStructure , "PCS structure" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeIPO , "IPO" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeIPO , MMG_C_lSubTypeIPOStructure , "IPO structure" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeMEC , "Mechanic" , 3);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMEC , MMG_C_lSubTypeMecMatCharacteristic,"MecMatCharacteristic" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMEC , MMG_C_lSubTypeMecCameraCard , "Camera Id Card" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeMEC , MMG_C_lSubTypeMecBaseCard , "Base Id Card" , 1);
MMG_fn_vInitTypeForMemoryRaster (MMG_C_lTypeRND , "RND" , 1);
MMG_fn_vInitSubTypeForMemoryRaster (MMG_C_lTypeRND , MMG_C_lSubTypeRND , "RND" , 1);
#undef C_lNbActors
}
/****************************************/
/* MMG_fn_vDesinitMemoryRasterDeclaration*/
/* Must be called once at the end of the game*/
/****************************************/
void MMG_fn_vDesinitMemoryRasterDeclaration (void)
{
int i , j;
int iNumberOfSubType;
tdstTypeMemoryInformation * p;
tdstSubTypeMemoryInformation * q;
for (i = 0 , p = g_a_tdstTypeMemory ; i < g_lNumberOfType ; i ++ , p ++)
{
iNumberOfSubType = p -> lNumberOfSubType;
for (j = 0 , q = p -> a_tdstSubTypeMemory ; j < iNumberOfSubType ; j ++ , q ++)
{
free (q -> a_tdstObjectMemory);
}
free (p -> a_tdstSubTypeMemory);
}
free (g_a_tdstTypeMemory);
}
/****************************************/
/* MMG_fn_vInitMemoryRaster*/
/* Allocate memory for the memory raster*/
/****************************************/
void MMG_fn_vInitMemoryRaster (long _lNumberOfType)
{
int i;
tdstTypeMemoryInformation * p;
/* Don't try to initialize twice*/
assert (g_a_tdstTypeMemory == NULL);
g_lNumberOfType = _lNumberOfType;
g_a_tdstTypeMemory = (tdstTypeMemoryInformation *) malloc (_lNumberOfType * sizeof (tdstTypeMemoryInformation));
for (i = 0 , p = g_a_tdstTypeMemory ; i < _lNumberOfType ; i ++ , p ++)
{
p -> szTypeName = NULL;
}
}
/****************************************/
/* MMG_fn_vInitTypeForMemoryRaster*/
/* Allocate memory for one type for the memory raster*/
/****************************************/
void MMG_fn_vInitTypeForMemoryRaster (long _lType , char * _szTypeName , long _lNumberOfSubType)
{
int i;
tdstTypeMemoryInformation * p;
tdstSubTypeMemoryInformation * q;
assert (_lType < g_lNumberOfType);
p = & g_a_tdstTypeMemory [_lType];
assert (p -> szTypeName == NULL); /* p -> szTypeName != NULL means that we are trying to initialize a type twice*/
p -> szTypeName = _szTypeName;
p -> lTotalNumberOfBlock = 0;
p -> lTotalNumberOfStructure = 0;
p -> lTotalRequestedMemory = 0;
p -> lTotalAllocatedMemory = 0;
p -> lTotalFreedMemory = 0;
p -> lNumberOfSubType = _lNumberOfSubType;
p -> a_tdstSubTypeMemory = (tdstSubTypeMemoryInformation *) malloc (_lNumberOfSubType * sizeof (tdstSubTypeMemoryInformation));
for (i = 0 , q = p -> a_tdstSubTypeMemory ; i < _lNumberOfSubType ; i ++ , q ++)
{
q -> szSubTypeName = NULL;
}
}
/****************************************/
/* MMG_fn_vInitSubTypeForMemoryRaster*/
/* Allocate memory for one sub-type for the memory raster*/
/****************************************/
void MMG_fn_vInitSubTypeForMemoryRaster (long _lType , long _lSubType , char * _szSubTypeName , long _lNumberOfObject)
{
tdstTypeMemoryInformation * p;
tdstSubTypeMemoryInformation * q;
assert (_lType < g_lNumberOfType);
p = & g_a_tdstTypeMemory [_lType];
/* The type must have been initialized*/
assert (p -> szTypeName != NULL);
/* _lSubType must not be too big*/
assert (_lSubType < p -> lNumberOfSubType);
q = & g_a_tdstTypeMemory [_lType] . a_tdstSubTypeMemory [_lSubType];
assert (q -> szSubTypeName == NULL); /* q -> szSubTypeName != NULL means that we are trying to initialize a sub-type twice*/
q -> szSubTypeName = _szSubTypeName;
q -> lTotalNumberOfBlock = 0;
q -> lTotalNumberOfStructure = 0;
q -> lTotalRequestedMemory = 0;
q -> lTotalAllocatedMemory = 0;
q -> lTotalFreedMemory = 0;
q -> lMemoryChannel = -1;
q -> lNumberOfObject = _lNumberOfObject;
q -> lNumberOfUsedObject = 0;
q -> a_tdstObjectMemory = (tdstObjectMemoryInformation *) malloc (_lNumberOfObject * sizeof (tdstObjectMemoryInformation));
}
/****************************************/
/* MMG_fn_vAddMemoryInfo*/
/* This function must be called before making a memory allocation*/
/****************************************/
void MMG_fn_vAddMemoryInfo (long _lType , long _lSubType , void * _p_vObject)
{
g_lType = _lType;
g_lSubType = _lSubType;
g_p_vObject = _p_vObject;
g_ucForOneAllocation = TRUE;
g_ucFirstAllocation = TRUE;
}
/****************************************/
/* MMG_fn_vBeginMemoryInfo*/
/* This function must be called before making several memory allocations*/
/* Then one must call the MMG_fn_vEndMemoryInfo function*/
/****************************************/
void MMG_fn_vBeginMemoryInfo (long _lType , long _lSubType , void * _p_vObject)
{
g_lType = _lType;
g_lSubType = _lSubType;
g_p_vObject = _p_vObject;
g_ucForOneAllocation = FALSE;
g_ucFirstAllocation = TRUE;
}
/****************************************/
/* MMG_fn_vEndMemoryInfo*/
/* This function must be called after calling*/
/* the MMG_fn_vBeginMemoryInfo and making memory allocations*/
/****************************************/
void MMG_fn_vEndMemoryInfo ()
{
g_lType = C_lDefaultType;
g_lSubType = C_lDefaultSubType;
g_p_vObject = C_p_vDefaultObject;
g_ucForOneAllocation = TRUE;
g_ucFirstAllocation = TRUE;
}
/****************************************/
/* MMG_fn_vPrivateRegisterMemoryAllocation*/
/* Private function to add the values in the array*/
/****************************************/
void MMG_fn_vPrivateRegisterMemoryAllocation (long _lType , long _lSubType , void * _p_vObject , long _lRequestedSize , long _lAllocatedSize , long _lChannelNumber ,
unsigned char _ucFirstAllocation)
{
tdstTypeMemoryInformation * p;
tdstSubTypeMemoryInformation * q;
tdstObjectMemoryInformation * r;
int iBegin , iEnd , iMiddle;
assert (_lType < g_lNumberOfType);
p = & g_a_tdstTypeMemory [_lType];
assert (_lSubType < p -> lNumberOfSubType);
q = & p -> a_tdstSubTypeMemory [_lSubType];
/* All the objects of the same sub-type must be allocated in the same memory channel, except for the default type*/
assert (_lChannelNumber == q -> lMemoryChannel || q -> lMemoryChannel == -1);
if (q -> lMemoryChannel == -1 && _lType != C_lDefaultType)
q -> lMemoryChannel = _lChannelNumber;
r = q -> a_tdstObjectMemory;
/* Search the object inside the list*/
iBegin = -1;
iEnd = (int) (q -> lNumberOfUsedObject);
while (iEnd > iBegin + 1)
{
iMiddle = (iBegin + iEnd) >> 1;
if (r [iMiddle] . p_vObject < _p_vObject) iBegin = iMiddle;
else iEnd = iMiddle;
}
r += iEnd; /* r points to the good object*/
if (iEnd < q -> lNumberOfUsedObject && r -> p_vObject == _p_vObject)
{
/* The object already exist in the list*/
if (_lAllocatedSize >= 0)
{
r -> lNumberOfBlock ++;
if (_ucFirstAllocation) r -> lNumberOfStructure ++;
r -> lRequestedMemory += _lRequestedSize;
r -> lAllocatedMemory += _lAllocatedSize;
}
else
{
r -> lFreedMemory -= _lAllocatedSize;
}
}
else
{
/* The object does not exist in the list*/
assert (q -> lNumberOfUsedObject < q -> lNumberOfObject);
memmove (r + 1 , r , (q -> lNumberOfUsedObject - iEnd) * sizeof (tdstObjectMemoryInformation));
r -> lNumberOfBlock = 1;
r -> lNumberOfStructure = _ucFirstAllocation ? 1 : 0;
r -> lRequestedMemory = _lRequestedSize;
r -> lAllocatedMemory = _lAllocatedSize;
r -> lFreedMemory = 0;
r -> p_vObject = _p_vObject;
q -> lNumberOfUsedObject ++;
}
}
/****************************************/
/* MMG_fn_vRegisterMemoryAllocation*/
/* This function is automatically called when making one memory allocation*/
/****************************************/
void MMG_fn_vRegisterMemoryAllocation (long _lChannelNumber , long _lRequestedSize)
{
/* Compute the allocated size*/
long lAllocatedSize;
if (Mmg_M_ucIsStaticMode (_lChannelNumber))
{
/* Static block*/
tdstBlockInfoPriv * p_stMyBlockInfo = (tdstBlockInfoPriv *) g_d_stCurrentModeInfo [_lChannelNumber] . p_vTdstBlockInfoOrTdstDynInfo;
if (p_stMyBlockInfo -> p_cFirstFree != C_FirstFreeValueForBlockWithoutFree)
{
/* Static block with free*/
lAllocatedSize = _lRequestedSize;
Mmg_M_BigBoundSize (lAllocatedSize , C_uwAllocSize);
lAllocatedSize >>= C_uwShiftAllocSize;
lAllocatedSize += C_ucMallocHeaderSize + C_ucMallocFooterSize;
lAllocatedSize <<= C_uwShiftAllocSize;
}
else
{
/* Static block without free*/
lAllocatedSize = _lRequestedSize;
#ifdef D_CheckSystemForBlockWithoutFree
{
tdstInformationHeaderOfBolckWithoutFree * p_stInfoHeaderBolck = (tdstInformationHeaderOfBolckWithoutFree *) p_stMyBlockInfo -> p_cBeginBlock;
if (p_stInfoHeaderBolck -> ucMode & C_Check_AlignementFlag)
{
Mmg_M_BigBoundSize (lAllocatedSize , p_stInfoHeaderBolck -> ucAlignment);
}
}
#endif
}
}
else
{
/* Dynamic block*/
lAllocatedSize = _lRequestedSize;
Mmg_M_BigBoundSize (lAllocatedSize , C_uwAllocSize);
lAllocatedSize >>= C_uwShiftAllocSize;
lAllocatedSize += C_ucMallocHeaderSize + C_ucMallocFooterSize;
lAllocatedSize <<= C_uwShiftAllocSize;
}
/* Add the values in the arrays*/
MMG_fn_vPrivateRegisterMemoryAllocation (g_lType , g_lSubType , g_p_vObject , _lRequestedSize , lAllocatedSize , _lChannelNumber , g_ucFirstAllocation);
if (g_ucForOneAllocation) MMG_fn_vEndMemoryInfo ();
else g_ucFirstAllocation = FALSE;
}
/****************************************/
/* MMG_fn_vRegisterMemoryFree*/
/* This function is automatically called when making one memory free*/
/****************************************/
void MMG_fn_vRegisterMemoryFree (long _lChannelNumber , void * _p_vBlock)
{
long lFreeSize;
unitAlloc * p_xBlock = (unitAlloc *) _p_vBlock;
if (_p_vBlock == NULL) return;
p_xBlock --;
lFreeSize = (* p_xBlock) * sizeof (unitAlloc);
/* Add the value in the arrays*/
MMG_fn_vPrivateRegisterMemoryAllocation (g_lType , g_lSubType , g_p_vObject , - lFreeSize , - lFreeSize , _lChannelNumber , g_ucFirstAllocation);
if (g_ucForOneAllocation) MMG_fn_vEndMemoryInfo ();
else g_ucFirstAllocation = FALSE;
}
/****************************************/
/* MMG_fn_vComputeSizeForSubType*/
/* Compute all the memory used for a sub-type*/
/****************************************/
void MMG_fn_vComputeSizeForSubType (long _lType , long _lSubType)
{
tdstSubTypeMemoryInformation * q;
tdstObjectMemoryInformation * r;
int i;
long lTotalNumberOfBlock = 0;
long lTotalNumberOfStructure = 0;
long lTotalRequestedMemory = 0;
long lTotalAllocatedMemory = 0;
long lTotalFreedMemory = 0;
q = & g_a_tdstTypeMemory [_lType] . a_tdstSubTypeMemory [_lSubType];
for (i = 0 , r = q -> a_tdstObjectMemory ; i < q -> lNumberOfUsedObject ; i ++ , r ++)
{
lTotalNumberOfBlock += r -> lNumberOfBlock;
lTotalNumberOfStructure += r -> lNumberOfStructure;
lTotalRequestedMemory += r -> lRequestedMemory;
lTotalAllocatedMemory += r -> lAllocatedMemory;
lTotalFreedMemory += r -> lFreedMemory;
}
q -> lTotalNumberOfBlock = lTotalNumberOfBlock;
q -> lTotalNumberOfStructure = lTotalNumberOfStructure;
q -> lTotalRequestedMemory = lTotalRequestedMemory;
q -> lTotalAllocatedMemory = lTotalAllocatedMemory;
q -> lTotalFreedMemory = lTotalFreedMemory;
}
/****************************************/
/* MMG_fn_vComputeSizeForType*/
/* COmpute all the memory used for a type*/
/****************************************/
void MMG_fn_vComputeSizeForType (long _lType)
{
tdstTypeMemoryInformation * p;
tdstSubTypeMemoryInformation * q;
long lSubType;
long lTotalNumberOfBlock = 0;
long lTotalNumberOfStructure = 0;
long lTotalRequestedMemory = 0;
long lTotalAllocatedMemory = 0;
long lTotalFreedMemory = 0;
p = & g_a_tdstTypeMemory [_lType];
for (lSubType = 0 , q = p -> a_tdstSubTypeMemory ; lSubType < p -> lNumberOfSubType ; lSubType ++ , q ++)
{
MMG_fn_vComputeSizeForSubType (_lType , lSubType);
lTotalNumberOfBlock += q -> lTotalNumberOfBlock;
lTotalNumberOfStructure += q -> lTotalNumberOfStructure;
lTotalRequestedMemory += q -> lTotalRequestedMemory;
lTotalAllocatedMemory += q -> lTotalAllocatedMemory;
lTotalFreedMemory += q -> lTotalFreedMemory;
}
p -> lTotalNumberOfBlock = lTotalNumberOfBlock;
p -> lTotalNumberOfStructure = lTotalNumberOfStructure;
p -> lTotalRequestedMemory = lTotalRequestedMemory;
p -> lTotalAllocatedMemory = lTotalAllocatedMemory;
p -> lTotalFreedMemory = lTotalFreedMemory;
}
/****************************************/
/* LToA*/
/* Convert a number into string with a comma to separate groups of 3 digits*/
/****************************************/
char g_szBuffer [8] [14];
char * LToA (long _lNumber)
{
static int iNumberOfBuffer = 0;
iNumberOfBuffer = (iNumberOfBuffer + 1) & 0x07;
if (_lNumber < 1000) sprintf (g_szBuffer [iNumberOfBuffer] , "%i" , _lNumber);
else
if (_lNumber < 1000000) sprintf (g_szBuffer [iNumberOfBuffer] , "%i,%03i" , _lNumber / 1000 , _lNumber % 1000);
else sprintf (g_szBuffer [iNumberOfBuffer] , "%i,%03i,%03i" , _lNumber / 1000000 , (_lNumber / 1000) % 1000 , _lNumber % 1000);
return g_szBuffer [iNumberOfBuffer];
}
#define HTML_C_szBeginningOfPage "<HTML>\n<BODY>\n"
#define HTML_C_szEndOfPage "</BODY>\n</HTML>\n"
#define HTML_C_szEndOfLine "</p>"
#define HTML_C_szBold "<b>"
#define HTML_C_szEndBold "</b>"
#define HTML_C_szItalic "<i>"
#define HTML_C_szEndItalic "</i>"
#define HTML_C_szUnderline "<u>"
#define HTML_C_szEndUnderline "</u>"
#define HTML_C_szBiggerOnce "<font size=+1>"
#define HTML_C_szBiggerTwice "<font size=+2>"
#define HTML_C_szEndBigger "</font>"
#define HTML_C_szLowerOnce "<font size=-1>"
#define HTML_C_szEndLower "</font>"
#define HTML_C_szTable "<table>"
#define HTML_C_szEndTable "</table>"
#define HTML_C_szTableLine "<TR>"
#define HTML_C_szTableLineCenter "<TR ALIGN=CENTER>"
#define HTML_C_szTableLineRight "<TR ALIGN=RIGHT>"
#define HTML_C_szEndTableLine "</TH>"
#define HTML_C_szTableColon "<TD>"
#define HTML_C_szTableColonCenter "<TD ALIGN=CENTER>"
#define HTML_C_szTableColonRight "<TD ALIGN=RIGHT>"
#define HTML_C_szEndTableColon "</TD>"
#define HTML_C_szDrawLine "<HR>"
#define HTML_C_szTab "&nbsp "
#define HTML_C_szTab2 "&nbsp;&nbsp "
#define HTML_C_szTab4 "&nbsp;&nbsp;&nbsp;&nbsp "
#define HTML_C_szTab8 "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp "
#define HTML_C_szJumpToTarget "<A HREF=\"#"
#define HTML_C_szMiddleJump "\">"
#define HTML_C_szEndJump "</A>"
#define HTML_C_szTarget "<A NAME=\""
#define HTML_C_szEndTarget "\"></A>"
#define HTML_C_szBiggerOnceAndBold "<font size=+1><b>"
#define HTML_C_szBiggerTwiceAndBold "<font size=+2><b>"
#define HTML_C_szEndBiggerAndBold "</b></font>"
/****************************************/
/* MMG_fn_vDumpMemory*/
/* Save into a file the list of all the allocated memory*/
/****************************************/
void MMG_fn_vDumpMemory ()
{
tdstTypeMemoryInformation * p;
tdstSubTypeMemoryInformation * q;
long lType , lSubType;
long lMemory , lWastedMemory , lFreedMemory;
long lNumberOfBlock , lNumberOfStructure;
FILE * pFile = fopen (C_szFileNameForMemoryDump , "wt");
if (pFile == NULL)
{
assert (0);
return;
}
fprintf (pFile , "%s%s%s%s%s%s%s\n" , HTML_C_szBeginningOfPage , HTML_C_szDrawLine , HTML_C_szBiggerTwiceAndBold , "MEMORY DUMP" , HTML_C_szEndBiggerAndBold ,
HTML_C_szEndOfLine , HTML_C_szDrawLine);
fprintf (pFile , "Number of types : %s%i%s%s%s\n" , HTML_C_szBiggerOnceAndBold , g_lNumberOfType , HTML_C_szEndBiggerAndBold , HTML_C_szEndOfLine , HTML_C_szEndOfLine);
fprintf (pFile , "%s\n" , HTML_C_szTable);
for (lType = 0 , p = g_a_tdstTypeMemory ; lType < g_lNumberOfType ; lType ++ , p ++)
{
MMG_fn_vComputeSizeForType (lType);
lMemory = p -> lTotalAllocatedMemory;
lWastedMemory = lMemory - p -> lTotalRequestedMemory;
lFreedMemory = p -> lTotalFreedMemory;
lNumberOfBlock = p -> lTotalNumberOfBlock;
lNumberOfStructure = p -> lTotalNumberOfStructure;
fprintf (pFile , "%s%s%s%s%s%i%s\n" ,
HTML_C_szTableLine ,
HTML_C_szTableColon , HTML_C_szLowerOnce , "Type # " , HTML_C_szEndLower , lType , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColon , HTML_C_szJumpToTarget , p -> szTypeName , HTML_C_szMiddleJump , HTML_C_szBiggerOnce , p -> szTypeName , HTML_C_szEndJump ,
HTML_C_szEndBigger , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , HTML_C_szBiggerTwice , LToA (lMemory) , HTML_C_szEndBigger , " bytes allocated" , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerOnce , LToA (lWastedMemory) , HTML_C_szEndBigger , " bytes wasted)" , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "in " , HTML_C_szBiggerOnce , LToA (lNumberOfStructure) , HTML_C_szEndBigger , " structures" , HTML_C_szEndTableColon);
if (lFreedMemory > 0)
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerTwice , LToA (lFreedMemory) , HTML_C_szEndBigger , " bytes freed)" , HTML_C_szEndTableColon);
if (lNumberOfBlock != lNumberOfStructure)
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerOnce , LToA (lNumberOfBlock) , HTML_C_szEndBigger , " blocks)" , HTML_C_szEndTableColon);
else fprintf (pFile , "%s %s\n" , HTML_C_szTableColon , HTML_C_szEndTableColon);
fprintf (pFile , "%s\n" , HTML_C_szEndTableLine);
}
fprintf (pFile , "%s%s\n" , HTML_C_szEndTable , HTML_C_szDrawLine);
for (lType = 0 , p = g_a_tdstTypeMemory ; lType < g_lNumberOfType ; lType ++ , p ++)
{
lMemory = p -> lTotalAllocatedMemory;
lWastedMemory = lMemory - p -> lTotalRequestedMemory;
lNumberOfBlock = p -> lTotalNumberOfBlock;
lNumberOfStructure = p -> lTotalNumberOfStructure;
lFreedMemory = p -> lTotalFreedMemory;
fprintf (pFile , "%s%s%s\n" ,
HTML_C_szTarget , p -> szTypeName , HTML_C_szEndTarget);
fprintf (pFile , "%s%s%i%s%s%s%s%s%s\n" ,
HTML_C_szBiggerTwice , "Type # " , lType , " - " , HTML_C_szBold , p -> szTypeName , HTML_C_szEndBold , HTML_C_szEndBigger , HTML_C_szEndOfLine);
fprintf (pFile , "%s%s%s%s%s%s%s%s%s%s%s%s%s\n" ,
HTML_C_szTab4 , HTML_C_szBiggerTwice , LToA (lMemory) , HTML_C_szEndBigger , " bytes allocated (" , HTML_C_szBiggerOnce , LToA (lWastedMemory) ,
HTML_C_szEndBigger , " bytes wasted) in " , HTML_C_szBiggerOnce , LToA (lNumberOfStructure) , HTML_C_szEndBigger , " structures");
if (lNumberOfBlock != lNumberOfStructure)
fprintf (pFile , "%s%s%s%s%s\n" ,
" (" , HTML_C_szBiggerOnce , LToA (lNumberOfBlock) , HTML_C_szEndBigger , " blocks)");
fprintf (pFile , "%s\n" , HTML_C_szEndOfLine);
fprintf (pFile , "%s%s%s%s%s%s%s%s%s%s\n" ,
HTML_C_szTab4 , "Average size of structure : " , HTML_C_szBiggerOnce , LToA (lMemory / max (lNumberOfStructure , 1)) , HTML_C_szEndBigger ,
" bytes (" , HTML_C_szBiggerOnce , LToA (lWastedMemory / max (lNumberOfStructure , 1)) , HTML_C_szEndBigger , " bytes wasted)");
if (lFreedMemory > 0)
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerTwice , LToA (lFreedMemory) , HTML_C_szEndBigger , " bytes freed)" , HTML_C_szEndTableColon);
if (lNumberOfBlock != lNumberOfStructure)
{
fprintf (pFile , "%s%s%i%s%s%s\n" ,
" - " , HTML_C_szBiggerOnce , lNumberOfBlock / max (lNumberOfStructure , 1) , HTML_C_szEndBigger , " blocks for one structure" , HTML_C_szEndOfLine);
fprintf (pFile , "%s%s%s%s%s%s%s%s%s%s\n" ,
HTML_C_szTab4 , "Average size of block : " , HTML_C_szBiggerOnce , LToA (lMemory / max (lNumberOfBlock , 1)) , HTML_C_szEndBigger ,
" bytes (" , HTML_C_szBiggerOnce , LToA (lWastedMemory / max (lNumberOfBlock , 1)) , HTML_C_szEndBigger , " bytes wasted)");
}
fprintf (pFile , "%s%s%s\n" , HTML_C_szEndOfLine , HTML_C_szTab4 , HTML_C_szTable);
for (lSubType = 0 , q = p -> a_tdstSubTypeMemory ; lSubType < p -> lNumberOfSubType ; lSubType ++ , q ++)
{
lMemory = q -> lTotalAllocatedMemory;
lWastedMemory = lMemory - q -> lTotalRequestedMemory;
lNumberOfBlock = q -> lTotalNumberOfBlock;
lNumberOfStructure = q -> lTotalNumberOfStructure;
lFreedMemory = q -> lTotalFreedMemory;
fprintf (pFile , "%s%s%s%s%s%i%s\n" ,
HTML_C_szTableLine ,
HTML_C_szTableColon , HTML_C_szLowerOnce , "Sub-type # " , HTML_C_szEndLower , lSubType , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s\n" ,
HTML_C_szTableColon , HTML_C_szBiggerOnce , q -> szSubTypeName , HTML_C_szEndBigger , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , HTML_C_szBiggerTwice , LToA (lMemory) , HTML_C_szEndBigger , " bytes allocated" , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerOnce , LToA (lWastedMemory) , HTML_C_szEndBigger , " bytes wasted)" , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "in " , HTML_C_szBiggerOnce , LToA (lNumberOfStructure) , HTML_C_szEndBigger , " structures" , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerOnce , LToA (lMemory / max (lNumberOfStructure , 1)) , HTML_C_szEndBigger , " bytes ave)" , HTML_C_szEndTableColon);
if (lFreedMemory > 0)
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerTwice , LToA (lFreedMemory) , HTML_C_szEndBigger , " bytes freed)" , HTML_C_szEndTableColon);
if (lNumberOfBlock != lNumberOfStructure)
{
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerOnce , LToA (lNumberOfBlock) , HTML_C_szEndBigger , " blocks)" , HTML_C_szEndTableColon);
fprintf (pFile , "%s%s%s%s%s%s%s\n" ,
HTML_C_szTableColonRight , "(" , HTML_C_szBiggerOnce , LToA (lMemory / max (lNumberOfBlock , 1)) , HTML_C_szEndBigger , " bytes ave)" , HTML_C_szEndTableColon);
}
fprintf (pFile , "%s" , HTML_C_szEndTableLine);
/*??? fprintf (pFile , " Average size of block : %s bytes (%s bytes wasted)\n" , LToA (lMemory / lNumberOfBlock) , LToA (lWastedMemory / lNumberOfBlock));*/
}
fprintf (pFile , "%s%s\n" , HTML_C_szEndTable , HTML_C_szDrawLine);
}
fprintf (pFile , HTML_C_szEndOfPage);
fclose (pFile);
}
/****************************************/
/* MMG_fn_vClearMemoryRaster*/
/* Set all counters to zero*/
/****************************************/
void MMG_fn_vClearMemoryRaster (void)
{
int i , j;
tdstTypeMemoryInformation * p;
tdstSubTypeMemoryInformation * q;
p = g_a_tdstTypeMemory;
for (i = 0 ; i < g_lNumberOfType ; i ++ , p ++)
{
p -> lTotalNumberOfBlock = 0;
p -> lTotalNumberOfStructure = 0;
p -> lTotalRequestedMemory = 0;
p -> lTotalAllocatedMemory = 0;
p -> lTotalFreedMemory = 0;
q = p -> a_tdstSubTypeMemory;
for (j = 0 ; j < p -> lNumberOfSubType ; j ++ , q ++)
{
q -> lTotalNumberOfBlock = 0;
q -> lTotalNumberOfStructure = 0;
q -> lTotalRequestedMemory = 0;
q -> lTotalAllocatedMemory = 0;
q -> lTotalFreedMemory = 0;
q -> lMemoryChannel = -1;
q -> lNumberOfUsedObject = 0;
}
}
}
#else /* #ifdef USE_PROFILER*/
void MMG_fn_vInitMemoryRasterDeclaration(void){} /* Called once when the first memory block is allocated*/
void MMG_fn_vDesinitMemoryRasterDeclaration (void){} /* Called once at the end of the program*/
void MMG_fn_vInitMemoryRaster (long _lNumberOfType){} /* Must be called once at the beginning of the game*/
void MMG_fn_vInitTypeForMemoryRaster (long _lType , char * _szTypeName , long _lNumberOfSubType){}
void MMG_fn_vInitSubTypeForMemoryRaster (long _lType , long _lSubType , char * _szSubTypeName , long _lNumberOfObject){}
void MMG_fn_vAddMemoryInfo (long _lType , long _lSubType , void * _p_vObject){} /* Must be called before making a memory allocation*/
void MMG_fn_vBeginMemoryInfo (long _lType , long _lSubType , void * _p_vObject){} /* Must be called before making several memory allocations. Then one must call the MMG_fn_vEndMemoryInfo function*/
void MMG_fn_vEndMemoryInfo (){} /* Must be called after calling the MMG_fn_vBeginMemoryInfo and making memory allocations*/
void MMG_fn_vRegisterMemoryAllocation (long _lChannelNumber , long _lRequestedSize){}/* This function is called only by the fn_p_vGenAlloc function*/
void MMG_fn_vRegisterMemoryFree (long _lChannelNumber , void * _p_vBlock){} /* This function is called only by the fn_p_vGenFree function*/
void MMG_fn_vDumpMemory (){} /* Save all memory informations into a dump file*/
void MMG_fn_vClearMemoryRaster (){}
#endif /* #ifdef USE_PROFILER*/

View File

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