Skip to content

Instantly share code, notes, and snippets.

@hax0kartik
Created January 28, 2022 18:23
Show Gist options
  • Save hax0kartik/bdd51eefd801378cd199121a46a50b33 to your computer and use it in GitHub Desktop.
Save hax0kartik/bdd51eefd801378cd199121a46a50b33 to your computer and use it in GitHub Desktop.
Patch to disable ZL/ZR/Cnub via luma
/* Disable CNUB */
case 0x150080:
{
SessionInfo *info = SessionInfo_Lookup(clientSession->parentSession);
if(info != NULL && strcmp(info->name, "i2c::IR") == 0){
skip = true;
res = SendSyncRequest(handle);
if(res == 0)
{
u32 *staticbuf = (u32 *)((u8 *)currentCoreContext->objectContext.currentThread->threadLocalStorage + 0x180);
u32 *bufaddr = (u32 *)staticbuf[1];
*bufaddr = 0x80800081 | (*bufaddr & 0x600);
}
}
break;
}
/* Disable ZR */
case 0x150080:
{
SessionInfo *info = SessionInfo_Lookup(clientSession->parentSession);
if(info != NULL && strcmp(info->name, "i2c::IR") == 0){
skip = true;
res = SendSyncRequest(handle);
if(res == 0)
{
u32 *staticbuf = (u32 *)((u8 *)currentCoreContext->objectContext.currentThread->threadLocalStorage + 0x180);
u32 *bufaddr = (u32 *)staticbuf[1];
*bufaddr &= ~0x200;
}
}
break;
}
/* Disable ZL */
case 0x150080:
{
SessionInfo *info = SessionInfo_Lookup(clientSession->parentSession);
if(info != NULL && strcmp(info->name, "i2c::IR") == 0){
skip = true;
res = SendSyncRequest(handle);
if(res == 0)
{
u32 *staticbuf = (u32 *)((u8 *)currentCoreContext->objectContext.currentThread->threadLocalStorage + 0x180);
u32 *bufaddr = (u32 *)staticbuf[1];
*bufaddr &= ~0x400;
}
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment