Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit abf587f

Browse files
committed
[fixing respawn delay issue]
so the issue seemed to be due to togglePatch not being called, added a few logs + renamed the method to verify that
1 parent 18986fa commit abf587f

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/shared/hacks/respawn-delay/respawn-delay.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@ namespace openhack::hacks {
66
float RespawnDelay::delay = 0.5f;
77
static ToggleComponent* s_respawnDelay = nullptr;
88

9-
inline void togglePatch() {
10-
if (!s_respawnDelay) return;
9+
void toggleDelayPatch() {
10+
L_TRACE("Toggling Respawn Delay patch");
11+
if (!s_respawnDelay) {
12+
L_WARN("Respawn Delay not initialized");
13+
return;
14+
}
1115
bool enabled = config::get<bool>("hack.respawn_delay.enabled");
12-
s_respawnDelay->applyPatch(enabled);
16+
bool success = s_respawnDelay->applyPatch(enabled);
17+
if (success) {
18+
L_INFO("Respawn Delay patch {}!", enabled ? "enabled" : "disabled");
19+
} else {
20+
L_WARN("Failed to patch Respawn Delay");
21+
}
1322
}
1423

1524
void RespawnDelay::onInit() {
@@ -53,15 +62,19 @@ namespace openhack::hacks {
5362
}
5463

5564
// Merge opcodes and customBypass
65+
L_TRACE("Merging opcodes and customBypass ({} + {})", opcodes.size(), customBypass.size());
5666
opcodes.insert(opcodes.end(), customBypass.begin(), customBypass.end());
67+
L_TRACE("Merged opcodes size: {}", opcodes.size());
5768
s_respawnDelay = new ToggleComponent("", "", opcodes);
58-
togglePatch();
69+
L_TRACE("Respawn Delay initialized");
70+
toggleDelayPatch();
71+
L_TRACE("Respawn Delay patched");
5972

6073
// Initialize keybind
6174
menu::keybinds::setKeybindCallback("respawn_delay.enabled", []() {
6275
bool enabled = !config::get<bool>("hack.respawn_delay.enabled");
6376
config::set("hack.respawn_delay.enabled", enabled);
64-
togglePatch();
77+
toggleDelayPatch();
6578
});
6679
}
6780

@@ -71,7 +84,7 @@ namespace openhack::hacks {
7184
menu::keybinds::addMenuKeybind("respawn_delay.enabled", "Respawn Delay", [](){
7285
bool enabled = !config::get<bool>("hack.respawn_delay.enabled");
7386
config::set("hack.respawn_delay.enabled", enabled);
74-
togglePatch();
87+
toggleDelayPatch();
7588
});
7689
});
7790
if (gui::toggleSetting("Respawn Delay", "hack.respawn_delay.enabled", []() {
@@ -82,7 +95,7 @@ namespace openhack::hacks {
8295
gui::tooltip("The delay before respawning");
8396
gui::width();
8497
}, ImVec2(0, 0))) {
85-
togglePatch();
98+
toggleDelayPatch();
8699
}
87100
}
88101

0 commit comments

Comments
 (0)