Decompile some input functions

This commit is contained in:
Alexander Batalov 2022-08-16 14:14:53 +03:00
parent a1521049b5
commit 0f60556b73
2 changed files with 83 additions and 9 deletions

View File

@ -17,11 +17,11 @@
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
// NOT USED. // 0x51E234
void (*_idle_func)() = NULL; IdleFunc* _idle_func = NULL;
// NOT USED. // 0x51E238
void (*_focus_func)(int) = NULL; FocusFunc* _focus_func = NULL;
// 0x51E23C // 0x51E23C
int gKeyboardKeyRepeatRate = 80; int gKeyboardKeyRepeatRate = 80;
@ -922,6 +922,70 @@ unsigned int _get_bk_time()
return gTickerLastTimestamp; 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 // 0x4C9490
void buildNormalizedQwertyKeys() void buildNormalizedQwertyKeys()
{ {
@ -1375,7 +1439,7 @@ void _GNW95_process_key(KeyboardData* data)
void _GNW95_lost_focus() void _GNW95_lost_focus()
{ {
if (_focus_func != NULL) { if (_focus_func != NULL) {
_focus_func(0); _focus_func(false);
} }
while (!gProgramIsActive) { while (!gProgramIsActive) {
@ -1387,7 +1451,7 @@ void _GNW95_lost_focus()
} }
if (_focus_func != NULL) { if (_focus_func != NULL) {
_focus_func(1); _focus_func(true);
} }
} }

View File

@ -414,7 +414,9 @@ typedef struct InputEvent {
int mouseY; int mouseY;
} InputEvent; } InputEvent;
typedef void TickerProc(); typedef void(IdleFunc)();
typedef void(FocusFunc)(bool focus);
typedef void(TickerProc)();
typedef struct TickerListNode { typedef struct TickerListNode {
int flags; int flags;
@ -461,8 +463,8 @@ typedef int(PauseHandler)();
typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, unsigned char* palette); typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, unsigned char* palette);
typedef void(VcrPlaybackCompletionCallback)(int reason); typedef void(VcrPlaybackCompletionCallback)(int reason);
extern void (*_idle_func)(); extern IdleFunc* _idle_func;
extern void (*_focus_func)(int); extern FocusFunc* _focus_func;
extern int gKeyboardKeyRepeatRate; extern int gKeyboardKeyRepeatRate;
extern int gKeyboardKeyRepeatDelay; extern int gKeyboardKeyRepeatDelay;
extern bool _keyboard_hooked; extern bool _keyboard_hooked;
@ -596,6 +598,14 @@ void coreDelay(unsigned int ms);
unsigned int getTicksSince(unsigned int a1); unsigned int getTicksSince(unsigned int a1);
unsigned int getTicksBetween(unsigned int a1, unsigned int a2); unsigned int getTicksBetween(unsigned int a1, unsigned int a2);
unsigned int _get_bk_time(); 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(); void buildNormalizedQwertyKeys();
int _GNW95_input_init(); int _GNW95_input_init();
void _GNW95_process_message(); void _GNW95_process_message();