mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-04-25 07:58:40 -05:00
Merge pull request #14406 from jordan-woyak/baseboard-minor-cleanups
SI_DeviceAMBaseboard: Minor cleanups.
This commit is contained in:
commit
56b9b37ac8
|
|
@ -68,6 +68,8 @@ public:
|
|||
|
||||
u32 GetPollXLines();
|
||||
|
||||
static constexpr u32 BUFFER_SIZE = 128;
|
||||
|
||||
private:
|
||||
// SI Interrupt Types
|
||||
enum SIInterruptType
|
||||
|
|
@ -241,7 +243,7 @@ private:
|
|||
USIComCSR m_com_csr;
|
||||
USIStatusReg m_status_reg;
|
||||
USIEXIClockCount m_exi_clock_count;
|
||||
std::array<u8, 128> m_si_buffer{};
|
||||
std::array<u8, BUFFER_SIZE> m_si_buffer{};
|
||||
|
||||
Core::System& m_system;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ enum class EBufferCommands : u8
|
|||
CMD_ORIGIN = 0x41,
|
||||
CMD_RECALIBRATE = 0x42,
|
||||
CMD_DIRECT_KB = 0x54,
|
||||
CMD_AM_BASEBOARD = 0x70,
|
||||
CMD_RESET = 0xFF
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,17 +3,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Core/HW/GCPad.h"
|
||||
#include "Core/HW/MagCard/MagneticCardReader.h"
|
||||
#include "Core/HW/SI/SI.h"
|
||||
#include "Core/HW/SI/SI_Device.h"
|
||||
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
namespace Movie
|
||||
{
|
||||
class MovieManager;
|
||||
}
|
||||
|
||||
namespace SerialInterface
|
||||
{
|
||||
|
||||
|
|
@ -39,81 +32,19 @@ 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
|
||||
int RunBuffer(u8* buffer, int request_length) override;
|
||||
|
||||
// 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
|
||||
{
|
||||
GCAM_Reset = 0x00,
|
||||
GCAM_Command = 0x70,
|
||||
};
|
||||
|
||||
enum GCAMCommand
|
||||
{
|
||||
StatusSwitches = 0x10,
|
||||
|
|
@ -182,23 +113,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,
|
||||
|
|
@ -259,8 +173,11 @@ private:
|
|||
u32 extlen;
|
||||
};
|
||||
|
||||
u8 m_last[2][0x80] = {};
|
||||
u32 m_lastptr[2] = {};
|
||||
static constexpr u32 RESPONSE_SIZE = SerialInterfaceManager::BUFFER_SIZE;
|
||||
|
||||
// Reply has to be delayed due a bug in the parser
|
||||
std::array<std::array<u8, RESPONSE_SIZE>, 2> m_response_buffers{};
|
||||
u8 m_current_response_buffer_index = 0;
|
||||
|
||||
std::array<u16, 2> m_coin{};
|
||||
std::array<u32, 2> m_coin_pressed{};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ struct CompressAndDumpStateArgs
|
|||
static Common::WorkQueueThreadSP<CompressAndDumpStateArgs> s_compress_and_dump_thread;
|
||||
|
||||
// Don't forget to increase this after doing changes on the savestate system
|
||||
constexpr u32 STATE_VERSION = 178; // Last changed in PR 14401
|
||||
constexpr u32 STATE_VERSION = 179; // Last changed in PR 14406
|
||||
|
||||
// Increase this if the StateExtendedHeader definition changes
|
||||
constexpr u32 EXTENDED_HEADER_VERSION = 1; // Last changed in PR 12217
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user