From cfca07f7f2f2d0586f06a7ecccd6236c355073dc Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Tue, 16 Aug 2022 14:24:57 +0300 Subject: [PATCH] Add idle func --- src/core.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core.cc b/src/core.cc index 19d02da..6778d7c 100644 --- a/src/core.cc +++ b/src/core.cc @@ -17,6 +17,8 @@ #include #include +static void idleImpl(); + // 0x51E234 IdleFunc* _idle_func = NULL; @@ -411,6 +413,10 @@ int coreInit(int a1) gTickerListHead = NULL; gScreenshotKeyCode = KEY_ALT_C; + // SFALL: Set idle function. + // CE: Prevents frying CPU when window is not focused. + inputSetIdleFunc(idleImpl); + return 0; } @@ -4907,3 +4913,8 @@ void convertMouseWheelToArrowKey(int* keyCodePtr) } } } + +static void idleImpl() +{ + SDL_Delay(125); +}