mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-02-16 17:35:39 +00:00
Added encryption keys, converted to cstdint types, fixed whitespace
This commit is contained in:
parent
c7ad13fb31
commit
0d989831ed
6265
Src/Games.cpp
6265
Src/Games.cpp
File diff suppressed because it is too large
Load diff
75
Src/Games.h
75
Src/Games.h
|
@ -29,7 +29,7 @@
|
|||
#define INCLUDED_GAMES_H
|
||||
|
||||
|
||||
#include "ROMLoad.h" // ROMInfo structure
|
||||
#include "ROMLoad.h" // ROMInfo structure
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -37,27 +37,27 @@
|
|||
******************************************************************************/
|
||||
|
||||
// Input flags
|
||||
#define GAME_INPUT_COMMON 0x00001 // game has common controls
|
||||
#define GAME_INPUT_VEHICLE 0x00002 // game has vehicle controls
|
||||
#define GAME_INPUT_JOYSTICK1 0x00004 // game has joystick 1
|
||||
#define GAME_INPUT_JOYSTICK2 0x00008 // game has joystick 2
|
||||
#define GAME_INPUT_FIGHTING 0x00010 // game has fighting game controls
|
||||
#define GAME_INPUT_VR4 0x00020 // game has four VR view buttons
|
||||
#define GAME_INPUT_VIEWCHANGE 0x00040 // game has single view change button
|
||||
#define GAME_INPUT_SHIFT4 0x00080 // game has 4-speed shifter
|
||||
#define GAME_INPUT_COMMON 0x00001 // game has common controls
|
||||
#define GAME_INPUT_VEHICLE 0x00002 // game has vehicle controls
|
||||
#define GAME_INPUT_JOYSTICK1 0x00004 // game has joystick 1
|
||||
#define GAME_INPUT_JOYSTICK2 0x00008 // game has joystick 2
|
||||
#define GAME_INPUT_FIGHTING 0x00010 // game has fighting game controls
|
||||
#define GAME_INPUT_VR4 0x00020 // game has four VR view buttons
|
||||
#define GAME_INPUT_VIEWCHANGE 0x00040 // game has single view change button
|
||||
#define GAME_INPUT_SHIFT4 0x00080 // game has 4-speed shifter
|
||||
#define GAME_INPUT_SHIFTUPDOWN 0x00100 // game has up/down shifter
|
||||
#define GAME_INPUT_HANDBRAKE 0x00200 // game has handbrake
|
||||
#define GAME_INPUT_HANDBRAKE 0x00200 // game has handbrake
|
||||
#define GAME_INPUT_HARLEY 0x00400 // game has Harley Davidson controls
|
||||
#define GAME_INPUT_GUN1 0x00800 // game has light gun 1
|
||||
#define GAME_INPUT_GUN2 0x01000 // game has light gun 2
|
||||
#define GAME_INPUT_ANALOG_JOYSTICK 0x02000 // game has analog joystick
|
||||
#define GAME_INPUT_TWIN_JOYSTICKS 0x04000 // game has twin joysticks
|
||||
#define GAME_INPUT_SOCCER 0x08000 // game has soccer controls
|
||||
#define GAME_INPUT_SPIKEOUT 0x10000 // game has Spikeout buttons
|
||||
#define GAME_INPUT_ANALOG_GUN1 0x20000 // game has analog gun 1
|
||||
#define GAME_INPUT_ANALOG_GUN2 0x40000 // game has analog gun 2
|
||||
#define GAME_INPUT_SKI 0x80000 // game has ski controls
|
||||
#define GAME_INPUT_ALL 0xFFFFF
|
||||
#define GAME_INPUT_GUN1 0x00800 // game has light gun 1
|
||||
#define GAME_INPUT_GUN2 0x01000 // game has light gun 2
|
||||
#define GAME_INPUT_ANALOG_JOYSTICK 0x02000 // game has analog joystick
|
||||
#define GAME_INPUT_TWIN_JOYSTICKS 0x04000 // game has twin joysticks
|
||||
#define GAME_INPUT_SOCCER 0x08000 // game has soccer controls
|
||||
#define GAME_INPUT_SPIKEOUT 0x10000 // game has Spikeout buttons
|
||||
#define GAME_INPUT_ANALOG_GUN1 0x20000 // game has analog gun 1
|
||||
#define GAME_INPUT_ANALOG_GUN2 0x40000 // game has analog gun 2
|
||||
#define GAME_INPUT_SKI 0x80000 // game has ski controls
|
||||
#define GAME_INPUT_ALL 0xFFFFF
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -71,23 +71,24 @@
|
|||
*/
|
||||
struct GameInfo
|
||||
{
|
||||
// Game information
|
||||
const char id[10]; // 9-character game identifier (also serves as zip archive file name)
|
||||
const char *parent; // parent game identifier
|
||||
const char *title; // complete game title
|
||||
const char *mfgName; // name of manufacturer
|
||||
unsigned year; // year released (in decimal)
|
||||
int step; // Model 3 hardware stepping: 0x10 = 1.0, 0x15 = 1.5, 0x20 = 2.0, 0x21 = 2.1
|
||||
unsigned cromSize; // size of fixed CROM (up to 8 MB)
|
||||
bool mirrorLow64MB; // mirror low 64 MB of banked CROM space to upper 64 MB
|
||||
unsigned vromSize; // size of video ROMs (32 or 64 MB; if 32 MB, will have to be mirrored)
|
||||
unsigned sampleSize; // size of sample ROMS (8 or 16 MB; if 8 MB, will have to be mirrored)
|
||||
unsigned inputFlags; // game input types
|
||||
int mpegBoard; // MPEG music board type: 0 = none, 1 = DSB1 (Z80), 2 = DSB2 (68K).
|
||||
bool driveBoard; // drive board (supported if true)
|
||||
// Game information
|
||||
const char id[10]; // 9-character game identifier (also serves as zip archive file name)
|
||||
const char *parent; // parent game identifier
|
||||
const char *title; // complete game title
|
||||
const char *mfgName; // name of manufacturer
|
||||
unsigned year; // year released (in decimal)
|
||||
int step; // Model 3 hardware stepping: 0x10 = 1.0, 0x15 = 1.5, 0x20 = 2.0, 0x21 = 2.1
|
||||
unsigned cromSize; // size of fixed CROM (up to 8 MB)
|
||||
bool mirrorLow64MB; // mirror low 64 MB of banked CROM space to upper 64 MB
|
||||
unsigned vromSize; // size of video ROMs (32 or 64 MB; if 32 MB, will have to be mirrored)
|
||||
unsigned sampleSize; // size of sample ROMS (8 or 16 MB; if 8 MB, will have to be mirrored)
|
||||
unsigned inputFlags; // game input types
|
||||
int mpegBoard; // MPEG music board type: 0 = none, 1 = DSB1 (Z80), 2 = DSB2 (68K).
|
||||
bool driveBoard; // drive board (supported if true)
|
||||
uint32_t encryptionKey; // security board encryption device key (or 0 if not applicable)
|
||||
|
||||
// ROM files
|
||||
struct ROMInfo ROM[48];
|
||||
// ROM files
|
||||
struct ROMInfo ROM[48];
|
||||
};
|
||||
|
||||
|
||||
|
@ -103,4 +104,4 @@ struct GameInfo
|
|||
extern const struct GameInfo g_Model3GameList[];
|
||||
|
||||
|
||||
#endif // INCLUDED_GAMES_H
|
||||
#endif // INCLUDED_GAMES_H
|
|
@ -30,14 +30,13 @@
|
|||
#include "Supermodel.h"
|
||||
#include "Pkgs/unzip.h"
|
||||
|
||||
static bool isPowerOfTwo(long x)
|
||||
static bool IsPowerOfTwo(long x)
|
||||
{
|
||||
while (((x & 1) == 0) && x > 1) // while x is even and > 1
|
||||
x >>= 1;
|
||||
return (x == 1);
|
||||
}
|
||||
|
||||
// Sega Bass Fishing
|
||||
static struct GameInfo cromInfo =
|
||||
{
|
||||
"crom.bin",
|
||||
|
@ -53,6 +52,7 @@ static struct GameInfo cromInfo =
|
|||
GAME_INPUT_COMMON|GAME_INPUT_JOYSTICK1,
|
||||
0, // no MPEG board
|
||||
false, // no drive board
|
||||
0, // no security board
|
||||
{
|
||||
{ NULL, false, NULL, 0, 0, 0, 0, 0, false }
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ static GameInfo * LoadCROMDirect(const struct ROMMap *Map, const char *file)
|
|||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
if (!isPowerOfTwo(fileSize))
|
||||
if (!IsPowerOfTwo(fileSize))
|
||||
{
|
||||
ErrorLog("CROM image size is not a power of 2.");
|
||||
fclose(fp);
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#ifndef INCLUDED_ROMLOAD_H
|
||||
#define INCLUDED_ROMLOAD_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Data Structures
|
||||
|
@ -40,20 +42,20 @@
|
|||
*/
|
||||
struct ROMInfo
|
||||
{
|
||||
// Function
|
||||
const char *region; // ROM region identifier (used as a key to search ROMMap)
|
||||
bool optional; // whether needs to be present or not
|
||||
|
||||
// Information used to identify files
|
||||
const char *fileName; // file name
|
||||
UINT32 crc; // CRC-32 checksum (same as zip format)
|
||||
unsigned fileSize; // file size in bytes (must be the same as all other ROMs with same region ID)
|
||||
|
||||
// Interleaving information
|
||||
unsigned groupSize; // number of consecutive bytes to fetch each time (groupSize%2 must = 0, must be consistent for region)
|
||||
unsigned offset; // starting offset within ROM region
|
||||
unsigned stride; // number of bytes to skip before loading next group of bytes from file (must be >= groupSize)
|
||||
bool byteSwap; // swap every pair of bytes if true
|
||||
// Function
|
||||
const char *region; // ROM region identifier (used as a key to search ROMMap)
|
||||
bool optional; // whether needs to be present or not
|
||||
|
||||
// Information used to identify files
|
||||
const char *fileName; // file name
|
||||
uint32_t crc; // CRC-32 checksum (same as zip format)
|
||||
unsigned fileSize; // file size in bytes (must be the same as all other ROMs with same region ID)
|
||||
|
||||
// Interleaving information
|
||||
unsigned groupSize; // number of consecutive bytes to fetch each time (groupSize%2 must = 0, must be consistent for region)
|
||||
unsigned offset; // starting offset within ROM region
|
||||
unsigned stride; // number of bytes to skip before loading next group of bytes from file (must be >= groupSize)
|
||||
bool byteSwap; // swap every pair of bytes if true
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -68,8 +70,8 @@ struct ROMInfo
|
|||
*/
|
||||
struct ROMMap
|
||||
{
|
||||
const char *region; // ROM region identifier
|
||||
UINT8 *ptr; // pointer to memory region
|
||||
const char *region; // ROM region identifier
|
||||
uint8_t *ptr; // pointer to memory region
|
||||
};
|
||||
|
||||
|
||||
|
@ -84,13 +86,13 @@ struct ROMMap
|
|||
* filled.
|
||||
*
|
||||
* Parameters:
|
||||
* dest Destination region.
|
||||
* destOffset Offset within destination to begin mirroring to.
|
||||
* destSize Size in bytes of destination region.
|
||||
* src Source region to copy from.
|
||||
* srcSize Size of region to copy from.
|
||||
* dest Destination region.
|
||||
* destOffset Offset within destination to begin mirroring to.
|
||||
* destSize Size in bytes of destination region.
|
||||
* src Source region to copy from.
|
||||
* srcSize Size of region to copy from.
|
||||
*/
|
||||
extern void CopyRegion(UINT8 *dest, unsigned destOffset, unsigned destSize, UINT8 *src, unsigned srcSize);
|
||||
extern void CopyRegion(uint8_t *dest, unsigned destOffset, unsigned destSize, uint8_t *src, unsigned srcSize);
|
||||
|
||||
/*
|
||||
* LoadROMSetFromZIPFile(Map, GameList, zipFile):
|
||||
|
@ -100,20 +102,19 @@ extern void CopyRegion(UINT8 *dest, unsigned destOffset, unsigned destSize, UINT
|
|||
* but the first detected game will be ignored.
|
||||
*
|
||||
* Parameters:
|
||||
* Map A list of pointers to the memory buffers for each ROM
|
||||
* region.
|
||||
* GameList List of all supported games and their ROMs.
|
||||
* zipFile ZIP file to load from.
|
||||
* loadAll If true, will check to ensure all ROMs were loaded.
|
||||
* Otherwise, omits this check and loads only specified
|
||||
* regions.
|
||||
* Map A list of pointers to the memory buffers for each ROM
|
||||
* region.
|
||||
* GameList List of all supported games and their ROMs.
|
||||
* zipFile ZIP file to load from.
|
||||
* loadAll If true, will check to ensure all ROMs were loaded.
|
||||
* Otherwise, omits this check and loads only specified
|
||||
* regions.
|
||||
*
|
||||
* Returns:
|
||||
* Pointer to GameInfo struct for loaded game if successful, NULL
|
||||
* otherwise. Prints errors.
|
||||
* Pointer to GameInfo struct for loaded game if successful, NULL
|
||||
* otherwise. Prints errors.
|
||||
*/
|
||||
extern const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const struct GameInfo *GameList, const char *zipFile,
|
||||
bool loadAll);
|
||||
extern const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const struct GameInfo *GameList, const char *zipFile, bool loadAll);
|
||||
|
||||
|
||||
#endif // INCLUDED_ROMLOAD_H
|
||||
#endif // INCLUDED_ROMLOAD_H
|
||||
|
|
Loading…
Reference in a new issue