Merge commit 'bb07a7334f064c9512bd7e387dab1b9ef9e228cd' into 3gx-master
* commit 'bb07a7334f064c9512bd7e387dab1b9ef9e228cd': (23 commits) update gitignore and makefile rosalina: ndm + shutdown issue workaround rosalina: ndm doesn't exist on SAFE_FIRM Update bug-report.md, etc rosalina: forgot float suffix in luminance.c rosalina: display min/max luminance hbloader: allow homebrew to write to the shared config page rosalina: minor menu changes rosalina/sm: properly interact with ndm k11ext: refactor ndm:u workaround k11ext: fix oops rosalina: properly rewrite luminance-setting menu, etc. sysmodules: use libctru configmem defs Fix release building (#1454) sysmodules: introduce "luma shared config", rewrite ndmu workaround rosalina: autoclose menu on sleep mode/shell closed to prevent lockup rosalina: prevent disconnect when shell is closed rosalina: properly restore screen filters when lid is reopened rosalina: prevent sleep mode entry if debugger/input redir is enabled to prevent lockup Separate exception dump parser in another repo, add boot.3dsx to release command ... # Conflicts: # .gitignore # exception_dump_parser/luma3ds_exception_dump_parser/__main__.py # sysmodules/rosalina/source/input_redirection.c # sysmodules/rosalina/source/menu.c
This commit is contained in:
@@ -105,14 +105,22 @@ Result KernelSetStateHook(u32 type, u32 varg1, u32 varg2, u32 varg3)
|
||||
__ldrex((s32 *)&rosalinaState);
|
||||
}
|
||||
while(__strex((s32 *)&rosalinaState, (s32)(rosalinaState ^ varg1)));
|
||||
__dmb();
|
||||
|
||||
if(rosalinaState & 2)
|
||||
if(rosalinaState & 0x10)
|
||||
hasStartedRosalinaNetworkFuncsOnce = true;
|
||||
|
||||
if(rosalinaState & 1)
|
||||
rosalinaLockAllThreads();
|
||||
else if(varg1 & 1)
|
||||
rosalinaUnlockAllThreads();
|
||||
// 1: all applet/app/dsp/csnd... threads 2: gsp 4: hid/ir
|
||||
for (u32 v = 4; v != 0; v >>= 1)
|
||||
{
|
||||
if (varg1 & v)
|
||||
{
|
||||
if (rosalinaState & v)
|
||||
rosalinaLockThreads(v);
|
||||
else
|
||||
rosalinaUnlockThreads(v);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -28,9 +28,16 @@
|
||||
#include "svc/SendSyncRequest.h"
|
||||
#include "ipc.h"
|
||||
|
||||
static inline bool isNdmuWorkaround(const SessionInfo *info, u32 pid)
|
||||
{
|
||||
return info != NULL && strcmp(info->name, "ndm:u") == 0 && hasStartedRosalinaNetworkFuncsOnce && pid >= nbSection0Modules;
|
||||
}
|
||||
|
||||
Result SendSyncRequestHook(Handle handle)
|
||||
{
|
||||
KProcessHandleTable *handleTable = handleTableOfProcess(currentCoreContext->objectContext.currentProcess);
|
||||
KProcess *currentProcess = currentCoreContext->objectContext.currentProcess;
|
||||
KProcessHandleTable *handleTable = handleTableOfProcess(currentProcess);
|
||||
u32 pid = idOfProcess(currentProcess);
|
||||
KClientSession *clientSession = (KClientSession *)KProcessHandleTable__ToKAutoObject(handleTable, handle);
|
||||
|
||||
u32 *cmdbuf = (u32 *)((u8 *)currentCoreContext->objectContext.currentThread->threadLocalStorage + 0x80);
|
||||
@@ -47,7 +54,7 @@ Result SendSyncRequestHook(Handle handle)
|
||||
case 0x10042:
|
||||
{
|
||||
SessionInfo *info = SessionInfo_Lookup(clientSession->parentSession);
|
||||
if(info != NULL && strcmp(info->name, "ndm:u") == 0 && hasStartedRosalinaNetworkFuncsOnce)
|
||||
if(isNdmuWorkaround(info, pid))
|
||||
{
|
||||
cmdbuf[0] = 0x10040;
|
||||
cmdbuf[1] = 0;
|
||||
@@ -87,7 +94,7 @@ Result SendSyncRequestHook(Handle handle)
|
||||
case 0x20002:
|
||||
{
|
||||
SessionInfo *info = SessionInfo_Lookup(clientSession->parentSession);
|
||||
if(info != NULL && strcmp(info->name, "ndm:u") == 0 && hasStartedRosalinaNetworkFuncsOnce)
|
||||
if(isNdmuWorkaround(info, pid))
|
||||
{
|
||||
cmdbuf[0] = 0x20040;
|
||||
cmdbuf[1] = 0;
|
||||
@@ -129,7 +136,7 @@ Result SendSyncRequestHook(Handle handle)
|
||||
if(!hasStartedRosalinaNetworkFuncsOnce)
|
||||
break;
|
||||
SessionInfo *info = SessionInfo_Lookup(clientSession->parentSession);
|
||||
skip = info != NULL && strcmp(info->name, "ndm:u") == 0; // SuspendScheduler
|
||||
skip = isNdmuWorkaround(info, pid); // SuspendScheduler
|
||||
if(skip)
|
||||
cmdbuf[1] = 0;
|
||||
break;
|
||||
@@ -140,7 +147,7 @@ Result SendSyncRequestHook(Handle handle)
|
||||
if(!hasStartedRosalinaNetworkFuncsOnce)
|
||||
break;
|
||||
SessionInfo *info = SessionInfo_Lookup(clientSession->parentSession);
|
||||
if(info != NULL && strcmp(info->name, "ndm:u") == 0) // ResumeScheduler
|
||||
if(isNdmuWorkaround(info, pid)) // ResumeScheduler
|
||||
{
|
||||
cmdbuf[0] = 0x90040;
|
||||
cmdbuf[1] = 0;
|
||||
|
||||
Reference in New Issue
Block a user