/* ***********************************************************************************/
/* * "a3x_mem.c"																	**/
/* * Written by :	Sébastien Rubens												**/
/* * Tabulations :	4 char															**/
/* ***********************************************************************************/
#define A3X_MEM_C
 
/* ***********************************************************************************/
/*																	Included files*/
 
#include <stdlib.h>
 
#include "PlayAnim/Interpol/specif/a3x_pref.h"
 
/*#define LST2_StaticIsOptimised*/
#include "TOOLSCPA.h"
#include "cpa_std.h"
#include "STRUCTUR/Anim_s.h"
 
#include "STRUCTUR/ErrGame.h"
#include "PlayAnim/Interpol/a3x_glob.h"
#include "PlayAnim/Interpol/a3x_cach.h"
#include "PlayAnim/Interpol/a3x_int.h"
#include "PlayAnim/Interpol/a3x_mem.h"
#include "zemem.h"
 
#ifndef U64
#include "SNA\snaglob.h"
#endif
 
#ifndef RETAIL
#include "STRUCTUR/GameScpt.h"
#endif
/* ***********************************************************************************/
/*																			Defines*/
 
/*#ifndef	A3X_CacheIsUsed*/
/*#ifndef U64
#define	MaxInTabA3dGENERAL			1500
#define	MaxInTabVertexes			60000
#define	MaxInTabQuaternions			60000
#define	MaxInTabHierarchies			5000
#define	MaxInTabNTTO				10000
#define	MaxInTabOnlyFrames			30000
#define	MaxInTabChannels			30000
#define	MaxInTabFrames				40000
#define	MaxInTabFramesKF			140000
#define	MaxInTabKeyFrames			65500
#define	MaxInTabEvents				5000
#define MaxInTabMorphData			30000
#define	MaxInTabCuttedAnim			3000
#define MaxInTabHandleElement3d		1000
#else*/
#ifdef U64
#define	MaxInTabA3dGENERAL			1500
#define	MaxInTabVertexes			30000
#define	MaxInTabQuaternions			20000
#define	MaxInTabHierarchies			5000
#define	MaxInTabNTTO				10000
#define	MaxInTabOnlyFrames			15000
#define	MaxInTabChannels			10000
#define	MaxInTabFrames				33000
#define	MaxInTabFramesKF			80000
#define	MaxInTabKeyFrames			30000
#define	MaxInTabEvents				5000
#define MaxInTabMorphData			5000
#define	MaxInTabCuttedAnim			3000
#define MaxInTabHandleElement3d		1000
#endif /*U64*/
/*#else
#define	MaxInTabA3dGENERAL		1
#define	MaxInTabVertexes		1
#define	MaxInTabQuaternions		1
#define	MaxInTabHierarchies		1
#define	MaxInTabNTTO			1
#define	MaxInTabOnlyFrames		1
#define	MaxInTabChannels		1
#define	MaxInTabFrames			1
#define	MaxInTabFramesKF		1
#define	MaxInTabKeyFrames		1
#define	MaxInTabEvents			1
#define	MaxInTabMorphData		1
#define	MaxInTabCuttedAnim		1
#define MaxInTabHandleElement3d		1
// Output cache
#define	uwMaxInTabFrame3d			100
#define uwMaxInTabElement3d			1000
#endif */
 
 
/* ***********************************************************************************/
/*																	Globals datas*/
 
tdstStackInfos	tdstStacks[eStackNbMax]=
{
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 },
	{	0,	0,	0, 0 }
};
 
#ifdef	A3X_StaticTables
tdstA3dGENERAL				ax_stA3dGENERAL			[MaxInTabA3dGENERAL];
tdxVector3					axa3_xVectors			[MaxInTabVertexes];
tdxSShortQuater4			axa4_xQuaternions		[MaxInTabQuaternions];
tdstHierarchy				ax_stHierarchies		[MaxInTabHierarchies];
tdstNTTO					ax_stNTTO				[MaxInTabNTTO];
tdstOnlyFrame				ax_stOnlyFrames			[MaxInTabOnlyFrames];
tdstChannel					ax_stChannels			[MaxInTabChannels];
tdstFrame					ax_stFrames				[MaxInTabFrames];
tdstFrameKF					ax_stFramesKF			[MaxInTabFramesKF];
tdstKeyFrame				ax_stKeyFrames			[MaxInTabKeyFrames];
tdstEvent					ax_stEvents				[MaxInTabEvents];
tdstMorphData				ax_stMorphData			[MaxInTabMorphData];
 
