forked from Hay1tsme/segatools
hooklib/clock.c: Split clock read and write hooks
This commit is contained in:
parent
65ccaf55f3
commit
94005de9e9
@ -48,7 +48,8 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
clock_hook_init();
|
||||
clock_read_hook_init();
|
||||
clock_write_hook_init();
|
||||
gfx_hook_init();
|
||||
serial_hook_init();
|
||||
|
||||
|
@ -36,7 +36,7 @@ static DWORD CALLBACK diva_pre_startup(void)
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
clock_hook_init();
|
||||
clock_write_hook_init();
|
||||
serial_hook_init();
|
||||
|
||||
/* Initialize emulation hooks */
|
||||
|
@ -17,7 +17,7 @@ static BOOL WINAPI my_SetTimeZoneInformation(TIME_ZONE_INFORMATION *tzinfo);
|
||||
static BOOL (WINAPI * next_GetSystemTimeAsFileTime)(FILETIME *out);
|
||||
static int64_t clock_current_day;
|
||||
|
||||
static const struct hook_symbol clock_hook_syms[] = {
|
||||
static const struct hook_symbol clock_read_hook_syms[] = {
|
||||
{
|
||||
.name = "GetSystemTimeAsFileTime",
|
||||
.patch = my_GetSystemTimeAsFileTime,
|
||||
@ -31,7 +31,11 @@ static const struct hook_symbol clock_hook_syms[] = {
|
||||
}, {
|
||||
.name = "GetTimeZoneInformation",
|
||||
.patch = my_GetTimeZoneInformation,
|
||||
}, {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct hook_symbol clock_write_hook_syms[] = {
|
||||
{
|
||||
.name = "SetLocalTime",
|
||||
.patch = my_SetLocalTime,
|
||||
}, {
|
||||
@ -203,11 +207,20 @@ static BOOL WINAPI my_SetTimeZoneInformation(TIME_ZONE_INFORMATION *in)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void clock_hook_init(void)
|
||||
void clock_read_hook_init(void)
|
||||
{
|
||||
hook_table_apply(
|
||||
NULL,
|
||||
"kernel32.dll",
|
||||
clock_hook_syms,
|
||||
_countof(clock_hook_syms));
|
||||
clock_read_hook_syms,
|
||||
_countof(clock_read_hook_syms));
|
||||
}
|
||||
|
||||
void clock_write_hook_init(void)
|
||||
{
|
||||
hook_table_apply(
|
||||
NULL,
|
||||
"kernel32.dll",
|
||||
clock_write_hook_syms,
|
||||
_countof(clock_write_hook_syms));
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void clock_hook_init(void);
|
||||
void clock_read_hook_init(void);
|
||||
void clock_write_hook_init(void);
|
||||
|
@ -35,7 +35,7 @@ static DWORD CALLBACK idz_pre_startup(void)
|
||||
|
||||
/* Hook Win32 APIs */
|
||||
|
||||
clock_hook_init();
|
||||
clock_write_hook_init();
|
||||
serial_hook_init();
|
||||
|
||||
/* Initialize emulation hooks */
|
||||
|
@ -25,7 +25,9 @@ static DWORD CALLBACK app_pre_startup(void)
|
||||
nusec_config_load(&nusec_cfg, L".\\segatools.ini");
|
||||
ds_config_load(&ds_cfg, L".\\segatools.ini");
|
||||
|
||||
clock_hook_init();
|
||||
// TODO make use of clock read hook configurable
|
||||
clock_read_hook_init();
|
||||
clock_write_hook_init();
|
||||
nusec_hook_init(&nusec_cfg, "SSSS", "AAV0");
|
||||
ds_hook_init(&ds_cfg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user