diff --git a/Source/Core/Core/HW/GCKeyboard.cpp b/Source/Core/Core/HW/GCKeyboard.cpp index 1b818bee84..a8bdd1884c 100644 --- a/Source/Core/Core/HW/GCKeyboard.cpp +++ b/Source/Core/Core/HW/GCKeyboard.cpp @@ -47,12 +47,8 @@ void LoadConfig() s_config.LoadConfig(true); } -void GetStatus(u8 port, KeyboardStatus* keyboard_status) +KeyboardStatus GetStatus(u8 port) { - memset(keyboard_status, 0, sizeof(*keyboard_status)); - keyboard_status->err = PAD_ERR_NONE; - - // Get input - static_cast(s_config.GetController(port))->GetInput(keyboard_status); + return static_cast(s_config.GetController(port))->GetInput(); } } diff --git a/Source/Core/Core/HW/GCKeyboard.h b/Source/Core/Core/HW/GCKeyboard.h index 56709a259e..f96d581c5c 100644 --- a/Source/Core/Core/HW/GCKeyboard.h +++ b/Source/Core/Core/HW/GCKeyboard.h @@ -17,5 +17,5 @@ void LoadConfig(); InputConfig* GetConfig(); -void GetStatus(u8 port, KeyboardStatus* keyboard_status); +KeyboardStatus GetStatus(u8 port); } diff --git a/Source/Core/Core/HW/GCKeyboardEmu.cpp b/Source/Core/Core/HW/GCKeyboardEmu.cpp index b022527a0d..ddf36d9350 100644 --- a/Source/Core/Core/HW/GCKeyboardEmu.cpp +++ b/Source/Core/Core/HW/GCKeyboardEmu.cpp @@ -84,15 +84,20 @@ std::string GCKeyboard::GetName() const return std::string("GCKeyboard") + char('1' + m_index); } -void GCKeyboard::GetInput(KeyboardStatus* const kb) +KeyboardStatus GCKeyboard::GetInput() const { auto lock = ControllerEmu::GetStateLock(); - m_keys0x->GetState(&kb->key0x, keys0_bitmasks); - m_keys1x->GetState(&kb->key1x, keys1_bitmasks); - m_keys2x->GetState(&kb->key2x, keys2_bitmasks); - m_keys3x->GetState(&kb->key3x, keys3_bitmasks); - m_keys4x->GetState(&kb->key4x, keys4_bitmasks); - m_keys5x->GetState(&kb->key5x, keys5_bitmasks); + + KeyboardStatus kb = {}; + + m_keys0x->GetState(&kb.key0x, keys0_bitmasks); + m_keys1x->GetState(&kb.key1x, keys1_bitmasks); + m_keys2x->GetState(&kb.key2x, keys2_bitmasks); + m_keys3x->GetState(&kb.key3x, keys3_bitmasks); + m_keys4x->GetState(&kb.key4x, keys4_bitmasks); + m_keys5x->GetState(&kb.key5x, keys5_bitmasks); + + return kb; } void GCKeyboard::LoadDefaults(const ControllerInterface& ciface) diff --git a/Source/Core/Core/HW/GCKeyboardEmu.h b/Source/Core/Core/HW/GCKeyboardEmu.h index 3f41659a1f..48451f3be2 100644 --- a/Source/Core/Core/HW/GCKeyboardEmu.h +++ b/Source/Core/Core/HW/GCKeyboardEmu.h @@ -14,7 +14,7 @@ class GCKeyboard : public ControllerEmu { public: GCKeyboard(const unsigned int index); - void GetInput(KeyboardStatus* const pad); + KeyboardStatus GetInput() const; std::string GetName() const override; void LoadDefaults(const ControllerInterface& ciface) override; diff --git a/Source/Core/Core/HW/GCPad.cpp b/Source/Core/Core/HW/GCPad.cpp index d88fd53be2..1ac20675a9 100644 --- a/Source/Core/Core/HW/GCPad.cpp +++ b/Source/Core/Core/HW/GCPad.cpp @@ -46,13 +46,9 @@ void LoadConfig() s_config.LoadConfig(true); } -void GetStatus(u8 pad_num, GCPadStatus* pad_status) +GCPadStatus GetStatus(u8 pad_num) { - memset(pad_status, 0, sizeof(*pad_status)); - pad_status->err = PAD_ERR_NONE; - - // Get input - static_cast(s_config.GetController(pad_num))->GetInput(pad_status); + return static_cast(s_config.GetController(pad_num))->GetInput(); } void Rumble(const u8 pad_num, const ControlState strength) diff --git a/Source/Core/Core/HW/GCPad.h b/Source/Core/Core/HW/GCPad.h index aff6745b07..6bd03b5812 100644 --- a/Source/Core/Core/HW/GCPad.h +++ b/Source/Core/Core/HW/GCPad.h @@ -18,7 +18,7 @@ void LoadConfig(); InputConfig* GetConfig(); -void GetStatus(u8 pad_num, GCPadStatus* pad_status); +GCPadStatus GetStatus(u8 pad_num); void Rumble(u8 pad_num, ControlState strength); bool GetMicButton(u8 pad_num); diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp index 36ab385486..366b3d310d 100644 --- a/Source/Core/Core/HW/GCPadEmu.cpp +++ b/Source/Core/Core/HW/GCPadEmu.cpp @@ -79,41 +79,44 @@ std::string GCPad::GetName() const return std::string("GCPad") + char('1' + m_index); } -void GCPad::GetInput(GCPadStatus* const pad) +GCPadStatus GCPad::GetInput() const { auto lock = ControllerEmu::GetStateLock(); ControlState x, y, triggers[2]; + GCPadStatus pad = {}; // buttons - m_buttons->GetState(&pad->button, button_bitmasks); + m_buttons->GetState(&pad.button, button_bitmasks); // set analog A/B analog to full or w/e, prolly not needed - if (pad->button & PAD_BUTTON_A) - pad->analogA = 0xFF; - if (pad->button & PAD_BUTTON_B) - pad->analogB = 0xFF; + if (pad.button & PAD_BUTTON_A) + pad.analogA = 0xFF; + if (pad.button & PAD_BUTTON_B) + pad.analogB = 0xFF; // dpad - m_dpad->GetState(&pad->button, dpad_bitmasks); + m_dpad->GetState(&pad.button, dpad_bitmasks); // sticks m_main_stick->GetState(&x, &y); - pad->stickX = + pad.stickX = static_cast(GCPadStatus::MAIN_STICK_CENTER_X + (x * GCPadStatus::MAIN_STICK_RADIUS)); - pad->stickY = + pad.stickY = static_cast(GCPadStatus::MAIN_STICK_CENTER_Y + (y * GCPadStatus::MAIN_STICK_RADIUS)); m_c_stick->GetState(&x, &y); - pad->substickX = + pad.substickX = static_cast(GCPadStatus::C_STICK_CENTER_X + (x * GCPadStatus::C_STICK_RADIUS)); - pad->substickY = + pad.substickY = static_cast(GCPadStatus::C_STICK_CENTER_Y + (y * GCPadStatus::C_STICK_RADIUS)); // triggers - m_triggers->GetState(&pad->button, trigger_bitmasks, triggers); - pad->triggerLeft = static_cast(triggers[0] * 0xFF); - pad->triggerRight = static_cast(triggers[1] * 0xFF); + m_triggers->GetState(&pad.button, trigger_bitmasks, triggers); + pad.triggerLeft = static_cast(triggers[0] * 0xFF); + pad.triggerRight = static_cast(triggers[1] * 0xFF); + + return pad; } void GCPad::SetOutput(const ControlState strength) diff --git a/Source/Core/Core/HW/GCPadEmu.h b/Source/Core/Core/HW/GCPadEmu.h index d7578a5780..b407f7a81d 100644 --- a/Source/Core/Core/HW/GCPadEmu.h +++ b/Source/Core/Core/HW/GCPadEmu.h @@ -12,7 +12,7 @@ class GCPad : public ControllerEmu { public: GCPad(const unsigned int index); - void GetInput(GCPadStatus* const pad); + GCPadStatus GetInput() const; void SetOutput(const ControlState strength); bool GetMicButton() const; diff --git a/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp b/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp index fd65412588..c978a7681e 100644 --- a/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp +++ b/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp @@ -132,16 +132,14 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength) case 0x10: { DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: Command 10, %02x (READ STATUS&SWITCHES)", ptr(1)); - GCPadStatus PadStatus; - memset(&PadStatus, 0, sizeof(PadStatus)); - Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); + GCPadStatus pad_status = Pad::GetStatus(m_iDeviceNumber); res[resp++] = 0x10; res[resp++] = 0x2; int d10_0 = 0xdf; - if (PadStatus.triggerLeft) + if (pad_status.triggerLeft) d10_0 &= ~0x80; - if (PadStatus.triggerRight) + if (pad_status.triggerRight) d10_0 &= ~0x40; res[resp++] = d10_0; @@ -299,32 +297,31 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength) msg.AddData(0); // tilt for (i = 0; i < nr_players; ++i) { - GCPadStatus PadStatus; - Pad::GetStatus(i, &PadStatus); + GCPadStatus pad_status = Pad::GetStatus(i); unsigned char player_data[2] = {0, 0}; - if (PadStatus.button & PAD_BUTTON_START) + if (pad_status.button & PAD_BUTTON_START) player_data[0] |= 0x80; - if (PadStatus.button & PAD_BUTTON_UP) + if (pad_status.button & PAD_BUTTON_UP) player_data[0] |= 0x20; - if (PadStatus.button & PAD_BUTTON_DOWN) + if (pad_status.button & PAD_BUTTON_DOWN) player_data[0] |= 0x10; - if (PadStatus.button & PAD_BUTTON_LEFT) + if (pad_status.button & PAD_BUTTON_LEFT) player_data[0] |= 0x08; - if (PadStatus.button & PAD_BUTTON_RIGHT) + if (pad_status.button & PAD_BUTTON_RIGHT) player_data[0] |= 0x04; - if (PadStatus.button & PAD_BUTTON_A) + if (pad_status.button & PAD_BUTTON_A) player_data[0] |= 0x02; - if (PadStatus.button & PAD_BUTTON_B) + if (pad_status.button & PAD_BUTTON_B) player_data[0] |= 0x01; - if (PadStatus.button & PAD_BUTTON_X) + if (pad_status.button & PAD_BUTTON_X) player_data[1] |= 0x80; - if (PadStatus.button & PAD_BUTTON_Y) + if (pad_status.button & PAD_BUTTON_Y) player_data[1] |= 0x40; - if (PadStatus.button & PAD_TRIGGER_L) + if (pad_status.button & PAD_TRIGGER_L) player_data[1] |= 0x20; - if (PadStatus.button & PAD_TRIGGER_R) + if (pad_status.button & PAD_TRIGGER_R) player_data[1] |= 0x10; for (j = 0; j < bytes_per_player; ++j) @@ -336,12 +333,11 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength) { int slots = *jvs_io++; msg.AddData(1); - GCPadStatus PadStatus; - Pad::GetStatus(0, &PadStatus); + GCPadStatus pad_status = Pad::GetStatus(0); while (slots--) { msg.AddData(0); - msg.AddData((PadStatus.button & PAD_BUTTON_START) ? 1 : 0); + msg.AddData((pad_status.button & PAD_BUTTON_START) ? 1 : 0); } break; } diff --git a/Source/Core/Core/HW/SI_DeviceGCAdapter.cpp b/Source/Core/Core/HW/SI_DeviceGCAdapter.cpp index 35bc93e2fb..694e033628 100644 --- a/Source/Core/Core/HW/SI_DeviceGCAdapter.cpp +++ b/Source/Core/Core/HW/SI_DeviceGCAdapter.cpp @@ -25,19 +25,18 @@ CSIDevice_GCAdapter::CSIDevice_GCAdapter(SIDevices device, int _iDeviceNumber) GCPadStatus CSIDevice_GCAdapter::GetPadStatus() { - GCPadStatus PadStatus; - memset(&PadStatus, 0, sizeof(PadStatus)); + 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()) { - GCAdapter::Input(ISIDevice::m_iDeviceNumber, &PadStatus); + pad_status = GCAdapter::Input(m_iDeviceNumber); } - HandleMoviePadStatus(&PadStatus); + HandleMoviePadStatus(&pad_status); - return PadStatus; + return pad_status; } int CSIDevice_GCAdapter::RunBuffer(u8* buffer, int length) diff --git a/Source/Core/Core/HW/SI_DeviceGCController.cpp b/Source/Core/Core/HW/SI_DeviceGCController.cpp index 4d32c20306..8708c09b74 100644 --- a/Source/Core/Core/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/HW/SI_DeviceGCController.cpp @@ -140,18 +140,17 @@ void CSIDevice_GCController::HandleMoviePadStatus(GCPadStatus* PadStatus) GCPadStatus CSIDevice_GCController::GetPadStatus() { - GCPadStatus PadStatus; - memset(&PadStatus, 0, sizeof(PadStatus)); + 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::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); + pad_status = Pad::GetStatus(m_iDeviceNumber); } - HandleMoviePadStatus(&PadStatus); - return PadStatus; + HandleMoviePadStatus(&pad_status); + return pad_status; } // GetData diff --git a/Source/Core/Core/HW/SI_DeviceKeyboard.cpp b/Source/Core/Core/HW/SI_DeviceKeyboard.cpp index 63645be706..dc321fd859 100644 --- a/Source/Core/Core/HW/SI_DeviceKeyboard.cpp +++ b/Source/Core/Core/HW/SI_DeviceKeyboard.cpp @@ -56,9 +56,7 @@ int CSIDevice_Keyboard::RunBuffer(u8* _pBuffer, int _iLength) KeyboardStatus CSIDevice_Keyboard::GetKeyboardStatus() const { - KeyboardStatus KeyStatus = {}; - Keyboard::GetStatus(ISIDevice::m_iDeviceNumber, &KeyStatus); - return KeyStatus; + return Keyboard::GetStatus(m_iDeviceNumber); } bool CSIDevice_Keyboard::GetData(u32& _Hi, u32& _Low) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 04c3c801fa..029b46a833 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -973,11 +973,11 @@ bool NetPlayClient::GetNetPads(const u8 pad_nb, GCPadStatus* pad_status) switch (SConfig::GetInstance().m_SIDevice[local_pad]) { case SIDEVICE_WIIU_ADAPTER: - GCAdapter::Input(local_pad, pad_status); + *pad_status = GCAdapter::Input(local_pad); break; case SIDEVICE_GC_CONTROLLER: default: - Pad::GetStatus(local_pad, pad_status); + *pad_status = Pad::GetStatus(local_pad); break; } diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index 7c450d4288..bd6a396354 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -371,13 +371,13 @@ static void Reset() NOTICE_LOG(SERIALINTERFACE, "GC Adapter detached"); } -void Input(int chan, GCPadStatus* pad) +GCPadStatus Input(int chan) { if (!UseAdapter()) - return; + return {}; if (s_handle == nullptr || !s_detected) - return; + return {}; int payload_size = 0; u8 controller_payload_copy[37]; @@ -389,6 +389,7 @@ void Input(int chan, GCPadStatus* pad) payload_size = s_controller_payload_size.load(); } + GCPadStatus pad = {}; if (payload_size != sizeof(controller_payload_copy) || controller_payload_copy[0] != LIBUSB_DT_HID) { @@ -410,57 +411,58 @@ void Input(int chan, GCPadStatus* pad) s_controller_type[chan] = type; - memset(pad, 0, sizeof(*pad)); if (s_controller_type[chan] != ControllerTypes::CONTROLLER_NONE) { u8 b1 = controller_payload_copy[1 + (9 * chan) + 1]; u8 b2 = controller_payload_copy[1 + (9 * chan) + 2]; if (b1 & (1 << 0)) - pad->button |= PAD_BUTTON_A; + pad.button |= PAD_BUTTON_A; if (b1 & (1 << 1)) - pad->button |= PAD_BUTTON_B; + pad.button |= PAD_BUTTON_B; if (b1 & (1 << 2)) - pad->button |= PAD_BUTTON_X; + pad.button |= PAD_BUTTON_X; if (b1 & (1 << 3)) - pad->button |= PAD_BUTTON_Y; + pad.button |= PAD_BUTTON_Y; if (b1 & (1 << 4)) - pad->button |= PAD_BUTTON_LEFT; + pad.button |= PAD_BUTTON_LEFT; if (b1 & (1 << 5)) - pad->button |= PAD_BUTTON_RIGHT; + pad.button |= PAD_BUTTON_RIGHT; if (b1 & (1 << 6)) - pad->button |= PAD_BUTTON_DOWN; + pad.button |= PAD_BUTTON_DOWN; if (b1 & (1 << 7)) - pad->button |= PAD_BUTTON_UP; + pad.button |= PAD_BUTTON_UP; if (b2 & (1 << 0)) - pad->button |= PAD_BUTTON_START; + pad.button |= PAD_BUTTON_START; if (b2 & (1 << 1)) - pad->button |= PAD_TRIGGER_Z; + pad.button |= PAD_TRIGGER_Z; if (b2 & (1 << 2)) - pad->button |= PAD_TRIGGER_R; + pad.button |= PAD_TRIGGER_R; if (b2 & (1 << 3)) - pad->button |= PAD_TRIGGER_L; + pad.button |= PAD_TRIGGER_L; if (get_origin) - pad->button |= PAD_GET_ORIGIN; + pad.button |= PAD_GET_ORIGIN; - pad->stickX = controller_payload_copy[1 + (9 * chan) + 3]; - pad->stickY = controller_payload_copy[1 + (9 * chan) + 4]; - pad->substickX = controller_payload_copy[1 + (9 * chan) + 5]; - pad->substickY = controller_payload_copy[1 + (9 * chan) + 6]; - pad->triggerLeft = controller_payload_copy[1 + (9 * chan) + 7]; - pad->triggerRight = controller_payload_copy[1 + (9 * chan) + 8]; + pad.stickX = controller_payload_copy[1 + (9 * chan) + 3]; + pad.stickY = controller_payload_copy[1 + (9 * chan) + 4]; + pad.substickX = controller_payload_copy[1 + (9 * chan) + 5]; + pad.substickY = controller_payload_copy[1 + (9 * chan) + 6]; + pad.triggerLeft = controller_payload_copy[1 + (9 * chan) + 7]; + pad.triggerRight = controller_payload_copy[1 + (9 * chan) + 8]; } else if (!Core::g_want_determinism) { // This is a hack to prevent a desync due to SI devices // being different and returning different values. // The corresponding code in DeviceGCAdapter has the same check - pad->button = PAD_ERR_STATUS; + pad.button = PAD_ERR_STATUS; } } + + return pad; } bool DeviceConnected(int chan) diff --git a/Source/Core/InputCommon/GCAdapter.h b/Source/Core/InputCommon/GCAdapter.h index 355f24d1f3..179b27793c 100644 --- a/Source/Core/InputCommon/GCAdapter.h +++ b/Source/Core/InputCommon/GCAdapter.h @@ -24,7 +24,7 @@ void Shutdown(); void SetAdapterCallback(std::function func); void StartScanThread(); void StopScanThread(); -void Input(int chan, GCPadStatus* pad); +GCPadStatus Input(int chan); void Output(int chan, u8 rumble_command); bool IsDetected(); bool IsDriverDetected(); diff --git a/Source/Core/InputCommon/GCAdapter_Android.cpp b/Source/Core/InputCommon/GCAdapter_Android.cpp index 8d2d6be6fe..c5f8a98922 100644 --- a/Source/Core/InputCommon/GCAdapter_Android.cpp +++ b/Source/Core/InputCommon/GCAdapter_Android.cpp @@ -262,10 +262,10 @@ void StopScanThread() s_adapter_detect_thread.join(); } -void Input(int chan, GCPadStatus* pad) +GCPadStatus Input(int chan) { if (!UseAdapter() || !s_detected || !s_fd) - return; + return {}; int payload_size = 0; u8 controller_payload_copy[37]; @@ -277,6 +277,7 @@ void Input(int chan, GCPadStatus* pad) payload_size = s_controller_payload_size.load(); } + GCPadStatus pad = {}; if (payload_size != sizeof(controller_payload_copy)) { ERROR_LOG(SERIALINTERFACE, "error reading payload (size: %d, type: %02x)", payload_size, @@ -297,54 +298,55 @@ void Input(int chan, GCPadStatus* pad) s_controller_type[chan] = type; - memset(pad, 0, sizeof(*pad)); if (s_controller_type[chan] != ControllerTypes::CONTROLLER_NONE) { u8 b1 = controller_payload_copy[1 + (9 * chan) + 1]; u8 b2 = controller_payload_copy[1 + (9 * chan) + 2]; if (b1 & (1 << 0)) - pad->button |= PAD_BUTTON_A; + pad.button |= PAD_BUTTON_A; if (b1 & (1 << 1)) - pad->button |= PAD_BUTTON_B; + pad.button |= PAD_BUTTON_B; if (b1 & (1 << 2)) - pad->button |= PAD_BUTTON_X; + pad.button |= PAD_BUTTON_X; if (b1 & (1 << 3)) - pad->button |= PAD_BUTTON_Y; + pad.button |= PAD_BUTTON_Y; if (b1 & (1 << 4)) - pad->button |= PAD_BUTTON_LEFT; + pad.button |= PAD_BUTTON_LEFT; if (b1 & (1 << 5)) - pad->button |= PAD_BUTTON_RIGHT; + pad.button |= PAD_BUTTON_RIGHT; if (b1 & (1 << 6)) - pad->button |= PAD_BUTTON_DOWN; + pad.button |= PAD_BUTTON_DOWN; if (b1 & (1 << 7)) - pad->button |= PAD_BUTTON_UP; + pad.button |= PAD_BUTTON_UP; if (b2 & (1 << 0)) - pad->button |= PAD_BUTTON_START; + pad.button |= PAD_BUTTON_START; if (b2 & (1 << 1)) - pad->button |= PAD_TRIGGER_Z; + pad.button |= PAD_TRIGGER_Z; if (b2 & (1 << 2)) - pad->button |= PAD_TRIGGER_R; + pad.button |= PAD_TRIGGER_R; if (b2 & (1 << 3)) - pad->button |= PAD_TRIGGER_L; + pad.button |= PAD_TRIGGER_L; if (get_origin) - pad->button |= PAD_GET_ORIGIN; + pad.button |= PAD_GET_ORIGIN; - pad->stickX = controller_payload_copy[1 + (9 * chan) + 3]; - pad->stickY = controller_payload_copy[1 + (9 * chan) + 4]; - pad->substickX = controller_payload_copy[1 + (9 * chan) + 5]; - pad->substickY = controller_payload_copy[1 + (9 * chan) + 6]; - pad->triggerLeft = controller_payload_copy[1 + (9 * chan) + 7]; - pad->triggerRight = controller_payload_copy[1 + (9 * chan) + 8]; + pad.stickX = controller_payload_copy[1 + (9 * chan) + 3]; + pad.stickY = controller_payload_copy[1 + (9 * chan) + 4]; + pad.substickX = controller_payload_copy[1 + (9 * chan) + 5]; + pad.substickY = controller_payload_copy[1 + (9 * chan) + 6]; + pad.triggerLeft = controller_payload_copy[1 + (9 * chan) + 7]; + pad.triggerRight = controller_payload_copy[1 + (9 * chan) + 8]; } else { - pad->button = PAD_ERR_STATUS; + pad.button = PAD_ERR_STATUS; } } + + return pad; } void Output(int chan, u8 rumble_command) diff --git a/Source/Core/InputCommon/GCAdapter_Null.cpp b/Source/Core/InputCommon/GCAdapter_Null.cpp index bb9422807b..e5b30a312f 100644 --- a/Source/Core/InputCommon/GCAdapter_Null.cpp +++ b/Source/Core/InputCommon/GCAdapter_Null.cpp @@ -4,6 +4,7 @@ #include "InputCommon/GCAdapter.h" #include "Common/CommonTypes.h" +#include "InputCommon/GCPadStatus.h" namespace GCAdapter { @@ -25,8 +26,9 @@ void StartScanThread() void StopScanThread() { } -void Input(int chan, GCPadStatus* pad) +GCPadStatus Input(int chan) { + return {}; } void Output(int chan, u8 rumble_command) {