diff options
Diffstat (limited to 'source/memmap.h')
-rw-r--r-- | source/memmap.h | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/source/memmap.h b/source/memmap.h index c4902f6..84eca92 100644 --- a/source/memmap.h +++ b/source/memmap.h @@ -93,35 +93,35 @@ #include "snes9x.h" #ifdef FAST_LSB_WORD_ACCESS -#define READ_WORD(s) (*(uint16 *) (s)) -#define READ_DWORD(s) (*(uint32 *) (s)) -#define WRITE_WORD(s, d) (*(uint16 *) (s)) = (d) -#define WRITE_DWORD(s, d) (*(uint32 *) (s)) = (d) +#define READ_WORD(s) (*(uint16_t *) (s)) +#define READ_DWORD(s) (*(uint32_t *) (s)) +#define WRITE_WORD(s, d) (*(uint16_t *) (s)) = (d) +#define WRITE_DWORD(s, d) (*(uint32_t *) (s)) = (d) -#define READ_3WORD(s) (0x00ffffff & *(uint32 *) (s)) -#define WRITE_3WORD(s, d) *(uint16 *) (s) = (uint16)(d),\ - *((uint8 *) (s) + 2) = (uint8) ((d) >> 16) +#define READ_3WORD(s) (0x00ffffff & *(uint32_t *) (s)) +#define WRITE_3WORD(s, d) *(uint16_t *) (s) = (uint16_t)(d),\ + *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16) #else -#define READ_WORD(s) ( *(uint8 *) (s) |\ - (*((uint8 *) (s) + 1) << 8)) -#define READ_DWORD(s) ( *(uint8 *) (s) |\ - (*((uint8 *) (s) + 1) << 8) |\ - (*((uint8 *) (s) + 2) << 16) |\ - (*((uint8 *) (s) + 3) << 24)) -#define WRITE_WORD(s, d) *(uint8 *) (s) = (d), \ - *((uint8 *) (s) + 1) = (d) >> 8 -#define WRITE_DWORD(s, d) *(uint8 *) (s) = (uint8) (d), \ - *((uint8 *) (s) + 1) = (uint8) ((d) >> 8),\ - *((uint8 *) (s) + 2) = (uint8) ((d) >> 16),\ - *((uint8 *) (s) + 3) = (uint8) ((d) >> 24) -#define WRITE_3WORD(s, d) *(uint8 *) (s) = (uint8) (d), \ - *((uint8 *) (s) + 1) = (uint8) ((d) >> 8),\ - *((uint8 *) (s) + 2) = (uint8) ((d) >> 16) -#define READ_3WORD(s) ( *(uint8 *) (s) |\ - (*((uint8 *) (s) + 1) << 8) |\ - (*((uint8 *) (s) + 2) << 16)) +#define READ_WORD(s) ( *(uint8_t *) (s) |\ + (*((uint8_t *) (s) + 1) << 8)) +#define READ_DWORD(s) ( *(uint8_t *) (s) |\ + (*((uint8_t *) (s) + 1) << 8) |\ + (*((uint8_t *) (s) + 2) << 16) |\ + (*((uint8_t *) (s) + 3) << 24)) +#define WRITE_WORD(s, d) *(uint8_t *) (s) = (d), \ + *((uint8_t *) (s) + 1) = (d) >> 8 +#define WRITE_DWORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), \ + *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8),\ + *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16),\ + *((uint8_t *) (s) + 3) = (uint8_t) ((d) >> 24) +#define WRITE_3WORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), \ + *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8),\ + *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16) +#define READ_3WORD(s) ( *(uint8_t *) (s) |\ + (*((uint8_t *) (s) + 1) << 8) |\ + (*((uint8_t *) (s) + 2) << 16)) #endif #define MEMMAP_BLOCK_SIZE (0x1000) @@ -140,13 +140,13 @@ #ifdef LOAD_FROM_MEMORY_TEST bool LoadROM(const struct retro_game_info* game); #else -bool8 LoadROM(const char*); -uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize); +bool LoadROM(const char*); +uint32_t FileLoader(uint8_t* buffer, const char* filename, int32_t maxsize); #endif -void InitROM(bool8); -bool8 LoadSRAM(const char*); -bool8 SaveSRAM(const char*); -bool8 S9xInitMemory(); +void InitROM(bool); +bool LoadSRAM(const char*); +bool SaveSRAM(const char*); +bool S9xInitMemory(); void S9xDeinitMemory(); void FreeSDD1Data(); @@ -157,7 +157,7 @@ void MapExtraRAM(); char* Safe(const char*); void BSLoROMMap(); -void JumboLoROMMap(bool8); +void JumboLoROMMap(bool); void LoROMMap(); void LoROM24MBSMap(); void SRAM512KLoROMMap(); @@ -165,22 +165,22 @@ void SRAM512KLoROMMap(); void SufamiTurboLoROMMap(); void HiROMMap(); void SuperFXROMMap(); -void TalesROMMap(bool8); +void TalesROMMap(bool); void AlphaROMMap(); void SA1ROMMap(); void BSHiROMMap(); void SPC7110HiROMMap(); -void SPC7110Sram(uint8); +void SPC7110Sram(uint8_t); void SetaDSPMap(); -bool8 AllASCII(uint8* b, int size); -int ScoreHiROM(bool8 skip_header, int32 offset); -int ScoreLoROM(bool8 skip_header, int32 offset); +bool AllASCII(uint8_t* b, int size); +int ScoreHiROM(bool skip_header, int32_t offset); +int ScoreLoROM(bool skip_header, int32_t offset); #if 0 void SufamiTurboAltROMMap(); #endif void ApplyROMFixes(); -void CheckForIPSPatch(const char* rom_filename, bool8 header, - int32* rom_size); +void CheckForIPSPatch(const char* rom_filename, bool header, + int32_t* rom_size); const char* TVStandard(); const char* Speed(); @@ -192,7 +192,7 @@ const char* Size(); const char* Headers(); const char* ROMID(); const char* CompanyID(); -void ParseSNESHeader(uint8*); +void ParseSNESHeader(uint8_t*); enum { MAP_PPU, MAP_CPU, MAP_DSP, MAP_LOROM_SRAM, MAP_HIROM_SRAM, @@ -204,47 +204,47 @@ enum { MAX_ROM_SIZE = 0x800000 }; typedef struct { - uint8* RAM; - uint8* ROM; - uint8* VRAM; - uint8* SRAM; - uint8* BWRAM; - uint8* FillRAM; - uint8* C4RAM; - bool8 HiROM; - bool8 LoROM; - uint32 SRAMMask; - uint8 SRAMSize; - uint8* Map [MEMMAP_NUM_BLOCKS]; - uint8* WriteMap [MEMMAP_NUM_BLOCKS]; - uint8 MemorySpeed [MEMMAP_NUM_BLOCKS]; - uint8 BlockIsRAM [MEMMAP_NUM_BLOCKS]; - uint8 BlockIsROM [MEMMAP_NUM_BLOCKS]; + uint8_t* RAM; + uint8_t* ROM; + uint8_t* VRAM; + uint8_t* SRAM; + uint8_t* BWRAM; + uint8_t* FillRAM; + uint8_t* C4RAM; + bool HiROM; + bool LoROM; + uint32_t SRAMMask; + uint8_t SRAMSize; + uint8_t* Map [MEMMAP_NUM_BLOCKS]; + uint8_t* WriteMap [MEMMAP_NUM_BLOCKS]; + uint8_t MemorySpeed [MEMMAP_NUM_BLOCKS]; + uint8_t BlockIsRAM [MEMMAP_NUM_BLOCKS]; + uint8_t BlockIsROM [MEMMAP_NUM_BLOCKS]; char ROMName [ROM_NAME_LEN]; char ROMId [5]; char CompanyId [3]; - uint8 ROMSpeed; - uint8 ROMType; - uint8 ROMSize; - int32 ROMFramesPerSecond; - int32 HeaderCount; - uint32 CalculatedSize; - uint32 CalculatedChecksum; - uint32 ROMChecksum; - uint32 ROMComplementChecksum; - uint8* SDD1Index; - uint8* SDD1Data; - uint32 SDD1Entries; - uint32 SDD1LoggedDataCountPrev; - uint32 SDD1LoggedDataCount; - uint8 SDD1LoggedData [MEMMAP_MAX_SDD1_LOGGED_ENTRIES]; + uint8_t ROMSpeed; + uint8_t ROMType; + uint8_t ROMSize; + int32_t ROMFramesPerSecond; + int32_t HeaderCount; + uint32_t CalculatedSize; + uint32_t CalculatedChecksum; + uint32_t ROMChecksum; + uint32_t ROMComplementChecksum; + uint8_t* SDD1Index; + uint8_t* SDD1Data; + uint32_t SDD1Entries; + uint32_t SDD1LoggedDataCountPrev; + uint32_t SDD1LoggedDataCount; + uint8_t SDD1LoggedData [MEMMAP_MAX_SDD1_LOGGED_ENTRIES]; char ROMFilename [_MAX_PATH]; - uint8 ROMRegion; - uint32 ROMCRC32; - uint8 ExtendedFormat; - uint8* BSRAM; + uint8_t ROMRegion; + uint32_t ROMCRC32; + uint8_t ExtendedFormat; + uint8_t* BSRAM; #if 0 - bool8 LoadMulti(const char*, const char*, const char*); + bool LoadMulti(const char*, const char*, const char*); #endif } CMemory; @@ -252,24 +252,24 @@ void ResetSpeedMap(); extern CMemory Memory; void S9xDeinterleaveMode2(); -bool8 LoadZip(const char* zipname, - int32* TotalFileSize, - int32* headers, - uint8* buffer); +bool LoadZip(const char* zipname, + int32_t* TotalFileSize, + int32_t* headers, + uint8_t* buffer); void S9xAutoSaveSRAM(); #ifdef NO_INLINE_SET_GET -uint8 S9xGetByte(uint32 Address); -uint16 S9xGetWord(uint32 Address); -void S9xSetByte(uint8 Byte, uint32 Address); -void S9xSetWord(uint16 Byte, uint32 Address); -void S9xSetPCBase(uint32 Address); -uint8* S9xGetMemPointer(uint32 Address); -uint8* GetBasePointer(uint32 Address); - -extern uint8 OpenBus; +uint8_t S9xGetByte(uint32_t Address); +uint16_t S9xGetWord(uint32_t Address); +void S9xSetByte(uint8_t Byte, uint32_t Address); +void S9xSetWord(uint16_t Byte, uint32_t Address); +void S9xSetPCBase(uint32_t Address); +uint8_t* S9xGetMemPointer(uint32_t Address); +uint8_t* GetBasePointer(uint32_t Address); + +extern uint8_t OpenBus; #else #define INLINE static inline |