Add rayman2 source files
This commit is contained in:
318
Rayman_X/cpa/public/MRC/BIGFILE.H
Normal file
318
Rayman_X/cpa/public/MRC/BIGFILE.H
Normal file
@@ -0,0 +1,318 @@
|
||||
/*=============================================================================
|
||||
*
|
||||
* Filename: BigFile.h
|
||||
* Version: 1.1
|
||||
* Date: 08/97
|
||||
* Author: 1.0 / Vincent Lhuillier
|
||||
* 1.1 / Adrian Silvescu, Laurentiu Barza, Yan Marchal
|
||||
*
|
||||
* Description: prototypes for accessing BigFile Info
|
||||
*
|
||||
*===========================================================================*/
|
||||
#define _UNICODE
|
||||
#ifndef __BIG_FILE__
|
||||
#define __BIG_FILE__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#undef CPA_EXPORT
|
||||
#if defined(CPA_WANTS_IMPORT)
|
||||
#define CPA_EXPORT __declspec(dllimport)
|
||||
#elif defined(CPA_WANTS_EXPORT)
|
||||
#define CPA_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define CPA_EXPORT
|
||||
#endif
|
||||
|
||||
/*=============================================================================
|
||||
* DEFINES & CONSTANTS
|
||||
=============================================================================*/
|
||||
/* constant for file location */
|
||||
#define MRC_C_wInexistentFile -3
|
||||
#define MRC_C_wInternalFile -2
|
||||
#define MRC_C_wExternalFile -1
|
||||
|
||||
/* number of file description in table */
|
||||
#define MRC_C_NumberMaxOfFileDescription 10
|
||||
|
||||
/* constant for bigfile managing mode */
|
||||
#define MRC_C_ucNormalMode 0x00
|
||||
#define MRC_C_ucExternalMode 0x01
|
||||
#define MRC_C_ucDebugMode 0x02
|
||||
#define MRC_C_ucProfileMode 0x04
|
||||
|
||||
/* constant for data path mode */
|
||||
#define MRC_C_ucDataPathIsCurrent 0
|
||||
#define MRC_C_ucDataPathIsNotCurrent 1
|
||||
|
||||
/*=============================================================================
|
||||
* STRUCTURES
|
||||
=============================================================================*/
|
||||
/* Diverses enums */
|
||||
typedef enum MRC_tdeFileMode_
|
||||
{
|
||||
MRC_FM_Read , MRC_FM_Write, MRC_FM_Append,
|
||||
MRC_FM_MaxFileModes
|
||||
}MRC_tdeFileMode;
|
||||
|
||||
typedef enum MRC_tdeFileType_
|
||||
{
|
||||
MRC_FT_Binary, MRC_FT_Texte,
|
||||
MRC_FT_MaxFileTypes
|
||||
} MRC_tdeFileType;
|
||||
|
||||
typedef enum MRC_tdeFileState_
|
||||
{
|
||||
MRC_FS_Close, MRC_FS_Ready, MRC_FS_NotReady,
|
||||
MRC_FS_MaxFileStates
|
||||
} MRC_tdeFileState;
|
||||
|
||||
typedef enum MRC_tdeSeekOrigin_
|
||||
{
|
||||
MRC_SO_SET , MRC_SO_CURRENT, MRC_SO_END
|
||||
} MRC_tdeSeekOrigin;
|
||||
|
||||
/*
|
||||
* Structure that describes each type of data
|
||||
* in the bigfile file
|
||||
*/
|
||||
typedef struct MRC_tdstDLst_
|
||||
{
|
||||
long lNameOffset;
|
||||
long lNumberOfSubDirs;
|
||||
long lFirstSubDir;
|
||||
long lNumberOfFiles;
|
||||
long lFirstFile;
|
||||
} MRC_tdstDLst;
|
||||
|
||||
typedef struct MRC_tdstFLst_
|
||||
{
|
||||
long lNameOffset;
|
||||
long lLength;
|
||||
long lOffset;
|
||||
long lInfo;
|
||||
} MRC_tdstFLst;
|
||||
|
||||
typedef struct MRC_tdstShortChunk_
|
||||
{
|
||||
char acChunk[4];
|
||||
long lSize;
|
||||
char acInfo[4];
|
||||
} MRC_tdstShortChunk;
|
||||
|
||||
/*
|
||||
* Structure that describes a directory entry
|
||||
*/
|
||||
typedef struct MRC_tdstDirectoryEntry_
|
||||
{
|
||||
char *szName; /* Directory name */
|
||||
short wNumberOfSubDirs; /* number of sub directories */
|
||||
short wFirstSubDir; /* index of first sub directory in directories table */
|
||||
short wNumberOfFiles; /* number of files */
|
||||
short wFirstFile; /* index of first file in file table */
|
||||
} MRC_tdstDirectoryEntry;
|
||||
|
||||
|
||||
/*
|
||||
* Struct that describes a file entry
|
||||
*/
|
||||
typedef struct MRC_tdstFileEntry_
|
||||
{
|
||||
char *szName; /* File Name */
|
||||
char *szExternFile; /* name of extern file if existent */
|
||||
long lLength; /* length of file */
|
||||
long lOffset; /* begin of the file in file data array */
|
||||
long lInfos; /* info about the file */
|
||||
short wPlace; /* Where is the file */
|
||||
/* -3 = C_InexistantFile */
|
||||
/* -2 = C_InternalFile */
|
||||
/* -1 = C_ExternalFile */
|
||||
/* other : nuber of patch file */
|
||||
} MRC_tdstFileEntry;
|
||||
|
||||
/*
|
||||
* structure that describe a file
|
||||
*/
|
||||
|
||||
typedef struct MRC_tdstBigFile_;
|
||||
typedef struct MRC_tdstBigFileListEx_;
|
||||
|
||||
typedef struct MRC_tsdtFileDescription_
|
||||
{
|
||||
|
||||
struct MRC_tdstBigFile_ *p_stBigFile;
|
||||
|
||||
char *p_cAsyncBuffer;
|
||||
long lAsyncSize;
|
||||
|
||||
MRC_tdstFileEntry *p_stFileEntry; /* File entry in BigFile */
|
||||
MRC_tdeFileType eType; /* file type */
|
||||
MRC_tdeFileMode eMode; /* file opening mode */
|
||||
MRC_tdeFileState eState; /* file current state */
|
||||
|
||||
long lPosition; /* current position in buffer */
|
||||
long lFirst; /* offset of first data */
|
||||
|
||||
int bEndOfFile; /* 0 if endoffile 1 if not end of file */
|
||||
|
||||
struct MRC_tsdtFileDescription_ *p_stNext; /* pointer to the next file description if file is not in bigfile */
|
||||
struct MRC_tsdtFileDescription_ *p_stPrev; /* pointer to the previous file description if file is not in bigfile */
|
||||
struct MRC_tdstBigFileListEx_ *p_stBFLEx; /* pointer to the extended big file */
|
||||
|
||||
FILE *hpFile;
|
||||
|
||||
} MRC_tdstFileDescription;
|
||||
|
||||
/*
|
||||
* structure de description d'un patch de bigfile
|
||||
*/
|
||||
typedef struct MRC_tdstDataPatch_
|
||||
{
|
||||
char *szName;
|
||||
long lVersion;
|
||||
long lFirstData;
|
||||
} MRC_tdstDataPatch;
|
||||
|
||||
/*
|
||||
* Structure of a BigFile
|
||||
*/
|
||||
typedef struct MRC_tdstBigFile_
|
||||
{
|
||||
char *szName; /* name of big file */
|
||||
FILE *hpBigFile; /* Handler of big file */
|
||||
MRC_tdstDirectoryEntry *pa_stDir; /* Directory list */
|
||||
MRC_tdstFileEntry *pa_stFile; /* File List */
|
||||
long lVersion;
|
||||
long lFirstData;
|
||||
short wNumberOfDirs; /* number of dir in dir table */
|
||||
short wNumberOfFiles; /* number of files in file table */
|
||||
short wNumberOfPatchs;
|
||||
MRC_tdstDataPatch *pa_stPatch;
|
||||
unsigned char ucMode; /* bigfile managing mode, a combination between following values */
|
||||
/* C_ucNormalMode, C_ucDebugMode, C_ucProfileMode, C_ucExternalMode */
|
||||
|
||||
FILE* hpDebugBigFile;
|
||||
FILE* hpProfileBigFile;
|
||||
|
||||
MRC_tdstFileDescription aFileDescription[ MRC_C_NumberMaxOfFileDescription ];
|
||||
|
||||
} MRC_tdstBigFile;
|
||||
/*
|
||||
* List of big files
|
||||
*/
|
||||
typedef MRC_tdstBigFile *MRC_tdstBigFileList;
|
||||
/*
|
||||
* List of big files + external file list
|
||||
*/
|
||||
typedef struct MRC_tdstBigFileListEx_
|
||||
{
|
||||
MRC_tdstBigFileList *p_BigFileList;
|
||||
MRC_tdstFileDescription *p_stFileDesc;
|
||||
|
||||
}MRC_tdstBigFileListEx;
|
||||
|
||||
/*=============================================================================
|
||||
* GLOBALS
|
||||
=============================================================================*/
|
||||
|
||||
/*extern CPA_EXPORT MRC_tdstBigFile MRC_g_stBigFile;*/
|
||||
|
||||
/*=============================================================================
|
||||
* FUNCTIONS
|
||||
=============================================================================*/
|
||||
/*
|
||||
* Fonction for managing debug file info
|
||||
*/
|
||||
CPA_EXPORT void MRC_fn_vPrintBigFileInfos( MRC_tdstBigFile *p_stBigFile );
|
||||
CPA_EXPORT void MRC_fn_vPrintFileDescriptionInfos( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT void MRC_fn_vOpenBigFileDebugFiles( MRC_tdstBigFile *p_stBigFile , char* szFileName);
|
||||
CPA_EXPORT void MRC_fn_vCloseBigFileDebugFiles( MRC_tdstBigFile *p_stBigFile );
|
||||
|
||||
/*
|
||||
* Fonctions for initialising and managing data and patch paths
|
||||
*/
|
||||
CPA_EXPORT long MRC_fn_lChangeDirectory( char *szPath );
|
||||
CPA_EXPORT long MRC_fn_lVerifyPath( char *szPath );
|
||||
|
||||
CPA_EXPORT long MRC_fn_lInitDataPath( char *szDataPath, unsigned char ucMode );
|
||||
CPA_EXPORT long MRC_fn_lInitPatchPath( char *szPatchPath );
|
||||
CPA_EXPORT void MRC_fn_vChangeDataPathMode( unsigned char ucMode );
|
||||
CPA_EXPORT void MRC_fn_vFreePath( void );
|
||||
CPA_EXPORT long MRC_fn_lGotoDataDir( void );
|
||||
CPA_EXPORT long MRC_fn_lGotoPatchDir( void );
|
||||
CPA_EXPORT char *MRC_fn_p_szGetFullFileName( char *szFileName, unsigned char ucType );
|
||||
|
||||
/*
|
||||
* functions for opening / closing bigfile
|
||||
*/
|
||||
CPA_EXPORT MRC_tdstBigFile *MRC_fn_p_stOpenBigFile( char *szFileName, unsigned char ucMode );
|
||||
CPA_EXPORT void MRC_fn_vCloseBigFile ( MRC_tdstBigFile *p_stBigFile );
|
||||
|
||||
/*
|
||||
* function for opening / closing a file
|
||||
*/
|
||||
CPA_EXPORT MRC_tdstFileDescription *MRC_fn_p_stOpenFile( char *szFileName, MRC_tdstBigFile *p_stBigFile );
|
||||
CPA_EXPORT void MRC_fn_vCloseFile( MRC_tdstFileDescription *p_stFile );
|
||||
|
||||
/*
|
||||
* Miscellaneous functions on a file
|
||||
*/
|
||||
CPA_EXPORT long MRC_fn_lFileLength( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT long MRC_fn_lSeek( MRC_tdstFileDescription *p_stFile, long lOffset, MRC_tdeSeekOrigin eOrigin);
|
||||
CPA_EXPORT long MRC_fn_lTell ( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT int MRC_fn_nEof ( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT int MRC_fn_nFileExists ( MRC_tdstBigFileListEx *p_stBigFileListEx , char* szFileName );
|
||||
|
||||
/*
|
||||
* synchronous read on a file
|
||||
*/
|
||||
CPA_EXPORT long MRC_fn_lSyncReadFile( MRC_tdstFileDescription *p_stFile, char *p_cBuffer, long lSize , long lCount );
|
||||
|
||||
/*
|
||||
* functions && macros for asynchronous read
|
||||
*/
|
||||
|
||||
CPA_EXPORT long MRC_fn_lAsyncReadFile( MRC_tdstFileDescription *p_stFile, char *p_cBuffer, long lSize );
|
||||
CPA_EXPORT long MRC_fn_lAsyncNumberOfBytesRead( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT void MRC_fn_vWaitEndOfAsyncRead( MRC_tdstFileDescription *p_stFile );
|
||||
#define MRC_M_lIsAsyncReadFinished( p_stFile ) (p_stFile->eState == FS_Ready)
|
||||
|
||||
/*
|
||||
* functions for BigFileList management
|
||||
*/
|
||||
|
||||
CPA_EXPORT MRC_tdstBigFileList *MRC_fn_p_stOpenBigFileList( char **szFileNames, unsigned char ucMode );
|
||||
CPA_EXPORT void MRC_fn_vCloseBigFileList ( MRC_tdstBigFileList *p_stBigFileList );
|
||||
CPA_EXPORT MRC_tdstFileDescription *MRC_fn_p_stOpenFileInList( char *szFileName, MRC_tdstBigFileList *p_stBigFileList );
|
||||
|
||||
/*
|
||||
* functions for BigFileListEx management
|
||||
*/
|
||||
|
||||
CPA_EXPORT MRC_tdstBigFileListEx *MRC_fn_p_stOpenBigFileListEx( char **szFileNames, unsigned char ucMode );
|
||||
CPA_EXPORT void MRC_fn_vCloseBigFileListEx ( MRC_tdstBigFileListEx *p_stBigFileListEx );
|
||||
CPA_EXPORT MRC_tdstFileDescription *MRC_fn_p_stOpenFileInListEx( MRC_tdstBigFileListEx *p_stBigFileListEx , char *szFileName , char *fmt );
|
||||
|
||||
/*
|
||||
* Functions for extended file services
|
||||
*/
|
||||
|
||||
CPA_EXPORT void MRC_fn_vCloseFileEx( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT long MRC_fn_lSyncReadFileEx( char *p_cBuffer, long lSize , long lCount , MRC_tdstFileDescription *p_stFile);
|
||||
CPA_EXPORT long MRC_fn_lFileLengthEx( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT long MRC_fn_lSeekEx( MRC_tdstFileDescription *p_stFile, long lOffset, MRC_tdeSeekOrigin eOrigin);
|
||||
CPA_EXPORT long MRC_fn_lTellEx ( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT int MRC_fn_nEofEx ( MRC_tdstFileDescription *p_stFile );
|
||||
CPA_EXPORT int MRC_fn_nFileExistsEx ( MRC_tdstBigFileListEx *p_stBigFileListEx , char* szFileName );
|
||||
/*CPA_EXPORT char* MRC_fn_szFileGetsEx ( char* buffer ,int n , MRC_tdstFileDescription* p_stFile );*/
|
||||
/*CPA_EXPORT int MRC_fn_nFileScanfEx ( MRC_tdstFileDescription* p_stFile , char* fmt , char* text);*/
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /*__BIG_FILE__*/
|
158
Rayman_X/cpa/public/MRC/Errmrc.h
Normal file
158
Rayman_X/cpa/public/MRC/Errmrc.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/*///////////////////////////////////////////////////////////*/
|
||||
/**/
|
||||
/* Management of the Module : Mrc*/
|
||||
/**/
|
||||
/* File Name : ErrMrc.h*/
|
||||
/* Date : 97/07/21*/
|
||||
/* Author : Yan Marchal*/
|
||||
/**/
|
||||
/*///////////////////////////////////////////////////////////*/
|
||||
/**/
|
||||
/* abbreviation of the module-name. Used in macro is 'Mrc'*/
|
||||
/**/
|
||||
/*///////////////////////////////////////////////////////////*/
|
||||
|
||||
#ifndef __ERRMRC_H__
|
||||
#define __ERRMRC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define C_szMrcVersion "MRC V1.0.0" /* The format is XXX Va.b.c with Xxx is the Tag of the module */
|
||||
#define C_szMrcFullName "MRC BigFile"/* the complete and clear name of the module */
|
||||
#define C_szMrcDate __DATE__ /*The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/
|
||||
|
||||
/* For DLLs who are using this module : */
|
||||
#undef CPA_EXPORT
|
||||
#if defined(CPA_WANTS_IMPORT)
|
||||
#define CPA_EXPORT __declspec(dllimport)
|
||||
#elif defined(CPA_WANTS_EXPORT)
|
||||
#define CPA_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define CPA_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
#include "ERM.h"
|
||||
|
||||
#define __FATAL_ERR_MRC__
|
||||
#define __WARNING1_ERR_MRC__
|
||||
#define __WARNING2_ERR_MRC__
|
||||
#define __WARNING3_ERR_MRC__
|
||||
/*----------*/
|
||||
/* Constant */
|
||||
/*----------*/
|
||||
/* error of the Mrc Module*/
|
||||
typedef enum e_uwMrcErrNumber_{
|
||||
E_uwMrcFatalErr,
|
||||
#ifdef __FATAL_ERR_MRC__
|
||||
/* -----------------*/
|
||||
#endif /*__FATAL_ERR_MRC__*/
|
||||
E_uwMrcStartOfWarning,/* important constant, it allows to recognize if an error is fatal or not.*/
|
||||
#ifdef __WARNING1_ERR_MRC__
|
||||
/* -------------------*/
|
||||
E_uwMrcWarningCanNotAlloc,
|
||||
E_uwMrcWarningCanNotFree,
|
||||
E_uwMrcWarningCanNotInitBlock,
|
||||
E_uwMrcWarningCanNotFreeBlock,
|
||||
E_uwMrcWarningCanNotDeleteBlock,
|
||||
E_uwMrcWarningBigFileNotFound,
|
||||
E_uwMrcWarningBigFileSyntax,
|
||||
E_uwMrcWarningFileNotFound,
|
||||
E_uwMrcWarningInvalidPath,
|
||||
E_uwMrcWarningCannotOpen,
|
||||
E_uwMrcWarningCannotClose,
|
||||
E_uwMrcWarningCannotRead,
|
||||
E_uwMrcWarningCannotWrite,
|
||||
E_uwMrcWarningBadParameters,
|
||||
E_uwMrcWarningEOF,
|
||||
E_uwMrcWarningAsyncLaunch,
|
||||
E_uwMrcWarningFileNotReady,
|
||||
E_uwMrcWarningUnknown,
|
||||
E_uwMrcWarningNone,
|
||||
#endif /*__WARNING1_ERR_MRC__*/
|
||||
#ifdef __WARNING2_ERR_MRC__
|
||||
/* -------------------*/
|
||||
#endif /*__WARNING2_ERR_MRC__*/
|
||||
#ifdef __WARNING3_ERR_MRC__
|
||||
/* -------------------*/
|
||||
#endif /*__WARNING3_ERR_MRC__*/
|
||||
E_uwMrcErrNumber
|
||||
} e_uwMrcErrNumber;
|
||||
|
||||
/*------------------*/
|
||||
/* Global Variables*/
|
||||
/*------------------*/
|
||||
#undef __ERRMRC_EXTERN
|
||||
#ifndef __DeclareGlobalVariableErrMrc_h__
|
||||
#define __ERRMRC_EXTERN extern /*external declaration*/
|
||||
#else /*__DeclareGlobalVariableErrMrc_h__*/
|
||||
#define __ERRMRC_EXTERN /*replace by nothing : we have to declare*/
|
||||
#endif /*__DeclareGlobalVariableErrMrc_h__*/
|
||||
|
||||
__ERRMRC_EXTERN CPA_EXPORT unsigned char g_ucMrcModuleId /*number of identification of the Erm module*/
|
||||
#if defined(__DeclareGlobalVariableErrMrc_h__) && !defined(CPA_WANTS_IMPORT)
|
||||
= C_ucModuleNotInitialized
|
||||
#endif /*__DeclareGlobalVariableErrMrc_h__&& CPA_WANTS_IMPORT*/
|
||||
;
|
||||
|
||||
#ifdef __ERROR_STRINGS__
|
||||
|
||||
__ERRMRC_EXTERN CPA_EXPORT char * g_a_szMrcInformationModule []
|
||||
#if defined(__DeclareGlobalVariableErrMrc_h__) && !defined(CPA_WANTS_IMPORT)
|
||||
= {C_szMrcVersion, C_szMrcFullName, C_szMrcDate}
|
||||
#endif /*__DeclareGlobalVariableErrMrc_h__ && CPA_WANTS_IMPORT*/
|
||||
;
|
||||
|
||||
__ERRMRC_EXTERN CPA_EXPORT char * g_szMrcModuleName /* Mandatory syntax 'g_sz'+[Abbreviation of ModuleName]+'ModuleName'*/
|
||||
#if defined(__DeclareGlobalVariableErrMrc_h__) && !defined(CPA_WANTS_IMPORT)
|
||||
= "Module Mrc"
|
||||
#endif /*__DeclareGlobalVariableErrMrc_h__ && CPA_WANTS_IMPORT*/
|
||||
;
|
||||
|
||||
__ERRMRC_EXTERN CPA_EXPORT struct tdstErrorMsg_ g_a_stMrcTabErr [] /* Mandatory syntax 'g_a_st'+[Abbreviation of ModuleName]+'TabErr'*/
|
||||
#if defined(__DeclareGlobalVariableErrMrc_h__) && !defined(CPA_WANTS_IMPORT)
|
||||
={
|
||||
#ifdef __FATAL_ERR_MRC__
|
||||
/* -------------*/
|
||||
#endif /*__FATAL_ERR_MRC__*/
|
||||
#ifdef __WARNING1_ERR_MRC__
|
||||
/* ----------------*/
|
||||
E_uwMrcWarningCanNotAlloc, "Failed in allocating memory",
|
||||
E_uwMrcWarningCanNotFree, "Failed in freeing memory",
|
||||
E_uwMrcWarningCanNotInitBlock, "Failed in initializing a static block of memory",
|
||||
E_uwMrcWarningCanNotFreeBlock, "Failed in reinitializing a static block of memory",
|
||||
E_uwMrcWarningCanNotDeleteBlock, "Failed in deleting a static block of memory",
|
||||
E_uwMrcWarningBigFileNotFound, "Big File not found",
|
||||
E_uwMrcWarningBigFileSyntax, "Syntax error in big file",
|
||||
E_uwMrcWarningFileNotFound, "File not found",
|
||||
E_uwMrcWarningInvalidPath, "Invalid path",
|
||||
E_uwMrcWarningCannotOpen, "Cannot open a file",
|
||||
E_uwMrcWarningCannotClose, "Cannot close a file",
|
||||
E_uwMrcWarningCannotRead, "Cannot read a file",
|
||||
E_uwMrcWarningCannotWrite, "Cannot write a file",
|
||||
E_uwMrcWarningBadParameters, "Bad parameters",
|
||||
E_uwMrcWarningEOF, "End of file encountered",
|
||||
E_uwMrcWarningAsyncLaunch, "Asynchronous launch",
|
||||
E_uwMrcWarningUnknown, "Unknown error",
|
||||
E_uwMrcWarningNone, "Everything's fine",
|
||||
#endif /*__WARNING1_ERR_MRC__*/
|
||||
#ifdef __WARNING2_ERR_MRC__
|
||||
/* ----------------*/
|
||||
#endif /*__WARNING2_ERR_MRC__*/
|
||||
#ifdef __WARNING3_ERR_MRC__
|
||||
/* ----------------*/
|
||||
#endif /*__WARNING3_ERR_MRC__*/
|
||||
0xFFFF, "\0"/*fin*/
|
||||
};
|
||||
#endif /*__DeclareGlobalVariableErrMrc_h__ && CPA_WANTS_IMPORT*/
|
||||
;
|
||||
|
||||
#endif /*__ERROR_STRINGS__*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /*__ERRMRC_H__*/
|
125
Rayman_X/cpa/public/MRC/MACROMRC.H
Normal file
125
Rayman_X/cpa/public/MRC/MACROMRC.H
Normal file
@@ -0,0 +1,125 @@
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
/**/
|
||||
/* Interface between MRC BigFile module and the ERM and MMG modules*/
|
||||
/* Yan Marchal, 97/07/21*/
|
||||
/**/
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#ifndef _MACROMRC_H_
|
||||
#define _MACROMRC_H_
|
||||
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
/**/
|
||||
/* With the ERM module*/
|
||||
/**/
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#include "ErrMrc.h"
|
||||
|
||||
/* To display an error message*/
|
||||
#define M_MrcError(_ucError) \
|
||||
{\
|
||||
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
|
||||
Erm_M_UpdateLastError(Mrc, C_ucErmDefaultChannel, _ucError, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);\
|
||||
}
|
||||
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
/**/
|
||||
/* With the MMG module, to deal with blocks and modes of allocation*/
|
||||
/**/
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#include "MmgMrc.h"
|
||||
|
||||
/* To initialize a static block of memory*/
|
||||
/* (4 entries to fill the block)*/
|
||||
#define M_MrcInitBlock(_ucMode, _ulSize) \
|
||||
{\
|
||||
Mmg_M_InitBlock(Mrc, _ucMode, _ulSize+16);\
|
||||
if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
|
||||
M_MrcError(E_uwMrcWarningCanNotInitBlock);\
|
||||
}\
|
||||
}
|
||||
|
||||
/* To reinitialize a static block of memory*/
|
||||
#define M_MrcReinitBlock(_ucMode) \
|
||||
{\
|
||||
Mmg_M_FreeBlock(Mrc, _ucMode);\
|
||||
if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
|
||||
M_MrcError(E_uwMrcWarningCanNotFreeBlock);\
|
||||
}\
|
||||
}
|
||||
|
||||
/* To delete a static block of memory*/
|
||||
#define M_MrcDeleteBlock(_ucMode) \
|
||||
{\
|
||||
Mmg_M_DeleteBlock(Mrc, _ucMode);\
|
||||
if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
|
||||
M_MrcError(E_uwMrcWarningCanNotDeleteBlock);\
|
||||
}\
|
||||
}
|
||||
|
||||
/* To know if a static block of memory is being used*/
|
||||
#define M_MrcBlockIsInUse(_ucMode) \
|
||||
(g_a_stMrcBlocksInfo[_ucMode].p_cBeginBlock!=NULL)
|
||||
|
||||
/* To set the current block or mode of allocation*/
|
||||
#define M_MrcSetModeAlloc(_ucMode) \
|
||||
Mmg_M_SetModeAlloc4Ch(Mrc, _ucMode, C_ucMmgDefaultChannel)
|
||||
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
/**/
|
||||
/* With the MMG module, to allocate, reallocate and free memory*/
|
||||
/**/
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
|
||||
/* To allocate memory in the current block or mode*/
|
||||
#define M_MrcAllocWithoutSetMode(_xVar, _cast, _ulSize)\
|
||||
{\
|
||||
_xVar = (_cast) Mmg_fn_p_vAlloc4Ch(_ulSize, C_ucMmgDefaultChannel);\
|
||||
if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
|
||||
M_MrcError(E_uwMrcWarningCanNotAlloc);\
|
||||
}\
|
||||
}
|
||||
|
||||
/* To allocate memory in a given block or mode*/
|
||||
#define M_MrcAlloc(_ucMode, _xVar, _cast, _ulSize)\
|
||||
{\
|
||||
M_MrcSetModeAlloc(_ucMode);\
|
||||
M_MrcAllocWithoutSetMode(_xVar, _cast, _ulSize);\
|
||||
}
|
||||
|
||||
/* To reallocate memory in the current block or mode*/
|
||||
#define M_MrcReallocWithoutSetMode(_xVar, _pAdrSrc, _cast, _ulSize)\
|
||||
{\
|
||||
_xVar = (_cast) Mmg_fn_p_vRealloc4Ch(_pAdrSrc, _ulSize, C_ucMmgDefaultChannel);\
|
||||
if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
|
||||
M_MrcError(E_uwMrcWarningCanNotAlloc);\
|
||||
}\
|
||||
}
|
||||
|
||||
/* To reallocate memory in a given block or mode*/
|
||||
#define M_MrcRealloc(_ucMode, _xVar, _pAdrSrc, _cast, _ulSize)\
|
||||
{\
|
||||
M_MrcSetModeAlloc(_ucMode);\
|
||||
M_MrcReallocWithoutSetMode(_xVar, _pAdrSrc, _cast, _ulSize);\
|
||||
}
|
||||
|
||||
/* To free memory from the current block or mode*/
|
||||
#define M_MrcFreeWithoutSetMode(_pAdr) \
|
||||
{\
|
||||
Mmg_fn_vFree4Ch(_pAdr, C_ucMmgDefaultChannel);\
|
||||
if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
|
||||
M_MrcError(E_uwMrcWarningCanNotFree);\
|
||||
}\
|
||||
}
|
||||
|
||||
/* To free memory from a given block or mode*/
|
||||
#define M_MrcFree(_ucMode, _pAdr) \
|
||||
{\
|
||||
M_MrcSetModeAlloc(_ucMode);\
|
||||
M_MrcFreeWithoutSetMode(_pAdr);\
|
||||
}
|
||||
|
||||
#endif /* _MACROMRC_H_*/
|
||||
|
55
Rayman_X/cpa/public/MRC/MMGMRC.H
Normal file
55
Rayman_X/cpa/public/MRC/MMGMRC.H
Normal file
@@ -0,0 +1,55 @@
|
||||
/*///////////////////////////////////////////////////////////*/
|
||||
/**/
|
||||
/* Memory Management of the Module : Mrc*/
|
||||
/**/
|
||||
/* File Name : MmgMrc.h*/
|
||||
/* Date : 97/07/21*/
|
||||
/* Author : Yan Marchal*/
|
||||
/**/
|
||||
/*///////////////////////////////////////////////////////////*/
|
||||
#ifndef __MmgMrc_H__
|
||||
#define __MmgMrc_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* For DLLs who are using this module : */
|
||||
#undef CPA_EXPORT
|
||||
#if defined(CPA_WANTS_IMPORT)
|
||||
#define CPA_EXPORT __declspec(dllimport)
|
||||
#elif defined(CPA_WANTS_EXPORT)
|
||||
#define CPA_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define CPA_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
#include "MMG.h"
|
||||
|
||||
typedef enum e_ucMrcStaticBlocks_{
|
||||
E_ucMrcBlock1,
|
||||
E_ucMrcMaxBlocksNb /* maximum number of static block, You have to follow this syntax 'E_uc+ Abbreviation Module +MaxBlocksNb'*/
|
||||
} e_ucMrcStaticBlocks;
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __DeclareGlobalVariableMmgMrc_h__
|
||||
#define EXTERN /*nothing*/
|
||||
#else /* no __DeclareGlobalVariableMmgMrc_h__*/
|
||||
#define EXTERN extern
|
||||
#endif /*__DeclareGlobalVariableMmgMrc_h__*/
|
||||
|
||||
EXTERN CPA_EXPORT struct tdstBlockInfo_ g_a_stMrcBlocksInfo[E_ucMrcMaxBlocksNb];
|
||||
|
||||
#ifdef __DYNAMIC_MALLOC_ALLOWED__
|
||||
#ifdef __DEBUG_MALLOC_MODE__
|
||||
EXTERN CPA_EXPORT struct tdstDynInfo_ g_stMrcDynInfo;
|
||||
#endif /*__DEBUG_MALLOC_MODE__*/
|
||||
#endif /*__DYNAMIC_MALLOC_ALLOWED__*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /*__MmgMrc_H__*/
|
Reference in New Issue
Block a user