Skip to content

Commit

Permalink
fix time
Browse files Browse the repository at this point in the history
  • Loading branch information
chirpxiv committed Nov 20, 2024
1 parent 8d3640e commit 024ff10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Ktisis/Env/EnvService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static void Dispose() {
// Events

private static void OnGPoseChange(bool state) {
Ktisis.Log.Info($"Setting env hooks: {state}");
EnvHooks.SetEnabled(state);
if (!state) {
TimeOverride = null;
Expand Down
7 changes: 5 additions & 2 deletions Ktisis/Interop/Hooks/EnvHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ public static class EnvHooks {

private static Hook<EnvUpdateDelegate> EnvUpdateHook = null!;
private unsafe static nint EnvUpdateDetour(EnvManagerEx* env, nint a2) {
if (Ktisis.IsInGPose && EnvService.TimeOverride != null)
Ktisis.Log.Info($"{(nint)env:X} {Ktisis.IsInGPose} {EnvService.TimeOverride}");
if (Ktisis.IsInGPose && EnvService.TimeOverride != null) {
Ktisis.Log.Info($"{env->Time}");
env->Time = EnvService.TimeOverride.Value;
}

return EnvUpdateHook.Original(env, a2);
}
Expand Down Expand Up @@ -67,7 +70,7 @@ private static void DisableHooks() {
// Init & Dispose

public unsafe static void Init() {
var addr1 = Services.SigScanner.ScanText("E8 ?? ?? ?? ?? 48 8B 0D ?? ?? ?? ?? 41 0F 28 CA");
var addr1 = Services.SigScanner.ScanText("40 53 48 83 EC 30 48 8B 05 ?? ?? ?? ?? 48 8B D9 0F 29 74 24 ??");
EnvUpdateHook = Services.Hooking.HookFromAddress<EnvUpdateDelegate>(addr1, EnvUpdateDetour);

var addr2 = Services.SigScanner.ScanText("E8 ?? ?? ?? ?? 49 3B F5 75 0D");
Expand Down

0 comments on commit 024ff10

Please sign in to comment.