diff --git a/core/hw/naomi/naomi_cart.cpp b/core/hw/naomi/naomi_cart.cpp index eb4d9c99e..cdf257f67 100644 --- a/core/hw/naomi/naomi_cart.cpp +++ b/core/hw/naomi/naomi_cart.cpp @@ -56,10 +56,10 @@ bool atomiswaveForceFeedback; static bool loadBios(const char *filename, Archive *child_archive, Archive *parent_archive, int region) { int biosid = 0; - for (; BIOS[biosid].name != NULL; biosid++) + for (; BIOS[biosid].name != nullptr; biosid++) if (!stricmp(BIOS[biosid].name, filename)) break; - if (BIOS[biosid].name == NULL) + if (BIOS[biosid].name == nullptr) { WARN_LOG(NAOMI, "Unknown BIOS %s", filename); return false; @@ -74,94 +74,53 @@ static bool loadBios(const char *filename, Archive *child_archive, Archive *pare DEBUG_LOG(NAOMI, "Loading BIOS from %s", path.c_str()); std::unique_ptr bios_archive(OpenArchive(path)); - MD5Sum md5; - bool found_region = false; u8 *biosData = nvmem::getBiosData(); - for (int romid = 0; bios->blobs[romid].filename != NULL; romid++) + for (int romid = 0; bios->blobs[romid].filename != nullptr && !found_region; romid++) { if (region == -1) { region = bios->blobs[romid].region; config::Region.override(region); } - else - { - if (bios->blobs[romid].region != (u32)region) - continue; + else if (bios->blobs[romid].region != (u32)region) + continue; + + std::unique_ptr file; + // Find by CRC + if (child_archive != nullptr) + file.reset(child_archive->OpenFileByCrc(bios->blobs[romid].crc)); + if (!file && parent_archive != nullptr) + file.reset(parent_archive->OpenFileByCrc(bios->blobs[romid].crc)); + if (!file && bios_archive != nullptr) + file.reset(bios_archive->OpenFileByCrc(bios->blobs[romid].crc)); + // Fallback to find by filename + if (!file && child_archive != nullptr) + file.reset(child_archive->OpenFile(bios->blobs[romid].filename)); + if (!file && parent_archive != nullptr) + file.reset(parent_archive->OpenFile(bios->blobs[romid].filename)); + if (!file && bios_archive != nullptr) + file.reset(bios_archive->OpenFile(bios->blobs[romid].filename)); + if (!file) { + WARN_LOG(NAOMI, "%s: Cannot open %s", filename, bios->blobs[romid].filename); + continue; } + verify(bios->blobs[romid].offset + bios->blobs[romid].length <= BIOS_SIZE); + u32 read = file->Read(biosData + bios->blobs[romid].offset, bios->blobs[romid].length); + if (config::GGPOEnable) + { + MD5Sum md5; + md5.add(biosData + bios->blobs[romid].offset, bios->blobs[romid].length); + md5.getDigest(settings.network.md5.bios); + } + DEBUG_LOG(NAOMI, "Mapped %s: %x bytes at %07x", bios->blobs[romid].filename, read, bios->blobs[romid].offset); found_region = true; - if (bios->blobs[romid].blob_type == Copy) - { - verify(bios->blobs[romid].offset + bios->blobs[romid].length <= BIOS_SIZE); - verify(bios->blobs[romid].src_offset + bios->blobs[romid].length <= BIOS_SIZE); - memcpy(biosData + bios->blobs[romid].offset, biosData + bios->blobs[romid].src_offset, bios->blobs[romid].length); - DEBUG_LOG(NAOMI, "Copied: %x bytes from %07x to %07x", bios->blobs[romid].length, bios->blobs[romid].src_offset, bios->blobs[romid].offset); - } - else - { - std::unique_ptr file; - // Find by CRC - if (child_archive != NULL) - file.reset(child_archive->OpenFileByCrc(bios->blobs[romid].crc)); - if (!file && parent_archive != NULL) - file.reset(parent_archive->OpenFileByCrc(bios->blobs[romid].crc)); - if (!file && bios_archive != NULL) - file.reset(bios_archive->OpenFileByCrc(bios->blobs[romid].crc)); - // Fallback to find by filename - if (!file && child_archive != NULL) - file.reset(child_archive->OpenFile(bios->blobs[romid].filename)); - if (!file && parent_archive != NULL) - file.reset(parent_archive->OpenFile(bios->blobs[romid].filename)); - if (!file && bios_archive != NULL) - file.reset(bios_archive->OpenFile(bios->blobs[romid].filename)); - if (!file) { - WARN_LOG(NAOMI, "%s: Cannot open %s", filename, bios->blobs[romid].filename); - return false; - } - switch (bios->blobs[romid].blob_type) - { - case Normal: - { - verify(bios->blobs[romid].offset + bios->blobs[romid].length <= BIOS_SIZE); - u32 read = file->Read(biosData + bios->blobs[romid].offset, bios->blobs[romid].length); - if (config::GGPOEnable) - md5.add(biosData + bios->blobs[romid].offset, bios->blobs[romid].length); - DEBUG_LOG(NAOMI, "Mapped %s: %x bytes at %07x", bios->blobs[romid].filename, read, bios->blobs[romid].offset); - } - break; - - case InterleavedWord: - { - u8 *buf = (u8 *)malloc(bios->blobs[romid].length); - if (buf == nullptr) - throw NaomiCartException("Memory allocation failed"); - - verify(bios->blobs[romid].offset + bios->blobs[romid].length <= BIOS_SIZE); - u32 read = file->Read(buf, bios->blobs[romid].length); - u16 *to = (u16 *)(biosData + bios->blobs[romid].offset); - u16 *from = (u16 *)buf; - for (int i = bios->blobs[romid].length / 2; --i >= 0; to++) - *to++ = *from++; - free(buf); - if (config::GGPOEnable) - md5.add(biosData + bios->blobs[romid].offset, bios->blobs[romid].length); - DEBUG_LOG(NAOMI, "Mapped %s: %x bytes (interleaved word) at %07x", bios->blobs[romid].filename, read, bios->blobs[romid].offset); - } - break; - - default: - die("Unknown blob type\n"); - break; - } - } } - if (config::GGPOEnable) - md5.getDigest(settings.network.md5.bios); // Reload the writeable portion of the FlashROM - nvmem::reloadAWBios(); + if (found_region) + nvmem::reloadAWBios(); return found_region; } diff --git a/core/hw/naomi/naomi_roms.cpp b/core/hw/naomi/naomi_roms.cpp index bc0b17abf..677fbd9a7 100644 --- a/core/hw/naomi/naomi_roms.cpp +++ b/core/hw/naomi/naomi_roms.cpp @@ -29,9 +29,10 @@ const BIOS_t BIOS[] = { "airlbios", { - { 2, "epr-21802.ic27", 0x000000, 0x200000 }, - { 1, "epr-21801.ic27", 0x000000, 0x200000 }, - { 0, NULL, 0, 0 }, + // Airline Pilots Deluxe (Export) + { 2, "epr-21802.ic27", 0x000000, 0x200000, 0xa77c6b1c }, + // Airline Pilots Deluxe (USA) + { 1, "epr-21801.ic27", 0x000000, 0x200000, 0xa21bef24 }, } }, { @@ -40,53 +41,52 @@ const BIOS_t BIOS[] = { 0, "bios0.ic23", 0x000000, 0x020000 }, //or //{ "bios1.ic23", 0x000000, 0x020000 }, - { 0, NULL, 0, 0 }, } }, { "f355bios", { - { 2, "epr-22851.ic27", 0x000000, 0x200000 }, - { 1, "epr-22850.ic27", 0x000000, 0x200000 }, - { 0, "epr-22849.ic27", 0x000000, 0x200000 }, - { 0, NULL, 0, 0 }, + // Ferrari F355 (Export) + { 2, "epr-22851.ic27", 0x000000, 0x200000, 0x62483677 }, + // Ferrari F355 (USA) + { 1, "epr-22850.ic27", 0x000000, 0x200000, 0x28aa539d }, + // Ferrari F355 (Japan) + { 0, "epr-22849.ic27", 0x000000, 0x200000, 0x121e009c }, } }, { "f355dlx", { // Ferrari F355 Deluxe (Export) - { 2, "epr-21864.ic27", 0x000000, 0x200000 }, + { 2, "epr-21864.ic27", 0x000000, 0x200000, 0x12ed7c66 }, // Ferrari F355 Deluxe (USA) - { 1, "epr-21863.ic27", 0x000000, 0x200000 }, + { 1, "epr-21863.ic27", 0x000000, 0x200000, 0x0615a4d1 }, // Ferrari F355 Deluxe (Japan) - { 0, "epr-21862.ic27", 0x000000, 0x200000 }, + { 0, "epr-21862.ic27", 0x000000, 0x200000, 0x1f630716 }, // Ferrari F355 Deluxe (Export, prototype) //{ 2, "epr-21864p.ic27", 0x000000, 0x200000 }, // Ferrari F355 Deluxe (Japan, prototype) //{ 0, "epr-21862p.ic27", 0x000000, 0x200000 }, - { 0, NULL, 0, 0 }, } }, { "hod2bios", { - //export - { 2, "epr-21331.ic27", 0x000000, 0x200000 }, - //usa - { 1, "epr-21330.ic27", 0x000000, 0x200000 }, - //japan - { 0, "epr-21329.ic27", 0x000000, 0x200000 }, - { 0, NULL, 0, 0 }, + // HOTD2 (Export) + { 2, "epr-21331.ic27", 0x000000, 0x200000, 0x065f8500 }, + // HOTD2 (USA) + { 1, "epr-21330.ic27", 0x000000, 0x200000, 0x9e3bfa1b }, + // HOTD2 (Japan) + { 0, "epr-21329.ic27", 0x000000, 0x200000, 0xd99e5b9b }, } }, { "naomi", { //ROM_SYSTEM_BIOS( 0, "bios0", "epr-21576h (Japan)" ) - { 0, "epr-21576h.ic27", 0x000000, 0x200000 }, + { 0, "epr-21576h.ic27", 0x000000, 0x200000, 0xd4895685 }, //ROM_SYSTEM_BIOS( 1, "bios1", "epr-21576g (Japan)" ) - //{ 0, "epr-21576g.ic27", 0x000000, 0x200000 }, + { 0, "epr-21576g.ic27", 0x000000, 0x200000, 0xd2a1c6bf }, //ROM_SYSTEM_BIOS( 2, "bios2", "epr-21576e (Japan)" ) //{ 0, "epr-21576e.ic27", 0x000000, 0x200000 }, //ROM_SYSTEM_BIOS( 3, "bios3", "epr-21576d (Japan)" ) @@ -100,9 +100,9 @@ const BIOS_t BIOS[] = //ROM_SYSTEM_BIOS( 7, "bios7", "epr-21576 (Japan)" ) //{ 0, "epr-21576.ic27", 0x000000, 0x200000 }, //ROM_SYSTEM_BIOS( 8, "bios8", "epr-21578h (Export)" ) - { 2, "epr-21578h.ic27", 0x000000, 0x200000 }, + { 2, "epr-21578h.ic27", 0x000000, 0x200000, 0x7b452946 }, //ROM_SYSTEM_BIOS( 9, "bios9", "epr-21578g (Export)" ) - //{ 2, "epr-21578g.ic27", 0x000000, 0x200000 }, + { 2, "epr-21578g.ic27", 0x000000, 0x200000, 0x55413214 }, //ROM_SYSTEM_BIOS( 10, "bios10", "epr-21578f (Export)" ) //{ 2, "epr-21578f.ic27", 0x000000, 0x200000 }, //ROM_SYSTEM_BIOS( 11, "bios11", "epr-21578e (Export)" ) @@ -112,9 +112,9 @@ const BIOS_t BIOS[] = //ROM_SYSTEM_BIOS( 13, "bios13", "epr-21578a (Export)" ) //{ 2, "epr-21578a.ic27", 0x000000, 0x200000 }, //ROM_SYSTEM_BIOS( 14, "bios14", "epr-21577h (USA)" ) - { 1, "epr-21577h.ic27", 0x000000, 0x200000 }, + { 1, "epr-21577h.ic27", 0x000000, 0x200000, 0xfdf17452 }, //ROM_SYSTEM_BIOS( 15, "bios15", "epr-21577g (USA)" ) - //{ 1, "epr-21577g.ic27", 0x000000, 0x200000 }, + { 1, "epr-21577g.ic27", 0x000000, 0x200000, 0x25f64af7 }, //ROM_SYSTEM_BIOS( 16, "bios16", "epr-21577e (USA)" ) //{ 1, "epr-21577e.ic27", 0x000000, 0x200000 }, //ROM_SYSTEM_BIOS( 17, "bios17", "epr-21577d (USA)" ) @@ -122,7 +122,7 @@ const BIOS_t BIOS[] = //ROM_SYSTEM_BIOS( 18, "bios18", "epr-21577a (USA)" ) //{ 1, "epr-21577a.ic27", 0x000000, 0x200000 }, //ROM_SYSTEM_BIOS( 19, "bios19", "epr-21579d (Korea)" ) - { 3, "epr-21579d.ic27", 0x000000, 0x200000 }, + { 3, "epr-21579d.ic27", 0x000000, 0x200000, 0x33513691 }, //ROM_SYSTEM_BIOS( 20, "bios20", "epr-21579 (Korea)" ) //{ 3, "epr-21579.ic27", 0x000000, 0x200000 }, //ROM_SYSTEM_BIOS( 21, "bios21", "Set4 Dev BIOS" ) @@ -134,40 +134,30 @@ const BIOS_t BIOS[] = //ROM_SYSTEM_BIOS( 24, "bios24", "Development ROM Board" ) //{ 3, "zukinver0930.ic25", 0x000000, 0x200000 }, //ROM_SYSTEM_BIOS( 25, "bios25", "epr-21576h (multi-region hack)" ) - //{ 3, "epr-21576h_multi.ic27", 0x000000, 0x200000 }, - { 0, NULL, 0, 0 }, - } - }, - { - "naomigd", - { - //ROM_SYSTEM_BIOS( 0, "bios0", "epr-21576e (Japan)" ) - //{ 0, "epr-21576e.ic27", 0x000000, 0x200000 }, - //ROM_SYSTEM_BIOS( 1, "bios1", "epr-21576g (Japan)" ) - //{ 0, "epr-21576g.ic27", 0x000000, 0x200000 }, - //ROM_SYSTEM_BIOS( 2, "bios2", "epr-21576h (Japan)" ) - { 0, "epr-21576h.ic27", 0x000000, 0x200000 }, - //ROM_SYSTEM_BIOS( 3, "bios3", "epr-21578h (Export)" ) - { 2, "epr-21578h.ic27", 0x000000, 0x200000 }, - //ROM_SYSTEM_BIOS( 4, "bios4", "epr-21578g (Export)" ) - //{ 0, "epr-21578g.ic27", 0x000000, 0x200000 }, - //ROM_SYSTEM_BIOS( 5, "bios5", "epr-21578e (Export)" ) - //{ 0, "epr-21578e.ic27", 0x000000, 0x200000 }, - //ROM_SYSTEM_BIOS( 6, "bios6", "epr-21577h (USA)" ) - { 1, "epr-21577h.ic27", 0x000000, 0x200000 }, - //ROM_SYSTEM_BIOS( 7, "bios7", "epr-21577g (USA)" ) - //{ 0, "epr-21577g.ic27", 0x000000, 0x200000 }, - //ROM_SYSTEM_BIOS( 8, "bios8", "epr-21577e (USA)" ) - //{ 0, "epr-21577e.ic27", 0x000000, 0x200000 }, - { 0, NULL, 0, 0 }, + // The default dipswitch configuration selects Korea for the multiregion hacked BIOS + // See hw/maple/maple_jvs.cpp + { 3, "epr-21576h_multi.ic27", 0x000000, 0x200000, 0xcce01f1f }, } }, { "naomi2", { - { 0, "epr-23605c.ic27", 0x000000, 0x200000 }, - { 1, "epr-23607c.ic27", 0x000000, 0x200000 }, - { 2, "epr-23608c.ic27", 0x000000, 0x200000 }, + // epr-23605c (Japan) + { 0, "epr-23605c.ic27", 0x000000, 0x200000, 0x297ea6ed }, + // epr-23605b (Japan) + { 0, "epr-23605b.ic27", 0x000000, 0x200000, 0x3a3242d4 }, + // epr-23607c (USA) + { 1, "epr-23607c.ic27", 0x000000, 0x200000, 0x750e254b }, + // epr-23607b (USA) + { 1, "epr-23607b.ic27", 0x000000, 0x200000, 0xf308c5e9 }, + // epr-23608c (Export) + { 2, "epr-23608c.ic27", 0x000000, 0x200000, 0x6ef1dd8e }, + // epr-23608b (Export) + { 2, "epr-23608b.ic27", 0x000000, 0x200000, 0xa554b1e3 }, + // epr-23609b (Korea) + { 3, "epr-23609b.ic27", 0x000000, 0x200000, 0x99e3751f }, + // epr-23605c (multi-region hack) + { 3, "epr-23605c_multi.ic27", 0x000000, 0x200000, 0x353fdbcd }, } }, { diff --git a/core/hw/naomi/naomi_roms.h b/core/hw/naomi/naomi_roms.h index 16d17d61f..43e0726ff 100644 --- a/core/hw/naomi/naomi_roms.h +++ b/core/hw/naomi/naomi_roms.h @@ -59,8 +59,6 @@ struct BIOS_t u32 offset; u32 length; u32 crc; - BlobType blob_type; - u32 src_offset; // For copy } blobs[MAX_GAME_FILES]; }; extern const BIOS_t BIOS[]; diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index c68abb6ff..ebf654dd9 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -1461,21 +1461,27 @@ static void gui_display_settings() if (ImGui::BeginTabItem("General")) { ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, normal_padding); - const char *languages[] = { "Japanese", "English", "German", "French", "Spanish", "Italian", "Default" }; - OptionComboBox("Language", config::Language, languages, std::size(languages), - "The language as configured in the Dreamcast BIOS"); + { + DisabledScope scope(settings.platform.isArcade()); - const char *broadcast[] = { "NTSC", "PAL", "PAL/M", "PAL/N", "Default" }; - OptionComboBox("Broadcast", config::Broadcast, broadcast, std::size(broadcast), - "TV broadcasting standard for non-VGA modes"); + const char *languages[] = { "Japanese", "English", "German", "French", "Spanish", "Italian", "Default" }; + OptionComboBox("Language", config::Language, languages, std::size(languages), + "The language as configured in the Dreamcast BIOS"); - const char *region[] = { "Japan", "USA", "Europe", "Default" }; - OptionComboBox("Region", config::Region, region, std::size(region), + const char *broadcast[] = { "NTSC", "PAL", "PAL/M", "PAL/N", "Default" }; + OptionComboBox("Broadcast", config::Broadcast, broadcast, std::size(broadcast), + "TV broadcasting standard for non-VGA modes"); + } + + const char *consoleRegion[] = { "Japan", "USA", "Europe", "Default" }; + const char *arcadeRegion[] = { "Japan", "USA", "Export", "Korea" }; + const char **region = settings.platform.isArcade() ? arcadeRegion : consoleRegion; + OptionComboBox("Region", config::Region, region, std::size(consoleRegion), "BIOS region"); const char *cable[] = { "VGA", "RGB Component", "TV Composite" }; { - DisabledScope scope(config::Cable.isReadOnly()); + DisabledScope scope(config::Cable.isReadOnly() || settings.platform.isArcade()); const char *value = config::Cable == 0 ? cable[0] : config::Cable > 0 && config::Cable <= (int)std::size(cable) ? cable[config::Cable - 1] @@ -1492,9 +1498,9 @@ static void gui_display_settings() } ImGui::EndCombo(); } + ImGui::SameLine(); + ShowHelpMarker("Video connection type"); } - ImGui::SameLine(); - ShowHelpMarker("Video connection type"); #if !defined(TARGET_IPHONE) ImVec2 size;