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

View File

@@ -0,0 +1,16 @@
#ifndef __SNAGLOB_H__
#define __SNAGLOB_H__
#ifdef __cplusplus
extern "C" {
#endif
#define SNA_LOAD_SCRIPT 0
#define SNA_LOAD_SNAPSHOT 1
#define SNA_SAVE_SNAPSHOT 2
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __SNAGLOB_H__*/

View File

@@ -0,0 +1,86 @@
#ifndef __SNAFILE_H__
#define __SNAFILE_H__
#include <windows.h>
#include "ACP_Base.h"
#include "PTC.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Constants for SNA_File options */
#define SNA_C_ucUseChecksum 1
#define SNA_C_ucUseEncryption 2
/* Constants for SNA_File open mode */
#define SNA_C_ucWrite 1
#define SNA_C_ucRead 2
/*////////////////////////////////////////////////////////*/
#define SNA_M_CREATEFILE PTC_CreateFile
#define SNA_M_WRITEFILE PTC_WriteFile
#define SNA_M_READFILE PTC_ReadFile
#define SNA_M_CLOSEHANDLE PTC_CloseHandle
#define SNA_M_SETFILEPOINTER PTC_SetFilePointer
#define SNA_M_FLUSHFILEBUFFERS PTC_FlushFileBuffers
/*//////////////////////////////////////////////////////// */
typedef ACP_tdxBool (*tdp_bfnWriteFunction)( const void *_p_vData, unsigned long _ulSize, struct SNA_tdstFile_ *_p_stFile );
typedef ACP_tdxBool (*tdp_bfnReadFunction)( void *_p_vData, unsigned long _ulSize, struct SNA_tdstFile_ *_p_stFile );
typedef struct SNA_tdstFile_
{
HANDLE hFile;
BOOL bReadSuccess;
char a4_cChecksumBuffer[4]; /* buffer for 32 bit CRC.*/
unsigned char ucBytesInChecksumBuffer ;
unsigned long ulChecksum;
unsigned long ulCryptKey;
unsigned char ucOptions; /* options for file (checksums, buffer, encryption...)*/
tdp_bfnWriteFunction p_fn_bDefaultWrite;
tdp_bfnWriteFunction p_fn_bWriteWithoutOptions;
tdp_bfnReadFunction p_fn_bDefaultRead;
tdp_bfnReadFunction p_fn_bReadWithoutOptions;
} SNA_tdstFile;
/* Generic functions.*/
void SNA_fn_vInitFile(unsigned char ucOptions, struct SNA_tdstFile_ *_p_stFile );
ACP_tdxBool SNA_fn_bFOpen( char *_p_szfilename, unsigned char ucMode, unsigned char ucOptions, struct SNA_tdstFile_ *_p_stFile );
ACP_tdxBool SNA_fn_bFClose( struct SNA_tdstFile_ *_p_stFile );
size_t SNA_fn_ulFWrite( void *_p_vBuffer, size_t _ulSize, size_t _ulCount, struct SNA_tdstFile_ *_p_stFile );
size_t SNA_fn_ulFRead( void *_p_vBuffer, size_t _ulSize, size_t _ulCount, struct SNA_tdstFile_ *_p_stFile );
size_t SNA_fn_ulFWriteWithoutOptions( void *_p_vBuffer, size_t _ulSize, size_t _ulCount, struct SNA_tdstFile_ *_p_stFile );
size_t SNA_fn_ulFReadWithoutOptions( void *_p_vBuffer, size_t _ulSize, size_t _ulCount, struct SNA_tdstFile_ *_p_stFile );
int SNA_fn_bFseek( struct SNA_tdstFile_ *_p_stFile, long _lOffset, int _lOrigin );
/* Functions specific to checksums.*/
ACP_tdxBool SNA_fn_bFileUseChecksum( struct SNA_tdstFile_ *_p_stFile );
ACP_tdxBool SNA_fn_bTestChecksum( struct SNA_tdstFile_ *_p_stFile );
ACP_tdxBool SNA_fn_bWriteChecksum( struct SNA_tdstFile_ *_p_stFile );
ACP_tdxBool SNA_fn_bReadChecksum( struct SNA_tdstFile_ *_p_stFile );
/* Functions specific to encryption*/
ACP_tdxBool SNA_fn_bFileUseEncryption( struct SNA_tdstFile_ *_p_stFile );
void SNA_fn_vSetCryptKey( unsigned char _ulCryptKey, struct SNA_tdstFile_ *_p_stFile );
/* Functions specific to buffer*/
int SNA_fn_iFFlush( struct SNA_tdstFile_ *_p_stFile );
/* Private functions*/
ACP_tdxBool SNA_fn_bCryptAndWriteToFile( const void *_p_vData, unsigned long _ulSize, struct SNA_tdstFile_ *_p_stFile );
ACP_tdxBool SNA_fn_bWriteToFile( const void *_p_vData, unsigned long _ulSize, struct SNA_tdstFile_ *_p_stFile );
ACP_tdxBool SNA_fn_bReadAndDecryptFromFile( void *_p_vData, unsigned long _ulSize, struct SNA_tdstFile_ *_p_stFile );
ACP_tdxBool SNA_fn_bReadFromFile( void *_p_vData, unsigned long _ulSize, struct SNA_tdstFile_ *_p_stFile );
#ifdef __cplusplus
}
#endif
#endif /* __SNAFILE_H__ */

