mirror of
https://github.com/cathery/sys-con.git
synced 2024-07-01 01:38:44 +00:00
Update libnx and libstratosphere
This commit is contained in:
parent
c91bcd9e26
commit
7cab2e1e89
|
@ -1,12 +1,9 @@
|
||||||
#include "SwitchControllerHandler.h"
|
#include "SwitchControllerHandler.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#define JOYSTICK_MAX_FIXED (JOYSTICK_MAX)
|
|
||||||
#define JOYSTICK_MIN_FIXED (JOYSTICK_MIN + 1)
|
|
||||||
|
|
||||||
static_assert(
|
static_assert(
|
||||||
JOYSTICK_MAX_FIXED == 32767 && JOYSTICK_MIN_FIXED == -32767,
|
JOYSTICK_MAX == 32767 && JOYSTICK_MIN == -32767,
|
||||||
"Seems like you're using a libnx build that has fixed the joystick values, please remove these _FIXED defines and use the unmodified joystick values instead"
|
"JOYSTICK_MAX and/or JOYSTICK_MIN has incorrect values. Update libnx"
|
||||||
);
|
);
|
||||||
|
|
||||||
SwitchControllerHandler::SwitchControllerHandler(std::unique_ptr<IController> &&controller)
|
SwitchControllerHandler::SwitchControllerHandler(std::unique_ptr<IController> &&controller)
|
||||||
|
@ -36,10 +33,10 @@ void SwitchControllerHandler::ConvertAxisToSwitchAxis(float x, float y, float de
|
||||||
{
|
{
|
||||||
float floatRange = 2.0f;
|
float floatRange = 2.0f;
|
||||||
//JOYSTICK_MAX is 1 above and JOYSTICK_MIN is 1 below acceptable joystick values, causing crashes on various games including Xenoblade Chronicles 2 and Resident Evil 4
|
//JOYSTICK_MAX is 1 above and JOYSTICK_MIN is 1 below acceptable joystick values, causing crashes on various games including Xenoblade Chronicles 2 and Resident Evil 4
|
||||||
float newRange = (JOYSTICK_MAX_FIXED - JOYSTICK_MIN_FIXED);
|
float newRange = (JOYSTICK_MAX - JOYSTICK_MIN);
|
||||||
|
|
||||||
*x_out = (((x + 1.0f) * newRange) / floatRange) + JOYSTICK_MIN_FIXED;
|
*x_out = (((x + 1.0f) * newRange) / floatRange) + JOYSTICK_MIN;
|
||||||
*y_out = (((y + 1.0f) * newRange) / floatRange) + JOYSTICK_MIN_FIXED;
|
*y_out = (((y + 1.0f) * newRange) / floatRange) + JOYSTICK_MIN;
|
||||||
/*
|
/*
|
||||||
OldRange = (OldMax - OldMin)
|
OldRange = (OldMax - OldMin)
|
||||||
NewRange = (NewMax - NewMin)
|
NewRange = (NewMax - NewMin)
|
||||||
|
|
|
@ -59,7 +59,7 @@ extern "C" void __appInit(void)
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
});
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsdevMountSdmc());
|
R_ABORT_UNLESS(fsdevMountSdmc());
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void __appExit(void)
|
extern "C" void __appExit(void)
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace syscon::psc
|
||||||
void PscThreadFunc(void *arg)
|
void PscThreadFunc(void *arg)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
if (R_SUCCEEDED(waitSingle(pscModuleWaiter, U64_MAX)))
|
if (R_SUCCEEDED(waitSingle(pscModuleWaiter, UINT64_MAX)))
|
||||||
{
|
{
|
||||||
PscPmState pscState;
|
PscPmState pscState;
|
||||||
u32 out_flags;
|
u32 out_flags;
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace syscon::usb
|
||||||
void UsbEventThreadFunc(void *arg)
|
void UsbEventThreadFunc(void *arg)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
if (R_SUCCEEDED(eventWait(&g_usbCatchAllEvent, U64_MAX)))
|
if (R_SUCCEEDED(eventWait(&g_usbCatchAllEvent, UINT64_MAX)))
|
||||||
{
|
{
|
||||||
WriteToLog("Catch-all event went off");
|
WriteToLog("Catch-all event went off");
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ namespace syscon::usb
|
||||||
void UsbDs3EventThreadFunc(void *arg)
|
void UsbDs3EventThreadFunc(void *arg)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
if (R_SUCCEEDED(eventWait(&g_usbDualshock3Event, U64_MAX)))
|
if (R_SUCCEEDED(eventWait(&g_usbDualshock3Event, UINT64_MAX)))
|
||||||
{
|
{
|
||||||
WriteToLog("Dualshock 3 event went off");
|
WriteToLog("Dualshock 3 event went off");
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ namespace syscon::usb
|
||||||
void UsbDs4EventThreadFunc(void *arg)
|
void UsbDs4EventThreadFunc(void *arg)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
if (R_SUCCEEDED(eventWait(&g_usbDualshock4Event, U64_MAX)))
|
if (R_SUCCEEDED(eventWait(&g_usbDualshock4Event, UINT64_MAX)))
|
||||||
{
|
{
|
||||||
WriteToLog("Dualshock 4 event went off");
|
WriteToLog("Dualshock 4 event went off");
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a4ce117292cc86e951d82666f4e13bc1dc40443f
|
Subproject commit 07630f73a72cf2d3ea2cefc70dcd8a0449fbcbd3
|
Loading…
Reference in New Issue
Block a user