Merge pull request #1010 from Nanquitas/input-redirection-sockupdate

InputRedirection: check service existence instead of using OpenProcessByName
This commit is contained in:
TuxSH 2018-01-19 01:30:15 +01:00 committed by GitHub
commit ccf13be964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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...");