tdstCuttedAnim				ax_stCuttedAnim			[MaxInTabCuttedAnim];
#endif
 
tdstA3dGENERAL				*p_stA3dGENERAL;
tdxVector3					*p_a3_xVectors;
tdxSShortQuater4			*p_a4_xQuaternions;
tdstHierarchy				*p_stHierarchies;
tdstNTTO					*p_stNTTO;
tdstOnlyFrame				*p_stOnlyFrames;
tdstChannel					*p_stChannels;
tdstFrame					*p_stFrames;
tdstFrameKF					*p_stFramesKF;
tdstKeyFrame				*p_stKeyFrames;
tdstEvent					*p_stEvents;
tdstMorphData				*p_stMorphData; /*AR9803*/
 
tdstCuttedAnim				*p_stCuttedAnim;
 
/* ***********************************************************************************/
 
 

#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 07/06/99 */
unsigned long	fn_ul_GetStackAlloc(	unsigned short	_uwNumStack )
{
	return	(tdstStacks[_uwNumStack].ulPosAlloc);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 07/06/99 */

 
 
 
 
 
/* ***********************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned long	fn_ul_GetStackPos(		unsigned short	_uwNumStack )
{
	return	(tdstStacks[_uwNumStack].ulStackPos);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
 
 
/* ***********************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void	fn_v_AllocateOnStack(	unsigned short	_uwNumStack,
								unsigned short	_uwWantedSize )
{
#ifndef	A3X_CacheIsUsed /*AR9807*/
	if ((tdstStacks[_uwNumStack].ulStackPos+_uwWantedSize)>tdstStacks[_uwNumStack].ulMaxPos) {
		char szMessage[50];
		sprintf(szMessage,"Stack %d exceed maximum elements(%d), change it in Game.dsc",_uwNumStack,tdstStacks[_uwNumStack].ulMaxPos);
		Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
			C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage);
	}
#endif
	tdstStacks[_uwNumStack].ulStackPos+=	_uwWantedSize;
 
	tdstStacks[_uwNumStack].ulPosAlloc=	tdstStacks[_uwNumStack].ulStackPos - _uwWantedSize;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
 
 
/* ***********************************************************************************/
unsigned long 	fn_ul_AllocateOnStack(	unsigned short	_uwNumStack,
										unsigned short	_uwWantedSize )
{
#ifndef	A3X_CacheIsUsed /*AR9807*/
#ifndef U64
	if ((tdstStacks[_uwNumStack].ulStackPos+_uwWantedSize)>tdstStacks[_uwNumStack].ulMaxPos) {
		char szMessage[50];
		sprintf(szMessage,"Stack %d exceed maximum elements(%d), change it in Game.dsc",_uwNumStack,tdstStacks[_uwNumStack].ulMaxPos);
		Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
			C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage);
	}
#else
	if((tdstStacks[_uwNumStack].ulStackPos+_uwWantedSize)>=tdstStacks[_uwNumStack].ulMaxPos)
		osSyncPrintf("No enough place in stack %d (%d)\n",_uwNumStack,_uwWantedSize);
#endif
#endif
	tdstStacks[_uwNumStack].ulStackPos+=	_uwWantedSize;
 
	tdstStacks[_uwNumStack].ulPosAlloc=	tdstStacks[_uwNumStack].ulStackPos - _uwWantedSize;
	return	tdstStacks[_uwNumStack].ulPosAlloc;
}
 
 
 
