Skip to content

Commit

Permalink
Update for FW 13.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cathery committed Sep 23, 2021
1 parent 7686597 commit 670968a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
9 changes: 8 additions & 1 deletion source/ControllerSwitch/SwitchHDLHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "ControllerHelpers.h"
#include <cmath>

static HiddbgHdlsSessionId g_hdlsSessionId;

SwitchHDLHandler::SwitchHDLHandler(std::unique_ptr<IController> &&controller)
: SwitchVirtualGamepadHandler(std::move(controller))
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -196,4 +198,9 @@ void SwitchHDLHandler::UpdateOutput()
}

svcSleepThread(1e+7L);
}

HiddbgHdlsSessionId &SwitchHDLHandler::GetHdlsSessionId()
{
return g_hdlsSessionId;
}
2 changes: 2 additions & 0 deletions source/ControllerSwitch/SwitchHDLHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ class SwitchHDLHandler : public SwitchVirtualGamepadHandler
void FillHdlState(const NormalizedButtonData &data);
//Passes the HDL state to HID so that it could register the inputs
Result UpdateHdlState();

static HiddbgHdlsSessionId &GetHdlsSessionId();
};
2 changes: 2 additions & 0 deletions source/Sysmodule/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion source/Sysmodule/source/config_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
7 changes: 4 additions & 3 deletions source/Sysmodule/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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());
Expand All @@ -81,7 +82,7 @@ extern "C" void __appExit(void)
{
pscmExit();
usbHsExit();
hiddbgReleaseHdlsWorkBuffer();
hiddbgReleaseHdlsWorkBuffer(SwitchHDLHandler::GetHdlsSessionId());
hiddbgExit();
fsdevUnmountAll();
fsExit();
Expand Down
2 changes: 1 addition & 1 deletion source/libstratosphere
Submodule libstratosphere updated 543 files

0 comments on commit 670968a

Please sign in to comment.