diff --git a/src/core.cc b/src/core.cc index d22b221..19d02da 100644 --- a/src/core.cc +++ b/src/core.cc @@ -17,11 +17,11 @@ #include #include -// NOT USED. -void (*_idle_func)() = NULL; +// 0x51E234 +IdleFunc* _idle_func = NULL; -// NOT USED. -void (*_focus_func)(int) = NULL; +// 0x51E238 +FocusFunc* _focus_func = NULL; // 0x51E23C int gKeyboardKeyRepeatRate = 80; @@ -922,6 +922,70 @@ unsigned int _get_bk_time() return gTickerLastTimestamp; } +// NOTE: Unused. +// +// 0x4C9418 +void inputSetKeyboardKeyRepeatRate(int value) +{ + gKeyboardKeyRepeatRate = value; +} + +// NOTE: Unused. +// +// 0x4C9420 +int inputGetKeyboardKeyRepeatRate() +{ + return gKeyboardKeyRepeatRate; +} + +// NOTE: Unused. +// +// 0x4C9428 +void inputSetKeyboardKeyRepeatDelay(int value) +{ + gKeyboardKeyRepeatDelay = value; +} + +// NOTE: Unused. +// +// 0x4C9430 +int inputGetKeyboardKeyRepeatDelay() +{ + return gKeyboardKeyRepeatDelay; +} + +// NOTE: Unused. +// +// 0x4C9438 +void inputSetFocusFunc(FocusFunc* func) +{ + _focus_func = func; +} + +// NOTE: Unused. +// +// 0x4C9440 +FocusFunc* inputGetFocusFunc() +{ + return _focus_func; +} + +// NOTE: Unused. +// +// 0x4C9448 +void inputSetIdleFunc(IdleFunc* func) +{ + _idle_func = func; +} + +// NOTE: Unused. +// +// 0x4C9450 +IdleFunc* inputGetIdleFunc() +{ + return _idle_func; +} + // 0x4C9490 void buildNormalizedQwertyKeys() { @@ -1375,7 +1439,7 @@ void _GNW95_process_key(KeyboardData* data) void _GNW95_lost_focus() { if (_focus_func != NULL) { - _focus_func(0); + _focus_func(false); } while (!gProgramIsActive) { @@ -1387,7 +1451,7 @@ void _GNW95_lost_focus() } if (_focus_func != NULL) { - _focus_func(1); + _focus_func(true); } } diff --git a/src/core.h b/src/core.h index 575a1c9..9210f52 100644 --- a/src/core.h +++ b/src/core.h @@ -414,7 +414,9 @@ typedef struct InputEvent { int mouseY; } InputEvent; -typedef void TickerProc(); +typedef void(IdleFunc)(); +typedef void(FocusFunc)(bool focus); +typedef void(TickerProc)(); typedef struct TickerListNode { int flags; @@ -461,8 +463,8 @@ typedef int(PauseHandler)(); typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, unsigned char* palette); typedef void(VcrPlaybackCompletionCallback)(int reason); -extern void (*_idle_func)(); -extern void (*_focus_func)(int); +extern IdleFunc* _idle_func; +extern FocusFunc* _focus_func; extern int gKeyboardKeyRepeatRate; extern int gKeyboardKeyRepeatDelay; extern bool _keyboard_hooked; @@ -596,6 +598,14 @@ void coreDelay(unsigned int ms); unsigned int getTicksSince(unsigned int a1); unsigned int getTicksBetween(unsigned int a1, unsigned int a2); unsigned int _get_bk_time(); +void inputSetKeyboardKeyRepeatRate(int value); +int inputGetKeyboardKeyRepeatRate(); +void inputSetKeyboardKeyRepeatDelay(int value); +int inputGetKeyboardKeyRepeatDelay(); +void inputSetFocusFunc(FocusFunc* func); +FocusFunc* inputGetFocusFunc(); +void inputSetIdleFunc(IdleFunc* func); +IdleFunc* inputGetIdleFunc(); void buildNormalizedQwertyKeys(); int _GNW95_input_init(); void _GNW95_process_message();