diff --git a/README.md b/README.md index e0234d4..ca1077c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Instead, clone the repository **recursively** using any git client you have. (Gi Like all other switch projects, you need to have [devkitA64](https://switchbrew.org/wiki/Setting_up_Development_Environment) set up on your system. -For compatibility with the Atmosphere-libs dependency, this project currently uses a version of libnx at commit **[5509f8f](https://github.com/switchbrew/libnx/commit/5509f8f14bc87a41794855d2b965cf0c08e9dd6d)**. Clone the repository, checkout to that commit, and run `make install` to set it up. +For compatibility with the Atmosphere-libs dependency, this project currently uses a version of libnx at commit **[b35d42f](https://github.com/switchbrew/libnx/commit/b35d42faaa60b02662aaaf0702614f6e4afcbbbc)**. Clone the repository, checkout to that commit, and run `make install` to set it up. If you have **Visual Studio Code**, you can open the project as a folder and run the build tasks from inside the program. It also has Intellisense configured for switch development, if you have DEVKITPRO correctly defined in your environment variables. Handy! diff --git a/source/ControllerSwitch/SwitchHDLHandler.cpp b/source/ControllerSwitch/SwitchHDLHandler.cpp index f4fa601..2ed70d3 100644 --- a/source/ControllerSwitch/SwitchHDLHandler.cpp +++ b/source/ControllerSwitch/SwitchHDLHandler.cpp @@ -2,6 +2,8 @@ #include "ControllerHelpers.h" #include +static HiddbgHdlsSessionId g_hdlsSessionId; + SwitchHDLHandler::SwitchHDLHandler(std::unique_ptr &&controller) : SwitchVirtualGamepadHandler(std::move(controller)) { @@ -84,7 +86,7 @@ Result SwitchHDLHandler::UpdateHdlState() //Checks if the virtual device was erased, in which case re-attach the device bool isAttached; - if (R_SUCCEEDED(hiddbgIsHdlsVirtualDeviceAttached(m_hdlHandle, &isAttached))) + if (R_SUCCEEDED(hiddbgIsHdlsVirtualDeviceAttached(GetHdlsSessionId(), m_hdlHandle, &isAttached))) { if (!isAttached) hiddbgAttachHdlsVirtualDevice(&m_hdlHandle, &m_deviceInfo); @@ -196,4 +198,9 @@ void SwitchHDLHandler::UpdateOutput() } svcSleepThread(1e+7L); +} + +HiddbgHdlsSessionId &SwitchHDLHandler::GetHdlsSessionId() +{ + return g_hdlsSessionId; } \ No newline at end of file diff --git a/source/ControllerSwitch/SwitchHDLHandler.h b/source/ControllerSwitch/SwitchHDLHandler.h index 872126a..18607d3 100644 --- a/source/ControllerSwitch/SwitchHDLHandler.h +++ b/source/ControllerSwitch/SwitchHDLHandler.h @@ -34,4 +34,6 @@ public: void FillHdlState(const NormalizedButtonData &data); //Passes the HDL state to HID so that it could register the inputs Result UpdateHdlState(); + + static HiddbgHdlsSessionId &GetHdlsSessionId(); }; \ No newline at end of file diff --git a/source/Sysmodule/config.json b/source/Sysmodule/config.json index f96f40e..ee1ee0d 100644 --- a/source/Sysmodule/config.json +++ b/source/Sysmodule/config.json @@ -11,6 +11,8 @@ "pool_partition": 2, "is_64_bit": true, "address_space_type": 1, + "system_resource_size": "0", + "disable_device_address_space_merge": true, "filesystem_access": { "permissions": "0xffffffffffffffff" }, diff --git a/source/Sysmodule/source/config_handler.cpp b/source/Sysmodule/source/config_handler.cpp index b02a287..e25e83a 100644 --- a/source/Sysmodule/source/config_handler.cpp +++ b/source/Sysmodule/source/config_handler.cpp @@ -55,7 +55,7 @@ namespace syscon::config ControllerButton StringToKey(const char *text) { - for (int i = 0; i != keyNames.size(); ++i) + for (std::size_t i = 0; i != keyNames.size(); ++i) { if (strcmp(keyNames[i], text) == 0) { diff --git a/source/Sysmodule/source/main.cpp b/source/Sysmodule/source/main.cpp index 814ceec..57b1e82 100644 --- a/source/Sysmodule/source/main.cpp +++ b/source/Sysmodule/source/main.cpp @@ -6,8 +6,9 @@ #include "controller_handler.h" #include "config_handler.h" #include "psc_module.h" +#include "SwitchHDLHandler.h" -#define APP_VERSION "0.6.3" +#define APP_VERSION "0.6.4" // libnx fake heap initialization extern "C" @@ -66,7 +67,7 @@ extern "C" void __appInit(void) R_ABORT_UNLESS(hiddbgInitialize()); if (hosversionAtLeast(7, 0, 0)) - R_ABORT_UNLESS(hiddbgAttachHdlsWorkBuffer()); + R_ABORT_UNLESS(hiddbgAttachHdlsWorkBuffer(&SwitchHDLHandler::GetHdlsSessionId())); R_ABORT_UNLESS(usbHsInitialize()); R_ABORT_UNLESS(pscmInitialize()); R_ABORT_UNLESS(fsInitialize()); @@ -81,7 +82,7 @@ extern "C" void __appExit(void) { pscmExit(); usbHsExit(); - hiddbgReleaseHdlsWorkBuffer(); + hiddbgReleaseHdlsWorkBuffer(SwitchHDLHandler::GetHdlsSessionId()); hiddbgExit(); fsdevUnmountAll(); fsExit(); diff --git a/source/libstratosphere b/source/libstratosphere index 44279db..dc52a32 160000 --- a/source/libstratosphere +++ b/source/libstratosphere @@ -1 +1 @@ -Subproject commit 44279dbac4cce6413faf5b44bd790b23aa323083 +Subproject commit dc52a32285c62fbb68e701393ec3b4efdc452343