diff --git a/Config/Games.xml b/Config/Games.xml index f5eddea..6c59b2d 100644 --- a/Config/Games.xml +++ b/Config/Games.xml @@ -146,6 +146,7 @@ 2.1 DSB2 24 + true @@ -236,6 +237,7 @@ Sega Model 3 2.1 DSB2 + true @@ -315,6 +317,7 @@ 2.1 DSB2 0x16C311DB + true @@ -388,6 +391,7 @@ 2.1 DSB2 0x16C311DB + true @@ -419,6 +423,7 @@ 2.1 DSB2 0x16C311DB + true @@ -450,6 +455,7 @@ 2.1 DSB2 0x16C311DB + true @@ -767,6 +773,7 @@ Sega Model 3 2.0 + true @@ -839,6 +846,7 @@ Sega Model 3 2.0 + true @@ -939,6 +947,7 @@ Sega Model 3 1.5 + true @@ -1260,6 +1269,7 @@ Sega Model 3 1.5 DSB1 + true @@ -1346,6 +1356,7 @@ Sega Model 3 1.5 DSB1 + true @@ -1374,6 +1385,7 @@ Sega Model 3 1.5 DSB1 + true @@ -1444,6 +1456,7 @@ Sega Model 3 1.5 DSB1 + true @@ -1489,6 +1502,7 @@ 1.5 DSB1 MPC106 + true @@ -1532,6 +1546,7 @@ Sega Model 3 2.0 + true @@ -1605,6 +1620,7 @@ Sega Model 3 2.1 DSB2 + true @@ -1691,6 +1707,7 @@ Sega Model 3 2.1 DSB2 + true @@ -1777,6 +1794,7 @@ Sega Model 3 2.0 DSB2 + true @@ -2419,6 +2437,7 @@ Sega Model 3 2.0 0x16C311DB + true @@ -2495,6 +2514,7 @@ Sega Model 3 2.0 0x16C311DB + true @@ -2522,6 +2542,7 @@ Sega Model 3 2.0 0x16C311DB + true @@ -2549,6 +2570,7 @@ Sega Model 3 2.0 0x16C311DB + true diff --git a/Src/Game.h b/Src/Game.h index 4cc3fbb..b11f37c 100644 --- a/Src/Game.h +++ b/Src/Game.h @@ -18,6 +18,8 @@ struct Game uint32_t real3d_pci_id = 0; // overrides default Real3D PCI ID for stepping (0 for default) float real3d_status_bit_set_percent_of_frame = 0; // overrides default status bit timing (0 for default) uint32_t encryption_key = 0; + std::string netboard_present; + enum Inputs { INPUT_UI = 0, // special code reserved for Supermodel UI inputs diff --git a/Src/GameLoader.cpp b/Src/GameLoader.cpp index 32a591a..1724aca 100644 --- a/Src/GameLoader.cpp +++ b/Src/GameLoader.cpp @@ -201,6 +201,8 @@ static void PopulateGameInfo(Game *game, const Util::Config::Node &game_node) game->real3d_pci_id = game_node["hardware/real3d_pci_id"].ValueAsDefault(0); game->real3d_status_bit_set_percent_of_frame = game_node["hardware/real3d_status_bit_set_percent_of_frame"].ValueAsDefault(0); game->encryption_key = game_node["hardware/encryption_key"].ValueAsDefault(0); + game->netboard_present = game_node["hardware/netboard"].ValueAsDefault("false"); + std::map input_flags { { "common", Game::INPUT_COMMON }, diff --git a/Src/Model3/Model3.cpp b/Src/Model3/Model3.cpp index 6e00e09..d1554ab 100644 --- a/Src/Model3/Model3.cpp +++ b/Src/Model3/Model3.cpp @@ -211,6 +211,7 @@ #include #include #include +#include /****************************************************************************** Model 3 Inputs @@ -1864,7 +1865,7 @@ void CModel3::Write32(UINT32 addr, UINT32 data) default: Unknown32: #ifdef NET_BOARD - printf("CMODEL3 : unknown W32 : %x (%x) data=%d\n", addr,addr >> 24,data); + if (m_runNetBoard) printf("CMODEL3 : unknown W32 : %x (%x) data=%d\n", addr,addr >> 24,data); #endif //printf("PC=%08X\twrite32: %08X=%08X\n", ppc_get_pc(), addr, data); DebugLog("PC=%08X\twrite32: %08X=%08X\n", ppc_get_pc(), addr, data); @@ -3023,12 +3024,17 @@ bool CModel3::LoadGame(const Game &game, const ROMSet &rom_set) // Print game information std::set extra_hw; + std::string netboard_present = game.netboard_present; + std::transform(netboard_present.begin(), netboard_present.end(), netboard_present.begin(), ::tolower); + if (DSB) extra_hw.insert(Util::Format() << "Digital Sound Board (Type " << game.mpeg_board << ")"); if (rom_set.get_rom("driveboard_program").size) extra_hw.insert("Drive Board"); if (game.encryption_key) extra_hw.insert("Security Board"); + if (netboard_present.compare("true")==0) + extra_hw.insert("Net Board"); if (!game.version.empty()) std::cout << " Title: " << game.title << " (" << game.version << ")" << std::endl; else @@ -3044,6 +3050,12 @@ bool CModel3::LoadGame(const Game &game, const ROMSet &rom_set) m_game = game; #ifdef NET_BOARD NetBoard.GetGame(m_game); + if (OKAY != NetBoard.Init(netRAM, netBuffer)) + { + return FAIL; + } + + m_runNetBoard = m_game.stepping != "1.0" && (NetBoard.IsAttached() && (m_config["EmulateNet"].ValueAs())); #endif return OKAY; } @@ -3152,13 +3164,6 @@ bool CModel3::Init(void) return FAIL; if (OKAY != SoundBoard.Init(soundROM,sampleROM)) return FAIL; -#ifdef NET_BOARD - if (OKAY != NetBoard.Init(netRAM, netBuffer)) { - return FAIL; - } - - m_runNetBoard = m_game.stepping != "1.0" && (NetBoard.IsAttached() && (m_config["EmulateNet"].ValueAs())); -#endif PCIBridge.AttachPCIBus(&PCIBus); PCIBus.AttachDevice(13,&GPU); diff --git a/Src/Network/NetBoard.cpp b/Src/Network/NetBoard.cpp index 352c34f..998ed34 100644 --- a/Src/Network/NetBoard.cpp +++ b/Src/Network/NetBoard.cpp @@ -78,6 +78,7 @@ #include "Util/ByteSwap.h" #include "TCPSend.h" #include "TCPReceive.h" +#include // few macros to make debugging a bit less painful // if NET_DEBUG is defined, printf works normally, otherwise it's compiled to nothing (ie removed) @@ -1178,7 +1179,11 @@ bool CNetBoard::Init(UINT8 * netRAMPtr, UINT8 *netBufferPtr) { netRAM = netRAMPtr; netBuffer = netBufferPtr; - m_attached = true; + + std::string netboard_present = Gameinfo.netboard_present; + std::transform(netboard_present.begin(), netboard_present.end(), netboard_present.begin(), ::tolower); + m_attached = (netboard_present.compare("true") == 0) ? true : false; + test_irq = 0; // Allocate all memory for RAM @@ -1246,7 +1251,7 @@ bool CNetBoard::Init(UINT8 * netRAMPtr, UINT8 *netBufferPtr) nets = std::make_unique(addr_out, port_out); netr = std::make_unique(port_in); - if (m_config["EmulateNet"].ValueAs()) { + if (m_config["EmulateNet"].ValueAs() && m_attached) { while (!nets->Connect()) { printf("Connecting to %s:%i ..\n", addr_out.c_str(), port_out); }