diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index 5d3e40028..095f97f48 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -121,6 +121,7 @@ Option GDBPort("Debug.GDBPort", debugger::DEFAULT_PORT); Option GDBWaitForConnection("Debug.GDBWaitForConnection"); Option UseReios("UseReios"); Option FastGDRomLoad("FastGDRomLoad", false); +Option RamMod32MB("Dreamcast.RamMod32MB", false); Option OpenGlChecks("OpenGlChecks", false, "validate"); diff --git a/core/cfg/option.h b/core/cfg/option.h index a4d784894..5a1487486 100644 --- a/core/cfg/option.h +++ b/core/cfg/option.h @@ -480,6 +480,7 @@ extern Option GDBPort; extern Option GDBWaitForConnection; extern Option UseReios; extern Option FastGDRomLoad; +extern Option RamMod32MB; extern Option OpenGlChecks; diff --git a/core/emulator.cpp b/core/emulator.cpp index 0aefb9d84..cbbc0f65a 100644 --- a/core/emulator.cpp +++ b/core/emulator.cpp @@ -420,7 +420,7 @@ static void setPlatform(int platform) switch (platform) { case DC_PLATFORM_DREAMCAST: - settings.platform.ram_size = 16_MB; + settings.platform.ram_size = config::RamMod32MB ? 32_MB : 16_MB; settings.platform.vram_size = 8_MB; settings.platform.aram_size = 2_MB; settings.platform.bios_size = 2_MB; diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index f12aeb6ee..4be8d0bcf 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -2423,6 +2423,11 @@ static void gui_display_settings() OptionCheckbox("Serial Console", config::SerialConsole, "Dump the Dreamcast serial console to stdout"); #endif + { + DisabledScope scope(game_started); + OptionCheckbox("Dreamcast 32MB RAM Mod", config::RamMod32MB, + "Enables 32MB RAM Mod for Dreamcast. May affect compatibility"); + } OptionCheckbox("Dump Textures", config::DumpTextures, "Dump all textures into data/texdump/"); diff --git a/core/serialize.h b/core/serialize.h index 795a9693f..f364630be 100644 --- a/core/serialize.h +++ b/core/serialize.h @@ -67,7 +67,8 @@ public: V39, V40, V41, - Current = V41, + V42, + Current = V42, Next = Current + 1, }; @@ -101,6 +102,15 @@ public: throw Exception("Unsupported version"); if (_version > Current) throw Exception("Version too recent"); + + if(_version >= V42 && settings.platform.isConsole()) + { + u32 ramSize; + deserialize(ramSize); + if (ramSize != settings.platform.ram_size) { + throw Exception("Selected RAM Size doesn't match Save State"); + } + } } template @@ -162,6 +172,8 @@ public: { Version v = Current; serialize(v); + if (settings.platform.isConsole()) + serialize(settings.platform.ram_size); } template diff --git a/shell/libretro/libretro_core_options.h b/shell/libretro/libretro_core_options.h index c5664cd02..2e1a927d1 100644 --- a/shell/libretro/libretro_core_options.h +++ b/shell/libretro/libretro_core_options.h @@ -689,6 +689,20 @@ struct retro_core_option_v2_definition option_defs_us[] = { "disabled", #endif }, + { + CORE_OPTION_NAME "_dc_32mb_mod", + "Dreamcast 32MB RAM Mod", + NULL, + "Enables 32MB RAM Mod for Dreamcast. May affect compatibility", + NULL, + "hacks", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled", + }, { CORE_OPTION_NAME "_sh4clock", "SH4 CPU under/overclock", diff --git a/shell/libretro/option.cpp b/shell/libretro/option.cpp index 066e63573..f593db076 100644 --- a/shell/libretro/option.cpp +++ b/shell/libretro/option.cpp @@ -101,6 +101,7 @@ Option UseReios(CORE_OPTION_NAME "_hle_bios"); Option OpenGlChecks("", false); Option FastGDRomLoad(CORE_OPTION_NAME "_gdrom_fast_loading", false); +Option RamMod32MB(CORE_OPTION_NAME "_dc_32mb_mod", false); //Option, false> ContentPath(""); //Option HideLegacyNaomiRoms("", true); diff --git a/tests/src/serialize_test.cpp b/tests/src/serialize_test.cpp index 47e5a7a0b..16ad3d883 100644 --- a/tests/src/serialize_test.cpp +++ b/tests/src/serialize_test.cpp @@ -32,7 +32,7 @@ TEST_F(SerializeTest, SizeTest) std::vector data(30000000); Serializer ser(data.data(), data.size()); dc_serialize(ser); - ASSERT_EQ(28191378u, ser.size()); + ASSERT_EQ(28191382u, ser.size()); }