summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2026-02-20 15:42:52 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2026-03-12 02:48:07 -0500
commitcda384d40f70099afb38c0fbfe8aeaf6201511ed (patch)
treeddc066c789a7233aeda7b6822034bb48e6b59490 /Source/Core
parentfe2d604060b96436159b39de94163b823778d01b (diff)
SI_DeviceAMBaseboard: Remove unnecessary code.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp207
-rw-r--r--Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h78
-rw-r--r--Source/Core/Core/NetPlayClient.cpp19
3 files changed, 3 insertions, 301 deletions
diff --git a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp
index 5532c06b87..ea8fb8fd6d 100644
--- a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp
+++ b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp
@@ -26,10 +26,8 @@
#include "Core/HW/ProcessorInterface.h"
#include "Core/HW/SI/SI.h"
#include "Core/HW/SI/SI_Device.h"
-#include "Core/HW/SI/SI_DeviceGCController.h"
#include "Core/HW/SystemTimers.h"
#include "Core/Movie.h"
-#include "Core/NetPlayProto.h"
#include "Core/System.h"
#include "InputCommon/GCPadStatus.h"
@@ -2087,217 +2085,18 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length)
return buffer_position;
}
-u32 CSIDevice_AMBaseboard::MapPadStatus(const GCPadStatus& pad_status)
+DataResponse CSIDevice_AMBaseboard::GetData(u32&, u32&)
{
- // Thankfully changing mode does not change the high bits ;)
- u32 hi = 0;
- hi = pad_status.stickY;
- hi |= pad_status.stickX << 8;
- hi |= (pad_status.button | PAD_USE_ORIGIN) << 16;
- return hi;
-}
-
-CSIDevice_AMBaseboard::EButtonCombo
-CSIDevice_AMBaseboard::HandleButtonCombos(const GCPadStatus& pad_status)
-{
- // Keep track of the special button combos (embedded in controller hardware... :( )
- EButtonCombo temp_combo = COMBO_NONE;
- if ((pad_status.button & 0xff00) == (PAD_BUTTON_Y | PAD_BUTTON_X | PAD_BUTTON_START))
- temp_combo = COMBO_ORIGIN;
- else if ((pad_status.button & 0xff00) == (PAD_BUTTON_B | PAD_BUTTON_X | PAD_BUTTON_START))
- temp_combo = COMBO_RESET;
-
- if (temp_combo != m_last_button_combo)
- {
- m_last_button_combo = temp_combo;
- if (m_last_button_combo != COMBO_NONE)
- m_timer_button_combo_start = m_system.GetCoreTiming().GetTicks();
- }
-
- if (m_last_button_combo != COMBO_NONE)
- {
- const u64 current_time = m_system.GetCoreTiming().GetTicks();
- const u32 ticks_per_second = m_system.GetSystemTimers().GetTicksPerSecond();
- if (u32(current_time - m_timer_button_combo_start) > ticks_per_second * 3)
- {
- if (m_last_button_combo == COMBO_RESET)
- {
- INFO_LOG_FMT(SERIALINTERFACE, "PAD - COMBO_RESET");
- m_system.GetProcessorInterface().ResetButton_Tap();
- }
- else if (m_last_button_combo == COMBO_ORIGIN)
- {
- INFO_LOG_FMT(SERIALINTERFACE, "PAD - COMBO_ORIGIN");
- SetOrigin(pad_status);
- }
-
- m_last_button_combo = COMBO_NONE;
- return temp_combo;
- }
- }
-
- return COMBO_NONE;
-}
-
-// GetData
-
-// Return true on new data (max 7 Bytes and 6 bits ;)
-// [00?SYXBA] [1LRZUDRL] [x] [y] [cx] [cy] [l] [r]
-// |\_ ERR_LATCH (error latched - check SISR)
-// |_ ERR_STATUS (error on last GetData or SendCmd?)
-DataResponse CSIDevice_AMBaseboard::GetData(u32& hi, u32& low)
-{
- GCPadStatus pad_status = GetPadStatus();
-
- if (!pad_status.isConnected)
- return DataResponse::ErrorNoResponse;
-
- if (HandleButtonCombos(pad_status) == COMBO_ORIGIN)
- pad_status.button |= PAD_GET_ORIGIN;
-
- hi = MapPadStatus(pad_status);
-
- // Low bits are packed differently per mode
- if (m_mode == 0 || m_mode == 5 || m_mode == 6 || m_mode == 7)
- {
- low = (pad_status.analogB >> 4); // Top 4 bits
- low |= ((pad_status.analogA >> 4) << 4); // Top 4 bits
- low |= ((pad_status.triggerRight >> 4) << 8); // Top 4 bits
- low |= ((pad_status.triggerLeft >> 4) << 12); // Top 4 bits
- low |= ((pad_status.substickY) << 16); // All 8 bits
- low |= ((pad_status.substickX) << 24); // All 8 bits
- }
- else if (m_mode == 1)
- {
- low = (pad_status.analogB >> 4); // Top 4 bits
- low |= ((pad_status.analogA >> 4) << 4); // Top 4 bits
- low |= (pad_status.triggerRight << 8); // All 8 bits
- low |= (pad_status.triggerLeft << 16); // All 8 bits
- low |= ((pad_status.substickY >> 4) << 24); // Top 4 bits
- low |= ((pad_status.substickX >> 4) << 28); // Top 4 bits
- }
- else if (m_mode == 2)
- {
- low = pad_status.analogB; // All 8 bits
- low |= pad_status.analogA << 8; // All 8 bits
- low |= ((pad_status.triggerRight >> 4) << 16); // Top 4 bits
- low |= ((pad_status.triggerLeft >> 4) << 20); // Top 4 bits
- low |= ((pad_status.substickY >> 4) << 24); // Top 4 bits
- low |= ((pad_status.substickX >> 4) << 28); // Top 4 bits
- }
- else if (m_mode == 3)
- {
- // Analog A/B are always 0
- low = pad_status.triggerRight; // All 8 bits
- low |= (pad_status.triggerLeft << 8); // All 8 bits
- low |= (pad_status.substickY << 16); // All 8 bits
- low |= (pad_status.substickX << 24); // All 8 bits
- }
- else if (m_mode == 4)
- {
- low = pad_status.analogB; // All 8 bits
- low |= pad_status.analogA << 8; // All 8 bits
- // triggerLeft/Right are always 0
- low |= pad_status.substickY << 16; // All 8 bits
- low |= pad_status.substickX << 24; // All 8 bits
- }
-
- return DataResponse::Success;
+ return DataResponse::NoData;
}
void CSIDevice_AMBaseboard::SendCommand(u32 command, u8 poll)
{
- UCommand controller_command(command);
-
- if (static_cast<EDirectCommands>(controller_command.command) == EDirectCommands::CMD_WRITE)
- {
- const u32 type = controller_command.parameter1; // 0 = stop, 1 = rumble, 2 = stop hard
-
- // get the correct pad number that should rumble locally when using netplay
- const int pad_num = NetPlay_InGamePadToLocalPad(m_device_number);
-
- if (pad_num < 4)
- {
- const SIDevices device = m_system.GetSerialInterface().GetDeviceType(pad_num);
- if (type == 1)
- CSIDevice_GCController::Rumble(pad_num, 1.0, device);
- else
- CSIDevice_GCController::Rumble(pad_num, 0.0, device);
- }
-
- if (poll == 0)
- {
- m_mode = controller_command.parameter2;
- INFO_LOG_FMT(SERIALINTERFACE, "PAD {} set to mode {}", m_device_number, m_mode);
- }
- }
- else if (controller_command.command != 0x00)
- {
- // Costis sent 0x00 in some demos :)
- ERROR_LOG_FMT(SERIALINTERFACE, "Unknown direct command ({:#x})", command);
- PanicAlertFmt("SI: Unknown direct command");
- }
-}
-
-void CSIDevice_AMBaseboard::SetOrigin(const GCPadStatus& pad_status)
-{
- m_origin.origin_stick_x = pad_status.stickX;
- m_origin.origin_stick_y = pad_status.stickY;
- m_origin.substick_x = pad_status.substickX;
- m_origin.substick_y = pad_status.substickY;
- m_origin.trigger_left = pad_status.triggerLeft;
- m_origin.trigger_right = pad_status.triggerRight;
-}
-
-void CSIDevice_AMBaseboard::HandleMoviePadStatus(Movie::MovieManager& movie, int device_number,
- GCPadStatus* pad_status)
-{
- movie.SetPolledDevice();
- if (NetPlay_GetInput(device_number, pad_status))
- {
- }
- else if (movie.IsPlayingInput())
- {
- movie.PlayController(pad_status, device_number);
- movie.InputUpdate();
- }
- else if (movie.IsRecordingInput())
- {
- movie.RecordInput(pad_status, device_number);
- movie.InputUpdate();
- }
- else
- {
- movie.CheckPadStatus(pad_status, device_number);
- }
-}
-
-GCPadStatus CSIDevice_AMBaseboard::GetPadStatus()
-{
- GCPadStatus pad_status = {};
-
- // For netplay, the local controllers are polled in GetNetPads(), and
- // the remote controllers receive their status there as well
- if (!NetPlay::IsNetPlayRunning())
- {
- pad_status = Pad::GetStatus(m_device_number);
- }
-
- // Our GCAdapter code sets PAD_GET_ORIGIN when a new device has been connected.
- // Watch for this to calibrate real controllers on connection.
- if (pad_status.button & PAD_GET_ORIGIN)
- SetOrigin(pad_status);
-
- return pad_status;
+ WARN_LOG_FMT(SERIALINTERFACE_AMBB, "Unhandled SendCommand(0x{:08x}, 0x{:02x})", command, poll);
}
void CSIDevice_AMBaseboard::DoState(PointerWrap& p)
{
- p.Do(m_origin);
- p.Do(m_mode);
- p.Do(m_timer_button_combo_start);
- p.Do(m_last_button_combo);
-
p.Do(m_last);
p.Do(m_lastptr);
diff --git a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h
index 31ed04053c..b235de1476 100644
--- a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h
+++ b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h
@@ -3,17 +3,9 @@
#pragma once
-#include "Core/HW/GCPad.h"
#include "Core/HW/MagCard/MagneticCardReader.h"
#include "Core/HW/SI/SI_Device.h"
-#include "InputCommon/GCPadStatus.h"
-
-namespace Movie
-{
-class MovieManager;
-}
-
namespace SerialInterface
{
@@ -39,15 +31,7 @@ private:
// Triforce (GC-AM) baseboard
class CSIDevice_AMBaseboard : public ISIDevice
{
- enum EButtonCombo
- {
- COMBO_NONE = 0,
- COMBO_ORIGIN,
- COMBO_RESET
- };
-
public:
- // constructor
CSIDevice_AMBaseboard(Core::System& system, SIDevices device, int device_number);
// run the SI Buffer
@@ -56,57 +40,12 @@ public:
// Reply has to be delayed due a bug in the parser
void SwapBuffers(u8* buffer, u32* buffer_length);
- // return true on new data
DataResponse GetData(u32& hi, u32& low) override;
- // send a command directly
void SendCommand(u32 command, u8 poll) override;
- virtual GCPadStatus GetPadStatus();
- virtual u32 MapPadStatus(const GCPadStatus& pad_status);
- virtual EButtonCombo HandleButtonCombos(const GCPadStatus& pad_status);
-
- static void HandleMoviePadStatus(Movie::MovieManager& movie, int device_number,
- GCPadStatus* pad_status);
-
- // Send and Receive pad input from network
- static bool NetPlay_GetInput(int pad_num, GCPadStatus* status);
- static int NetPlay_InGamePadToLocalPad(int pad_num);
-
void DoState(PointerWrap&) override;
-protected:
- struct SOrigin
- {
- u16 button;
- u8 origin_stick_x;
- u8 origin_stick_y;
- u8 substick_x;
- u8 substick_y;
- u8 trigger_left;
- u8 trigger_right;
- u8 unk_4;
- u8 unk_5;
- };
-
- // struct to compare input against
- // Set on connection to perfect neutral values
- // (standard pad only) Set on button combo to current input state
- SOrigin m_origin = {};
-
- // PADAnalogMode
- // Dunno if we need to do this, game/lib should set it?
- u8 m_mode = 0x3;
-
- // Timer to track special button combos:
- // y, X, start for 3 seconds updates origin with current status
- // Technically, the above is only on standard pad, wavebird does not support it for example
- // b, x, start for 3 seconds triggers reset (PI reset button interrupt)
- u64 m_timer_button_combo_start = 0;
- // Type of button combo from the last/current poll
- EButtonCombo m_last_button_combo = COMBO_NONE;
- void SetOrigin(const GCPadStatus& pad_status);
-
private:
enum BaseBoardCommand
{
@@ -182,23 +121,6 @@ private:
AcknowledgeOverflow = 4,
};
- enum CARDCommand
- {
- Init = 0x10,
- GetState = 0x20,
- Read = 0x33,
- IsPresent = 0x40,
- Write = 0x53,
- SetPrintParam = 0x78,
- RegisterFont = 0x7A,
- WriteInfo = 0x7C,
- Erase = 0x7D,
- Eject = 0x80,
- Clean = 0xA0,
- Load = 0xB0,
- SetShutter = 0xD0,
- };
-
enum ICCARDCommand
{
GetStatus = 0x10,
diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp
index 028799d56f..80bee1639b 100644
--- a/Source/Core/Core/NetPlayClient.cpp
+++ b/Source/Core/Core/NetPlayClient.cpp
@@ -2774,16 +2774,6 @@ bool SerialInterface::CSIDevice_GCController::NetPlay_GetInput(int pad_num, GCPa
return false;
}
-bool SerialInterface::CSIDevice_AMBaseboard::NetPlay_GetInput(int pad_num, GCPadStatus* status)
-{
- std::lock_guard lk(NetPlay::crit_netplay_client);
-
- if (NetPlay::netplay_client)
- return NetPlay::netplay_client->GetNetPads(pad_num, NetPlay::s_si_poll_batching, status);
-
- return false;
-}
-
bool NetPlay::NetPlay_GetWiimoteData(const std::span<NetPlayClient::WiimoteDataBatchEntry>& entries)
{
std::lock_guard lk(crit_netplay_client);
@@ -2856,12 +2846,3 @@ int SerialInterface::CSIDevice_GCController::NetPlay_InGamePadToLocalPad(int pad
return pad_num;
}
-int SerialInterface::CSIDevice_AMBaseboard::NetPlay_InGamePadToLocalPad(int pad_num)
-{
- std::lock_guard lk(NetPlay::crit_netplay_client);
-
- if (NetPlay::netplay_client)
- return NetPlay::netplay_client->InGamePadToLocalPad(pad_num);
-
- return pad_num;
-}