diff --git a/Assets/gamedb/gamedb_sega_md.txt b/Assets/gamedb/gamedb_sega_md.txt index 6854ef14ed..46c87fe5a9 100644 --- a/Assets/gamedb/gamedb_sega_md.txt +++ b/Assets/gamedb/gamedb_sega_md.txt @@ -2653,12 +2653,12 @@ C5E4B901CA41524C182E576BEDB13981 Madden NFL 97 (UE) [!] GEN 31FDA133C077E6315232016CEDF3AABE Madden NFL 97 (UE) [b1] GEN 40D39CE3B288D3E3AC59ACE17CF053B7 Madden NFL 97 (UE) [b2] GEN 9277DB50DF385883749A74A87901B8C8 Madden NFL 97 (UE) [b3] GEN -7A960CF918F5D014BC5E5C330EA6642E Madden NFL 98 (U) [b1] GEN -E1A03EE2334ED425E71278D38A70E4E4 Madden NFL 98 (U) [b2] GEN -E3044F5DE786CFA13F2D689E427F62E3 Madden NFL 98 (U) [c][!] GEN -5B66890D9A48EE0EDF7FFAD7920BFCC8 Madden NFL 98 (U) [h1C] GEN -D9B1C5D34D112051E838F720A26CC8CF Madden NFL 98 (U) [h2C] GEN -22BBDE2293E404C5C91CD3CBE59CF4DD Madden NFL 98 (U) [h3C] GEN +7A960CF918F5D014BC5E5C330EA6642E Madden NFL 98 (U) [b1] GEN sram=1 +E1A03EE2334ED425E71278D38A70E4E4 Madden NFL 98 (U) [b2] GEN sram=1 +E3044F5DE786CFA13F2D689E427F62E3 Madden NFL 98 (U) [c][!] GEN sram=1 +5B66890D9A48EE0EDF7FFAD7920BFCC8 Madden NFL 98 (U) [h1C] GEN sram=1 +D9B1C5D34D112051E838F720A26CC8CF Madden NFL 98 (U) [h2C] GEN sram=1 +22BBDE2293E404C5C91CD3CBE59CF4DD Madden NFL 98 (U) [h3C] GEN sram=1 571F2908C01D5B4FEAFAC5663A85A897 Madonna Songs for 50HZ (PD) GEN 41B8BA3569E3F4F98155DEA64318D223 Madou Monogatari I (J) [!] GEN D82529E8ABD9D82C4907867ACE6C581B Madou Monogatari I (J) [b1] GEN @@ -3179,7 +3179,7 @@ ADD607E0DD5B9F294BB5A246D8946AED NHL 96 Elitserien (E) GEN 0D48E7FC7BE607CAA4B18615A718E5B7 NHL 97 (UE) [b1] GEN 31F2A66438932E5318A1BD46EC2CABB1 NHL 97 (UE) [b2] 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 C80ACA6AE52106638CAEE05FDE2FD9B7 NHL 98 (U) [h2C] GEN 03EB2646961C7B68E06A8CE5522538B9 NHL 98 (U) [h3C] GEN diff --git a/output/dll/gpgx.wbx.gz b/output/dll/gpgx.wbx.gz index 9b6ba498e6..2a59d1fd32 100644 Binary files a/output/dll/gpgx.wbx.gz and b/output/dll/gpgx.wbx.gz differ diff --git a/src/BizHawk.Client.Common/RomLoader.cs b/src/BizHawk.Client.Common/RomLoader.cs index 785b5202bd..5a90cdcfb9 100644 --- a/src/BizHawk.Client.Common/RomLoader.cs +++ b/src/BizHawk.Client.Common/RomLoader.cs @@ -557,7 +557,7 @@ namespace BizHawk.Client.Common nextEmulator = null; break; case "GEN": - var genesis = new GPGX(nextComm, null, new[] { disc }, GetCoreSettings(), GetCoreSyncSettings()); + var genesis = new GPGX(nextComm, game, null, new[] { disc }, GetCoreSettings(), GetCoreSyncSettings()); nextEmulator = genesis; break; case "SAT": @@ -824,7 +824,7 @@ namespace BizHawk.Client.Common { return false; } - nextEmulator = new GPGX(nextComm, null, genDiscs, GetCoreSettings(), GetCoreSyncSettings()); + nextEmulator = new GPGX(nextComm, game, null, genDiscs, GetCoreSettings(), GetCoreSyncSettings()); break; case "Game Gear": var leftBytesGG = xmlGame.Assets.First().Value; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs index 5e66deb66a..26d010e658 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs @@ -23,12 +23,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx IInputPollable, IDebuggable, IDriveLight, ICodeDataLogger, IDisassemblable { [CoreConstructor("GEN")] - public GPGX(CoreComm comm, byte[] file, object settings, object syncSettings) - : this(comm, file, null, settings, syncSettings) + public GPGX(CoreComm comm, GameInfo game, byte[] file, object settings, object syncSettings) + : this(comm, game, file, null, settings, syncSettings) { } - public GPGX(CoreComm comm, byte[] rom, IEnumerable cds, object settings, object syncSettings) + public GPGX(CoreComm comm, GameInfo game, byte[] rom, IEnumerable cds, object settings, object syncSettings) { ServiceProvider = new BasicServiceProvider(this); // this can influence some things internally (autodetect romtype, etc) @@ -114,7 +114,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx 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"); { diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/LibGPGX.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/LibGPGX.cs index a05c0e2301..562f2e949e 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/LibGPGX.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/LibGPGX.cs @@ -50,7 +50,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx } [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)] public abstract void gpgx_get_fps(ref int num, ref int den); diff --git a/waterbox/gpgx/.vscode/settings.json b/waterbox/gpgx/.vscode/settings.json index a5401e1c1f..474940b1c6 100644 --- a/waterbox/gpgx/.vscode/settings.json +++ b/waterbox/gpgx/.vscode/settings.json @@ -2,5 +2,8 @@ { "editor.tabSize": 4, "editor.insertSpaces": false, - "editor.detectIndentation": false + "editor.detectIndentation": false, + "files.associations": { + "callbacks.h": "c" + } } \ No newline at end of file diff --git a/waterbox/gpgx/cinterface/cinterface.c b/waterbox/gpgx/cinterface/cinterface.c index 84efe5fa24..10d5a27be6 100644 --- a/waterbox/gpgx/cinterface/cinterface.c +++ b/waterbox/gpgx/cinterface/cinterface.c @@ -40,6 +40,8 @@ uint8 cinterface_custom_backdrop = 0; uint32 cinterface_custom_backdrop_color = 0xffff00ff; // pink extern uint8 border; +int cinterface_force_sram = 0; + #ifdef _MSC_VER #define GPGX_EX __declspec(dllexport) #else @@ -502,9 +504,16 @@ struct InitSettings 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..."); + + cinterface_force_sram = forcesram; + memset(&bitmap, 0, sizeof(bitmap)); strncpy(romextension, feromextension, 3); diff --git a/waterbox/gpgx/core/cart_hw/sram.c b/waterbox/gpgx/core/cart_hw/sram.c index 3389163ee3..d6b419ebcc 100644 --- a/waterbox/gpgx/core/cart_hw/sram.c +++ b/waterbox/gpgx/core/cart_hw/sram.c @@ -43,6 +43,8 @@ T_SRAM sram; +extern int cinterface_force_sram; + /**************************************************************************** * 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 */ sram.on = 0; } - - // by default, enable backup RAM for ROM smaller than 2MB - /* - else if (cart.romsize <= 0x200000) + else if (cinterface_force_sram && 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.end = 0x20ffff; sram.on = 1; } - */ } }