Merge pull request #601 from lioncash/pad-struct

Change SPADStatus struct name to GCPadStatus
This commit is contained in:
Dolphin Bot 2014-07-11 06:20:33 +02:00
commit 75c6575f37
20 changed files with 39 additions and 39 deletions

View File

@ -47,7 +47,7 @@ void Initialize(void* const hwnd)
g_plugin.LoadConfig(true); g_plugin.LoadConfig(true);
} }
void GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus)
{ {
memset(_pPADStatus, 0, sizeof(*_pPADStatus)); memset(_pPADStatus, 0, sizeof(*_pPADStatus));
_pPADStatus->err = PAD_ERR_NONE; _pPADStatus->err = PAD_ERR_NONE;

View File

@ -16,7 +16,7 @@ void Initialize(void* const hwnd);
InputPlugin *GetPlugin(); InputPlugin *GetPlugin();
void GetStatus(u8 _numPAD, SPADStatus* _pPADStatus); void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus);
void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength); void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength);
void Motor(u8 _numPAD, unsigned int _uType, unsigned int _uStrength); void Motor(u8 _numPAD, unsigned int _uType, unsigned int _uStrength);

View File

@ -87,7 +87,7 @@ std::string GCPad::GetName() const
return std::string("GCPad") + char('1'+m_index); return std::string("GCPad") + char('1'+m_index);
} }
void GCPad::GetInput(SPADStatus* const pad) void GCPad::GetInput(GCPadStatus* const pad)
{ {
// if window has focus or background input enabled // if window has focus or background input enabled
if (Host_RendererHasFocus() || m_options[0].settings[0]->value) if (Host_RendererHasFocus() || m_options[0].settings[0]->value)

View File

@ -13,7 +13,7 @@ class GCPad : public ControllerEmu
public: public:
GCPad(const unsigned int index); GCPad(const unsigned int index);
void GetInput(SPADStatus* const pad); void GetInput(GCPadStatus* const pad);
void SetOutput(const u8 on); void SetOutput(const u8 on);
void SetMotor(const u8 on); void SetMotor(const u8 on);

View File

@ -134,7 +134,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
case 0x10: case 0x10:
{ {
DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: Command 10, %02x (READ STATUS&SWITCHES)", ptr(1)); DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: Command 10, %02x (READ STATUS&SWITCHES)", ptr(1));
SPADStatus PadStatus; GCPadStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(PadStatus)); memset(&PadStatus, 0 ,sizeof(PadStatus));
Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
res[resp++] = 0x10; res[resp++] = 0x10;
@ -299,7 +299,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
msg.addData(0); // tilt msg.addData(0); // tilt
for (i=0; i<nr_players; ++i) for (i=0; i<nr_players; ++i)
{ {
SPADStatus PadStatus; GCPadStatus PadStatus;
Pad::GetStatus(i, &PadStatus); Pad::GetStatus(i, &PadStatus);
unsigned char player_data[2] = {0,0}; unsigned char player_data[2] = {0,0};
if (PadStatus.button & PAD_BUTTON_START) if (PadStatus.button & PAD_BUTTON_START)
@ -336,7 +336,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
{ {
int slots = *jvs_io++; int slots = *jvs_io++;
msg.addData(1); msg.addData(1);
SPADStatus PadStatus; GCPadStatus PadStatus;
Pad::GetStatus(0, &PadStatus); Pad::GetStatus(0, &PadStatus);
while (slots--) while (slots--)
{ {

View File

@ -106,7 +106,7 @@ int CSIDevice_DanceMat::RunBuffer(u8* _pBuffer, int _iLength)
// |_ ERR_STATUS (error on last GetData or SendCmd?) // |_ ERR_STATUS (error on last GetData or SendCmd?)
bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low) bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low)
{ {
SPADStatus PadStatus; GCPadStatus PadStatus;
memset(&PadStatus, 0, sizeof(PadStatus)); memset(&PadStatus, 0, sizeof(PadStatus));
Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);

View File

@ -87,7 +87,7 @@ public:
virtual int RunBuffer(u8* _pBuffer, int _iLength) override; virtual int RunBuffer(u8* _pBuffer, int _iLength) override;
// Send and Receive pad input from network // Send and Receive pad input from network
static bool NetPlay_GetInput(u8 numPAD, SPADStatus status, u32 *PADStatus); static bool NetPlay_GetInput(u8 numPAD, GCPadStatus status, u32 *PADStatus);
static u8 NetPlay_InGamePadToLocalPad(u8 numPAD); static u8 NetPlay_InGamePadToLocalPad(u8 numPAD);
// Return true on new data // Return true on new data

View File

@ -106,7 +106,7 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
// |_ ERR_STATUS (error on last GetData or SendCmd?) // |_ ERR_STATUS (error on last GetData or SendCmd?)
bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
{ {
SPADStatus PadStatus; GCPadStatus PadStatus;
memset(&PadStatus, 0, sizeof(PadStatus)); memset(&PadStatus, 0, sizeof(PadStatus));
Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);

View File

@ -88,7 +88,7 @@ public:
virtual int RunBuffer(u8* _pBuffer, int _iLength) override; virtual int RunBuffer(u8* _pBuffer, int _iLength) override;
// Send and Receive pad input from network // Send and Receive pad input from network
static bool NetPlay_GetInput(u8 numPAD, SPADStatus status, u32 *PADStatus); static bool NetPlay_GetInput(u8 numPAD, GCPadStatus status, u32 *PADStatus);
static u8 NetPlay_InGamePadToLocalPad(u8 numPAD); static u8 NetPlay_InGamePadToLocalPad(u8 numPAD);
// Return true on new data // Return true on new data

View File

@ -97,7 +97,7 @@ int CSIDevice_GCSteeringWheel::RunBuffer(u8* _pBuffer, int _iLength)
// |_ ERR_STATUS (error on last GetData or SendCmd?) // |_ ERR_STATUS (error on last GetData or SendCmd?)
bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low) bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low)
{ {
SPADStatus PadStatus; GCPadStatus PadStatus;
memset(&PadStatus, 0, sizeof(PadStatus)); memset(&PadStatus, 0, sizeof(PadStatus));
Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);

View File

@ -88,7 +88,7 @@ public:
virtual int RunBuffer(u8* _pBuffer, int _iLength) override; virtual int RunBuffer(u8* _pBuffer, int _iLength) override;
// Send and Receive pad input from network // Send and Receive pad input from network
static bool NetPlay_GetInput(u8 numPAD, SPADStatus status, u32 *PADStatus); static bool NetPlay_GetInput(u8 numPAD, GCPadStatus status, u32 *PADStatus);
static u8 NetPlay_InGamePadToLocalPad(u8 numPAD); static u8 NetPlay_InGamePadToLocalPad(u8 numPAD);
// Return true on new data // Return true on new data

View File

@ -607,7 +607,7 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD
g_InputDisplay[controllerID].append("\n"); g_InputDisplay[controllerID].append("\n");
} }
void CheckPadStatus(SPADStatus *PadStatus, int controllerID) void CheckPadStatus(GCPadStatus* PadStatus, int controllerID)
{ {
g_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0); g_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0);
g_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0); g_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0);
@ -635,7 +635,7 @@ void CheckPadStatus(SPADStatus *PadStatus, int controllerID)
SetInputDisplayString(g_padState, controllerID); SetInputDisplayString(g_padState, controllerID);
} }
void RecordInput(SPADStatus *PadStatus, int controllerID) void RecordInput(GCPadStatus* PadStatus, int controllerID)
{ {
if (!IsRecordingInput() || !IsUsingPad(controllerID)) if (!IsRecordingInput() || !IsUsingPad(controllerID))
return; return;
@ -934,7 +934,7 @@ static void CheckInputEnd()
} }
} }
void PlayController(SPADStatus *PadStatus, int controllerID) void PlayController(GCPadStatus* PadStatus, int controllerID)
{ {
// Correct playback is entirely dependent on the emulator polling the controllers // Correct playback is entirely dependent on the emulator polling the controllers
// in the same order done during recording // in the same order done during recording
@ -950,7 +950,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
// dtm files don't save the mic button or error bit. not sure if they're actually used, but better safe than sorry // dtm files don't save the mic button or error bit. not sure if they're actually used, but better safe than sorry
signed char e = PadStatus->err; signed char e = PadStatus->err;
memset(PadStatus, 0, sizeof(SPADStatus)); memset(PadStatus, 0, sizeof(GCPadStatus));
PadStatus->err = e; PadStatus->err = e;
@ -1172,7 +1172,7 @@ void SetInputManip(ManipFunction func)
mfunc = func; mfunc = func;
} }
void CallInputManip(SPADStatus *PadStatus, int controllerID) void CallInputManip(GCPadStatus* PadStatus, int controllerID)
{ {
if (mfunc) if (mfunc)
(*mfunc)(PadStatus, controllerID); (*mfunc)(PadStatus, controllerID);

View File

@ -166,13 +166,13 @@ void SetFrameSkipping(unsigned int framesToSkip);
void FrameSkipping(); void FrameSkipping();
bool BeginRecordingInput(int controllers); bool BeginRecordingInput(int controllers);
void RecordInput(SPADStatus *PadStatus, int controllerID); void RecordInput(GCPadStatus* PadStatus, int controllerID);
void RecordWiimote(int wiimote, u8 *data, u8 size); void RecordWiimote(int wiimote, u8 *data, u8 size);
bool PlayInput(const std::string& filename); bool PlayInput(const std::string& filename);
void LoadInput(const std::string& filename); void LoadInput(const std::string& filename);
void ReadHeader(); void ReadHeader();
void PlayController(SPADStatus *PadStatus, int controllerID); void PlayController(GCPadStatus* PadStatus, int controllerID);
bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode); bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
void EndPlayInput(bool cont); void EndPlayInput(bool cont);
void SaveRecording(const std::string& filename); void SaveRecording(const std::string& filename);
@ -180,14 +180,14 @@ void DoState(PointerWrap &p);
void CheckMD5(); void CheckMD5();
void GetMD5(); void GetMD5();
void Shutdown(); void Shutdown();
void CheckPadStatus(SPADStatus *PadStatus, int controllerID); void CheckPadStatus(GCPadStatus* PadStatus, int controllerID);
void CheckWiimoteStatus(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode); void CheckWiimoteStatus(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
std::string GetInputDisplay(); std::string GetInputDisplay();
// Done this way to avoid mixing of core and gui code // Done this way to avoid mixing of core and gui code
typedef void(*ManipFunction)(SPADStatus *, int); typedef void(*ManipFunction)(GCPadStatus*, int);
void SetInputManip(ManipFunction); void SetInputManip(ManipFunction);
void CallInputManip(SPADStatus *PadStatus, int controllerID); void CallInputManip(GCPadStatus* PadStatus, int controllerID);
}; };

