rosalina/sm: properly interact with ndm
This commit is contained in:
@@ -17,7 +17,6 @@ This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for
|
||||
|
||||
extern u32 nbSection0Modules;
|
||||
extern Handle resumeGetServiceHandleOrPortRegisteredSemaphore;
|
||||
extern u32 ndmuServicePid;
|
||||
|
||||
struct SessionDataList;
|
||||
|
||||
|
||||
@@ -10,17 +10,11 @@ This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
static atomic_int ndmuWorkaroundCount;
|
||||
|
||||
static bool isNotificationInhibited(const ProcessData *processData, u32 notificationId)
|
||||
{
|
||||
u32 pid = processData->pid;
|
||||
(void)processData;
|
||||
switch(notificationId)
|
||||
{
|
||||
// Shell opened, shell closed
|
||||
case 0x213:
|
||||
case 0x214:
|
||||
return pid == ndmuServicePid && atomic_load(&ndmuWorkaroundCount) > 0;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -207,10 +201,3 @@ Result PublishToAll(u32 notificationId)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result AddToNdmuWorkaroundCount(s32 count)
|
||||
{
|
||||
// Note: no check is made to (current value)+count
|
||||
atomic_fetch_add(&ndmuWorkaroundCount, count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for
|
||||
ServiceInfo servicesInfo[0xA0] = { 0 };
|
||||
u32 nbServices = 0; // including "ports" registered with getPort
|
||||
|
||||
u32 ndmuServicePid = 3; // use our PID as default.
|
||||
|
||||
static Result checkServiceName(const char *name, s32 nameSize)
|
||||
{
|
||||
if(nameSize <= 0 || nameSize > 8)
|
||||
@@ -98,9 +96,6 @@ static Result doRegisterServiceOrPort(u32 pid, Handle *serverPort, Handle client
|
||||
if(!isNamedPort)
|
||||
*serverPort = portServer;
|
||||
|
||||
if(R_SUCCEEDED(res) && strcmp(name, "ndm:u") == 0)
|
||||
ndmuServicePid = pid;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,14 +167,6 @@ Result srvHandleCommands(SessionData *sessionData)
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x1000: // Custom command: AddToNdmuWorkaroundCount
|
||||
{
|
||||
res = AddToNdmuWorkaroundCount((s32)cmdbuf[1]);
|
||||
cmdbuf[0] = IPC_MakeHeader(0x1000, 1, 0);;
|
||||
cmdbuf[1] = (u32)res;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
goto invalid_command;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user