diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index b11c678..0573a2a 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -22,7 +22,7 @@ "ATMOSPHERE_OS_HORIZON" ], "compilerPath": "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-g++", - "cStandard": "gnu18", + "cStandard": "gnu17", "cppStandard": "gnu++20", "intelliSenseMode": "gcc-arm64" } diff --git a/source/ControllerSwitch/SwitchAbstractedPadHandler.cpp b/source/ControllerSwitch/SwitchAbstractedPadHandler.cpp index 836a623..70d5b48 100644 --- a/source/ControllerSwitch/SwitchAbstractedPadHandler.cpp +++ b/source/ControllerSwitch/SwitchAbstractedPadHandler.cpp @@ -73,9 +73,9 @@ Result SwitchAbstractedPadHandler::InitAbstractedPadState() m_state = {0}; m_abstractedPadID = getUniqueId(); m_state.type = BIT(0); - m_state.npadInterfaceType = NpadInterfaceType_USB; + m_state.npadInterfaceType = HidNpadInterfaceType_USB; m_state.flags = 0xff; - m_state.state.batteryCharge = 4; + m_state.state.battery_level = 4; ControllerConfig *config = GetController()->GetConfig(); m_state.singleColorBody = config->bodyColor.rgbaValue; m_state.singleColorButtons = config->buttonsColor.rgbaValue; @@ -129,7 +129,7 @@ void SwitchAbstractedPadHandler::FillAbstractedState(const NormalizedButtonData daxis_y += data.buttons[14] ? -1.0f : 0.0f; //DDOWN daxis_x += data.buttons[15] ? -1.0f : 0.0f; //DLEFT - ConvertAxisToSwitchAxis(daxis_x, daxis_y, 0, &m_state.state.joysticks[JOYSTICK_LEFT].dx, &m_state.state.joysticks[JOYSTICK_LEFT].dy); + ConvertAxisToSwitchAxis(daxis_x, daxis_y, 0, &m_state.state.analog_stick_l.x, &m_state.state.analog_stick_l.y); } else { @@ -138,10 +138,10 @@ void SwitchAbstractedPadHandler::FillAbstractedState(const NormalizedButtonData m_state.state.buttons |= (data.buttons[14] ? KEY_DDOWN : 0); m_state.state.buttons |= (data.buttons[15] ? KEY_DLEFT : 0); - ConvertAxisToSwitchAxis(data.sticks[0].axis_x, data.sticks[0].axis_y, 0, &m_state.state.joysticks[JOYSTICK_LEFT].dx, &m_state.state.joysticks[JOYSTICK_LEFT].dy); + ConvertAxisToSwitchAxis(data.sticks[0].axis_x, data.sticks[0].axis_y, 0, &m_state.state.analog_stick_l.x, &m_state.state.analog_stick_l.y); } - ConvertAxisToSwitchAxis(data.sticks[1].axis_x, data.sticks[1].axis_y, 0, &m_state.state.joysticks[JOYSTICK_RIGHT].dx, &m_state.state.joysticks[JOYSTICK_RIGHT].dy); + ConvertAxisToSwitchAxis(data.sticks[1].axis_x, data.sticks[1].axis_y, 0, &m_state.state.analog_stick_r.x, &m_state.state.analog_stick_r.y); m_state.state.buttons |= (data.buttons[16] ? KEY_CAPTURE : 0); m_state.state.buttons |= (data.buttons[17] ? KEY_HOME : 0); @@ -170,14 +170,16 @@ void SwitchAbstractedPadHandler::UpdateOutput() if (R_SUCCEEDED(m_controller->OutputBuffer())) return; + /* if (DoesControllerSupport(m_controller->GetType(), SUPPORTS_RUMBLE)) { Result rc; HidVibrationValue value; - rc = hidGetActualVibrationValue(&m_vibrationDeviceHandle, &value); + rc = hidGetActualVibrationValue(m_vibrationDeviceHandle, &value); if (R_SUCCEEDED(rc)) GetController()->SetRumble(static_cast(value.amp_high * 255.0f), static_cast(value.amp_low * 255.0f)); } + */ svcSleepThread(1e+7L); } \ No newline at end of file diff --git a/source/ControllerSwitch/SwitchHDLHandler.cpp b/source/ControllerSwitch/SwitchHDLHandler.cpp index 3d21079..65df6b3 100644 --- a/source/ControllerSwitch/SwitchHDLHandler.cpp +++ b/source/ControllerSwitch/SwitchHDLHandler.cpp @@ -48,13 +48,13 @@ void SwitchHDLHandler::Exit() Result SwitchHDLHandler::InitHdlState() { - m_hdlHandle = 0; + m_hdlHandle = {0}; m_deviceInfo = {0}; m_hdlState = {0}; // Set the controller type to Pro-Controller, and set the npadInterfaceType. m_deviceInfo.deviceType = HidDeviceType_FullKey15; - m_deviceInfo.npadInterfaceType = NpadInterfaceType_USB; + m_deviceInfo.npadInterfaceType = HidNpadInterfaceType_USB; // Set the controller colors. The grip colors are for Pro-Controller on [9.0.0+]. ControllerConfig *config = m_controller->GetConfig(); m_deviceInfo.singleColorBody = config->bodyColor.rgbaValue; @@ -62,11 +62,11 @@ Result SwitchHDLHandler::InitHdlState() m_deviceInfo.colorLeftGrip = config->leftGripColor.rgbaValue; m_deviceInfo.colorRightGrip = config->rightGripColor.rgbaValue; - m_hdlState.batteryCharge = 4; // Set battery charge to full. - m_hdlState.joysticks[JOYSTICK_LEFT].dx = 0x1234; - m_hdlState.joysticks[JOYSTICK_LEFT].dy = -0x1234; - m_hdlState.joysticks[JOYSTICK_RIGHT].dx = 0x5678; - m_hdlState.joysticks[JOYSTICK_RIGHT].dy = -0x5678; + m_hdlState.battery_level = 4; // Set battery charge to full. + m_hdlState.analog_stick_l.x = 0x1234; + m_hdlState.analog_stick_l.y = -0x1234; + m_hdlState.analog_stick_r.x = 0x5678; + m_hdlState.analog_stick_r.y = -0x5678; if (m_controller->IsControllerActive()) return hiddbgAttachHdlsVirtualDevice(&m_hdlHandle, &m_deviceInfo); @@ -139,7 +139,7 @@ void SwitchHDLHandler::FillHdlState(const NormalizedButtonData &data) daxis_x *= ratio; daxis_y *= ratio; - ConvertAxisToSwitchAxis(daxis_x, daxis_y, 0, &m_hdlState.joysticks[JOYSTICK_LEFT].dx, &m_hdlState.joysticks[JOYSTICK_LEFT].dy); + ConvertAxisToSwitchAxis(daxis_x, daxis_y, 0, &m_hdlState.analog_stick_l.x, &m_hdlState.analog_stick_l.y); } else { @@ -148,10 +148,10 @@ void SwitchHDLHandler::FillHdlState(const NormalizedButtonData &data) m_hdlState.buttons |= (data.buttons[14] ? KEY_DDOWN : 0); m_hdlState.buttons |= (data.buttons[15] ? KEY_DLEFT : 0); - ConvertAxisToSwitchAxis(data.sticks[0].axis_x, data.sticks[0].axis_y, 0, &m_hdlState.joysticks[JOYSTICK_LEFT].dx, &m_hdlState.joysticks[JOYSTICK_LEFT].dy); + ConvertAxisToSwitchAxis(data.sticks[0].axis_x, data.sticks[0].axis_y, 0, &m_hdlState.analog_stick_l.x, &m_hdlState.analog_stick_l.y); } - ConvertAxisToSwitchAxis(data.sticks[1].axis_x, data.sticks[1].axis_y, 0, &m_hdlState.joysticks[JOYSTICK_RIGHT].dx, &m_hdlState.joysticks[JOYSTICK_RIGHT].dy); + ConvertAxisToSwitchAxis(data.sticks[1].axis_x, data.sticks[1].axis_y, 0, &m_hdlState.analog_stick_r.x, &m_hdlState.analog_stick_r.y); m_hdlState.buttons |= (data.buttons[16] ? KEY_CAPTURE : 0); m_hdlState.buttons |= (data.buttons[17] ? KEY_HOME : 0); @@ -185,15 +185,17 @@ void SwitchHDLHandler::UpdateOutput() if (R_SUCCEEDED(m_controller->OutputBuffer())) return; + /* // Process rumble values if supported if (DoesControllerSupport(m_controller->GetType(), SUPPORTS_RUMBLE)) { Result rc; HidVibrationValue value; - rc = hidGetActualVibrationValue(&m_vibrationDeviceHandle, &value); + rc = hidGetActualVibrationValue(m_vibrationDeviceHandle, &value); if (R_SUCCEEDED(rc)) m_controller->SetRumble(static_cast(value.amp_high * 255.0f), static_cast(value.amp_low * 255.0f)); } + */ svcSleepThread(1e+7L); } \ No newline at end of file diff --git a/source/ControllerSwitch/SwitchHDLHandler.h b/source/ControllerSwitch/SwitchHDLHandler.h index a828ced..872126a 100644 --- a/source/ControllerSwitch/SwitchHDLHandler.h +++ b/source/ControllerSwitch/SwitchHDLHandler.h @@ -8,7 +8,7 @@ class SwitchHDLHandler : public SwitchVirtualGamepadHandler { private: - u64 m_hdlHandle; + HiddbgHdlsHandle m_hdlHandle; HiddbgHdlsDeviceInfo m_deviceInfo; HiddbgHdlsState m_hdlState; diff --git a/source/ControllerSwitch/SwitchVirtualGamepadHandler.h b/source/ControllerSwitch/SwitchVirtualGamepadHandler.h index 9400edd..6e4c500 100644 --- a/source/ControllerSwitch/SwitchVirtualGamepadHandler.h +++ b/source/ControllerSwitch/SwitchVirtualGamepadHandler.h @@ -7,7 +7,7 @@ class SwitchVirtualGamepadHandler { protected: - u32 m_vibrationDeviceHandle; + //HidVibrationDeviceHandle m_vibrationDeviceHandle; std::unique_ptr m_controller; alignas(ams::os::ThreadStackAlignment) u8 input_thread_stack[0x1000]; @@ -52,5 +52,5 @@ public: //Get the raw controller pointer inline IController *GetController() { return m_controller.get(); } - inline u32 *GetVibrationHandle() { return &m_vibrationDeviceHandle; } + //inline HidVibrationDeviceHandle *GetVibrationHandle() { return &m_vibrationDeviceHandle; } }; \ No newline at end of file diff --git a/source/Sysmodule/source/main.cpp b/source/Sysmodule/source/main.cpp index 06a2c9c..7c43183 100644 --- a/source/Sysmodule/source/main.cpp +++ b/source/Sysmodule/source/main.cpp @@ -7,7 +7,7 @@ #include "config_handler.h" #include "psc_module.h" -#define APP_VERSION "0.6.2" +#define APP_VERSION "0.6.3" // libnx fake heap initialization extern "C" diff --git a/source/libstratosphere b/source/libstratosphere index 797dfa7..2c3ccef 160000 --- a/source/libstratosphere +++ b/source/libstratosphere @@ -1 +1 @@ -Subproject commit 797dfa782e85173652d017de38066f9a5c88622a +Subproject commit 2c3ccef17e9b267a5d9d232f1aba689f2c591b95