From cb83d319b90e7d3bdb44450af36a2cb1a8aa731a Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 20 Mar 2023 12:35:36 +0100 Subject: [PATCH] naomi: 4-player and eeprom fixes Add 4-player support to Dirty Pigskin Football, WFF Royal Rumble, World kicks PCB and Beach Spikers. Fix several bugs in initEeprom and force 4-player cab when needed. Get rid of pstone, pstone2 and ringout default eeproms. --- core/emulator.cpp | 7 +++++-- core/hw/maple/maple_jvs.cpp | 15 +++++++------- core/hw/naomi/naomi_flashrom.cpp | 26 +++++++++++++++--------- core/hw/naomi/naomi_roms.cpp | 5 ----- core/hw/naomi/naomi_roms_eeprom.h | 33 ------------------------------- 5 files changed, 30 insertions(+), 56 deletions(-) diff --git a/core/emulator.cpp b/core/emulator.cpp index e04ad2c77..1bcae990a 100644 --- a/core/emulator.cpp +++ b/core/emulator.cpp @@ -273,7 +273,8 @@ static void loadSpecialSettings() settings.input.JammaSetup = JVS::RotaryEncoders; } else if (prod_id == "POWER STONE 2 JAPAN" // Naomi - || prod_id == "GUILTY GEAR isuka") // AW + || prod_id == "GUILTY GEAR isuka" // AW + || prod_id == "Dirty Pigskin Football") // AW { INFO_LOG(BOOT, "Enabling 4-player setup for game %s", prod_id.c_str()); settings.input.JammaSetup = JVS::FourPlayers; @@ -285,7 +286,9 @@ static void loadSpecialSettings() settings.input.JammaSetup = JVS::SegaMarineFishing; } else if (prod_id == "RINGOUT 4X4 JAPAN" - || prod_id == "VIRTUA ATHLETE") + || prod_id == "VIRTUA ATHLETE" + || prod_id == "ROYAL RUMBLE" + || prod_id == "BEACH SPIKERS JAPAN") { INFO_LOG(BOOT, "Enabling specific JVS setup for game %s", prod_id.c_str()); settings.input.JammaSetup = JVS::DualIOBoards4P; diff --git a/core/hw/maple/maple_jvs.cpp b/core/hw/maple/maple_jvs.cpp index 09ef12ae7..b04c718a5 100644 --- a/core/hw/maple/maple_jvs.cpp +++ b/core/hw/maple/maple_jvs.cpp @@ -881,17 +881,17 @@ maple_naomi_jamma::maple_naomi_jamma() io_boards.push_back(std::make_unique(1, this)); break; case JVS::DualIOBoards4P: - if (settings.content.gameId == "VIRTUA ATHLETE") + if (settings.content.gameId == "RINGOUT 4X4 JAPAN") + { + io_boards.push_back(std::make_unique(1, this)); + io_boards.push_back(std::make_unique(2, this, 2)); + } + else { // reverse the board order so that P1 is P1 io_boards.push_back(std::make_unique(1, this, 2)); io_boards.push_back(std::make_unique(2, this, 0)); } - else - { - io_boards.push_back(std::make_unique(1, this)); - io_boards.push_back(std::make_unique(2, this, 2)); - } break; case JVS::LightGun: io_boards.push_back(std::make_unique(1, this)); @@ -918,7 +918,8 @@ maple_naomi_jamma::maple_naomi_jamma() io_boards.push_back(std::make_unique(1, this)); break; case JVS::WorldKicksPCB: - io_boards.push_back(std::make_unique(1, this)); + io_boards.push_back(std::make_unique(1, this, 2)); + io_boards.push_back(std::make_unique(2, this)); break; case JVS::WaveRunnerGP: io_boards.push_back(std::make_unique(1, this)); diff --git a/core/hw/naomi/naomi_flashrom.cpp b/core/hw/naomi/naomi_flashrom.cpp index 8e13c30a0..c01ffdb46 100644 --- a/core/hw/naomi/naomi_flashrom.cpp +++ b/core/hw/naomi/naomi_flashrom.cpp @@ -149,22 +149,30 @@ static bool initEeprom(const RomBootID *bootId) for (int i = 0; i < 4; i++) write_naomi_eeprom(3 + i, bootId->gameID[i]); write_naomi_eeprom(7, 9); // FIXME 9 or 0x18? - if (bootId->cabinet & 8) - write_naomi_eeprom(8, 30); + if (bootId->cabinet == 0 + && (settings.input.JammaSetup == JVS::FourPlayers + || settings.input.JammaSetup == JVS::DualIOBoards4P + || settings.input.JammaSetup == JVS::WorldKicks + || settings.input.JammaSetup == JVS::WorldKicksPCB)) + write_naomi_eeprom(8, 0x30); + else if (bootId->cabinet & 8) + write_naomi_eeprom(8, 0x30); else if (bootId->cabinet & 4) - write_naomi_eeprom(8, 20); + write_naomi_eeprom(8, 0x20); else if (bootId->cabinet & 2) - write_naomi_eeprom(8, 10); + write_naomi_eeprom(8, 0x10); else write_naomi_eeprom(8, 0); - if (bootId->coinFlag[0][1] == 1) + if (bootId->coinFlag[0][0] == 1) { // ROM-specific defaults - write_naomi_eeprom(2, bootId->coinFlag[0][3] | (((bootId->coinFlag[0][3] & 2) ^ 2) << 3)); + write_naomi_eeprom(2, bootId->coinFlag[0][1] | (((bootId->coinFlag[0][1] & 2) ^ 2) << 3)); + if (bootId->coinFlag[0][2] == 1) // individual coin chute + write_naomi_eeprom(8, readEeprom(8) | 1); write_naomi_eeprom(9, bootId->coinFlag[0][3] - 1); - write_naomi_eeprom(10, bootId->coinFlag[0][6]); - write_naomi_eeprom(11, bootId->coinFlag[0][4]); - write_naomi_eeprom(12, bootId->coinFlag[0][5]); + write_naomi_eeprom(10, std::max(bootId->coinFlag[0][6], (u8)1)); + write_naomi_eeprom(11, std::max(bootId->coinFlag[0][4], (u8)1)); + write_naomi_eeprom(12, std::max(bootId->coinFlag[0][5], (u8)1)); write_naomi_eeprom(13, bootId->coinFlag[0][7]); write_naomi_eeprom(14, bootId->coinFlag[0][8] | (bootId->coinFlag[0][9] << 4)); write_naomi_eeprom(15, bootId->coinFlag[0][10] | (bootId->coinFlag[0][11] << 4)); diff --git a/core/hw/naomi/naomi_roms.cpp b/core/hw/naomi/naomi_roms.cpp index f675c87c4..e2ccacf18 100644 --- a/core/hw/naomi/naomi_roms.cpp +++ b/core/hw/naomi/naomi_roms.cpp @@ -2647,7 +2647,6 @@ const Game Games[] = }, nullptr, &pstone_inputs, - pstone_eeprom_dump, }, // Power Stone 2 { @@ -2674,7 +2673,6 @@ const Game Games[] = }, nullptr, &pstone2_inputs, - pstone2_eeprom_dump }, // Power Stone 2 (bootleg) { @@ -2701,7 +2699,6 @@ const Game Games[] = }, nullptr, &pstone2_inputs, - pstone2_eeprom_dump }, // Puyo Puyo Da! (Japan) { @@ -2764,7 +2761,6 @@ const Game Games[] = }, NULL, &ringout_inputs, - ringout_eeprom_dump }, // Ring Out 4x4 { @@ -2792,7 +2788,6 @@ const Game Games[] = }, NULL, &ringout_inputs, - ringout_eeprom_dump }, // Samba De Amigo (Rev B) { diff --git a/core/hw/naomi/naomi_roms_eeprom.h b/core/hw/naomi/naomi_roms_eeprom.h index d047a0b39..4dfd5a496 100644 --- a/core/hw/naomi/naomi_roms_eeprom.h +++ b/core/hw/naomi/naomi_roms_eeprom.h @@ -44,28 +44,6 @@ static u8 alpilot_eeprom_dump[] = { 0x00, 0x00, }; -static u8 pstone_eeprom_dump[] = { - 0xb8, 0xd7, 0x10, 0x42, 0x41, 0x42, 0x30, 0x18, 0x10, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, - 0xb8, 0xd7, 0x10, 0x42, 0x41, 0x42, 0x30, 0x18, 0x10, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, -}; - -static u8 pstone2_eeprom_dump[] = { - 0xd2, 0xf5, 0x10, 0x42, 0x42, 0x4a, 0x30, 0x09, 0x30, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, - 0xd2, 0xf5, 0x10, 0x42, 0x42, 0x4a, 0x30, 0x09, 0x30, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, - 0xa4, 0x79, 0x10, 0x10, 0xa4, 0x79, 0x10, 0x10, 0x30, 0x4a, 0x42, 0x42, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, - 0x03, 0x01, 0x00, 0x00, 0x01, 0x00, 0x30, 0x4a, 0x42, 0x42, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x03, 0x01, - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, -}; - static u8 illvelo_eeprom_dump[] = { 0xab, 0xa6, 0x11, 0x42, 0x51, 0x52, 0x00, 0x09, 0x00, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, 0xab, 0xa6, 0x11, 0x42, 0x51, 0x52, 0x00, 0x09, 0x00, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, @@ -154,17 +132,6 @@ static u8 spawn_eeprom_dump[] = { 0x00, 0x00, }; -static u8 ringout_eeprom_dump[] = { - 0xa2, 0x47, 0x10, 0x42, 0x41, 0x46, 0x32, 0x09, 0x31, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, - 0xa2, 0x47, 0x10, 0x42, 0x41, 0x46, 0x32, 0x09, 0x31, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, - 0xdf, 0xcb, 0x20, 0x20, 0xdf, 0xcb, 0x20, 0x20, 0xf2, 0xba, 0x20, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xf2, 0xba, 0x20, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, -}; - static u8 slashout_eeprom_dump[] = { 0x7f, 0x5d, 0x10, 0x42, 0x43, 0x45, 0x30, 0x18, 0x10, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, 0x7f, 0x5d, 0x10, 0x42, 0x43, 0x45, 0x30, 0x18, 0x10, 0x1a, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11,