From f186046c985fcf750d02331ff4155bc7fdd083c7 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Thu, 9 Mar 2023 17:54:57 +0100 Subject: [PATCH] partial support for sega driving simulator --- core/cfg/cfg.h | 2 +- core/cfg/cl.cpp | 3 +-- core/hw/flashrom/nvmem.cpp | 2 +- core/hw/maple/maple_jvs.cpp | 9 ++++++-- core/hw/naomi/naomi_roms.cpp | 25 ++++++++++++++++++++ core/hw/naomi/naomi_roms_eeprom.h | 12 ++++++++++ core/hw/naomi/naomi_roms_input.h | 38 +++++++++++++++++++++++++++++++ core/network/naomi_network.cpp | 3 ++- core/nullDC.cpp | 6 ++--- core/types.h | 1 + 10 files changed, 90 insertions(+), 11 deletions(-) diff --git a/core/cfg/cfg.h b/core/cfg/cfg.h index be6163ca4c..f13279e542 100644 --- a/core/cfg/cfg.h +++ b/core/cfg/cfg.h @@ -14,7 +14,7 @@ bool cfgLoadBool(const std::string& section, const std::string& key, bool def); void cfgSetVirtual(const std::string& section, const std::string& key, const std::string& value); bool cfgIsVirtual(const std::string& section, const std::string& key); -bool ParseCommandLine(int argc, char *argv[]); +void ParseCommandLine(int argc, char *argv[]); void cfgSetAutoSave(bool autoSave); bool cfgHasSection(const std::string& section); diff --git a/core/cfg/cl.cpp b/core/cfg/cl.cpp index 9827a15078..768e990644 100644 --- a/core/cfg/cl.cpp +++ b/core/cfg/cl.cpp @@ -86,7 +86,7 @@ static int showhelp() return 0; } -bool ParseCommandLine(int argc,char* argv[]) +void ParseCommandLine(int argc,char* argv[]) { settings.content.path.clear(); int cl=argc-2; @@ -140,5 +140,4 @@ bool ParseCommandLine(int argc,char* argv[]) arg++; cl--; } - return false; } diff --git a/core/hw/flashrom/nvmem.cpp b/core/hw/flashrom/nvmem.cpp index 916a9119b5..d1317b7129 100644 --- a/core/hw/flashrom/nvmem.cpp +++ b/core/hw/flashrom/nvmem.cpp @@ -236,7 +236,7 @@ bool loadFiles() void saveFiles() { - if (settings.naomi.slave) + if (settings.naomi.slave || settings.naomi.drivingSimSlave) return; if (settings.platform.isConsole()) sys_nvmem->Save(getRomPrefix(), "nvmem.bin", "nvmem"); diff --git a/core/hw/maple/maple_jvs.cpp b/core/hw/maple/maple_jvs.cpp index dd3ed6da9d..2371ea076f 100644 --- a/core/hw/maple/maple_jvs.cpp +++ b/core/hw/maple/maple_jvs.cpp @@ -853,7 +853,7 @@ class jvs_namco_v226_pcb : public jvs_io_board maple_naomi_jamma::maple_naomi_jamma() { - if (!settings.naomi.slave) + if (settings.naomi.drivingSimSlave == 0 && !settings.naomi.slave) { switch (settings.input.JammaSetup) { @@ -1278,7 +1278,12 @@ void maple_naomi_jamma::handle_86_subcommand() w8(0x00); w8(0xff); // in(4) - w8(0xff); // in(5) bit0: 1=VGA, 0=NTSCi + u8 v = 0xf9; + if (settings.naomi.drivingSimSlave == 1) + v |= 2; + else if (settings.naomi.drivingSimSlave == 2) + v |= 4; + w8(v); // in(5) bit0: 1=VGA, 0=NTSCi w8(0xff); // in(6) w32(0x00); diff --git a/core/hw/naomi/naomi_roms.cpp b/core/hw/naomi/naomi_roms.cpp index ba52891e2a..f675c87c41 100644 --- a/core/hw/naomi/naomi_roms.cpp +++ b/core/hw/naomi/naomi_roms.cpp @@ -7083,6 +7083,31 @@ const Game Games[] = }, nullptr, &clubkart_inputs, + }, + { + "sgdrvsim", + nullptr, + "Sega Driving Simulator", + 0x20000000, + 0x5508, + "naomi2", + M4, + ROT0, + { + { "ic8.bin", 0x00000000, 0x4000000, 0x3ef5e62f }, + { "ic9.bin", 0x04000000, 0x4000000, 0x4edf67df }, + { "ic10.bin", 0x08000000, 0x4000000, 0xa3b0f436 }, + { "ic11.bin", 0x0c000000, 0x4000000, 0x200ad72c }, + { "ic12.bin", 0x10000000, 0x4000000, 0x90d192a4 }, + { "ic13.bin", 0x14000000, 0x4000000, 0xeed33acc }, + { "ic14.bin", 0x18000000, 0x4000000, 0x349267e9 }, + { "ic15.bin", 0x1c000000, 0x4000000, 0xacc0c039 }, + + { "317-0502-jpn.ic3", 0, 0x800, 0x528ad9e7, Key }, + }, + nullptr, + &drvsim_inputs, + sgdrvsim_eeprom_dump, }, // // Naomi 2 GD-ROM diff --git a/core/hw/naomi/naomi_roms_eeprom.h b/core/hw/naomi/naomi_roms_eeprom.h index 0ecee6744d..d047a0b391 100644 --- a/core/hw/naomi/naomi_roms_eeprom.h +++ b/core/hw/naomi/naomi_roms_eeprom.h @@ -654,4 +654,16 @@ static u8 kingrt66_eeprom_dump[] { 0x00, 0x00, }; +// network: alone +static u8 sgdrvsim_eeprom_dump[] { + 0x47, 0xDA, 0x10, 0x42, 0x41, 0x41, 0x30, 0x09, 0x00, 0x1A, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, + 0x47, 0xDA, 0x10, 0x42, 0x41, 0x41, 0x30, 0x09, 0x00, 0x1A, 0x01, 0x01, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11, + 0xB2, 0x69, 0x20, 0x20, 0xB2, 0x69, 0x20, 0x20, 0x44, 0x72, 0x76, 0x53, 0x69, 0x6D, 0x6D, 0x00, 0x05, 0x00, + 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, + 0x00, 0x00, 0xFF, 0xFF, 0x44, 0x72, 0x76, 0x53, 0x69, 0x6D, 0x6D, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x1E, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, +}; + #endif /* CORE_HW_NAOMI_NAOMI_ROMS_EEPROM_H_ */ diff --git a/core/hw/naomi/naomi_roms_input.h b/core/hw/naomi/naomi_roms_input.h index a254fb1883..7771963662 100644 --- a/core/hw/naomi/naomi_roms_input.h +++ b/core/hw/naomi/naomi_roms_input.h @@ -659,3 +659,41 @@ static InputDescriptors soulsurfer_inputs = { { "PITCH", Full, 1, true }, }, }; + +static InputDescriptors drvsim_inputs = { + { + { NAOMI_BTN0_KEY, "Turn R" }, + { NAOMI_BTN1_KEY, "Turn L" }, + { NAOMI_BTN2_KEY, "Shift 2" }, + { NAOMI_BTN3_KEY, "Shift 3" }, + { NAOMI_BTN4_KEY, "O/D Switch" }, + { NAOMI_BTN5_KEY, "S-Brake" }, + { NAOMI_BTN6_KEY, "IG-ON", 0, NAOMI_DOWN_KEY }, + { NAOMI_BTN7_KEY, "IG-START", 0, NAOMI_LEFT_KEY }, + { NAOMI_BTN8_KEY, "Shift 0", 0, NAOMI_BTN0_KEY }, + { NAOMI_UP_KEY, "Horn" }, + { NAOMI_DOWN_KEY, "Light 0" }, + { NAOMI_LEFT_KEY, "Light 1" }, + { NAOMI_RIGHT_KEY, "Light 2" }, + NAO_START_DESC + NAO_BASE_BTN_DESC + // P2 inputs: + // BTN0 Shift 0 + // BTN1 Shift 1 + // BTN2 BELT + // UP Washer + // DOWN IG-ON + // LEFT IG_START + // RIGHT HAZARD + // START WIPER-LO + // Unknown: + // STOP + // WIPER-HI + }, + { + { "Master", Full, 0 }, + { "Accelerator", Half, 4 }, + { "Brake", Half, 5 }, + { "Clutch", Full, 1 }, + }, +}; diff --git a/core/network/naomi_network.cpp b/core/network/naomi_network.cpp index 7a21bdcdd6..f7d73d5653 100644 --- a/core/network/naomi_network.cpp +++ b/core/network/naomi_network.cpp @@ -391,7 +391,8 @@ bool NaomiNetworkSupported() "SPIKERS BATTLE JAPAN VERSION", "VIRTUAL-ON ORATORIO TANGRAM", "WAVE RUNNER GP", "WORLD KICKS", "F355 CHALLENGE JAPAN", // Naomi 2 - "CLUB KART IN JAPAN", "INITIAL D", "INITIAL D Ver.2", "INITIAL D Ver.3", "THE KING OF ROUTE66" + "CLUB KART IN JAPAN", "INITIAL D", "INITIAL D Ver.2", "INITIAL D Ver.3", "THE KING OF ROUTE66", + "SAMPLE GAME MAX LONG NAME-" // Driving Simulator }; if (!config::NetworkEnable) return false; diff --git a/core/nullDC.cpp b/core/nullDC.cpp index ad7d2fe77a..15d2f3e8b0 100644 --- a/core/nullDC.cpp +++ b/core/nullDC.cpp @@ -27,15 +27,13 @@ int flycast_init(int argc, char* argv[]) ERROR_LOG(VMEM, "Failed to alloc mem"); return -1; } - if (ParseCommandLine(argc, argv)) - { - return 69; - } + ParseCommandLine(argc, argv); if (cfgLoadInt("naomi", "BoardId", 0) != 0) { settings.naomi.multiboard = true; settings.naomi.slave = true; } + settings.naomi.drivingSimSlave = cfgLoadInt("naomi", "DrivingSimSlave", 0); config::Settings::instance().reset(); LogManager::Shutdown(); diff --git a/core/types.h b/core/types.h index 21c5aeeed0..3ff3cda804 100644 --- a/core/types.h +++ b/core/types.h @@ -306,6 +306,7 @@ struct settings_t { bool multiboard; bool slave; + int drivingSimSlave; } naomi; bool disableRenderer;