Skip to content

Instantly share code, notes, and snippets.

@averne
Created August 19, 2020 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save averne/faa5bac706d027c342a6db1595455acf to your computer and use it in GitHub Desktop.
Save averne/faa5bac706d027c342a6db1595455acf to your computer and use it in GitHub Desktop.
Patching nxmtp

Patching nxmtp to receive input on 9.0.0+

On firmwares 9.0.0+, the HID shared memory won't update values for the controller libnx uses, unless it is explicitely specified as supported. The fix is as simple as changing the bitflag passed to nn::hid::SetSupportedNpadStyleSet, from 0x1f to 0x6000001f (see here).

Aarch64 doesn't allow loading immediate values of size bigger than 16-bit unsigned, so we need to split the loading into two instructions:

becomes:

However, this removes the error handling for the above function (_hidActivateNpad).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment