Netboard related : Define a new hardware line in games.xml

This commit is contained in:
SpinDizzy 2020-07-01 15:56:21 +00:00
parent 345310fbee
commit a73a06d546
5 changed files with 46 additions and 10 deletions

View file

@ -146,6 +146,7 @@
<stepping>2.1</stepping>
<mpeg_board>DSB2</mpeg_board>
<real3d_status_bit_set_percent_of_frame>24</real3d_status_bit_set_percent_of_frame>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -236,6 +237,7 @@
<platform>Sega Model 3</platform>
<stepping>2.1</stepping>
<mpeg_board>DSB2</mpeg_board>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -315,6 +317,7 @@
<stepping>2.1</stepping>
<mpeg_board>DSB2</mpeg_board>
<real3d_pci_id>0x16C311DB</real3d_pci_id>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -388,6 +391,7 @@
<stepping>2.1</stepping>
<mpeg_board>DSB2</mpeg_board>
<real3d_pci_id>0x16C311DB</real3d_pci_id>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -419,6 +423,7 @@
<stepping>2.1</stepping>
<mpeg_board>DSB2</mpeg_board>
<real3d_pci_id>0x16C311DB</real3d_pci_id>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -450,6 +455,7 @@
<stepping>2.1</stepping>
<mpeg_board>DSB2</mpeg_board>
<real3d_pci_id>0x16C311DB</real3d_pci_id>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -767,6 +773,7 @@
<hardware>
<platform>Sega Model 3</platform>
<stepping>2.0</stepping>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -839,6 +846,7 @@
<hardware>
<platform>Sega Model 3</platform>
<stepping>2.0</stepping>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -939,6 +947,7 @@
<hardware>
<platform>Sega Model 3</platform>
<stepping>1.5</stepping>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -1260,6 +1269,7 @@
<platform>Sega Model 3</platform>
<stepping>1.5</stepping>
<mpeg_board>DSB1</mpeg_board>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -1346,6 +1356,7 @@
<platform>Sega Model 3</platform>
<stepping>1.5</stepping>
<mpeg_board>DSB1</mpeg_board>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -1374,6 +1385,7 @@
<platform>Sega Model 3</platform>
<stepping>1.5</stepping>
<mpeg_board>DSB1</mpeg_board>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -1444,6 +1456,7 @@
<platform>Sega Model 3</platform>
<stepping>1.5</stepping>
<mpeg_board>DSB1</mpeg_board>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -1489,6 +1502,7 @@
<stepping>1.5</stepping>
<mpeg_board>DSB1</mpeg_board>
<pci_bridge>MPC106</pci_bridge>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -1532,6 +1546,7 @@
<hardware>
<platform>Sega Model 3</platform>
<stepping>2.0</stepping>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="ski" />
@ -1605,6 +1620,7 @@
<platform>Sega Model 3</platform>
<stepping>2.1</stepping>
<mpeg_board>DSB2</mpeg_board>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="joystick1" />
@ -1691,6 +1707,7 @@
<platform>Sega Model 3</platform>
<stepping>2.1</stepping>
<mpeg_board>DSB2</mpeg_board>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="joystick1" />
@ -1777,6 +1794,7 @@
<platform>Sega Model 3</platform>
<stepping>2.0</stepping>
<mpeg_board>DSB2</mpeg_board>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="vehicle" />
@ -2419,6 +2437,7 @@
<platform>Sega Model 3</platform>
<stepping>2.0</stepping>
<real3d_pci_id>0x16C311DB</real3d_pci_id>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="twin_joysticks" />
@ -2495,6 +2514,7 @@
<platform>Sega Model 3</platform>
<stepping>2.0</stepping>
<real3d_pci_id>0x16C311DB</real3d_pci_id>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="twin_joysticks" />
@ -2522,6 +2542,7 @@
<platform>Sega Model 3</platform>
<stepping>2.0</stepping>
<real3d_pci_id>0x16C311DB</real3d_pci_id>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="twin_joysticks" />
@ -2549,6 +2570,7 @@
<platform>Sega Model 3</platform>
<stepping>2.0</stepping>
<real3d_pci_id>0x16C311DB</real3d_pci_id>
<netboard>true</netboard>
<inputs>
<input type="common" />
<input type="twin_joysticks" />

View file

@ -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

View file

@ -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<uint32_t>(0);
game->real3d_status_bit_set_percent_of_frame = game_node["hardware/real3d_status_bit_set_percent_of_frame"].ValueAsDefault<float>(0);
game->encryption_key = game_node["hardware/encryption_key"].ValueAsDefault<uint32_t>(0);
game->netboard_present = game_node["hardware/netboard"].ValueAsDefault<std::string>("false");
std::map<std::string, uint32_t> input_flags
{
{ "common", Game::INPUT_COMMON },

View file

@ -211,6 +211,7 @@
#include <functional>
#include <set>
#include <iostream>
#include <algorithm>
/******************************************************************************
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<std::string> 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<bool>()));
#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<bool>()));
#endif
PCIBridge.AttachPCIBus(&PCIBus);
PCIBus.AttachDevice(13,&GPU);

View file

@ -78,6 +78,7 @@
#include "Util/ByteSwap.h"
#include "TCPSend.h"
#include "TCPReceive.h"
#include <algorithm>
// 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<TCPSend>(addr_out, port_out);
netr = std::make_unique<TCPReceive>(port_in);
if (m_config["EmulateNet"].ValueAs<bool>()) {
if (m_config["EmulateNet"].ValueAs<bool>() && m_attached) {
while (!nets->Connect()) {
printf("Connecting to %s:%i ..\n", addr_out.c_str(), port_out);
}