View File

@@ -0,0 +1,24 @@
#ifndef __SNAGLOB_H__
#define __SNAGLOB_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Load mode for engine : script, binary or saving binary */
#define SNA_LOAD_SCRIPT 0
#define SNA_LOAD_SNAPSHOT 1
#define SNA_SAVE_SNAPSHOT 2
extern CPA_EXPORT void SNA_fn_vSetLoadType(unsigned char ucType);
extern CPA_EXPORT unsigned char SNA_fn_ucGetLoadType();
extern CPA_EXPORT void SNA_fn_vSetLevelName(char *szLevelName);
extern CPA_EXPORT char *SNA_fn_ucGetLevelName();
extern CPA_EXPORT void SNA_fn_vSetBigFile(ACP_tdxBool _bFigFileUsed);
extern CPA_EXPORT ACP_tdxBool SNA_fn_bBigFileUsed();
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __SNAGLOB_H__*/

View File

@@ -0,0 +1,108 @@
#ifndef __SNAMMG_H__
#define __SNAMMG_H__
#ifdef __cplusplus
extern "C" {
#endif
#define SNA_C_ucBlockOfFix 1 /* Indicates a block that is part of the fix*/
#define SNA_C_ucBlockOfLevel 2 /* Indicates a block that is part of the level*/
#define SNA_C_ucEmptyBlock 255 /* Only infos are saved for this block.*/
#define SNA_C_ulBlockNotLoaded 0
#define SNA_C_ulBlockLoaded 1
typedef struct tdstModuleBloc_
{
unsigned char *p_ucModuleId;
unsigned char ucBlockId;
/* unsigned char ucIsBlockLoaded;*/
} tdstModuleBloc;
#define SNA_M_SetBlocForSaving( Module, Block ) { &g_uc##Module##ModuleId, Block }
#define SNA_M_NbElementOfBlocArray(Array) (sizeof(Array)/sizeof(struct tdstModuleBloc_))
typedef struct tdstPtr_
{
unsigned long p_vPtr;
unsigned char ucTargetModule;
unsigned char ucTargetBlock;
} tdstPtr;
#ifndef __CRB_Includes_SNA__ /* { */
typedef struct tdstBloc_
{
unsigned char ucModuleNumber;
unsigned char ucBlocNumber;
unsigned long ulSize;
struct tdstPtr_ *p_stPtr;
} tdstBloc;
typedef struct tdstRelocTable_
{
struct tdstBloc_ *p_stBloc;
unsigned char ucBlocNumber;
} tdstRelocTable;
typedef struct tdstReducedRelocTable_
{
unsigned long ulBlockIndex;
unsigned long ulPointerIndex;
} tdstReducedRelocTable;
extern CPA_EXPORT void SNA_fn_vSetSaveLoadFix();
extern CPA_EXPORT void SNA_fn_vSetSaveLoadLevel();
extern CPA_EXPORT void SNA_fn_xWriteOpenMemoryFile(char *szFilename);
extern CPA_EXPORT void SNA_fn_vCloseMemoryFile();
extern CPA_EXPORT void SNA_fn_vWriteAllMemoryBlocks(char *szFilename);
extern CPA_EXPORT BOOL SNA_fn_bReadAllMemoryBlocks(char *szFilename);
extern CPA_EXPORT void SNA_fn_bRelocateMemoryBlocks(char *szFilename);
extern CPA_EXPORT void SNA_fn_bDelocateMemoryBlocks();
extern CPA_EXPORT void SNA_fn_vInitArrays(); /* MR2711*/
extern ACP_tdxBool g_a_bIsBlocRelocated[C_ucNbOfMaxModule][10];
extern long g_a_ulOffset[C_ucNbOfMaxModule][10];
extern struct tdstModuleBloc_ g_a_stModuleBlocToSaveInLevel[];
extern struct tdstModuleBloc_ g_a_stModuleBlocToSaveInFix[];
extern unsigned long SNA_g_ulNbBlocksInFix;
extern unsigned long SNA_g_ulNbBlocksInLevel;
#ifndef RETAIL
void CPA_EXPORT SNA_fn_vCheckAllMMGBlocks();
void SNA_fn_vCheckMMGBlock( unsigned char _ucModule, unsigned char _ucBlock, unsigned char _ucLog );
#endif
#define SNA_M_vValidateLst(hFather, hLastElement, hCurrent, hNext) \
{ \
for(hCurrent=hLastElement,hNext=NULL; hCurrent!=NULL; hCurrent=LST2_M_DynamicGetPrevElement(hCurrent))\
{\
LST2_M_DynamicSetFather(hCurrent, hFather);\
LST2_M_DynamicSetNextElement(hCurrent, hNext);\
hNext=hCurrent; \
}\
} \
#define SNA_M_vValidateStaticLst(hFather, hLastElement, hCurrent, hNext) \
{ \
for(hCurrent=hLastElement,hNext=NULL; hCurrent!=NULL; hCurrent=LST2_M_StaticGetPrevElement(hCurrent))\
{\
LST2_M_StaticSetFather(hCurrent, hFather);\
LST2_M_StaticSetNextElement(hCurrent, hNext);\
hNext=hCurrent; \
}\
} \
#endif /* } ! __CRB_Includes_SNA__*/
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __SNAMMG_H__*/

View File

@@ -0,0 +1,269 @@
/*--------------------------------------------------------------------*
* SnaNoScr.h written by Guillaume Souchet (based on Michael Ryssen's code)
*
* Purpose : load binarized game desc scripts
* (game.dsc, game.mem, level.mem, level.dsc)
*--------------------------------------------------------------------*/
#ifndef __SNANOSCR_H__
#define __SNANOSCR_H__
#ifdef __cplusplus
extern "C" {
#endif
/* File containing game description (in the gamedata directory)*/
#define SNA_C_GameDscFileName "Game.dsb"
/* File containing level description is named <NameOfLevel>.dsb (in the level directory)*/
/* Type of the file currently opened*/
typedef enum tdeDscFileType_
{
SNA_C_NoDscFile = 0,
SNA_C_GameDscFile = 1,
SNA_C_LevelDscFile = 2
} tdeDscFileType;
/* File currently opened*/
extern enum tdeDscFileType_ SNA_g_eFileCurrentlyOpened;
/* Constants for SNA_fn_ucGetLoadDscType*/
/* and SNA_fn_vSetLoadDscType*/
#define SNA_C_LoadScriptDsc 0
#define SNA_C_LoadBinaryDsc 1
#define SNA_C_SaveBinaryDsc 2
/* Keyword constants in the dsb files.*/
/* From Game.mem */
#define SNA_C_ul_MemoryDescTitle 0
#define SNA_C_ul_GAMFixMemory 1
#define SNA_C_ul_ACPFixMemory 2
#define SNA_C_ul_ACPTextMemory 3
#define SNA_C_ul_AIFixMemory 4
#define SNA_C_ul_TMPFixMemory 5
#define SNA_C_ul_IPTMemory 6
#define SNA_C_ul_SAIFixMemory 7
#define SNA_C_ul_FontMemory 8
#define SNA_C_ul_PositionMemory 9
/* From level.mem */
#define SNA_C_ul_GAMLevelMemory 11
#define SNA_C_ul_AILevelMemory 12
#define SNA_C_ul_ACPLevelMemory 13
#define SNA_C_ul_SAILevelMemory 14
#define SNA_C_ul_TMPLevelMemory 15
/* From both, but should not be present in final release */
#ifndef RETAIL
#define SNA_C_ul_ScriptMemory 16
#endif
/* From game.dsc : level description */
#define SNA_C_ul_LevelNameTitle 30
#define SNA_C_ul_LevelName 31
/* From game.dsc and game.rnd: random description */
#define SNA_C_ul_RandomDescTitle 32
#define SNA_C_ul_RandomComputeTable 33
#define SNA_C_ul_RandomReadTable 34
/* From game.dsc : Directories description */
#define SNA_C_ul_DirectoryDescTitle 40
#define SNA_C_ul_DirectoryOfEngineDLL 41
#define SNA_C_ul_DirectoryOfGameData 42
#define SNA_C_ul_DirectoryOfTexts 43
#define SNA_C_ul_DirectoryOfWorld 44
#define SNA_C_ul_DirectoryOfLevels 45
#define SNA_C_ul_DirectoryOfFamilies 46
#define SNA_C_ul_DirectoryOfCharacters 47
#define SNA_C_ul_DirectoryOfAnimations 48
#define SNA_C_ul_DirectoryOfGraphicsClasses 49
#define SNA_C_ul_DirectoryOfGraphicsBanks 50
#define SNA_C_ul_DirectoryOfMechanics 51
#define SNA_C_ul_DirectoryOfSound 52
#define SNA_C_ul_DirectoryOfVisuals 53
#define SNA_C_ul_DirectoryOfEnvironment 54
#define SNA_C_ul_DirectoryOfMaterials 55
#define SNA_C_ul_DirectoryOfSaveGame 56
#define SNA_C_ul_DirectoryOfExtras 57
#define SNA_C_ul_DirectoryOfTexture 58
#define SNA_C_ul_DirectoryOfVignettes 59
#define SNA_C_ul_DirectoryOfOptions 60
#define SNA_C_ul_DirectoryOfLipsSync 61
#define SNA_C_ul_DirectoryOfZdx 62
#define SNA_C_ul_DirectoryOfEffects 63
/* From game.dsc : big file description */
#define SNA_C_ul_BigFileDescTitle 64
#define SNA_C_ul_BigFileVignettes 65
#define SNA_C_ul_BigFileTextures 66
/* From game.pbg & level.pbg : Vignette description */
#define SNA_C_ul_VignetteDescTitle 70
#define SNA_C_ul_LoadVignette 71
#define SNA_C_ul_LoadLevelVignette 72
#define SNA_C_ul_InitVignette 73
#define SNA_C_ul_FreeVignette 74
#define SNA_C_ul_DisplayVignette 75
#define SNA_C_ul_InitBarOutlineColor 76
#define SNA_C_ul_InitBarInsideColor 77
#define SNA_C_ul_InitBarColor 78
#define SNA_C_ul_CreateBar 79
#define SNA_C_ul_AddBar 80
#define SNA_C_ul_MaxValueBar 81
/* From level.dsc */
#define SNA_C_ul_LevelDscTitle 90
#define SNA_C_ul_NumberOfAlways 91
#define SNA_C_ul_LevelDscLevelSoundBanks 92
#define SNA_C_ul_LevelLoadMap 93
#define SNA_C_ul_LevelLoadSoundBank 94
/* From game.dsc : game options description */
#define SNA_C_ul_GameOptionDescTitle 100
#define SNA_C_ul_DefaultFile 101
#define SNA_C_ul_CurrentFile 102
#define SNA_C_ul_FrameSynchro 103
#ifdef USE_IPT_DX5
/* from game.dsc, input description */
#define SNA_C_ul_InitInputDeviceManager 110
/* from Device.ipt, active devices description */
#define SNA_C_ul_ActivateDeviceTitle 120
#define SNA_C_ul_ActivatePadAction 121
#define SNA_C_ul_ActivateJoystickAction 122
#define SNA_C_ul_ActivateKeyboardAction 123
#define SNA_C_ul_ActivateMouseAction 124
#endif /* USE_IPT_DX5 */
/* To say: "no more entries" */
#define SNA_C_ulEndOfDescSection 0xffff
/*
* public functions and macros
*/
/** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Functions an macros for getting and setting
* Type of load and save and options
* These functions use as parameters or return following values :
* SNA_C_LoadScriptDsc (=0)
* SNA_C_LoadBinaryDsc (=1)
* SNA_C_SaveBinaryDsc (=2)
*/
extern CPA_EXPORT unsigned char SNA_fn_ucGetLoadDscType();
extern CPA_EXPORT void SNA_fn_vSetLoadDscType( unsigned char ucType );
/** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Macros for testing save and load options
*/
#define SNA_M_bTestSaveGameDesc() \
( (SNA_fn_ucGetLoadDscType() == SNA_C_SaveBinaryDsc) \
&& (SNA_g_eFileCurrentlyOpened == SNA_C_GameDscFile) )
#define SNA_M_bTestSaveLevelDesc() \
( (SNA_fn_ucGetLoadDscType() == SNA_C_SaveBinaryDsc) \
&& (SNA_g_eFileCurrentlyOpened == SNA_C_LevelDscFile) )
/*
#define SNA_M_bTestSaveLevelMemDesc() SNA_M_bTestSaveLevelDesc()
#define SNA_M_bTestSaveGameMemDesc() SNA_M_bTestSaveGameDesc()
*/
#define SNA_M_bTestSaveGameMemDesc() \
( (SNA_fn_ucGetLoadDscType() == SNA_C_SaveBinaryDsc) \
&& (SNA_g_eFileCurrentlyOpened != SNA_C_NoDscFile) )
#define SNA_M_bTestSaveLevelMemDesc() SNA_M_bTestSaveGameMemDesc()
/** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Macros for reading binarized dsc files
*/
#define SNA_M_BeginReadFromDscFile( eDscFileType ) \
{ \
SNA_fn_vOpenDscFileForReading( eDscFileType ); \
SNA_g_eFileCurrentlyOpened = eDscFileType; \
}
#define SNA_M_ReadSingleSectionFromDscFile() \
SNA_fn_vReadSectionFromDscFile( 1 )
#define SNA_M_ReadAllRemainingSectionsFromDscFile() \
SNA_fn_vReadSectionFromDscFile( 0xffff )
#define SNA_M_EndReadFromCurrentDscFile() \
{ \
SNA_fn_vCloseDscFile(); \
SNA_g_eFileCurrentlyOpened = SNA_C_NoDscFile; \
}
/** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Functions for making binarized dsc files
*/
/*#ifndef RETAIL*/
#define SNA_M_BeginWriteToDscFile( eDscFileType ) \
{ \
SNA_fn_vOpenDscFileForWriting( eDscFileType ); \
SNA_g_eFileCurrentlyOpened = eDscFileType; \
}
#define SNA_M_EndWriteToCurrentDscFile() \
{ \
SNA_fn_vCloseDscFile(); \
SNA_g_eFileCurrentlyOpened = SNA_C_NoDscFile; \
}
/* Functions for writing entries to a file*/
extern CPA_EXPORT void SNA_fn_vWriteNoParamEntryToCurrentDscFile( unsigned long ulEntryType );
extern CPA_EXPORT void SNA_fn_vWriteLongEntryToCurrentDscFile( unsigned long ulEntryType, unsigned long ulEntryParam );
extern CPA_EXPORT void SNA_fn_vWriteStringEntryToCurrentDscFile( unsigned long ulEntryType, char *szEntryParam );
extern CPA_EXPORT void SNA_fn_vWrite2LongEntryToCurrentDscFile( unsigned long ulEntryType, unsigned long, unsigned long);
extern CPA_EXPORT void SNA_fn_vWrite3StringsEntryToCurrentDscFile( unsigned long , char *, char *,char *);
extern CPA_EXPORT void SNA_fn_vWriteBlockToCurrentDscFile( char *d_cData, unsigned long ulSize );
extern CPA_EXPORT void SNA_fn_vWriteLongToCurrentDscFile( unsigned long ulLong );
extern CPA_EXPORT void SNA_fn_vWriteDoubleToCurrentDscFile( double _dfNumber );
extern CPA_EXPORT void SNA_fn_vWriteStringToCurrentDscFile( char *szString );
extern CPA_EXPORT void SNA_fn_vWriteIntArrayEntryToCurrentDscFile( unsigned long ulEntryType, int iEntryParam0, int *p_iArray );
/*#endif // RETAIL */
/*
* Misc functions
* Usually used through macros
*/
extern CPA_EXPORT void SNA_fn_vOpenDscFileForReading( enum tdeDscFileType_ _eFile );
extern CPA_EXPORT void SNA_fn_vReadSectionFromDscFile( unsigned short _usNumberOfSection );
extern CPA_EXPORT void SNA_fn_vOpenDscFileForWriting( enum tdeDscFileType_ _eFile );
extern CPA_EXPORT void SNA_fn_vOpenDscFile( enum tdeDscFileType_ _eFile, char *_szMode );
extern CPA_EXPORT void SNA_fn_vCloseDscFile();
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __SNANOSCR_H__*/

View File

@@ -0,0 +1,46 @@
#ifndef __SNAPOINT_H__
#define __SNAPOINT_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SNA_tdstFixInfo_
{
ALW_tdxHandleToModelList h_LastAlwaysInTheFix;
struct tdstObjectTypeElement_ * hLastFamilyTypeInTheFix;
struct tdstObjectTypeElement_ * hLastModelTypeInTheFix;
struct tdstObjectTypeElement_ * hLastPersonalTypeInTheFix;
unsigned long ulNbObject;
struct tdstEngineObject_ *a20_stObjects[20];
} SNA_tdstFixInfo;
extern struct SNA_tdstFixInfo_ SNA_g_stFixInfo;
extern CPA_EXPORT void SNA_fn_xWriteOpenGlobalPointersFile(char *szFileName);
extern CPA_EXPORT void SNA_fn_xReadOpenGlobalPointersFile(char *szFileName);
extern CPA_EXPORT void SNA_fn_vCloseGlobalPointersFile();
extern CPA_EXPORT void SNA_fn_vWritePointerInGlobalPointersFile(unsigned long ulPointerAdr);
extern CPA_EXPORT unsigned long SNA_fn_vReadPointerFromGlobalPointersFile();
extern CPA_EXPORT void SNA_fn_xReadOpenGlobalTextureFile();
extern CPA_EXPORT void SNA_fn_vCloseGlobalTextureFile();
extern CPA_EXPORT void SNA_fn_vRelocateTexturePointer(unsigned long **);
extern CPA_EXPORT void SNA_fn_vWriteStructureInGlobalPointersFile(void *p_vAdr,unsigned long ulStructSize);
extern CPA_EXPORT void SNA_fn_vReadStructureFromGlobalPointersFile(unsigned long *p_ulAdr,unsigned long ulStructSize);
extern CPA_EXPORT void SNA_fn_vWriteArrayWithoutPointerInGlobalPointersFile( void *p_vAdr, unsigned long ulNumberOfElements,unsigned long ulElementSize );
extern CPA_EXPORT void SNA_fn_vWriteArrayInGlobalPointersFile( void *p_vAdr, unsigned long ulNumberOfElements,unsigned long ulElementSize );
extern CPA_EXPORT void SNA_fn_vReadArrayWithoutPointerFromGlobalPointersFile( void *p_vAdr, unsigned long ulNumberOfElements,unsigned long ulElementSize );
extern CPA_EXPORT void SNA_fn_vReadArrayFromGlobalPointersFile( void *p_vAdr, unsigned long ulNumberOfElements,unsigned long ulElementSize );
/* MR1311*/
extern CPA_EXPORT void SNA_fn_vSimpleReadFromGlobalPointersFile(unsigned long *p_ulAdr,unsigned long ulStructSize);
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __SNAPOINT_H__*/

View File

@@ -0,0 +1,165 @@
#ifndef __SNARLT_H__
#define __SNARLT_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Relocation table : defs and macro for special load mode used by protection */
#define SNA_M_ProtectRelocationTableSize 20
/* Variables that contains the id of next relocation to load. */
extern unsigned char SNA_g_ucNextRelocationTableToLoad[];
extern DWORD SNA_g_a_dwInitKeyRelocationTableLoaded[SNA_M_ProtectRelocationTableSize];
extern DWORD SNA_g_a_dwProtectKeyRelocationTableLoaded[SNA_M_ProtectRelocationTableSize];
extern DWORD SNA_g_dwNumberOfRelocationTableLoaded;
/* File types */
#define SNA_C_ucSNARelocationTable 0 /* alphabetical order of extension */
#define SNA_C_ucGlobalPointersRelocationTable 1
#define SNA_C_ucSoundRelocationTable 2
#define SNA_C_ucTexturesRelocationTable 3
#define SNA_C_ucLipsSyncRelocationTable 4 /* Not used in Rayman II. */
/* Macros to manipulate the global variable */
#define SNA_M_vSetNextRelocationFileToLoad( ucLevelNumber, ucFileType ) \
{ \
SNA_g_ucNextRelocationTableToLoad[0] = (unsigned char)ucLevelNumber; \
SNA_g_ucNextRelocationTableToLoad[1] = (unsigned char)ucFileType; \
}
#define SNA_M_vSetNextRelocationFileTypeToLoad( ucFileType ) \
SNA_g_ucNextRelocationTableToLoad[1] = (unsigned char)ucFileType;
#define SNA_M_vSetNextRelocationFileLevelToLoad( ucFileType ) \
SNA_g_ucNextRelocationTableToLoad[0] = (unsigned char)ucLevelNumber;
#define SNA_M_vUpdateOccurrenceToLoad() \
{ \
SNA_g_ucNextRelocationTableToLoad[2] += (unsigned char)PTC_fn_lGetRandomRange(1,6);\
}
extern CPA_EXPORT unsigned char SNA_fn_ucGetLevelID( char *_p_szLevelName );
extern CPA_EXPORT tdstRelocTable *SNA_fn_pLoadRelocationTable();
extern CPA_EXPORT void SNA_fn_pFreeRelocationTable(tdstRelocTable * p_stRelocTable);
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* used to load unused relocTable (for protection) */
extern tdstRelocTable *SNA_g_PTCRelocationTable;
/* ---------------------------------------------------------------------------------------------- */
#define SNA_M_FreeRelocationTable() \
{ \
if (SNA_g_PTCRelocationTable) SNA_fn_pFreeRelocationTable(SNA_g_PTCRelocationTable); \
SNA_g_PTCRelocationTable = NULL; \
}
#define SNA_M_LoadUsedRelocationTable() \
{ \
SNA_M_FreeRelocationTable(); \
SNA_g_PTCRelocationTable = SNA_fn_pLoadRelocationTable(); \
}
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/*------------------------------------------------------------------------*/
#if defined(PTC_SYSTEM_ACTIVED) /* { */
/*------------------------------------------------------------------------*/
#define SNA_M_LoadUnusedRelocationTable() \
{ \
if (SNA_fn_bBigFileUsed() /* && PTC_fn_lGetRandom() & 0x1*/) \
{ \
SNA_g_ucNextRelocationTableToLoad[0] = (unsigned char)(g_stEngineStructure.ucNumberOfLevels - (SNA_g_ucNextRelocationTableToLoad[0] + SNA_g_ucNextRelocationTableToLoad[1])); \
SNA_g_ucNextRelocationTableToLoad[1] = (unsigned char)(4 - SNA_g_ucNextRelocationTableToLoad[1]); \
SNA_M_vUpdateOccurrenceToLoad(); \
SNA_M_LoadUsedRelocationTable(); \
} \
}
#define SNA_M_InitLoadRelocationTable() \
{ \
SNA_g_ucNextRelocationTableToLoad[0] = (unsigned char)PTC_fn_lGetRandomRange(0,g_stEngineStructure.ucNumberOfLevels); \
SNA_g_ucNextRelocationTableToLoad[1] = (unsigned char)PTC_fn_lGetRandomRange(0,3); \
SNA_g_ucNextRelocationTableToLoad[2] = (unsigned char)PTC_fn_lGetRandomRange(0,20);\
SNA_g_dwNumberOfRelocationTableLoaded = 0; \
}
#define SNA_M_ReInitLoadRelocationTable() \
{ \
SNA_g_dwNumberOfRelocationTableLoaded = 0; \
}
/*------------------------------------------------------------------------*/
#else /* } PTC_SYSTEM_ACTIVED { */
/*------------------------------------------------------------------------*/
#define SNA_M_LoadUnusedRelocationTable()
#define SNA_M_InitLoadRelocationTable()
#define SNA_M_ReInitLoadRelocationTable()
/*------------------------------------------------------------------------*/
#endif /* } PTC_SYSTEM_ACTIVED */
/*------------------------------------------------------------------------*/
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
INLINE DWORD SNA_fn_dwGetCryptKey(DWORD _dwValue)
{
DWORD dwTmp;
_dwValue ^= 123459876;
dwTmp = _dwValue / 127773;
_dwValue = 16807 * (_dwValue - dwTmp * 127773) - 2836 * dwTmp;
if (_dwValue < 0) _dwValue += 2147483647;
return _dwValue;
}
INLINE DWORD SNA_fn_dwGetCryptKeyRelocationTable()
{
DWORD dwValue = *((DWORD*)SNA_g_ucNextRelocationTableToLoad);
return SNA_fn_dwGetCryptKey (dwValue);
}
INLINE DWORD SNA_fn_dwGetProtectionKey(DWORD _dwValue)
{
DWORD dwTmp;
_dwValue ^= 123459876;
dwTmp = _dwValue / 44488;
_dwValue = 48271 * (_dwValue - dwTmp * 44488) - 3399 * dwTmp;
if (_dwValue < 0) _dwValue += 2147483647;
return _dwValue;
}
INLINE DWORD SNA_fn_dwGetProtectionKeyRelocationTable()
{
DWORD dwValue = *((DWORD*)SNA_g_ucNextRelocationTableToLoad);
return SNA_fn_dwGetProtectionKey (dwValue);
}
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------- */
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __SNAGLOB_H__*/

View File

@@ -0,0 +1,18 @@
#ifndef __SNASND_H__
#define __SNASND_H__
#ifdef __cplusplus
extern "C" {
#endif
extern CPA_EXPORT void SNA_fn_xWriteOpenSoundTableFile(char *szFileName);
extern CPA_EXPORT void SNA_fn_xReadOpenSoundTableFile(char *szFileName);
extern CPA_EXPORT void SNA_fn_vCloseSoundTableFile();
extern CPA_EXPORT void SNA_fn_vWriteSoundEntryInSoundTableFile(unsigned long ulId,unsigned long ulPointerAdr);
extern CPA_EXPORT void SNA_fn_vReadAndUpdateSoundPointers(char *szFileName);
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __SNASND_H__*/

View File

@@ -0,0 +1,28 @@
#ifndef __SNASYN_H__
#define __SNASYN_H__
#ifdef D_USE_LIPSYNC
#ifdef __cplusplus
extern "C" {
#endif
extern CPA_EXPORT void SNA_fn_xWriteOpenLipsSynchTableFile(char *szFileName);
extern CPA_EXPORT ACP_tdxBool SNA_fn_xReadOpenLipsSynchTableFile(char *szFileName);
extern CPA_EXPORT void SNA_fn_vCloseLipsSynchTableFile();
extern CPA_EXPORT void SNA_fn_vWriteLipsSynchEntryInLipsSynchTableFile(char *szVigFilename,unsigned long ulPointerAdr);
extern CPA_EXPORT void SNA_fn_vReadAndUpdateLipsSynchPointers();
extern CPA_EXPORT void fn_vOpenWriteLipsSynchroBloc(char *szFileName);
extern CPA_EXPORT void fn_vCloseWriteLipsSynchroBloc();
extern CPA_EXPORT void fn_vWriteLipsSynchroBloc(tdstLipsSynchroTable *p_stLSTable, char *szSectionName);
extern CPA_EXPORT void fn_vReadAllLipsSynchroBlocs(char *szFileName);
extern CPA_EXPORT tdstLipsSynchroTable *fn_p_stReturnLipsSynchTable(char *szSectionName);
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /*D_USE_LIPSYNC*/
#endif /* __SNASYN_H__*/

View File

@@ -0,0 +1,15 @@
#ifndef __SNAVIG_H__
#define __SNAVIG_H__
#ifdef __cplusplus
extern "C" {
#endif
unsigned long SNA_fn_ulGetMaxVignetteValueForLevel();
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __SNAVIG_H__*/