/* ***********************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void	fn_v_DeAllocateOnStack(	unsigned short	_uwNumStack,
								unsigned short	_uwSize )
{
	tdstStacks[_uwNumStack].ulStackPos-=	_uwSize;
 
	assert(tdstStacks[_uwNumStack].ulStackPos >= 0);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
 
 
/* ************************************************** fn_v_UnclearPreviousLoadedAnims*/
/*	Allow to keep the N First Anims when clear*/
/*	Must be call after loading the N anims*/
/*	03/07/98 Carlos Torres*/
/* ***********************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_UnclearPreviousLoadedAnims( void ) {
	unsigned short	uwCnt;
 
	for	( uwCnt=0 ; uwCnt<eStackNbMax ; uwCnt++ )
		tdstStacks[uwCnt].ulResetPos=tdstStacks[uwCnt].ulStackPos;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
 
/* ************************************************************ fn_v_ClearLoadedAnims*/
/*	Clear Loaded Anims depending on parameter ucClearAll*/
/*		False : Until the position set by fn_v_UnclearPreviousLoadedAnims*/
/*		True : ALL anims*/
/*	03/07/98 Carlos Torres*/
/* ***********************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_ClearLoadedAnims(unsigned char ucClearAll) {
	unsigned short	uwCnt;
 
	for	( uwCnt=0 ; uwCnt<eStackNbMax ; uwCnt++ ) {
		if (ucClearAll)
			tdstStacks[uwCnt].ulResetPos=0;
		M_v_ResetOneStack(uwCnt);
	}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
 
 
/* **************************************************************** fn_v_InitInterpol*/
/*	Make allocation and init structure for anim management*/
/*	Must be called only once*/
/**/
/*	03/07/98 Carlos Torres*/
/*  17/07/98 : Erase table of Frame and table of Element3d*/
/* ***********************************************************************************/
void fn_v_InitInterpol( void ) 
{
#ifdef U64
#ifndef FORCE_REAL_TIME_LOAD
	fn_vInitROMLoad(); /* To initialise the animation loading system*/
#endif
#endif /*U64*/
	
#ifndef FORCE_REAL_TIME_LOAD
	if(!g_bRealTimeAnimationLoad)
	{
#ifdef	A3X_StaticTables
		p_stA3dGENERAL=			ax_stA3dGENERAL;
		p_a3_xVectors=			axa3_xVectors;
		p_a4_xQuaternions=		axa4_xQuaternions;
		p_stHierarchies=		ax_stHierarchies;
		p_stNTTO=				ax_stNTTO;
		p_stOnlyFrames=			ax_stOnlyFrames;
		p_stChannels=			ax_stChannels;
		p_stFrames=				ax_stFrames;
		p_stFramesKF=			ax_stFramesKF;
		p_stKeyFrames=			ax_stKeyFrames;
		p_stEvents=				ax_stEvents;
		p_stMorphData=			ax_stMorphData;
		
		p_stCuttedAnim=			ax_stCuttedAnim;
#else
#ifndef A3X_N64
		if (SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT)
#endif
		{
			
			unsigned char ucOldACPModeMalloc;
			
			ucOldACPModeMalloc = GEO_M_ucGetMemMallocMode();
			GEO_xSelectMemoryChannel(ACP_FixMemoryChannel);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeA3dGENERAL , 0 );
#ifndef U64
			/* check if all stack size is set*/
			{
				unsigned short uwCnt;
				for	( uwCnt=0 ; uwCnt<eStackNbMax ; uwCnt++ ) {
					if (!tdstStacks[uwCnt].ulMaxPos) {
						char szMessage[50];
						sprintf(szMessage,"To Load Animation All stacks must be sized, correct Game.dsc for stack %d",uwCnt);
						Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
							C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage);
					}
				}
			}
 
			GEO_M_CPAMalloc(p_stA3dGENERAL,		tdstA3dGENERAL *		, tdstStacks[eStackA3dGENERAL].ulMaxPos * sizeof(tdstA3dGENERAL)		, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeVectors , 0 );
			GEO_M_CPAMalloc(p_a3_xVectors,		tdxVector3 *			, tdstStacks[eStackVertexes].ulMaxPos * sizeof(tdxVector3)				, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeQuaternions , 0 );
			GEO_M_CPAMalloc(p_a4_xQuaternions,	tdxSShortQuater4 *	, tdstStacks[eStackQuaternions].ulMaxPos * sizeof(tdxSShortQuater4)	, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeHierarchies , 0 );
			GEO_M_CPAMalloc(p_stHierarchies,	tdstHierarchy *		, tdstStacks[eStackHierarchies].ulMaxPos * sizeof(tdstHierarchy)		, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeNTTO , 0 );
			GEO_M_CPAMalloc(p_stNTTO,			tdstNTTO *			, tdstStacks[eStackNTTO].ulMaxPos * sizeof(tdstNTTO)					, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeOnlyFrames , 0 );
			GEO_M_CPAMalloc(p_stOnlyFrames,		tdstOnlyFrame *		, tdstStacks[eStackOnlyFrames].ulMaxPos * sizeof(tdstOnlyFrame)		, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeChannels , 0 );
			GEO_M_CPAMalloc(p_stChannels,		tdstChannel *			, tdstStacks[eStackChannels].ulMaxPos * sizeof(tdstChannel)			, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeFrames , 0 );
			GEO_M_CPAMalloc(p_stFrames,			tdstFrame *			, tdstStacks[eStackFrames].ulMaxPos * sizeof(tdstFrame)				, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeFramesKF , 0 );
			GEO_M_CPAMalloc(p_stFramesKF,		tdstFrameKF *			, tdstStacks[eStackFramesKF].ulMaxPos * sizeof(tdstFrameKF)			, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeKeyFrames , 0 );
			GEO_M_CPAMalloc(p_stKeyFrames,		tdstKeyFrame *		, tdstStacks[eStackKeyFrames].ulMaxPos * sizeof(tdstKeyFrame)			, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeEvents , 0 );
			GEO_M_CPAMalloc(p_stEvents,			tdstEvent *			, tdstStacks[eStackEvents].ulMaxPos * sizeof(tdstEvent)				, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeMorphData , 0 );
			GEO_M_CPAMalloc(p_stMorphData,		tdstMorphData *		, tdstStacks[eStackMorphData].ulMaxPos * sizeof(tdstMorphData)			, E_uwGEONotEnoughtMemory);
#else /* U64 */
			GEO_M_CPAMalloc(p_stA3dGENERAL,		tdstA3dGENERAL *		, MaxInTabA3dGENERAL * sizeof(tdstA3dGENERAL)		, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeVectors , 0 );
			GEO_M_CPAMalloc(p_a3_xVectors,		tdxVector3 *			, MaxInTabVertexes * sizeof(tdxVector3)				, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeQuaternions , 0 );
			GEO_M_CPAMalloc(p_a4_xQuaternions,	tdxSShortQuater4 *	, MaxInTabQuaternions * sizeof(tdxSShortQuater4)	, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeHierarchies , 0 );
			GEO_M_CPAMalloc(p_stHierarchies,	tdstHierarchy *		, MaxInTabHierarchies * sizeof(tdstHierarchy)		, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeNTTO , 0 );
			GEO_M_CPAMalloc(p_stNTTO,			tdstNTTO *			, MaxInTabNTTO * sizeof(tdstNTTO)					, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeOnlyFrames , 0 );
			GEO_M_CPAMalloc(p_stOnlyFrames,		tdstOnlyFrame *		, MaxInTabOnlyFrames * sizeof(tdstOnlyFrame)		, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeChannels , 0 );
			GEO_M_CPAMalloc(p_stChannels,		tdstChannel *			, MaxInTabChannels * sizeof(tdstChannel)			, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeFrames , 0 );
			GEO_M_CPAMalloc(p_stFrames,			tdstFrame *			, MaxInTabFrames * sizeof(tdstFrame)				, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeFramesKF , 0 );
			GEO_M_CPAMalloc(p_stFramesKF,		tdstFrameKF *			, MaxInTabFramesKF * sizeof(tdstFrameKF)			, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeKeyFrames , 0 );
			GEO_M_CPAMalloc(p_stKeyFrames,		tdstKeyFrame *		, MaxInTabKeyFrames * sizeof(tdstKeyFrame)			, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeEvents , 0 );
			GEO_M_CPAMalloc(p_stEvents,			tdstEvent *			, MaxInTabEvents * sizeof(tdstEvent)				, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeMorphData , 0 );
			GEO_M_CPAMalloc(p_stMorphData,		tdstMorphData *		, MaxInTabMorphData * sizeof(tdstMorphData)			, E_uwGEONotEnoughtMemory);
			MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeSpeedCuttedAnim, 0 );
			GEO_M_CPAMalloc(p_stCuttedAnim,		tdstCuttedAnim *		, MaxInTabCuttedAnim * sizeof(tdstCuttedAnim)		, E_uwGEONotEnoughtMemory);
