Skip to content

Commit

Permalink
refactor: Fallback to A1200 config, if A600 ROM is not found (fixes #…
Browse files Browse the repository at this point in the history
…1183)

If the A600HD (2.05) Kickstart ROM is not available, Amiberry would try to use the A1200 3.0 one, but still using the CPU options from the XML. This of course failed, since that ROM requires an 020 CPU model.

Added a graceful fallback to A1200 config for such cases, where the CPU will also be set to 68020 in order to boot properly. Compatibility might be reduced, but at least it won't fail completely like before. The logs will also indicate that something like this has happened, to help troubleshoot things.
  • Loading branch information
midwan committed Nov 20, 2023
1 parent 3386f8a commit 4177add
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/osdep/amiberry_whdbooter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,16 +685,16 @@ void parse_gfx_settings(uae_prefs* prefs, game_options game_detail)
void set_compatibility_settings(uae_prefs* prefs, game_options game_detail, const bool a600_available)
{
std::string line_string;
// CPU 68020/040
if (strcmpi(game_detail.cpu, "68020") == 0 || strcmpi(game_detail.cpu, "68040") == 0)
// CPU 68020/040 or no A600 ROM available
if (strcmpi(game_detail.cpu, "68020") == 0 || strcmpi(game_detail.cpu, "68040") == 0 || !a600_available)
{
line_string = "cpu_type=";
line_string.append(game_detail.cpu);
line_string.append(a600_available ? game_detail.cpu : "68020");
parse_cfg_line(prefs, line_string);
}

// CPU 68000/010 [requires a600 rom)]
if ((strcmpi(game_detail.cpu, "68000") == 0 || strcmpi(game_detail.cpu, "68010") == 0) && a600_available)
else if ((strcmpi(game_detail.cpu, "68000") == 0 || strcmpi(game_detail.cpu, "68010") == 0) && a600_available)
{
line_string = "cpu_type=";
line_string.append(game_detail.cpu);
Expand All @@ -704,6 +704,14 @@ void set_compatibility_settings(uae_prefs* prefs, game_options game_detail, cons
parse_cfg_line(prefs, line_string);
}

// Fallback for any invalid values - 68020 CPU
else
{
write_log("Invalid CPU value, falling back to 68020!\n");
line_string = "cpu_type=68020";
parse_cfg_line(prefs, line_string);
}

// CPU SPEED
if (strcmpi(game_detail.clock, "7") == 0)
{
Expand Down Expand Up @@ -1112,7 +1120,11 @@ void whdload_auto_prefs(uae_prefs* prefs, char* filepath)
const auto a600_available = is_a600_available(prefs);
if (a600_available)
{
write_log("WHDBooter - Host: A600 ROM Available \n");
write_log("WHDBooter - Host: A600 ROM available, will use it for non-AGA titles\n");
}
else
{
write_log("WHDBooter - Host: A600 ROM not found, falling back to A1200 config for all titles\n");
}

// REMOVE THE FILE PATH AND EXTENSION
Expand All @@ -1123,8 +1135,8 @@ void whdload_auto_prefs(uae_prefs* prefs, char* filepath)
// CONFIG LOAD IF .UAE IS IN CONFIG PATH
build_uae_config_filename();

// if we have a config file, we will use it
// we will need it for the WHDLoad options too.
// If we have a config file, we will use it.
// We will need it for the WHDLoad options too.
if (my_existsfile2(uae_config))
{
write_log("WHDBooter - %s found. Loading Config for WHDLoad options.\n", uae_config);
Expand Down Expand Up @@ -1230,7 +1242,7 @@ void whdload_auto_prefs(uae_prefs* prefs, char* filepath)
const auto is_aga = strstr(filename, "AGA") != nullptr || strcmpi(game_detail.chipset, "AGA") == 0;
const auto is_cd32 = strstr(filename, "CD32") != nullptr || strcmpi(game_detail.chipset, "CD32") == 0;

if (is_aga || is_cd32)
if (is_aga || is_cd32 || !a600_available)
{
// SET THE BASE AMIGA (Expanded A1200)
built_in_prefs(prefs, 4, A1200_CONFIG, 0, 0);
Expand Down

0 comments on commit 4177add

Please sign in to comment.