Skip to content

Commit 2eb26ab

Browse files
committed
possibly make the bot break less
1 parent 8fd8b82 commit 2eb26ab

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/hooks.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ void Hooks::init() {
1717

1818
add_hook<&PlayLayer::update, Thiscall>(gd::base + 0x2029C0);
1919

20-
add_hook<&PlayLayer::pushButton>(gd::base + 0x111500);
21-
add_hook<&PlayLayer::releaseButton>(gd::base + 0x111660);
2220
add_hook<&PlayLayer::resetLevel>(gd::base + 0x20BF00);
2321

2422
add_hook<&PlayLayer::pauseGame>(gd::base + 0x20D3C0);
@@ -179,6 +177,14 @@ void Hooks::PauseLayer_onEditor(gd::PauseLayer* self, CCObject* idk) {
179177
}
180178

181179
bool Hooks::PauseLayer_init(gd::PauseLayer* self) {
180+
static bool placed_hooks = false;
181+
if (!placed_hooks) {
182+
placed_hooks = true;
183+
// this is stupid lol, but should hopefully
184+
// stop it breaking when loading from extensions
185+
add_hook<&PlayLayer::pushButton>(gd::base + 0x111500);
186+
add_hook<&PlayLayer::releaseButton>(gd::base + 0x111660);
187+
}
182188
if (orig<&PauseLayer_init>(self)) {
183189
auto win_size = CCDirector::sharedDirector()->getWinSize();
184190

0 commit comments

Comments
 (0)