forked from Hay1tsme/segatools
Combine both clock hooks
Turns out the clock skew doesn't really work unless RTC and TZ changes are blocked as well.
This commit is contained in:
parent
1725cfb9ac
commit
51994d59ff
@ -43,8 +43,7 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
|||||||
|
|
||||||
/* Hook Win32 APIs */
|
/* Hook Win32 APIs */
|
||||||
|
|
||||||
clock_set_hook_init();
|
clock_hook_init();
|
||||||
clock_skew_hook_init();
|
|
||||||
gfx_hook_init();
|
gfx_hook_init();
|
||||||
serial_hook_init();
|
serial_hook_init();
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ static DWORD CALLBACK app_pre_startup(void)
|
|||||||
|
|
||||||
ds_hook_init();
|
ds_hook_init();
|
||||||
nusec_hook_init();
|
nusec_hook_init();
|
||||||
clock_skew_hook_init();
|
clock_hook_init();
|
||||||
spike_hook_init("minispike.txt");
|
spike_hook_init("minispike.txt");
|
||||||
|
|
||||||
dprintf("--- End %s ---\n", __func__);
|
dprintf("--- End %s ---\n", __func__);
|
||||||
|
31
util/clock.c
31
util/clock.c
@ -16,18 +16,12 @@ static BOOL WINAPI my_SetTimeZoneInformation(TIME_ZONE_INFORMATION *tzinfo);
|
|||||||
static BOOL (WINAPI * next_GetSystemTimeAsFileTime)(FILETIME *out);
|
static BOOL (WINAPI * next_GetSystemTimeAsFileTime)(FILETIME *out);
|
||||||
static int64_t clock_current_day;
|
static int64_t clock_current_day;
|
||||||
|
|
||||||
static const struct hook_symbol clock_skew_hook_syms[] = {
|
static const struct hook_symbol clock_hook_syms[] = {
|
||||||
/* Canonical time */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
.name = "GetSystemTimeAsFileTime",
|
.name = "GetSystemTimeAsFileTime",
|
||||||
.patch = my_GetSystemTimeAsFileTime,
|
.patch = my_GetSystemTimeAsFileTime,
|
||||||
.link = (void **) &next_GetSystemTimeAsFileTime,
|
.link = (void **) &next_GetSystemTimeAsFileTime,
|
||||||
},
|
}, {
|
||||||
|
|
||||||
/* Derived time */
|
|
||||||
|
|
||||||
{
|
|
||||||
.name = "GetLocalTime",
|
.name = "GetLocalTime",
|
||||||
.patch = my_GetLocalTime,
|
.patch = my_GetLocalTime,
|
||||||
}, {
|
}, {
|
||||||
@ -36,11 +30,7 @@ static const struct hook_symbol clock_skew_hook_syms[] = {
|
|||||||
}, {
|
}, {
|
||||||
.name = "GetTimeZoneInformation",
|
.name = "GetTimeZoneInformation",
|
||||||
.patch = my_GetTimeZoneInformation,
|
.patch = my_GetTimeZoneInformation,
|
||||||
},
|
}, {
|
||||||
};
|
|
||||||
|
|
||||||
static const struct hook_symbol clock_set_hook_syms[] = {
|
|
||||||
{
|
|
||||||
.name = "SetSystemTime",
|
.name = "SetSystemTime",
|
||||||
.patch = my_SetSystemTime,
|
.patch = my_SetSystemTime,
|
||||||
}, {
|
}, {
|
||||||
@ -182,20 +172,11 @@ static BOOL WINAPI my_SetTimeZoneInformation(TIME_ZONE_INFORMATION *in)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clock_set_hook_init(void)
|
void clock_hook_init(void)
|
||||||
{
|
{
|
||||||
hook_table_apply(
|
hook_table_apply(
|
||||||
NULL,
|
NULL,
|
||||||
"kernel32.dll",
|
"kernel32.dll",
|
||||||
clock_set_hook_syms,
|
clock_hook_syms,
|
||||||
_countof(clock_set_hook_syms));
|
_countof(clock_hook_syms));
|
||||||
}
|
|
||||||
|
|
||||||
void clock_skew_hook_init(void)
|
|
||||||
{
|
|
||||||
hook_table_apply(
|
|
||||||
NULL,
|
|
||||||
"kernel32.dll",
|
|
||||||
clock_skew_hook_syms,
|
|
||||||
_countof(clock_skew_hook_syms));
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void clock_set_hook_init(void);
|
void clock_hook_init(void);
|
||||||
void clock_skew_hook_init(void);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user