mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
- Added drive board ROM loading.
- Changed EnableFFeedback -> ForceFeedback to be more consistent with the other options. - Updated help text.
This commit is contained in:
parent
cd5bf4c1dd
commit
70ec09de92
3323
Src/Games.cpp
3323
Src/Games.cpp
File diff suppressed because it is too large
Load diff
|
@ -77,6 +77,7 @@ struct GameInfo
|
||||||
unsigned sampleSize; // size of sample ROMS (8 or 16 MB; if 8 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
|
unsigned inputFlags; // game input types
|
||||||
int mpegBoard; // MPEG music board type: 0 = none, 1 = DSB1 (Z80), 2 = DSB2 (68K).
|
int mpegBoard; // MPEG music board type: 0 = none, 1 = DSB1 (Z80), 2 = DSB2 (68K).
|
||||||
|
bool driveBoard; // drive board (supported if true)
|
||||||
|
|
||||||
// ROM files
|
// ROM files
|
||||||
struct ROMInfo ROM[48];
|
struct ROMInfo ROM[48];
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//TODO: save state must record whether the drive board is active (if we load a state with inactive drive board while drive board is active, should
|
||||||
|
// disable currently active drive board. Perhaps this should be done in Model3.cpp?
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -117,11 +119,11 @@ void CDriveBoard::LoadState(CBlockFile *SaveState)
|
||||||
|
|
||||||
BOOL CDriveBoard::Init(const UINT8 *romPtr)
|
BOOL CDriveBoard::Init(const UINT8 *romPtr)
|
||||||
{
|
{
|
||||||
// Assign ROM
|
// Assign ROM (note that the ROM data has not yet been loaded)
|
||||||
m_rom = romPtr;
|
m_rom = romPtr;
|
||||||
|
|
||||||
// Check have a valid ROM and force feedback is enabled
|
// Check have a valid ROM and force feedback is enabled
|
||||||
m_attached = m_rom && g_Config.enableFFeedback;
|
m_attached = m_rom && g_Config.forceFeedback;
|
||||||
if (!m_attached)
|
if (!m_attached)
|
||||||
return OKAY;
|
return OKAY;
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
class CDriveBoardConfig
|
class CDriveBoardConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool enableFFeedback; // Enable drive board emulation/simulation
|
bool forceFeedback; // Enable drive board emulation/simulation
|
||||||
bool simulateDrvBoard; // Simulate drive board rather than emulating it
|
bool simulateDrvBoard; // Simulate drive board rather than emulating it
|
||||||
unsigned steeringStrength; // Setting for steering strength on DIP switches of drive board
|
unsigned steeringStrength; // Setting for steering strength on DIP switches of drive board
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
CDriveBoardConfig(void)
|
CDriveBoardConfig(void)
|
||||||
{
|
{
|
||||||
enableFFeedback = false;
|
forceFeedback = false;
|
||||||
simulateDrvBoard = false;
|
simulateDrvBoard = false;
|
||||||
steeringStrength = 5;
|
steeringStrength = 5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2506,7 +2506,11 @@ static void Dump(const char *file, UINT8 *buf, unsigned size, BOOL reverse32, BO
|
||||||
#define OFFSET_SAMPLEROM 0xD0C0000 // 16 MB (sound board samples)
|
#define OFFSET_SAMPLEROM 0xD0C0000 // 16 MB (sound board samples)
|
||||||
#define OFFSET_DSBPROGROM 0xE0C0000 // 128 KB (DSB program)
|
#define OFFSET_DSBPROGROM 0xE0C0000 // 128 KB (DSB program)
|
||||||
#define OFFSET_DSBMPEGROM 0xE0E0000 // 16 MB (DSB MPEG data -- Z80 version only uses 8MB)
|
#define OFFSET_DSBMPEGROM 0xE0E0000 // 16 MB (DSB MPEG data -- Z80 version only uses 8MB)
|
||||||
#define MEMORY_POOL_SIZE (0x800000 + 0x800000 + 0x8000000 + 0x4000000 + 0x20000 + 0x20000 + 0x80000 + 0x1000000 + 0x20000 + 0x1000000)
|
#define OFFSET_DRIVEROM 0xF0E0000 // 64 KB
|
||||||
|
#define MEMORY_POOL_SIZE (0x800000 + 0x800000 + 0x8000000 + 0x4000000 + 0x20000 + 0x20000 + 0x80000 + 0x1000000 + 0x20000 + 0x1000000 + 0x10000)
|
||||||
|
|
||||||
|
// 64-bit magic number to use detect if ROM was loaded
|
||||||
|
#define MAGIC_NUMBER 0x4C444D5245505553ULL
|
||||||
|
|
||||||
const struct GameInfo * CModel3::GetGameInfo(void)
|
const struct GameInfo * CModel3::GetGameInfo(void)
|
||||||
{
|
{
|
||||||
|
@ -2525,10 +2529,14 @@ BOOL CModel3::LoadROMSet(const struct GameInfo *GameList, const char *zipFile)
|
||||||
{ "Samples", sampleROM },
|
{ "Samples", sampleROM },
|
||||||
{ "DSBProg", dsbROM },
|
{ "DSBProg", dsbROM },
|
||||||
{ "DSBMPEG", mpegROM },
|
{ "DSBMPEG", mpegROM },
|
||||||
|
{ "DriveBd", driveROM },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
PPC_CONFIG PPCConfig;
|
PPC_CONFIG PPCConfig;
|
||||||
|
|
||||||
|
// Magic numbers to detect if optional ROMs are loaded
|
||||||
|
*(UINT64 *) driveROM = MAGIC_NUMBER;
|
||||||
|
|
||||||
// Load game
|
// Load game
|
||||||
Game = LoadROMSetFromZIPFile(Map, GameList, zipFile, TRUE);
|
Game = LoadROMSetFromZIPFile(Map, GameList, zipFile, TRUE);
|
||||||
if (NULL == Game)
|
if (NULL == Game)
|
||||||
|
@ -2616,6 +2624,19 @@ BOOL CModel3::LoadROMSet(const struct GameInfo *GameList, const char *zipFile)
|
||||||
}
|
}
|
||||||
SoundBoard.AttachDSB(DSB);
|
SoundBoard.AttachDSB(DSB);
|
||||||
|
|
||||||
|
// Drive board (if present)
|
||||||
|
if (Game->driveBoard)
|
||||||
|
{
|
||||||
|
// Was the optional drive board ROM loaded?
|
||||||
|
if (MAGIC_NUMBER != *(UINT64 *) driveROM) // magic number overwritten by ROM
|
||||||
|
{
|
||||||
|
if (DriveBoard.Init(driveROM))
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DriveBoard.Init(NULL); // disable
|
||||||
|
|
||||||
// Apply ROM patches
|
// Apply ROM patches
|
||||||
Patch();
|
Patch();
|
||||||
|
|
||||||
|
@ -2665,7 +2686,7 @@ BOOL CModel3::Init(void)
|
||||||
mpegROM = &memoryPool[OFFSET_DSBMPEGROM];
|
mpegROM = &memoryPool[OFFSET_DSBMPEGROM];
|
||||||
backupRAM = &memoryPool[OFFSET_BACKUPRAM];
|
backupRAM = &memoryPool[OFFSET_BACKUPRAM];
|
||||||
securityRAM = &memoryPool[OFFSET_SECURITYRAM];
|
securityRAM = &memoryPool[OFFSET_SECURITYRAM];
|
||||||
driveROM = NULL; // TODO - need to read drive board ROM, but not complain if it is not available
|
driveROM = &memoryPool[OFFSET_DRIVEROM];
|
||||||
SetCROMBank(0xFF);
|
SetCROMBank(0xFF);
|
||||||
|
|
||||||
// Initialize other devices (PowerPC and DSB initialized after ROMs loaded)
|
// Initialize other devices (PowerPC and DSB initialized after ROMs loaded)
|
||||||
|
@ -2681,8 +2702,6 @@ BOOL CModel3::Init(void)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
if (OKAY != SoundBoard.Init(soundROM,sampleROM))
|
if (OKAY != SoundBoard.Init(soundROM,sampleROM))
|
||||||
return FAIL;
|
return FAIL;
|
||||||
if (OKAY != DriveBoard.Init(driveROM))
|
|
||||||
return FAIL;
|
|
||||||
|
|
||||||
PCIBridge.AttachPCIBus(&PCIBus);
|
PCIBridge.AttachPCIBus(&PCIBus);
|
||||||
PCIBus.AttachDevice(13,&GPU);
|
PCIBus.AttachDevice(13,&GPU);
|
||||||
|
|
|
@ -386,8 +386,8 @@ static void ApplySettings(CINIFile *INI, const char *section)
|
||||||
g_Config.emulateDSB = x ? true : false;
|
g_Config.emulateDSB = x ? true : false;
|
||||||
|
|
||||||
// Drive board
|
// Drive board
|
||||||
if (OKAY == INI->Get(section, "EnableFFeedback", x))
|
if (OKAY == INI->Get(section, "ForceFeedback", x))
|
||||||
g_Config.enableFFeedback = x ? true : false;
|
g_Config.forceFeedback = x ? true : false;
|
||||||
|
|
||||||
// OSD
|
// OSD
|
||||||
INI->Get(section, "XResolution", g_Config.xRes);
|
INI->Get(section, "XResolution", g_Config.xRes);
|
||||||
|
@ -444,7 +444,7 @@ static void LogConfig(void)
|
||||||
InfoLog("\tMusicVolume = %d", g_Config.GetMusicVolume());
|
InfoLog("\tMusicVolume = %d", g_Config.GetMusicVolume());
|
||||||
|
|
||||||
// CDriveBoardConfig
|
// CDriveBoardConfig
|
||||||
InfoLog("\tEnableFFeedback = %d", g_Config.enableFFeedback);
|
InfoLog("\tForceFeedback = %d", g_Config.forceFeedback);
|
||||||
|
|
||||||
// CRender3DConfig
|
// CRender3DConfig
|
||||||
InfoLog("\tVertexShader = %s", g_Config.vertexShaderFile.c_str());
|
InfoLog("\tVertexShader = %s", g_Config.vertexShaderFile.c_str());
|
||||||
|
@ -1214,7 +1214,7 @@ int main(int argc, char **argv)
|
||||||
else if (!strcmp(argv[i], "-force-feedback"))
|
else if (!strcmp(argv[i], "-force-feedback"))
|
||||||
{
|
{
|
||||||
n = 1;
|
n = 1;
|
||||||
CmdLine.Set("Global", "EnableFFeedback", n);
|
CmdLine.Set("Global", "ForceFeedback", n);
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[i],"-res",4))
|
else if (!strncmp(argv[i],"-res",4))
|
||||||
{
|
{
|
||||||
|
|
|
@ -211,7 +211,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
|
||||||
int romIdx; // index within Game->ROM
|
int romIdx; // index within Game->ROM
|
||||||
unsigned romsFound[sizeof(Game->ROM)/sizeof(struct ROMInfo)], numROMs;
|
unsigned romsFound[sizeof(Game->ROM)/sizeof(struct ROMInfo)], numROMs;
|
||||||
int err;
|
int err;
|
||||||
unsigned i, n, maxSize;
|
unsigned i, maxSize;
|
||||||
BOOL multipleGameError = FALSE;
|
BOOL multipleGameError = FALSE;
|
||||||
UINT8 *buf;
|
UINT8 *buf;
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
|
||||||
err = OKAY;
|
err = OKAY;
|
||||||
for (i = 0; i < numROMs; i++)
|
for (i = 0; i < numROMs; i++)
|
||||||
{
|
{
|
||||||
if (romsFound[i] == 0)
|
if ((0 == romsFound[i]) && !Game->ROM[i].optional) // if not found and also not optional
|
||||||
err |= ErrorLog("%s (CRC=%08X) is missing from %s.", Game->ROM[i].fileName, Game->ROM[i].crc, zipFile);
|
err |= ErrorLog("%s (CRC=%08X) is missing from %s.", Game->ROM[i].fileName, Game->ROM[i].crc, zipFile);
|
||||||
}
|
}
|
||||||
if (err != OKAY)
|
if (err != OKAY)
|
||||||
|
@ -345,18 +345,12 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
|
||||||
// Ensure all ROMs were loaded
|
// Ensure all ROMs were loaded
|
||||||
if (loadAll)
|
if (loadAll)
|
||||||
{
|
{
|
||||||
n = 0;
|
err = OKAY;
|
||||||
for (i = 0; i < numROMs; i++)
|
for (i = 0; i < numROMs; i++)
|
||||||
{
|
{
|
||||||
if (romsFound[i])
|
if (!(romsFound[i] || Game->ROM[i].optional)) // if ROM not found and also not optional
|
||||||
++n;
|
err = ErrorLog("Could not load %s (CRC=%08X) from %s.", Game->ROM[i].fileName, Game->ROM[i].crc, zipFile);
|
||||||
else
|
|
||||||
ErrorLog("Failed to load %s (CRC=%08X) from %s.", Game->ROM[i].fileName, Game->ROM[i].crc, zipFile);
|
|
||||||
}
|
}
|
||||||
if (n < numROMs)
|
|
||||||
err = FAIL;
|
|
||||||
else
|
|
||||||
err = OKAY;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
err = OKAY;
|
err = OKAY;
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct ROMInfo
|
||||||
{
|
{
|
||||||
// Function
|
// Function
|
||||||
const char *region; // ROM region identifier (used as a key to search ROMMap)
|
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
|
// Information used to identify files
|
||||||
const char *fileName; // file name
|
const char *fileName; // file name
|
||||||
|
|
Loading…
Reference in a new issue