587 lines
22 KiB
C
587 lines
22 KiB
C
/* ##C_FILE#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
FILE : CpaError.c
|
|
|
|
DESCRIPTION : Main functions of the ERM module
|
|
|
|
VERSION : 1.00/Pierrick Crepy/ Creation
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
|
/* ##INCLUDE#----------------------------------------------------------------------------
|
|
Includes Files
|
|
---------------------------------------------------------------------------------------*/
|
|
#ifdef U64
|
|
#ifndef FINAL_VERSION
|
|
#include "ultra.h"
|
|
#include "GLD/Specif/DisplMsg.h"
|
|
extern CPA_EXPORT unsigned char GAM_fn_bIsEngineInLevelMode(void);
|
|
#endif /* FINAL_VERSION */
|
|
#endif/*U64*/
|
|
#ifdef WIN32
|
|
#include <Windows.h>
|
|
#endif
|
|
#define __DeclareGlobalVariableInCpaError_h__
|
|
#include "Erm/CpaError.h"
|
|
#undef __DeclareGlobalVariableInCpaError_h__
|
|
#include "PrivErm.h"
|
|
|
|
#ifdef PSX
|
|
|
|
#include "PSX.h"
|
|
#include "Erm.h"
|
|
#include "PSX\Erm_PSX.h"
|
|
|
|
#endif /* PSX */
|
|
|
|
|
|
|
|
|
|
void (*p_fn_ExitAppliCallBack)() = NULL;
|
|
|
|
/* ##FUNCDEF#----------------------------------------------------------------------------
|
|
Functions definition
|
|
---------------------------------------------------------------------------------------*/
|
|
|
|
/* ##F===================================================================================
|
|
NAME : Erm_fn_vSetCallBackForExit
|
|
DESCRIPTION : Set the call back use before exit after an error occur
|
|
INPUT : Pointer on the callback
|
|
=========================================================================================
|
|
CREATION : Carlos Torres 12/01/98
|
|
=======================================================================================*/
|
|
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
void Erm_fn_vSetCallBackForExit(void (*_p_fn_ExitAppliCallBack)())
|
|
{
|
|
p_fn_ExitAppliCallBack = _p_fn_ExitAppliCallBack;
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|
|
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_ucInitErrMsg
|
|
DESCRIPTION : Init error Message
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
#ifdef __ERROR_STRINGS__
|
|
unsigned char Erm_fn_ucInitErrMsg (char ** a_szModuleName, struct tdstErrorMsg_ * a_stTabErr)
|
|
#else /* no ERROR_STRINGS */
|
|
unsigned char Erm_fn_ucInitErrMsg ()
|
|
#endif/* __ERROR_STRINGS__*/
|
|
{
|
|
#if defined(__MULTI_THREAD_ERROR_MANAGEMENT__) || defined(__ERROR_STRINGS__)
|
|
unsigned char ucI;
|
|
#endif /*if defined(__MULTI_THREAD_ERROR_MANAGEMENT__) || defined(__ERROR_STRINGS__)*/
|
|
|
|
#ifdef __FATAL_ERR_ERM__
|
|
if (g_ucErmNbOfModule == C_ucNbOfMaxModule)
|
|
Erm_M_UpdateLastError(Erm, C_ucErmDefaultChannel, E_uwErmTooManyModulesErr, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);
|
|
#endif /*__FATAL_ERR_ERM__*/
|
|
#ifdef __ERROR_STRINGS__
|
|
g_a_a_szErmModuleInformationTab [g_ucErmNbOfModule] = a_szModuleName;
|
|
g_a_p_stErmGeneralTabErr[g_ucErmNbOfModule] = a_stTabErr;
|
|
#endif/* __ERROR_STRINGS__*/
|
|
if (g_ucErmNbOfModule == 0)
|
|
{
|
|
#ifdef __MULTI_THREAD_ERROR_MANAGEMENT__
|
|
{
|
|
/*Channel init */
|
|
for (ucI=0; ucI<C_ucErmNbOfErrorChannel; ucI++)
|
|
{
|
|
g_stErmTheLastErrorInfo[ucI].uwLastErr = C_uwErmNoErr;
|
|
g_stErmTheLastErrorInfo[ucI].ulChannelId = C_ucErmDefaultChannel;
|
|
}
|
|
}
|
|
#else /* not __MULTI_THREAD_ERROR_MANAGEMENT__*/
|
|
g_stErmTheLastErrorInfo.uwLastErr = C_uwErmNoErr;
|
|
#endif/*__MULTI_THREAD_ERROR_MANAGEMENT__*/
|
|
#ifdef __LOG_FILE_ERROR__
|
|
Erm_fn_v_ClearLogFile();
|
|
#endif /*__LOG_FILE_ERROR__*/
|
|
}
|
|
#ifdef __LOG_FILE_ERROR__
|
|
{
|
|
char szTxt[C_ucSizeOfErrTxt];
|
|
sprintf (szTxt,"\t\\->\tThe module : [");
|
|
Erm_M_GetModuleInformation(szTxt+strlen(szTxt), g_ucErmNbOfModule);
|
|
sprintf (szTxt+strlen(szTxt), "] is initialized with the id #%d", g_ucErmNbOfModule);
|
|
Erm_fn_v_PrintErrMsg("Just for information\n", szTxt);
|
|
}
|
|
#endif /*__LOG_FILE_ERROR__*/
|
|
return (g_ucErmNbOfModule++);
|
|
}/*Erm_fn_ucInitErrMsg*/
|
|
|
|
|
|
#ifdef __ERROR_STRINGS__
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_szGetLastErrorString
|
|
DESCRIPTION : Get last error string
|
|
INPUT : one structure Last error info
|
|
OUTPUT : Error string
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
char *Erm_fn_szGetLastErrorString (struct tdstLastErrorInfo_ *stMyLastErrorInfo)
|
|
{
|
|
unsigned short uwI;
|
|
static char szErrTxt[C_ucSizeOfErrTxt];
|
|
|
|
for ( uwI=0;
|
|
g_a_p_stErmGeneralTabErr [stMyLastErrorInfo->ucLastFailedModuleId][uwI].uwErrorId != stMyLastErrorInfo->uwLastErr;
|
|
uwI++);/*lint !e722*/
|
|
|
|
#ifdef __MULTI_THREAD_ERROR_MANAGEMENT__
|
|
sprintf(szErrTxt,"Channel Error: %d (0x%x)\nFrom %s: '%s' of %s,\nin the source file '%s' (line:%d):\n\n-> \"%s\" <-\n",
|
|
stMyLastErrorInfo->ulChannelId,stMyLastErrorInfo->ulChannelId,
|
|
g_a_a_szErmModuleInformationTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmVersionAccessId],
|
|
g_a_a_szErmModuleInformationTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmFullNameAccessId],
|
|
g_a_a_szErmModuleInformationTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmDateAccessId],
|
|
stMyLastErrorInfo->szLastErrFileName, stMyLastErrorInfo->uwLastErrLineNumber,
|
|
g_a_p_stErmGeneralTabErr [stMyLastErrorInfo->ucLastFailedModuleId][uwI].szErrorText);
|
|
#else /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
|
|
sprintf(szErrTxt,"\nFrom %s: '%s' of %s,\nin the source file '%s' (line:%d):\n\n-> \"%s\" <-\n",
|
|
g_a_szErmModuleNameTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmVersionAccessId],
|
|
g_a_szErmModuleNameTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmFullNameAccessId],
|
|
g_a_szErmModuleNameTab[stMyLastErrorInfo->ucLastFailedModuleId][C_ucErmDateAccessId],
|
|
stMyLastErrorInfo->szLastErrFileName, stMyLastErrorInfo->uwLastErrLineNumber,
|
|
g_a_p_stErmGeneralTabErr [stMyLastErrorInfo->ucLastFailedModuleId][uwI].szErrorText);
|
|
#endif /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
|
|
|
|
Erm_M_CheckLenOfTxtWithoutUpdate (szErrTxt);
|
|
|
|
return (szErrTxt);
|
|
}/* Erm_fn_szGetLastErrorString */
|
|
#endif /*__ERROR_STRINGS__*/
|
|
|
|
|
|
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_uwCheckError
|
|
DESCRIPTION : Check error
|
|
INPUT : Module Id
|
|
Channel Id
|
|
OUTPUT : Last error info
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
unsigned short Erm_fn_uwCheckError(unsigned char ucModuleId, unsigned long ulChannelId)
|
|
{
|
|
#ifdef __MULTI_THREAD_ERROR_MANAGEMENT__
|
|
unsigned char ucI;
|
|
for (ucI=0;
|
|
( ucI < C_ucErmNbOfErrorChannel)&&
|
|
(g_stErmTheLastErrorInfo[ucI].uwLastErr != C_uwErmNoErr) &&
|
|
(g_stErmTheLastErrorInfo[ucI].ulChannelId != ulChannelId);
|
|
ucI++){};/*lint !e722*/
|
|
|
|
if (ucI >= C_ucErmNbOfErrorChannel)
|
|
return C_uwErmNoErr;
|
|
else
|
|
{
|
|
if ((g_stErmTheLastErrorInfo[ucI].ulChannelId == ulChannelId) &&
|
|
(g_stErmTheLastErrorInfo[ucI].uwLastErr !=C_uwErmNoErr) &&
|
|
(g_stErmTheLastErrorInfo[ucI].ucLastFailedModuleId != ucModuleId))
|
|
{
|
|
char szTxt[C_ucSizeOfErrTxt];
|
|
#ifdef __ERROR_STRINGS__
|
|
sprintf (szTxt, "Strange!\nThe Erm_fn_uwCheckError macro is called for the specific Module (%s),\nbut the last error does not come from this module.", g_a_a_szErmModuleInformationTab[ucModuleId][C_ucErmFullNameAccessId]);
|
|
#endif /*__ERROR_STRINGS__*/
|
|
Erm_M_CheckLenOfTxt (szTxt);
|
|
Erm_fn_v_PrintErrMsg(szTxt,"");
|
|
Erm_M_PrintInfoWindow(szTxt,"");
|
|
}
|
|
return g_stErmTheLastErrorInfo[ucI].uwLastErr;
|
|
}
|
|
#else /* not __MULTI_THREAD_ERROR_MANAGEMENT__*/
|
|
if ((g_stErmTheLastErrorInfo.uwLastErr !=C_uwErmNoErr) && (g_stErmTheLastErrorInfo.ucLastFailedModuleId != ucModuleId))
|
|
{
|
|
char szTxt[C_ucSizeOfErrTxt];
|
|
#ifdef __ERROR_STRINGS__
|
|
sprintf (szTxt, "Strange!\nThe Erm_fn_uwCheckError macro is called for the specific Module (%s),\nbut the last error does not come from this module.", g_a_a_szErmModuleNameTab[ucModuleId][C_ucErmFullNameAccessId]);
|
|
#else /*__ERROR_STRINGS__*/
|
|
sprintf (szTxt, "Strange!\nThe Erm_fn_uwCheckError macro is called for the specific Module,\nbut the last error does not come from this module.");
|
|
#endif /*__ERROR_STRINGS__*/
|
|
Erm_M_CheckLenOfTxt (szTxt);
|
|
Erm_fn_v_PrintErrMsg(szTxt,"");
|
|
Erm_M_PrintInfoWindow(szTxt,"");
|
|
}
|
|
return (g_stErmTheLastErrorInfo.uwLastErr);
|
|
#endif /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
|
|
}/*Erm_fn_uwCheckError*//*lint !e715: ulChannelId (line 94) not referenced*/
|
|
|
|
|
|
|
|
|
|
#ifdef __MULTI_THREAD_ERROR_MANAGEMENT__
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_p_stFindstMyLastErrorInfo
|
|
DESCRIPTION : Find structure ladt error info
|
|
INPUT : Channel Id
|
|
OUTPUT : Last error info structure
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
tdstLastErrorInfo *Erm_fn_p_stFindstMyLastErrorInfo(unsigned long ulChannelId)
|
|
{
|
|
unsigned char ucI;
|
|
for ( ucI=0;
|
|
( ucI < C_ucErmNbOfErrorChannel)&&
|
|
(g_stErmTheLastErrorInfo[ucI].uwLastErr != C_uwErmNoErr) &&
|
|
(g_stErmTheLastErrorInfo[ucI].ulChannelId != ulChannelId);
|
|
ucI++){};/*lint !e722*/
|
|
|
|
if (ucI >= C_ucErmNbOfErrorChannel)
|
|
{
|
|
/* there is no error for this Channel but, there is no more space for an other error. */
|
|
return NULL;
|
|
}
|
|
else
|
|
{
|
|
/*
|
|
here, we have :
|
|
- g_stErmTheLastErrorInfo[ucI].ulChannelId = ulChannel I.e. there is already an error for the Channel
|
|
Or
|
|
- g_stErmTheLastErrorInfo[ucI].ulChannelId != ulChannel and g_stErmTheLastErrorInfo[ucI] is the last error (!= C_uwErmNoErr)
|
|
*/
|
|
return g_stErmTheLastErrorInfo+ucI;
|
|
}
|
|
}/*Erm_fn_p_stFindstMyLastErrorInfo*/
|
|
#endif /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
|
|
|
|
|
|
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_ClearLastError
|
|
DESCRIPTION : Clear last error
|
|
INPUT : Channel Id
|
|
File Name
|
|
Line Number
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
/* Oliv' */
|
|
#ifndef U64
|
|
void Erm_fn_ClearLastError(unsigned long ulChannelId, char * p_cFileName, unsigned short uwLineNumber)
|
|
#else /* U64 */
|
|
void Erm_fn_ClearLastError(unsigned long ulChannelId)
|
|
#endif /* U64 */
|
|
#ifndef __MULTI_THREAD_ERROR_MANAGEMENT__
|
|
{
|
|
tdstLastErrorInfo *p_stMyLastErrorInfo;
|
|
|
|
p_stMyLastErrorInfo = Erm_M_p_stFindstMyLastErrorInfo(ulMyChannelId);
|
|
if ((p_stMyLastErrorInfo != NULL) && (p_stMyLastErrorInfo->uwLastErr != C_uwErmNoErr))
|
|
{
|
|
p_stMyLastErrorInfo->uwLastErr = C_uwErmNoErr;
|
|
Erm_M_AffectUlChannelId(p_stMyLastErrorInfo->ulChannelId, C_ucErmDefaultChannel);
|
|
Erm_fn_v_PrintErrMsg("Explicit request for clear of the last error","");
|
|
/*Erm_M_PrintTraceClearWindow();*/
|
|
}
|
|
else
|
|
{
|
|
Erm_M_PrintTraceUnUsefullClearWindow();
|
|
Erm_fn_v_PrintErrMsg("Explicit request for clear of the last error.\nBut there is no error !","");
|
|
Erm_M_StopForDebugForTraceClear("Erm_fn_ClearLastError not necessary" ,p_cFileName, uwLineNumber);
|
|
}
|
|
}/*Erm_fn_ClearLastError without __MULTI_THREAD_ERROR_MANAGEMENT__ defined*/
|
|
#else /* __MULTI_THREAD_ERROR_MANAGEMENT__ is defined*/
|
|
{
|
|
unsigned char ucJ;
|
|
unsigned char ucI;
|
|
|
|
for ( ucI=0;
|
|
( ucI < C_ucErmNbOfErrorChannel)&&
|
|
(g_stErmTheLastErrorInfo[ucI].uwLastErr != C_uwErmNoErr) &&
|
|
(g_stErmTheLastErrorInfo[ucI].ulChannelId != ulChannelId);
|
|
ucI++){};/*lint !e722*/
|
|
|
|
if (ucI < C_ucErmNbOfErrorChannel && (g_stErmTheLastErrorInfo[ucI].uwLastErr != C_uwErmNoErr))
|
|
{
|
|
(g_stErmTheLastErrorInfo+ucI)->uwLastErr = C_uwErmNoErr;
|
|
Erm_M_AffectUlChannelId((g_stErmTheLastErrorInfo+ucI)->ulChannelId, C_ucErmDefaultChannel);
|
|
Erm_fn_v_PrintErrMsg("Explicit request for clear of the last error","");
|
|
Erm_M_PrintTraceClearWindow();
|
|
/*Move down all other errors*/
|
|
ucJ= (unsigned char) (ucI+1);
|
|
if ((ucJ < C_ucErmNbOfErrorChannel) && (g_stErmTheLastErrorInfo[ucJ].uwLastErr != C_uwErmNoErr))
|
|
{
|
|
for ( ;
|
|
( ucJ < C_ucErmNbOfErrorChannel)&&
|
|
(g_stErmTheLastErrorInfo[ucJ].uwLastErr != C_uwErmNoErr);
|
|
ucJ++)
|
|
{
|
|
g_stErmTheLastErrorInfo[ucJ-1] = g_stErmTheLastErrorInfo[ucJ];
|
|
g_stErmTheLastErrorInfo[ucJ].uwLastErr = C_uwErmNoErr;
|
|
Erm_M_AffectUlChannelId(g_stErmTheLastErrorInfo[ucJ].ulChannelId, C_ucErmDefaultChannel);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Erm_M_PrintTraceUnUsefullClearWindow();
|
|
Erm_fn_v_PrintErrMsg("Explicit request for clear of the last error.\n But there is no error !","");
|
|
Erm_M_StopForDebugForTraceClear("Erm_fn_ClearLastError not necessary" ,p_cFileName, uwLineNumber);
|
|
}
|
|
}/*Erm_fn_ClearLastError with __MULTI_THREAD_ERROR_MANAGEMENT__ defined*/
|
|
#endif /*__MULTI_THREAD_ERROR_MANAGEMENT__*/
|
|
|
|
|
|
|
|
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_v_PrintModuleList
|
|
DESCRIPTION : Actually do nothimg
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
#ifndef _FIRE_DEADCODE_U64_
|
|
void Erm_fn_v_PrintModuleList()
|
|
{
|
|
#ifdef __ERROR_STRINGS__
|
|
unsigned char ucModuleId;
|
|
for (ucModuleId=0; ucModuleId < g_ucErmNbOfModule; ucModuleId++)
|
|
{
|
|
}/* end of for module*/
|
|
#endif/* __ERROR_STRINGS__*/
|
|
}/*Erm_fn_v_PrintModuleList*/
|
|
#endif /* _FIRE_DEADCODE_U64_ */
|
|
|
|
|
|
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_v_UpdateLastError
|
|
DESCRIPTION : Update Last Error
|
|
INPUT : Id of start of warnings
|
|
Module Id
|
|
Channel Id
|
|
Error number
|
|
Debug Data
|
|
Open Info Window flag
|
|
Stop For Debug flag
|
|
Personnal message
|
|
File Name
|
|
Line number
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
#ifndef U64
|
|
void Erm_fn_v_UpdateLastError(unsigned short uwStartOfWarningsId, unsigned char ucModuleId,
|
|
unsigned long ulChannelId, unsigned short uwErrNum,
|
|
long lDebugData, unsigned char ucOpenInfoWindow,
|
|
unsigned char ucStopForDebug, char *szPersonalMsg,
|
|
char * p_cFileName, unsigned short uwLineNumber)
|
|
#else /* U64 */
|
|
void Erm_fn_v_UpdateLastError(unsigned short uwStartOfWarningsId, unsigned char ucModuleId,
|
|
unsigned long ulChannelId, unsigned short uwErrNum,
|
|
long lDebugData, unsigned char ucOpenInfoWindow,
|
|
unsigned char ucStopForDebug, char *szPersonalMsg)
|
|
#endif /* U64 */
|
|
{
|
|
tdstLastErrorInfo *p_stMyLastErrorInfo;
|
|
|
|
Erm_M_PrintSeparationBegin();
|
|
p_stMyLastErrorInfo = Erm_M_p_stFindstMyLastErrorInfo(ulChannelId);
|
|
if (p_stMyLastErrorInfo == NULL)
|
|
{
|
|
Erm_fn_v_PrintErrMsg("Error in the Erm:","There is no more Channel error to raise the new error.\nPerhaps the constant C_ucErmNbOfErrorChannel is too low.");
|
|
Erm_M_PrintInfoWindow("Error in the Erm:","There is no more Channel error to raise the new error.\nPerhaps the constant C_ucErmNbOfErrorChannel is too low.");
|
|
/*lint -save -e527*/
|
|
Erm_M_Error_Exit();
|
|
/*lint -restore*/
|
|
}
|
|
else
|
|
{
|
|
if ((*p_stMyLastErrorInfo).uwLastErr != C_uwErmNoErr)
|
|
{
|
|
Erm_fn_v_PrintErrMsg("Strange!\nThe last error was never treated","");
|
|
Erm_M_PrintInfoWindow("Strange!\tThe last error was never treated\n\nThe last error was:",Erm_M_szGetLastErrorString(*p_stMyLastErrorInfo));
|
|
}
|
|
Erm_M_AffectLastErrorInfo((*p_stMyLastErrorInfo), ModuleName, uwErrNum, ulChannelId, lDebugData, ucModuleId, p_cFileName, uwLineNumber);
|
|
if ((*p_stMyLastErrorInfo).uwLastErr < uwStartOfWarningsId)
|
|
{
|
|
/*this is a Fatal Error*/
|
|
/*lint -save -e506 -e774*/
|
|
if (szPersonalMsg == NULL)
|
|
{
|
|
/*lint -restore*/
|
|
Erm_fn_v_PrintErrMsg("Fatale error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)));
|
|
#ifndef FINAL_VERSION
|
|
#ifdef U64
|
|
M_PrintfN64(("ucModuleId=%d; uwErrNum=%d\n", ucModuleId, uwErrNum));
|
|
if((ucModuleId==1)&&(uwErrNum==35)) /* bloc full*/
|
|
{
|
|
char szDebugMessage[64];
|
|
strcpy(szDebugMessage,"Increase ");
|
|
switch(g_ucModuleIdForDebug)
|
|
{
|
|
case 0:
|
|
if(GAM_fn_bIsEngineInLevelMode())
|
|
strcat(szDebugMessage,"ACPMemory");
|
|
else
|
|
strcat(szDebugMessage,"ACPFixMemory");
|
|
break;
|
|
case 1:
|
|
strcat(szDebugMessage,"AIMemory");
|
|
break;
|
|
case 2:
|
|
if(GAM_fn_bIsEngineInLevelMode())
|
|
strcat(szDebugMessage,"GameLevelMemorySize");
|
|
else
|
|
strcat(szDebugMessage,"GameFixMemorySize");
|
|
break;
|
|
case 3:
|
|
strcat(szDebugMessage,"SAIMemorySize");
|
|
break;
|
|
case 4:
|
|
strcat(szDebugMessage,"TMPLevelMemory");
|
|
break;
|
|
default:
|
|
strcat(szDebugMessage,"???");
|
|
break;
|
|
}
|
|
GLD_fn_vDisplayMessage(szDebugMessage);
|
|
}
|
|
else
|
|
{
|
|
char szDebugMessage[64];
|
|
sprintf(szDebugMessage,"Fatal error %d in module %d",uwErrNum,ucModuleId);
|
|
GLD_fn_vDisplayMessage(szDebugMessage);
|
|
}
|
|
ASM_BREAK;
|
|
#endif /*U64*/
|
|
#endif /* !FINAL_VERSION */
|
|
Erm_M_PrintInfoWindow("Fatale error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)));
|
|
}
|
|
else
|
|
{
|
|
Erm_fn_v_PrintErrMsgWithPersonalMsg("\nFatale error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)), szPersonalMsg);
|
|
/*lint -save -e560*/
|
|
Erm_M_PrintInfoWindowWithPersonalMsg("Fatale error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)), szPersonalMsg);
|
|
/*lint -restore*/
|
|
}
|
|
/*lint -save -e527*/
|
|
Erm_M_Error_Exit();
|
|
/*lint -restore*/
|
|
}
|
|
else
|
|
{
|
|
/*this is warning error*/
|
|
/*lint -save -e506 -e774*/
|
|
if(szPersonalMsg == NULL)
|
|
{
|
|
/*lint -restore*/
|
|
Erm_fn_v_PrintErrMsg("Warning error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)));
|
|
#ifndef FINAL_VERSION
|
|
#ifdef U64
|
|
M_PrintfN64(("Warning error: %s",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo))));
|
|
|
|
M_PrintfN64(("ucModuleId=%d; uwErrNum=%d\n", ucModuleId, uwErrNum));
|
|
if((ucModuleId==1)&&(uwErrNum==35)) /* bloc full*/
|
|
{
|
|
char szDebugMessage[64];
|
|
strcpy(szDebugMessage,"Increase ");
|
|
switch(g_ucModuleIdForDebug)
|
|
{
|
|
case 0:
|
|
strcat(szDebugMessage,"ACPMemory");
|
|
break;
|
|
case 1:
|
|
strcat(szDebugMessage,"AIMemory");
|
|
break;
|
|
case 2:
|
|
strcat(szDebugMessage,"GameLevelMemorySize");
|
|
break;
|
|
case 3:
|
|
strcat(szDebugMessage,"SAIMemorySize");
|
|
break;
|
|
case 4:
|
|
strcat(szDebugMessage,"TMPLevelMemory");
|
|
break;
|
|
default:
|
|
strcat(szDebugMessage,"???");
|
|
break;
|
|
}
|
|
/* GLD_fn_vDisplayMessage(szDebugMessage);*/
|
|
M_PrintfN64(("%s\n", szDebugMessage));
|
|
}
|
|
else
|
|
{
|
|
char szDebugMessage[64];
|
|
strcpy(szDebugMessage,"Fatal error");
|
|
/* GLD_fn_vDisplayMessage(szDebugMessage);*/
|
|
M_PrintfN64(("%s\n", szDebugMessage));
|
|
}
|
|
/* ASM_BREAK;*/
|
|
|
|
#endif /*U64*/
|
|
#endif /* !FINAL_VERSION */
|
|
/*lint -save -e506 -e774*/
|
|
if (ucOpenInfoWindow)
|
|
/*lint -restore*/
|
|
{
|
|
Erm_M_PrintInfoWindow("Warning error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Erm_fn_v_PrintErrMsgWithPersonalMsg("Warning error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)), szPersonalMsg);
|
|
/*lint -save -e506 -e774*/
|
|
if (ucOpenInfoWindow)
|
|
/*lint -restore*/
|
|
{
|
|
/*lint -save -e560*/
|
|
Erm_M_PrintInfoWindowWithPersonalMsg("Warning error: ",Erm_M_szGetLastErrorString((*p_stMyLastErrorInfo)), szPersonalMsg);
|
|
/*lint -restore*/
|
|
}
|
|
}
|
|
/*lint -save -e560 -e506 -e774*/
|
|
DebugIf((ucStopForDebug != C_ucNeverStopForDebug), Erm_M_AnErrorWasRaised());
|
|
/*lint -restore*/
|
|
}
|
|
}
|
|
Erm_M_PrintSeparationEnd();
|
|
}/*Erm_fn_v_UpdateLastError*/
|
|
|
|
|
|
|
|
#ifdef __ENABLE_DISPLAY_ERROR_WINDOW__
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_PrintInfoWindow
|
|
DESCRIPTION : Print Info in window
|
|
INPUT : string1 to print
|
|
string2 to print
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
void Erm_fn_PrintInfoWindow(char * szTxt1,char * szTxt2)
|
|
{
|
|
char szMyTxt [C_ucSizeOfErrTxt];
|
|
|
|
sprintf(szMyTxt, "%s\n%s\n", szTxt1, szTxt2);
|
|
Erm_M_CheckLenOfTxtWithoutUpdate(szMyTxt);
|
|
Erm_fn_iMessageBox(szMyTxt, "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);\
|
|
}
|
|
|
|
|
|
/* ##F#===================================================================================
|
|
NAME : Erm_fn_PrintInfoWindowWithPersonalMsg
|
|
DESCRIPTION : Print Info in window
|
|
INPUT : string1 to print
|
|
string2 to print
|
|
string3 to print
|
|
=========================================================================================
|
|
CREATION : Pierrick Crepy
|
|
=======================================================================================*/
|
|
void Erm_fn_PrintInfoWindowWithPersonalMsg(char * szTxt1,char * szTxt2,char * szTxt3)
|
|
{
|
|
char szMyTxt [C_ucSizeOfErrTxt];
|
|
|
|
sprintf(szMyTxt, "%s\n%s\n%s\n", szTxt1, szTxt2, szTxt3);
|
|
Erm_M_CheckLenOfTxtWithoutUpdate(szMyTxt);
|
|
Erm_fn_iMessageBox(szMyTxt, "Erm Information Window", MB_TOPMOST| MB_ICONEXCLAMATION | MB_OK);
|
|
}
|
|
|
|
#endif /*__ENABLE_DISPLAY_ERROR_WINDOW__*/
|
|
|