Skip to content

Commit

Permalink
partial support for sega driving simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
flyinghead committed Mar 9, 2023
1 parent 5644e83 commit f186046
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/cfg/cfg.h
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions core/cfg/cl.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -140,5 +140,4 @@ bool ParseCommandLine(int argc,char* argv[])
arg++;
cl--;
}
return false;
}
2 changes: 1 addition & 1 deletion core/hw/flashrom/nvmem.cpp
Expand Up @@ -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");
Expand Down
9 changes: 7 additions & 2 deletions core/hw/maple/maple_jvs.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down
25 changes: 25 additions & 0 deletions core/hw/naomi/naomi_roms.cpp
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions core/hw/naomi/naomi_roms_eeprom.h
Expand Up @@ -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_ */
38 changes: 38 additions & 0 deletions core/hw/naomi/naomi_roms_input.h
Expand Up @@ -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 },
},
};
3 changes: 2 additions & 1 deletion core/network/naomi_network.cpp
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions core/nullDC.cpp
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions core/types.h
Expand Up @@ -306,6 +306,7 @@ struct settings_t
{
bool multiboard;
bool slave;
int drivingSimSlave;
} naomi;

bool disableRenderer;
Expand Down

0 comments on commit f186046

Please sign in to comment.