InputRedirection: check service existence instead of using OpenProcessByName

This commit is contained in:
Nanquitas 2018-01-18 20:44:54 +01:00
parent 11f820efa7
commit f36977017b

View File

@ -258,19 +258,19 @@ void MiscellaneousMenu_InputRedirection(void)
} }
else else
{ {
Handle dummy; s64 dummyInfo;
s64 dummyInfo; bool isN3DS = svcGetSystemInfo(&dummyInfo, 0x10001, 0) == 0;
bool isN3DS = svcGetSystemInfo(&dummyInfo, 0x10001, 0) == 0; bool isSocURegistered;
res = OpenProcessByName("socket", &dummy); res = srvIsServiceRegistered(&isSocURegistered, "soc:U");
cantStart = R_FAILED(res); cantStart = R_FAILED(res) || !isSocURegistered;
svcCloseHandle(dummy);
if(!cantStart && isN3DS) if(!cantStart && isN3DS)
{ {
res = OpenProcessByName("ir", &dummy); bool isIrRstRegistered;
cantStart = R_FAILED(res);
svcCloseHandle(dummy); res = srvIsServiceRegistered(&isIrRstRegistered, "ir:rst");
cantStart = R_FAILED(res) || !isIrRstRegistered;
} }
} }
@ -285,7 +285,7 @@ void MiscellaneousMenu_InputRedirection(void)
Draw_DrawString(10, 10, COLOR_TITLE, "Miscellaneous options menu"); Draw_DrawString(10, 10, COLOR_TITLE, "Miscellaneous options menu");
if(!wasEnabled && cantStart) if(!wasEnabled && cantStart)
Draw_DrawString(10, 30, COLOR_WHITE, "Can't start the debugger before the system has fi-\nnished loading."); Draw_DrawString(10, 30, COLOR_WHITE, "Can't start the input redirection before the system\nhas finished loading.");
else if(!wasEnabled) else if(!wasEnabled)
{ {
Draw_DrawString(10, 30, COLOR_WHITE, "Starting InputRedirection..."); Draw_DrawString(10, 30, COLOR_WHITE, "Starting InputRedirection...");