rosalina: fix rare screen filter race condition

This commit is contained in:
TuxSH 2023-01-21 20:32:57 +00:00
parent 8dd40158ca
commit ee9f283d4d
2 changed files with 15 additions and 2 deletions

View File

@ -255,8 +255,8 @@ void menuThreadMain(void)
if(isN3DS)
N3DSMenu_UpdateStatus();
while (!isServiceUsable("ac:u") || !isServiceUsable("hid:USER"))
svcSleepThread(500 * 1000 * 1000LL);
while (!isServiceUsable("ac:u") || !isServiceUsable("hid:USER") || !isServiceUsable("gsp::Gpu"))
svcSleepThread(250 * 1000 * 1000LL);
s64 out = 0;

View File

@ -153,13 +153,26 @@ void ScreenFiltersMenu_Set##name(void)\
void ScreenFiltersMenu_RestoreSettings(void)
{
// Precondition: menu has not been entered
// Not initialized/default: return
if (ScreenFiltersMenu_IsDefaultSettings())
return;
// Wait for GSP to restore the CCT table
svcSleepThread(20 * 1000 * 1000LL);
// Pause GSP, then wait a bit to ensure GPU commands complete
// We need to ensure no GPU stuff is running when changing
// the gamma table (otherwise colors become and stay glitched).
svcKernelSetState(0x10000, 2);
svcSleepThread(5 * 1000 * 100LL);
ScreenFiltersMenu_ApplyColorSettings();
// Unpause GSP
svcKernelSetState(0x10000, 2);
svcSleepThread(5 * 1000 * 100LL);
}
DEF_CCT_SETTER(6500, Default)