Add bsx loading to libsnes

This commit is contained in:
OV2 2012-01-28 01:52:28 +01:00
parent 0a7c84e767
commit 668f8becb7
2 changed files with 19 additions and 9 deletions

12
bsx.cpp
View File

@ -1023,11 +1023,19 @@ static bool8 BSX_LoadBIOS (void)
return (r); return (r);
} }
static bool8 is_BSX_BIOS (const uint8 *data, uint32 size)
{
if (size == BIOS_SIZE && strncmp((char *) (data + 0x7FC0), "Satellaview BS-X ", 21) == 0)
return (TRUE);
else
return (FALSE);
}
void S9xInitBSX (void) void S9xInitBSX (void)
{ {
Settings.BS = FALSE; Settings.BS = FALSE;
if (!memcmp(&Memory.ROM[0x7FC0], "Satellaview BS-X ", 21)) if (is_BSX_BIOS(Memory.ROM,Memory.CalculatedSize))
{ {
// BS-X itself // BS-X itself
@ -1074,7 +1082,7 @@ void S9xInitBSX (void)
BSX.bootup = Settings.BSXBootup; BSX.bootup = Settings.BSXBootup;
if (!BSX_LoadBIOS()) if (!BSX_LoadBIOS() && !is_BSX_BIOS(BIOSROM,BIOS_SIZE))
{ {
BSX.bootup = FALSE; BSX.bootup = FALSE;
memset(BIOSROM, 0, BIOS_SIZE); memset(BIOSROM, 0, BIOS_SIZE);

View File

@ -170,11 +170,14 @@ bool snes_load_cartridge_bsx_slotted(
} }
bool snes_load_cartridge_bsx( bool snes_load_cartridge_bsx(
const char *, const uint8_t *, unsigned, const char *rom_xml, const uint8_t *rom_data, unsigned rom_size,
const char *, const uint8_t *, unsigned const char *bsx_xml, const uint8_t *bsx_data, unsigned bsx_size
) )
{ {
return false; if(bsx_data==NULL)
return snes_load_cartridge_normal(rom_xml,rom_data,rom_size);
memcpy(Memory.BIOSROM,rom_data,rom_size);
return snes_load_cartridge_normal(bsx_xml,bsx_data,bsx_size);
} }
bool snes_load_cartridge_sufami_turbo( bool snes_load_cartridge_sufami_turbo(
@ -668,20 +671,19 @@ bool8 S9xContinueUpdate(int width, int height)
return S9xDeinitUpdate(width, height); return S9xDeinitUpdate(width, height);
} }
// Dummy functions that should probably be implemented correctly later. // Dummy functions that should probably be implemented correctly later.
void S9xParsePortConfig(ConfigFile&, int) {} void S9xParsePortConfig(ConfigFile&, int) {}
void S9xSyncSpeed() {} void S9xSyncSpeed() {}
//void S9xPollPointer(int, short*, short*) {} //void S9xPollPointer(int, short*, short*) {}
const char* S9xStringInput(const char* in) { return in; } const char* S9xStringInput(const char* in) { return in; }
const char* S9xGetFilename(const char* in, s9x_getdirtype) { return in; } const char* S9xGetFilename(const char* in, s9x_getdirtype) { return in; }
const char* S9xGetDirectory(s9x_getdirtype) { return NULL; } const char* S9xGetDirectory(s9x_getdirtype) { return ""; }
void S9xInitInputDevices() {} void S9xInitInputDevices() {}
const char* S9xChooseFilename(unsigned char) { return NULL; } const char* S9xChooseFilename(unsigned char) { return ""; }
void S9xHandlePortCommand(s9xcommand_t, short, short) {} void S9xHandlePortCommand(s9xcommand_t, short, short) {}
bool S9xPollButton(unsigned int, bool*) { return false; } bool S9xPollButton(unsigned int, bool*) { return false; }
void S9xToggleSoundChannel(int) {} void S9xToggleSoundChannel(int) {}
const char* S9xGetFilenameInc(const char* in, s9x_getdirtype) { return NULL; } const char* S9xGetFilenameInc(const char* in, s9x_getdirtype) { return ""; }
const char* S9xBasename(const char* in) { return in; } const char* S9xBasename(const char* in) { return in; }
bool8 S9xInitUpdate() { return TRUE; } bool8 S9xInitUpdate() { return TRUE; }
void S9xExtraUsage() {} void S9xExtraUsage() {}