1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-07-01 01:38:44 +00:00

Update dependencies

This commit is contained in:
cathery 2020-12-07 17:58:19 +03:00
parent 8e6a34b900
commit 773f741d62
7 changed files with 27 additions and 23 deletions

View File

@ -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"
}

View File

@ -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<uint8_t>(value.amp_high * 255.0f), static_cast<uint8_t>(value.amp_low * 255.0f));
}
*/
svcSleepThread(1e+7L);
}

View File

@ -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<uint8_t>(value.amp_high * 255.0f), static_cast<uint8_t>(value.amp_low * 255.0f));
}
*/
svcSleepThread(1e+7L);
}

View File

@ -8,7 +8,7 @@
class SwitchHDLHandler : public SwitchVirtualGamepadHandler
{
private:
u64 m_hdlHandle;
HiddbgHdlsHandle m_hdlHandle;
HiddbgHdlsDeviceInfo m_deviceInfo;
HiddbgHdlsState m_hdlState;

View File

@ -7,7 +7,7 @@
class SwitchVirtualGamepadHandler
{
protected:
u32 m_vibrationDeviceHandle;
//HidVibrationDeviceHandle m_vibrationDeviceHandle;
std::unique_ptr<IController> 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; }
};

View File

@ -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"

@ -1 +1 @@
Subproject commit 797dfa782e85173652d017de38066f9a5c88622a
Subproject commit 2c3ccef17e9b267a5d9d232f1aba689f2c591b95