- Added drive board ROM loading.

- Changed EnableFFeedback -> ForceFeedback to be more consistent with the other options.
- Updated help text.
This commit is contained in:
Bart Trzynadlowski 2011-09-08 01:07:06 +00:00
parent cd5bf4c1dd
commit 70ec09de92
8 changed files with 1734 additions and 1652 deletions

File diff suppressed because it is too large Load diff

View file

@ -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 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)
// ROM files
struct ROMInfo ROM[48];

View file

@ -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 <stdio.h>
@ -117,11 +119,11 @@ void CDriveBoard::LoadState(CBlockFile *SaveState)
BOOL CDriveBoard::Init(const UINT8 *romPtr)
{
// Assign ROM
// Assign ROM (note that the ROM data has not yet been loaded)
m_rom = romPtr;
// 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)
return OKAY;

View file

@ -11,14 +11,14 @@
class CDriveBoardConfig
{
public:
bool enableFFeedback; // Enable drive board emulation/simulation
bool forceFeedback; // Enable drive board emulation/simulation
bool simulateDrvBoard; // Simulate drive board rather than emulating it
unsigned steeringStrength; // Setting for steering strength on DIP switches of drive board
// Defaults
CDriveBoardConfig(void)
{
enableFFeedback = false;
forceFeedback = false;
simulateDrvBoard = false;
steeringStrength = 5;
}

View file

@ -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_DSBPROGROM 0xE0C0000 // 128 KB (DSB program)
#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)
{
@ -2525,10 +2529,14 @@ BOOL CModel3::LoadROMSet(const struct GameInfo *GameList, const char *zipFile)
{ "Samples", sampleROM },
{ "DSBProg", dsbROM },
{ "DSBMPEG", mpegROM },
{ "DriveBd", driveROM },
{ NULL, NULL }
};
PPC_CONFIG PPCConfig;
// Magic numbers to detect if optional ROMs are loaded
*(UINT64 *) driveROM = MAGIC_NUMBER;
// Load game
Game = LoadROMSetFromZIPFile(Map, GameList, zipFile, TRUE);
if (NULL == Game)
@ -2616,6 +2624,19 @@ BOOL CModel3::LoadROMSet(const struct GameInfo *GameList, const char *zipFile)
}
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
Patch();
@ -2665,7 +2686,7 @@ BOOL CModel3::Init(void)
mpegROM = &memoryPool[OFFSET_DSBMPEGROM];
backupRAM = &memoryPool[OFFSET_BACKUPRAM];
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);
// Initialize other devices (PowerPC and DSB initialized after ROMs loaded)
@ -2681,8 +2702,6 @@ BOOL CModel3::Init(void)
return FAIL;
if (OKAY != SoundBoard.Init(soundROM,sampleROM))
return FAIL;
if (OKAY != DriveBoard.Init(driveROM))
return FAIL;
PCIBridge.AttachPCIBus(&PCIBus);
PCIBus.AttachDevice(13,&GPU);

View file

@ -386,8 +386,8 @@ static void ApplySettings(CINIFile *INI, const char *section)
g_Config.emulateDSB = x ? true : false;
// Drive board
if (OKAY == INI->Get(section, "EnableFFeedback", x))
g_Config.enableFFeedback = x ? true : false;
if (OKAY == INI->Get(section, "ForceFeedback", x))
g_Config.forceFeedback = x ? true : false;
// OSD
INI->Get(section, "XResolution", g_Config.xRes);
@ -444,7 +444,7 @@ static void LogConfig(void)
InfoLog("\tMusicVolume = %d", g_Config.GetMusicVolume());
// CDriveBoardConfig
InfoLog("\tEnableFFeedback = %d", g_Config.enableFFeedback);
InfoLog("\tForceFeedback = %d", g_Config.forceFeedback);
// CRender3DConfig
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"))
{
n = 1;
CmdLine.Set("Global", "EnableFFeedback", n);
CmdLine.Set("Global", "ForceFeedback", n);
}
else if (!strncmp(argv[i],"-res",4))
{

View file

@ -211,7 +211,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
int romIdx; // index within Game->ROM
unsigned romsFound[sizeof(Game->ROM)/sizeof(struct ROMInfo)], numROMs;
int err;
unsigned i, n, maxSize;
unsigned i, maxSize;
BOOL multipleGameError = FALSE;
UINT8 *buf;
@ -294,7 +294,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
err = OKAY;
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);
}
if (err != OKAY)
@ -345,18 +345,12 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
// Ensure all ROMs were loaded
if (loadAll)
{
n = 0;
err = OKAY;
for (i = 0; i < numROMs; i++)
{
if (romsFound[i])
++n;
else
ErrorLog("Failed to load %s (CRC=%08X) from %s.", Game->ROM[i].fileName, Game->ROM[i].crc, zipFile);
if (!(romsFound[i] || Game->ROM[i].optional)) // if ROM not found and also not optional
err = ErrorLog("Could not load %s (CRC=%08X) from %s.", Game->ROM[i].fileName, Game->ROM[i].crc, zipFile);
}
if (n < numROMs)
err = FAIL;
else
err = OKAY;
}
else
err = OKAY;

View file

@ -42,6 +42,7 @@ 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