Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dreamcast 32MB RAM Mod #1198

Merged
merged 7 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/cfg/option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Option<int> GDBPort("Debug.GDBPort", debugger::DEFAULT_PORT);
Option<bool> GDBWaitForConnection("Debug.GDBWaitForConnection");
Option<bool> UseReios("UseReios");
Option<bool> FastGDRomLoad("FastGDRomLoad", false);
Option<bool> RamMod32MB("Dreamcast.RamMod32MB", false);

Option<bool> OpenGlChecks("OpenGlChecks", false, "validate");

Expand Down
1 change: 1 addition & 0 deletions core/cfg/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ extern Option<int> GDBPort;
extern Option<bool> GDBWaitForConnection;
extern Option<bool> UseReios;
extern Option<bool> FastGDRomLoad;
extern Option<bool> RamMod32MB;

extern Option<bool> OpenGlChecks;

Expand Down
2 changes: 1 addition & 1 deletion core/emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions core/rend/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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/<game id>");

Expand Down
14 changes: 13 additions & 1 deletion core/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class SerializeBase
V39,
V40,
V41,
Current = V41,
V42,
Current = V42,

Next = Current + 1,
};
Expand Down Expand Up @@ -101,6 +102,15 @@ class Deserializer : public SerializeBase
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<typename T>
Expand Down Expand Up @@ -162,6 +172,8 @@ class Serializer : public SerializeBase
{
Version v = Current;
serialize(v);
if (settings.platform.isConsole())
serialize(settings.platform.ram_size);
}

template<typename T>
Expand Down
14 changes: 14 additions & 0 deletions shell/libretro/libretro_core_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions shell/libretro/option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Option<bool> UseReios(CORE_OPTION_NAME "_hle_bios");

Option<bool> OpenGlChecks("", false);
Option<bool> FastGDRomLoad(CORE_OPTION_NAME "_gdrom_fast_loading", false);
Option<bool> RamMod32MB(CORE_OPTION_NAME "_dc_32mb_mod", false);

//Option<std::vector<std::string>, false> ContentPath("");
//Option<bool, false> HideLegacyNaomiRoms("", true);
Expand Down
2 changes: 1 addition & 1 deletion tests/src/serialize_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TEST_F(SerializeTest, SizeTest)
std::vector<char> data(30000000);
Serializer ser(data.data(), data.size());
dc_serialize(ser);
ASSERT_EQ(28191378u, ser.size());
ASSERT_EQ(28191382u, ser.size());
}


Expand Down