#endif /* U64 */
			GEO_xSelectMemoryChannel(ucOldACPModeMalloc);
		}
#endif /*A3X_StaticTables*/
	}
#endif
#ifdef U64
#ifndef FORCE_REAL_TIME_LOAD
	else
#endif
		fn_v_InitCache();
#endif
	
	fn_v_InitSinTab();
}
 
 
/* ***************************************************************** fn_vSetStackSize*/
/*	Set the stack size */
/*	Must be called only once for all stack to configure it*/
/**/
/*	27/10/98 Carlos Torres*/
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetStackSize(unsigned short uwNumStack,unsigned long ulSize) {
	/* change only if is not previously set*/
	if (!tdstStacks[uwNumStack].ulMaxPos)
		tdstStacks[uwNumStack].ulMaxPos = ulSize;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
#if !defined(RETAIL) && !defined(U64)
/* ***************************************************************** fn_vAnimStackLog*/
/*	Make a log of Memory used for each stack in an open file*/
/**/
/*	11/12/98 Carlos Torres*/
/* ***********************************************************************************/
void fn_vAnimStackLog(FILE * fLogFile) {
	unsigned short uwCnt;
	unsigned long ulMemFix=0,ulMemGlob=0;
	struct {
		char szName[16];
		unsigned long ulSize;
	} stStackData[eStackNbMax] = {
		C_Entry_A3dGeneral,sizeof(tdstA3dGENERAL),
		C_Entry_Vertexes,sizeof(tdxVector3),
		C_Entry_Quaternions,sizeof(tdxSShortQuater4),
		C_Entry_Hierarchies,sizeof(tdstHierarchy),
		C_Entry_NTTO,sizeof(tdstNTTO),
		C_Entry_OnlyFrames,sizeof(tdstOnlyFrame),
		C_Entry_Channels,sizeof(tdstChannel),
		C_Entry_Frames,sizeof(tdstFrame),
		C_Entry_FramesKF,sizeof(tdstFrameKF),
		C_Entry_KeyFrames,sizeof(tdstKeyFrame),
		C_Entry_Events,sizeof(tdstEvent),
		C_Entry_MorphData,sizeof(tdstMorphData)
	};
 
	if (!fLogFile)
		return;
 
	fprintf (fLogFile,"\tStack Name\tFix Nb:  FixMem  \tLvl Nb:  Lvl Mem  \tTot Nb( Max. ):  Tot Mem \n");
 
	/* log for each stack*/
	for	(uwCnt=0 ; uwCnt<eStackNbMax ; uwCnt++) {
		fprintf (fLogFile,"\t%10s\t%6d:%8do\t%6d:%8do\t%6d(%6d):%8do\n",
			stStackData[uwCnt].szName,
			tdstStacks[uwCnt].ulResetPos,tdstStacks[uwCnt].ulResetPos*stStackData[uwCnt].ulSize,
			tdstStacks[uwCnt].ulStackPos-tdstStacks[uwCnt].ulResetPos,
			(tdstStacks[uwCnt].ulStackPos-tdstStacks[uwCnt].ulResetPos)*stStackData[uwCnt].ulSize,
			tdstStacks[uwCnt].ulStackPos,
			tdstStacks[uwCnt].ulMaxPos,
			tdstStacks[uwCnt].ulStackPos*stStackData[uwCnt].ulSize);
		ulMemFix += tdstStacks[uwCnt].ulResetPos*stStackData[uwCnt].ulSize;
		ulMemGlob += tdstStacks[uwCnt].ulStackPos*stStackData[uwCnt].ulSize;
	}
 
	/* Total*/
	fprintf(fLogFile,"\t---------------------------------------------------------------------------------\n");
	fprintf (fLogFile,"\tTotal     \t       %8do\t       %8do\t               %8do\n\n",
		ulMemFix,ulMemGlob-ulMemFix,ulMemGlob);
}
#endif /* RETAIL */
 
/* ***********************************************************************************/
#undef	A3X_MEM_C
