BSX rom is now optional. if missing, it will load directly into the

game.
This commit is contained in:
Daryl 2020-06-28 21:24:42 -06:00
parent ffde2f7bf3
commit 8435c09b65
3 changed files with 40 additions and 15 deletions

View File

@ -600,8 +600,8 @@ done you can proceed to run the emulator via the Homebrew Channel.
-=[ Satellaview (BS-X) ]=- -=[ Satellaview (BS-X) ]=-
Snes9x GX supports loading BS games. The BSX BIOS is required. Snes9x GX supports loading BS games. The BSX BIOS is not required.
Download the English + No DRM BS-X ROM here: If you wish to use one, download the English + No DRM BS-X ROM here:
https://project.satellaview.org/downloads.htm https://project.satellaview.org/downloads.htm
Put it in your snes9xgx folder, renamed to BS-X.bin. Put it in your snes9xgx folder, renamed to BS-X.bin.

View File

@ -49,6 +49,7 @@ bool inSz = false;
unsigned long SNESROMSize = 0; unsigned long SNESROMSize = 0;
bool loadingFile = false; bool loadingFile = false;
bool bsxBiosLoadFailed;
extern bool isBSX(); extern bool isBSX();
@ -377,9 +378,10 @@ static bool IsValidROM()
if(p != NULL) if(p != NULL)
{ {
if (strcasecmp(p, ".smc") == 0 || if (strcasecmp(p, ".bs") == 0 ||
strcasecmp(p, ".fig") == 0 || strcasecmp(p, ".fig") == 0 ||
strcasecmp(p, ".sfc") == 0 || strcasecmp(p, ".sfc") == 0 ||
strcasecmp(p, ".smc") == 0 ||
strcasecmp(p, ".swc") == 0) strcasecmp(p, ".swc") == 0)
{ {
if(zippedFilename) free(zippedFilename); if(zippedFilename) free(zippedFilename);
@ -455,8 +457,6 @@ int BrowserLoadSz()
return szfiles; return szfiles;
} }
static bool bsxBiosLoadFailed;
int WiiFileLoader() int WiiFileLoader()
{ {
size_t size; size_t size;
@ -531,9 +531,6 @@ int BrowserLoadFile()
{ {
ErrorPrompt("Error loading game!"); ErrorPrompt("Error loading game!");
} }
else if(bsxBiosLoadFailed) {
ErrorPrompt("BS-X BIOS file not found!");
}
else else
{ {
// load SRAM or snapshot // load SRAM or snapshot

View File

@ -14,6 +14,8 @@
#include "display.h" #include "display.h"
#include <math.h> #include <math.h>
extern bool bsxBiosLoadFailed;
//#define BSX_DEBUG //#define BSX_DEBUG
#define BIOS_SIZE 0x100000 #define BIOS_SIZE 0x100000
@ -1209,7 +1211,7 @@ uint8 * S9xGetBasePointerBSX (uint32 address)
static bool8 BSX_LoadBIOS (void) static bool8 BSX_LoadBIOS (void)
{ {
#ifdef GEKKO #ifdef GEKKO
return FALSE; // We're not loading the BIOS! return TRUE; // We're not loading the BIOS!
#else #else
FILE *fp; FILE *fp;
char path[PATH_MAX + 1], name[PATH_MAX + 1]; char path[PATH_MAX + 1], name[PATH_MAX + 1];
@ -1305,7 +1307,7 @@ void S9xInitBSX (void)
uint8 *header = r1 ? Memory.ROM + 0x7FC0 : Memory.ROM + 0xFFC0; uint8 *header = r1 ? Memory.ROM + 0x7FC0 : Memory.ROM + 0xFFC0;
FlashMode = (header[0x18] & 0xEF) == 0x20 ? FALSE : TRUE; FlashMode = (header[0x18] & 0xEF) == 0x20 ? FALSE : TRUE;
FlashSize = FLASH_SIZE; FlashSize = (header[0x19] & 0x20) ? PSRAM_SIZE : FLASH_SIZE;
// Fix Block Allocation Flags // Fix Block Allocation Flags
// (for games that don't have it setup properly, // (for games that don't have it setup properly,
@ -1374,12 +1376,38 @@ void S9xResetBSX (void)
BSX.out_index = 0; BSX.out_index = 0;
memset(BSX.output, 0, sizeof(BSX.output)); memset(BSX.output, 0, sizeof(BSX.output));
// starting from the bios if(bsxBiosLoadFailed) {
BSX.MMC[0x02] = BSX.MMC[0x03] = BSX.MMC[0x05] = BSX.MMC[0x06] = 0x80; BSX.MMC[0x02] = FlashMode ? 0x80: 0;
BSX.MMC[0x09] = BSX.MMC[0x0B] = 0x80;
BSX.MMC[0x07] = BSX.MMC[0x08] = 0x80; // per bios: run from psram or flash card
BSX.MMC[0x0E] = 0x80; if (FlashSize == PSRAM_SIZE)
{
memcpy(PSRAM, FlashROM, PSRAM_SIZE);
BSX.MMC[0x01] = 0x80;
BSX.MMC[0x03] = 0x80;
BSX.MMC[0x04] = 0x80;
BSX.MMC[0x0C] = 0x80;
BSX.MMC[0x0D] = 0x80;
}
else
{
BSX.MMC[0x03] = 0x80;
BSX.MMC[0x05] = 0x80;
BSX.MMC[0x06] = 0x80;
BSX.MMC[0x09] = BSX.MMC[0x0B] = 0x80;
}
BSX.MMC[0x0E] = 0x80;
}
else {
// starting from the bios
BSX.MMC[0x02] = BSX.MMC[0x03] = BSX.MMC[0x05] = BSX.MMC[0x06] = 0x80;
BSX.MMC[0x09] = BSX.MMC[0x0B] = 0x80;
BSX.MMC[0x07] = BSX.MMC[0x08] = 0x80;
BSX.MMC[0x0E] = 0x80;
}
// default register values // default register values
BSX.PPU[0x2196 - BSXPPUBASE] = 0x10; BSX.PPU[0x2196 - BSXPPUBASE] = 0x10;