From 8ba8d7290e17208367e2b94eef92ac7aa6a34232 Mon Sep 17 00:00:00 2001 From: Bart Trzynadlowski Date: Thu, 26 May 2016 04:13:22 +0000 Subject: [PATCH] Hooked up Sega Bass Fishing / Get Bass controls --- Config/Supermodel.ini | 19 +++++++++++++++++++ Src/Games.cpp | 4 ++-- Src/Games.h | 3 ++- Src/Inputs/Input.cpp | 1 + Src/Inputs/Inputs.cpp | 28 ++++++++++++++++++++++++---- Src/Inputs/Inputs.h | 9 +++++++++ Src/Model3/Model3.cpp | 26 ++++++++++++++++++++++++-- 7 files changed, 81 insertions(+), 9 deletions(-) diff --git a/Config/Supermodel.ini b/Config/Supermodel.ini index e5908ea..4595824 100644 --- a/Config/Supermodel.ini +++ b/Config/Supermodel.ini @@ -212,3 +212,22 @@ InputMagicalLever1 = "JOY1_YAXIS" InputMagicalLever2 = "JOY2_YAXIS" InputMagicalPedal1 = "KEY_A,JOY1_BUTTON1" InputMagicalPedal2 = "KEY_S,JOY2_BUTTON1" + +; Sega Bass Fishing / Get Bass controls +InputFishingRodLeft = "KEY_LEFT" +InputFishingRodRight = "KEY_RIGHT" +InputFishingRodUp = "KEY_UP" +InputFishingRodDown = "KEY_DOWN" +InputFishingReelFaster = "KEY_Q" +InputFishingReelSlower = "KEY_E" +InputFishingStickLeft = "KEY_A" +InputFishingStickRight = "KEY_D" +InputFishingStickUp = "KEY_W" +InputFishingStickDown = "KEY_S" +InputFishingRodX = "JOY1_XAXIS" +InputFishingRodY = "JOY1_YAXIS" +InputFishingStickX = "JOY1_RXAXIS" +InputFishingStickY = "JOY1_RYAXIS" +InputFishingReel = "JOY1_ZAXIS" +InputFishingCast = "KEY_Z,JOY1_BUTTON1" +InputFishingSelect = "KEY_X,JOY1_BUTTON2" diff --git a/Src/Games.cpp b/Src/Games.cpp index 2e66aa6..18e860f 100644 --- a/Src/Games.cpp +++ b/Src/Games.cpp @@ -47,7 +47,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x2000000, // 32 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_JOYSTICK1, + GAME_INPUT_COMMON|GAME_INPUT_FISHING, 0, // no MPEG board false, // no drive board, 0, // no security board @@ -633,7 +633,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x2000000, // 32 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_JOYSTICK1, + GAME_INPUT_COMMON|GAME_INPUT_FISHING, 0, // no MPEG board false, // no drive board 0, // no security board diff --git a/Src/Games.h b/Src/Games.h index 0b2b49c..775ae2b 100644 --- a/Src/Games.h +++ b/Src/Games.h @@ -58,7 +58,8 @@ #define GAME_INPUT_ANALOG_GUN2 0x000040000 // game has analog gun 2 #define GAME_INPUT_SKI 0x000080000 // game has ski controls #define GAME_INPUT_MAGTRUCK 0x000100000 // game has magical truck controls -#define GAME_INPUT_ALL 0x0001FFFFF +#define GAME_INPUT_FISHING 0x000200000 // game has fishing controls +#define GAME_INPUT_ALL 0x0003FFFFF /****************************************************************************** diff --git a/Src/Inputs/Input.cpp b/Src/Inputs/Input.cpp index a96a5ae..954d62e 100644 --- a/Src/Inputs/Input.cpp +++ b/Src/Inputs/Input.cpp @@ -105,6 +105,7 @@ const char* CInput::GetInputGroup() case GAME_INPUT_ANALOG_GUN2: return "Analog Guns"; case GAME_INPUT_SKI: return "Ski Controls"; case GAME_INPUT_MAGTRUCK: return "Magical Truck Controls"; + case GAME_INPUT_FISHING: return "Fishing Controls"; default: return "Misc"; } } diff --git a/Src/Inputs/Inputs.cpp b/Src/Inputs/Inputs.cpp index 77f401b..da3f1a1 100644 --- a/Src/Inputs/Inputs.cpp +++ b/Src/Inputs/Inputs.cpp @@ -244,10 +244,30 @@ CInputs::CInputs(CInputSystem *system) : m_system(system) CAnalogInput *magicalLeverUp2 = AddAnalogInput("MagicalLeverUp2", "P2 Magical Lever Up", GAME_INPUT_MAGTRUCK, "NONE"); CAnalogInput *magicalLeverDown2 = AddAnalogInput("MagicalLeverDown2", "P2 Magical Lever Down", GAME_INPUT_MAGTRUCK, "NONE"); - magicalLever1 = AddAxisInput( "MagicalLever1", "P1 Magical Lever Full Analog", GAME_INPUT_MAGTRUCK, "NONE", magicalLeverUp1, magicalLeverDown1, 0xFF, 0x80, 0); - magicalLever2 = AddAxisInput( "MagicalLever2", "P2 Magical Lever Full Analog", GAME_INPUT_MAGTRUCK, "NONE", magicalLeverUp2, magicalLeverDown2, 0xFF, 0x80, 0); - magicalPedal1 = AddSwitchInput( "MagicalPedal1", "P1 Magical Pedal", GAME_INPUT_MAGTRUCK, "NONE"); - magicalPedal2 = AddSwitchInput( "MagicalPedal2", "P2 Magical Pedal", GAME_INPUT_MAGTRUCK, "NONE"); + magicalLever1 = AddAxisInput( "MagicalLever1", "P1 Magical Lever", GAME_INPUT_MAGTRUCK, "NONE", magicalLeverUp1, magicalLeverDown1, 0xFF, 0x80, 0); + magicalLever2 = AddAxisInput( "MagicalLever2", "P2 Magical Lever", GAME_INPUT_MAGTRUCK, "NONE", magicalLeverUp2, magicalLeverDown2, 0xFF, 0x80, 0); + magicalPedal1 = AddSwitchInput( "MagicalPedal1", "P1 Magical Pedal", GAME_INPUT_MAGTRUCK, "NONE"); + magicalPedal2 = AddSwitchInput( "MagicalPedal2", "P2 Magical Pedal", GAME_INPUT_MAGTRUCK, "NONE"); + + // Sega Bass Fishing controls + CAnalogInput *fishingRodLeft = AddAnalogInput("FishingRodLeft", "Rod Left", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingRodRight = AddAnalogInput("FishingRodRight", "Rod Right", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingRodUp = AddAnalogInput("FishingRodUp", "Rod Up", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingRodDown = AddAnalogInput("FishingRodDown", "Rod Down", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingReelFaster = AddAnalogInput("FishingReelFaster", "Reel Faster", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingReelSlower = AddAnalogInput("FishingReelSlower", "Reel Slower", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingStickLeft = AddAnalogInput("FishingStickLeft", "Stick Left", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingStickRight = AddAnalogInput("FishingStickRight", "Stick Right", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingStickUp = AddAnalogInput("FishingStickUp", "Stick Up", GAME_INPUT_FISHING, "NONE"); + CAnalogInput *fishingStickDown = AddAnalogInput("FishingStickDown", "Stick Down", GAME_INPUT_FISHING, "NONE"); + + fishingRodX = AddAxisInput( "FishingRodX", "Rod X-Axis", GAME_INPUT_FISHING, "NONE", fishingRodLeft, fishingRodRight, 0, 0x80, 0xFF); + fishingRodY = AddAxisInput( "FishingRodY", "Rod Y-Axis", GAME_INPUT_FISHING, "NONE", fishingRodUp, fishingRodDown, 0xFF, 0x80, 0); + fishingReel = AddAxisInput( "FishingReel", "Reel Speed", GAME_INPUT_FISHING, "NONE", fishingReelSlower, fishingReelFaster, 0, 0x80, 0xFF); + fishingStickX = AddAxisInput( "FishingStickX", "Stick X-Axis", GAME_INPUT_FISHING, "NONE", fishingStickLeft, fishingStickRight, 0, 0x80, 0xFF); + fishingStickY = AddAxisInput( "FishingStickY", "Stick Y-Axis", GAME_INPUT_FISHING, "NONE", fishingStickUp, fishingStickDown, 0xFF, 0x80, 0); + fishingCast = AddSwitchInput( "FishingCast", "Cast", GAME_INPUT_FISHING, "NONE"); + fishingSelect = AddSwitchInput( "FishingSelect", "Select", GAME_INPUT_FISHING, "NONE"); } CInputs::~CInputs() diff --git a/Src/Inputs/Inputs.h b/Src/Inputs/Inputs.h index 5a3ee9d..d0d90d4 100644 --- a/Src/Inputs/Inputs.h +++ b/Src/Inputs/Inputs.h @@ -220,6 +220,15 @@ public: CAxisInput *magicalLever2; CSwitchInput *magicalPedal1; CSwitchInput *magicalPedal2; + + // Sega Bass Fishing controls + CAxisInput *fishingRodX; + CAxisInput *fishingRodY; + CAxisInput *fishingReel; + CAxisInput *fishingStickX; + CAxisInput *fishingStickY; + CSwitchInput *fishingCast; + CSwitchInput *fishingSelect; /* * Creates a set of inputs with the given input system. diff --git a/Src/Model3/Model3.cpp b/Src/Model3/Model3.cpp index 12476c6..9dea1e7 100644 --- a/Src/Model3/Model3.cpp +++ b/Src/Model3/Model3.cpp @@ -427,6 +427,11 @@ UINT8 CModel3::ReadInputs(unsigned reg) if ((Game->inputFlags & GAME_INPUT_MAGTRUCK)) data &= ~(Inputs->magicalPedal1->value << 0); + if ((Game->inputFlags & GAME_INPUT_FISHING)) + { + data &= ~(Inputs->fishingCast->value << 0); + data &= ~(Inputs->fishingSelect->value << 1); + } return data; case 0x0C: // game-specific inputs @@ -500,7 +505,7 @@ UINT8 CModel3::ReadInputs(unsigned reg) if ((Game->inputFlags & GAME_INPUT_MAGTRUCK)) data &= ~(Inputs->magicalPedal2->value << 0); - + return data; case 0x2C: // Serial FIFO 1 @@ -551,6 +556,15 @@ UINT8 CModel3::ReadInputs(unsigned reg) adc[1] = uint8_t(Inputs->magicalLever2->value); } + if ((Game->inputFlags & GAME_INPUT_FISHING)) + { + adc[0] = uint8_t(Inputs->fishingRodY->value); + adc[1] = uint8_t(Inputs->fishingRodX->value); + adc[3] = uint8_t(Inputs->fishingReel->value); + adc[5] = uint8_t(Inputs->fishingStickX->value); + adc[4] = uint8_t(Inputs->fishingStickY->value); + } + // Read out appropriate channel data = adc[adcChannel&7]; ++adcChannel; @@ -1382,6 +1396,11 @@ void CModel3::Write32(UINT32 addr, UINT32 data) GPU.WritePolygonRAM(addr&0x3FFFFF,FLIPENDIAN32(data)); break; + // Real3D configuration registers + case 0x9C: // 9Cxxxxxx + //printf("%08X=%08X\n", addr, data); //TODO: flip endian? + break; + // Real3D DMA case 0xC2: // C2000000-C2000100 GPU.WriteDMARegister32(addr&0xFF,FLIPENDIAN32(data)); @@ -1515,6 +1534,7 @@ void CModel3::Write32(UINT32 addr, UINT32 data) // Unknown default: Unknown32: + //printf("PC=%08X\twrite32: %08X=%08X\n", ppc_get_pc(), addr, data); DebugLog("PC=%08X\twrite32: %08X=%08X\n", ppc_get_pc(), addr, data); break; } @@ -2874,6 +2894,8 @@ void CModel3::Patch(void) *(UINT32 *) &crom[0x50E8D4] = 0x60000000; *(UINT32 *) &crom[0x50E8F4] = 0x60000000; *(UINT32 *) &crom[0x50FB84] = 0x60000000; + *(UINT32 *) &crom[0x4F736C] = 0x60000000; // + *(UINT32 *) &crom[0x4F738C] = 0x60000000; } else if (!strcmp(Game->id, "harleyb")) { @@ -3229,8 +3251,8 @@ CModel3::CModel3(void) DebugLog("Built Model 3\n"); } -/* // Dumps a memory region to a file for debugging purposes +/* static void Dump(const char *file, uint8_t *buf, size_t size, bool reverse32, bool reverse16) { FILE *fp = fopen(file, "wb");