Add option to force sram in genesis core (#1991)
gpgx upstream automatically gives 64KiB sram to every game of size 2MB or lower, unless specifically overrided. That sucks and we don't do it. But some games do need it; there's not enough information to autodetect otherwise. So add a flag that we can set in gameDB for it, and set it true for two known games that have problems otherwise.
This commit is contained in:
parent
976ea4967b
commit
a040e67c95
|
@ -2653,12 +2653,12 @@ C5E4B901CA41524C182E576BEDB13981 Madden NFL 97 (UE) [!] GEN
|
||||||
31FDA133C077E6315232016CEDF3AABE Madden NFL 97 (UE) [b1] GEN
|
31FDA133C077E6315232016CEDF3AABE Madden NFL 97 (UE) [b1] GEN
|
||||||
40D39CE3B288D3E3AC59ACE17CF053B7 Madden NFL 97 (UE) [b2] GEN
|
40D39CE3B288D3E3AC59ACE17CF053B7 Madden NFL 97 (UE) [b2] GEN
|
||||||
9277DB50DF385883749A74A87901B8C8 Madden NFL 97 (UE) [b3] GEN
|
9277DB50DF385883749A74A87901B8C8 Madden NFL 97 (UE) [b3] GEN
|
||||||
7A960CF918F5D014BC5E5C330EA6642E Madden NFL 98 (U) [b1] GEN
|
7A960CF918F5D014BC5E5C330EA6642E Madden NFL 98 (U) [b1] GEN sram=1
|
||||||
E1A03EE2334ED425E71278D38A70E4E4 Madden NFL 98 (U) [b2] GEN
|
E1A03EE2334ED425E71278D38A70E4E4 Madden NFL 98 (U) [b2] GEN sram=1
|
||||||
E3044F5DE786CFA13F2D689E427F62E3 Madden NFL 98 (U) [c][!] GEN
|
E3044F5DE786CFA13F2D689E427F62E3 Madden NFL 98 (U) [c][!] GEN sram=1
|
||||||
5B66890D9A48EE0EDF7FFAD7920BFCC8 Madden NFL 98 (U) [h1C] GEN
|
5B66890D9A48EE0EDF7FFAD7920BFCC8 Madden NFL 98 (U) [h1C] GEN sram=1
|
||||||
D9B1C5D34D112051E838F720A26CC8CF Madden NFL 98 (U) [h2C] GEN
|
D9B1C5D34D112051E838F720A26CC8CF Madden NFL 98 (U) [h2C] GEN sram=1
|
||||||
22BBDE2293E404C5C91CD3CBE59CF4DD Madden NFL 98 (U) [h3C] GEN
|
22BBDE2293E404C5C91CD3CBE59CF4DD Madden NFL 98 (U) [h3C] GEN sram=1
|
||||||
571F2908C01D5B4FEAFAC5663A85A897 Madonna Songs for 50HZ (PD) GEN
|
571F2908C01D5B4FEAFAC5663A85A897 Madonna Songs for 50HZ (PD) GEN
|
||||||
41B8BA3569E3F4F98155DEA64318D223 Madou Monogatari I (J) [!] GEN
|
41B8BA3569E3F4F98155DEA64318D223 Madou Monogatari I (J) [!] GEN
|
||||||
D82529E8ABD9D82C4907867ACE6C581B Madou Monogatari I (J) [b1] GEN
|
D82529E8ABD9D82C4907867ACE6C581B Madou Monogatari I (J) [b1] GEN
|
||||||
|
@ -3179,7 +3179,7 @@ ADD607E0DD5B9F294BB5A246D8946AED NHL 96 Elitserien (E) GEN
|
||||||
0D48E7FC7BE607CAA4B18615A718E5B7 NHL 97 (UE) [b1] GEN
|
0D48E7FC7BE607CAA4B18615A718E5B7 NHL 97 (UE) [b1] GEN
|
||||||
31F2A66438932E5318A1BD46EC2CABB1 NHL 97 (UE) [b2] GEN
|
31F2A66438932E5318A1BD46EC2CABB1 NHL 97 (UE) [b2] GEN
|
||||||
24D07598509CFBF10C450DD8FD274C41 NHL 97 (UE) [b3] GEN
|
24D07598509CFBF10C450DD8FD274C41 NHL 97 (UE) [b3] GEN
|
||||||
A2C92C09D420CF7C2D2E55E8777F3A31 NHL 98 (U) [c][!] GEN
|
A2C92C09D420CF7C2D2E55E8777F3A31 NHL 98 (U) [c][!] GEN sram=1
|
||||||
32917C8A2D984FE32B342DBDAF78F50C NHL 98 (U) [h1C] GEN
|
32917C8A2D984FE32B342DBDAF78F50C NHL 98 (U) [h1C] GEN
|
||||||
C80ACA6AE52106638CAEE05FDE2FD9B7 NHL 98 (U) [h2C] GEN
|
C80ACA6AE52106638CAEE05FDE2FD9B7 NHL 98 (U) [h2C] GEN
|
||||||
03EB2646961C7B68E06A8CE5522538B9 NHL 98 (U) [h3C] GEN
|
03EB2646961C7B68E06A8CE5522538B9 NHL 98 (U) [h3C] GEN
|
||||||
|
|
Binary file not shown.
|
@ -557,7 +557,7 @@ namespace BizHawk.Client.Common
|
||||||
nextEmulator = null;
|
nextEmulator = null;
|
||||||
break;
|
break;
|
||||||
case "GEN":
|
case "GEN":
|
||||||
var genesis = new GPGX(nextComm, null, new[] { disc }, GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
|
var genesis = new GPGX(nextComm, game, null, new[] { disc }, GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
|
||||||
nextEmulator = genesis;
|
nextEmulator = genesis;
|
||||||
break;
|
break;
|
||||||
case "SAT":
|
case "SAT":
|
||||||
|
@ -824,7 +824,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
nextEmulator = new GPGX(nextComm, null, genDiscs, GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
|
nextEmulator = new GPGX(nextComm, game, null, genDiscs, GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
|
||||||
break;
|
break;
|
||||||
case "Game Gear":
|
case "Game Gear":
|
||||||
var leftBytesGG = xmlGame.Assets.First().Value;
|
var leftBytesGG = xmlGame.Assets.First().Value;
|
||||||
|
|
|
@ -23,12 +23,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
IInputPollable, IDebuggable, IDriveLight, ICodeDataLogger, IDisassemblable
|
IInputPollable, IDebuggable, IDriveLight, ICodeDataLogger, IDisassemblable
|
||||||
{
|
{
|
||||||
[CoreConstructor("GEN")]
|
[CoreConstructor("GEN")]
|
||||||
public GPGX(CoreComm comm, byte[] file, object settings, object syncSettings)
|
public GPGX(CoreComm comm, GameInfo game, byte[] file, object settings, object syncSettings)
|
||||||
: this(comm, file, null, settings, syncSettings)
|
: this(comm, game, file, null, settings, syncSettings)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public GPGX(CoreComm comm, byte[] rom, IEnumerable<Disc> cds, object settings, object syncSettings)
|
public GPGX(CoreComm comm, GameInfo game, byte[] rom, IEnumerable<Disc> cds, object settings, object syncSettings)
|
||||||
{
|
{
|
||||||
ServiceProvider = new BasicServiceProvider(this);
|
ServiceProvider = new BasicServiceProvider(this);
|
||||||
// this can influence some things internally (autodetect romtype, etc)
|
// this can influence some things internally (autodetect romtype, etc)
|
||||||
|
@ -114,7 +114,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Core.gpgx_init(romextension, LoadCallback, _syncSettings.UseSixButton, system_a, system_b, _syncSettings.Region, _syncSettings.GetNativeSettings()))
|
var initResult = Core.gpgx_init(
|
||||||
|
romextension,
|
||||||
|
LoadCallback, _syncSettings.UseSixButton, system_a, system_b, _syncSettings.Region, game["sram"],
|
||||||
|
_syncSettings.GetNativeSettings());
|
||||||
|
|
||||||
|
if (!initResult)
|
||||||
throw new Exception($"{nameof(Core.gpgx_init)}() failed");
|
throw new Exception($"{nameof(Core.gpgx_init)}() failed");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
}
|
}
|
||||||
|
|
||||||
[BizImport(CallingConvention.Cdecl, Compatibility = true)]
|
[BizImport(CallingConvention.Cdecl, Compatibility = true)]
|
||||||
public abstract bool gpgx_init(string feromextension, load_archive_cb feload_archive_cb, bool sixbutton, INPUT_SYSTEM system_a, INPUT_SYSTEM system_b, Region region, [In]InitSettings settings);
|
public abstract bool gpgx_init(
|
||||||
|
string feromextension,
|
||||||
|
load_archive_cb feload_archive_cb,
|
||||||
|
bool sixbutton, INPUT_SYSTEM system_a, INPUT_SYSTEM system_b, Region region, bool forcesram,
|
||||||
|
[In]InitSettings settings);
|
||||||
|
|
||||||
[BizImport(CallingConvention.Cdecl)]
|
[BizImport(CallingConvention.Cdecl)]
|
||||||
public abstract void gpgx_get_fps(ref int num, ref int den);
|
public abstract void gpgx_get_fps(ref int num, ref int den);
|
||||||
|
|
|
@ -2,5 +2,8 @@
|
||||||
{
|
{
|
||||||
"editor.tabSize": 4,
|
"editor.tabSize": 4,
|
||||||
"editor.insertSpaces": false,
|
"editor.insertSpaces": false,
|
||||||
"editor.detectIndentation": false
|
"editor.detectIndentation": false,
|
||||||
|
"files.associations": {
|
||||||
|
"callbacks.h": "c"
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -40,6 +40,8 @@ uint8 cinterface_custom_backdrop = 0;
|
||||||
uint32 cinterface_custom_backdrop_color = 0xffff00ff; // pink
|
uint32 cinterface_custom_backdrop_color = 0xffff00ff; // pink
|
||||||
extern uint8 border;
|
extern uint8 border;
|
||||||
|
|
||||||
|
int cinterface_force_sram = 0;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define GPGX_EX __declspec(dllexport)
|
#define GPGX_EX __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
|
@ -502,9 +504,16 @@ struct InitSettings
|
||||||
uint32_t BackdropColor;
|
uint32_t BackdropColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
GPGX_EX int gpgx_init(const char *feromextension, ECL_ENTRY int (*feload_archive_cb)(const char *filename, unsigned char *buffer, int maxsize), int sixbutton, char system_a, char system_b, int region, struct InitSettings *settings)
|
GPGX_EX int gpgx_init(
|
||||||
|
const char *feromextension,
|
||||||
|
ECL_ENTRY int (*feload_archive_cb)(const char *filename, unsigned char *buffer, int maxsize),
|
||||||
|
int sixbutton, char system_a, char system_b, int region, int forcesram,
|
||||||
|
struct InitSettings *settings)
|
||||||
{
|
{
|
||||||
_debug_puts("Initializing GPGX native...");
|
_debug_puts("Initializing GPGX native...");
|
||||||
|
|
||||||
|
cinterface_force_sram = forcesram;
|
||||||
|
|
||||||
memset(&bitmap, 0, sizeof(bitmap));
|
memset(&bitmap, 0, sizeof(bitmap));
|
||||||
|
|
||||||
strncpy(romextension, feromextension, 3);
|
strncpy(romextension, feromextension, 3);
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
|
|
||||||
T_SRAM sram;
|
T_SRAM sram;
|
||||||
|
|
||||||
|
extern int cinterface_force_sram;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* A quick guide to external RAM on the Genesis
|
* A quick guide to external RAM on the Genesis
|
||||||
*
|
*
|
||||||
|
@ -201,17 +203,15 @@ void sram_init()
|
||||||
/* this prevents backup RAM from being mapped in place of mirrored ROM when using S&K LOCK-ON feature */
|
/* this prevents backup RAM from being mapped in place of mirrored ROM when using S&K LOCK-ON feature */
|
||||||
sram.on = 0;
|
sram.on = 0;
|
||||||
}
|
}
|
||||||
|
else if (cinterface_force_sram && cart.romsize <= 0x200000)
|
||||||
// by default, enable backup RAM for ROM smaller than 2MB
|
|
||||||
/*
|
|
||||||
else if (cart.romsize <= 0x200000)
|
|
||||||
{
|
{
|
||||||
// 64KB static RAM mapped to $200000-$20ffff
|
// by default, gpgx enables saveram for all rom no bigger than 2MB
|
||||||
|
// we don't do that because it confuses ram searches and debugging, and adds extra baggage to savestates
|
||||||
|
// but some games do need it, so allow that to be hacked in here
|
||||||
sram.start = 0x200000;
|
sram.start = 0x200000;
|
||||||
sram.end = 0x20ffff;
|
sram.end = 0x20ffff;
|
||||||
sram.on = 1;
|
sram.on = 1;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue