Update GSP patch address for 11.6 to enable brightness control past version 11.3
Opened this issue · 2 comments
therealbungus commented
from source/tools.c
line 651
int GSPPid = 0x14;
int isGSPPatchRequired = 0;
uintptr_t gspPatchAddr = 0;
int bklightValue = 50;
int checkBacklightSupported() {
Handle hGSPProcess = 0;
u32 ret;
u8 buf[16] = { 0 };
static u8 desiredHeader[16] = { 0x30, 0x40, 0x2D, 0xE9, 0x00, 0x40, 0xA0, 0xE1, 0x01, 0x5C, 0x80, 0xE2, 0x8C, 0x01, 0xD0, 0xE5 };
if (!(ntrConfig->isNew3DS)) {
return 1;
}
ret = svc_openProcess(&hGSPProcess, GSPPid);
if (ret != 0) {
return 0;
}
gspPatchAddr = 0x0010740C;
copyRemoteMemory(getCurrentProcessHandle(), buf, hGSPProcess, (void*) gspPatchAddr, 16);
if (memcmp(buf, desiredHeader, 16) == 0) {
goto requirePatch;
}
// 11.3.0
gspPatchAddr = 0x0010743C;
copyRemoteMemory(getCurrentProcessHandle(), buf, hGSPProcess, (void*) gspPatchAddr, 16);
if (memcmp(buf, desiredHeader, 16) == 0) {
goto requirePatch;
}
svc_closeHandle(hGSPProcess);
return 0;
requirePatch:
svc_closeHandle(hGSPProcess);
isGSPPatchRequired = 1;
return 1;
}
This would fix the brightness control not working in system versions past 11.3
RocketRobz commented
Does it work?
If so, one thing that's missing is firmware checking, where if it's 11.3, the below code would be used. (unless the top works on all firmwares?)
therealbungus commented
I downgraded to 11.3 on my n2ds XL which shipped with 11.4 and the
brightness control menu option is showing and working correctly. Although
some people have reported it working while on 11.6, but that may be because
they were on 11.3 at one point in time. Still unsure why it works for them
but I do know that it doesn't work for me past 11.3, and unless there's
more code elsewhere that patches the memory and looks for version specific
offsets, updating this would fix it.
Updated the original post with the whole function for clarification
On Dec 16, 2017 7:44 PM, "Robz8" <notifications@github.com> wrote:
Does it work?
If so, one thing that's missing is firmware checking, where if it's 11.3,
the below code would be used. (unless the top works on all firmwares?)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAba1ZjyuvzboiaEs22pStj4eQ13n1iCks5tBI4FgaJpZM4RENVM>
.