View File

@ -29,7 +29,7 @@ NetPad::NetPad()
nLo = 0x80800000; nLo = 0x80800000;
} }
NetPad::NetPad(const SPADStatus* const pad_status) NetPad::NetPad(const GCPadStatus* const pad_status)
{ {
nHi = (u32)((u8)pad_status->stickY); nHi = (u32)((u8)pad_status->stickY);
nHi |= (u32)((u8)pad_status->stickX << 8); nHi |= (u32)((u8)pad_status->stickX << 8);
@ -558,7 +558,7 @@ void NetPlayClient::ClearBuffers()
} }
// called from ---CPU--- thread // called from ---CPU--- thread
bool NetPlayClient::GetNetPads(const u8 pad_nb, const SPADStatus* const pad_status, NetPad* const netvalues) bool NetPlayClient::GetNetPads(const u8 pad_nb, const GCPadStatus* const pad_status, NetPad* const netvalues)
{ {
// The interface for this is extremely silly. // The interface for this is extremely silly.
// //
@ -618,7 +618,7 @@ bool NetPlayClient::GetNetPads(const u8 pad_nb, const SPADStatus* const pad_stat
Common::SleepCurrentThread(1); Common::SleepCurrentThread(1);
} }
SPADStatus tmp; GCPadStatus tmp;
tmp.stickY = ((u8*)&netvalues->nHi)[0]; tmp.stickY = ((u8*)&netvalues->nHi)[0];
tmp.stickX = ((u8*)&netvalues->nHi)[1]; tmp.stickX = ((u8*)&netvalues->nHi)[1];
tmp.button = ((u16*)&netvalues->nHi)[1]; tmp.button = ((u16*)&netvalues->nHi)[1];
@ -846,7 +846,7 @@ u8 NetPlayClient::LocalWiimoteToInGameWiimote(u8 local_pad)
// called from ---CPU--- thread // called from ---CPU--- thread
// Actual Core function which is called on every frame // Actual Core function which is called on every frame
bool CSIDevice_GCController::NetPlay_GetInput(u8 numPAD, SPADStatus PadStatus, u32 *PADStatus) bool CSIDevice_GCController::NetPlay_GetInput(u8 numPAD, GCPadStatus PadStatus, u32 *PADStatus)
{ {
std::lock_guard<std::mutex> lk(crit_netplay_client); std::lock_guard<std::mutex> lk(crit_netplay_client);
@ -866,12 +866,12 @@ bool WiimoteEmu::Wiimote::NetPlay_GetWiimoteData(int wiimote, u8* data, u8 size)
return false; return false;
} }
bool CSIDevice_GCSteeringWheel::NetPlay_GetInput(u8 numPAD, SPADStatus PadStatus, u32 *PADStatus) bool CSIDevice_GCSteeringWheel::NetPlay_GetInput(u8 numPAD, GCPadStatus PadStatus, u32 *PADStatus)
{ {
return CSIDevice_GCController::NetPlay_GetInput(numPAD, PadStatus, PADStatus); return CSIDevice_GCController::NetPlay_GetInput(numPAD, PadStatus, PADStatus);
} }
bool CSIDevice_DanceMat::NetPlay_GetInput(u8 numPAD, SPADStatus PadStatus, u32 *PADStatus) bool CSIDevice_DanceMat::NetPlay_GetInput(u8 numPAD, GCPadStatus PadStatus, u32 *PADStatus)
{ {
return CSIDevice_GCController::NetPlay_GetInput(numPAD, PadStatus, PADStatus); return CSIDevice_GCController::NetPlay_GetInput(numPAD, PadStatus, PADStatus);
} }

View File

@ -25,7 +25,7 @@ class NetPad
{ {
public: public:
NetPad(); NetPad();
NetPad(const SPADStatus* const); NetPad(const GCPadStatus* const);
u32 nHi; u32 nHi;
u32 nLo; u32 nLo;
@ -78,7 +78,7 @@ public:
// Send and receive pads values // Send and receive pads values
bool WiimoteUpdate(int _number, u8* data, const u8 size); bool WiimoteUpdate(int _number, u8* data, const u8 size);
bool GetNetPads(const u8 pad_nb, const SPADStatus* const, NetPad* const netvalues); bool GetNetPads(const u8 pad_nb, const GCPadStatus* const, NetPad* const netvalues);
u8 LocalPadToInGamePad(u8 localPad); u8 LocalPadToInGamePad(u8 localPad);
u8 InGamePadToLocalPad(u8 localPad); u8 InGamePadToLocalPad(u8 localPad);

View File

@ -922,7 +922,7 @@ void OnStoppedCallback()
} }
} }
void TASManipFunction(SPADStatus *PadStatus, int controllerID) void TASManipFunction(GCPadStatus* PadStatus, int controllerID)
{ {
if (main_frame) if (main_frame)
main_frame->g_TASInputDlg[controllerID]->GetValues(PadStatus, controllerID); main_frame->g_TASInputDlg[controllerID]->GetValues(PadStatus, controllerID);

View File

@ -358,5 +358,5 @@ void OnAfterLoadCallback();
void OnStoppedCallback(); void OnStoppedCallback();
// For TASInputDlg // For TASInputDlg
void TASManipFunction(SPADStatus *PadStatus, int controllerID); void TASManipFunction(GCPadStatus* PadStatus, int controllerID);
bool TASInputHasFocus(); bool TASInputHasFocus();

View File

@ -242,7 +242,7 @@ void TASInputDlg::ResetValues()
wx_start_button->SetValue(false); wx_start_button->SetValue(false);
} }
void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus) void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus)
{ {
if (PadStatus->stickX != 128) if (PadStatus->stickX != 128)
{ {
@ -471,7 +471,7 @@ void TASInputDlg::SetLandRTriggers()
rTrig = wx_r_s->GetValue(); rTrig = wx_r_s->GetValue();
} }
void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID) void TASInputDlg::GetValues(GCPadStatus* PadStatus, int controllerID)
{ {
if (!IsShown()) if (!IsShown())
return; return;

View File

@ -39,11 +39,11 @@ class TASInputDlg : public wxDialog
void OnMouseDownL(wxMouseEvent& event); void OnMouseDownL(wxMouseEvent& event);
void OnMouseUpR(wxMouseEvent& event); void OnMouseUpR(wxMouseEvent& event);
void ResetValues(); void ResetValues();
void GetValues(SPADStatus *PadStatus, int controllerID); void GetValues(GCPadStatus* PadStatus, int controllerID);
void SetTurbo(wxMouseEvent& event); void SetTurbo(wxMouseEvent& event);
void SetTurboFalse(wxMouseEvent& event); void SetTurboFalse(wxMouseEvent& event);
void ButtonTurbo(); void ButtonTurbo();
void GetKeyBoardInput(SPADStatus *PadStatus); void GetKeyBoardInput(GCPadStatus* PadStatus);
bool TextBoxHasFocus(); bool TextBoxHasFocus();
void SetLandRTriggers(); void SetLandRTriggers();
bool TASHasFocus(); bool TASHasFocus();

View File

@ -24,7 +24,7 @@
#define PAD_BUTTON_Y 0x0800 #define PAD_BUTTON_Y 0x0800
#define PAD_BUTTON_START 0x1000 #define PAD_BUTTON_START 0x1000
typedef struct struct GCPadStatus
{ {
unsigned short button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits unsigned short button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
unsigned char stickX; // 0 <= stickX <= 255 unsigned char stickX; // 0 <= stickX <= 255
@ -36,4 +36,4 @@ typedef struct
unsigned char analogA; // 0 <= analogA <= 255 unsigned char analogA; // 0 <= analogA <= 255
unsigned char analogB; // 0 <= analogB <= 255 unsigned char analogB; // 0 <= analogB <= 255
signed char err; // one of PAD_ERR_* number signed char err; // one of PAD_ERR_* number
} SPADStatus; };