Skip to content

Commit

Permalink
wa
Browse files Browse the repository at this point in the history
  • Loading branch information
user95401 committed Jul 9, 2024
1 parent 0b8314e commit 0734652
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/level_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ class $modify(LocalLevelManagerExt, LocalLevelManager) {
}
};


//// fffffffffffffuc a here is aaa problematic functions idk lol

#include <Geode/modify/GameLevelManager.hpp>
class $modify(GameLevelManager) {
GJGameLevel* getMainLevel(int levelID, bool dontGetLevelString) {
GJGameLevel* NOT_NOW___getMainLevel(int levelID, bool dontGetLevelString) {
auto level = GameLevelManager::get()->getMainLevel(levelID, dontGetLevelString);
//json meta
updateLevelByJson(level);
Expand All @@ -122,3 +125,26 @@ class $modify(LevelTools) {
return 1;
}
};

GJGameLevel* getMainLevelDet(GameLevelManager* __this, int levelID, bool dontGetLevelString) {
auto level = __this->getMainLevel(levelID, dontGetLevelString);
//json meta
updateLevelByJson(level);
return level;
}
GEODE_WINDOWS(auto getMainLevelAddr = reinterpret_cast<void*>(geode::base::get() + 0x13fa40));
GEODE_ANDROID(
auto getMainLevelAddr = reinterpret_cast<void*>(
// All of this is to get the address of ccDrawCircle
geode::addresser::getNonVirtual<int, bool>(&GameLevelManager::getMainLevel)
)
);
void HookTheGetMainLevelFunc() {
Mod::get()->hook(
getMainLevelAddr, // address
&getMainLevelDet, // detour
"GameLevelManager::getMainLevel", // display name, shows up on the console
tulip::hook::TulipConvention::Thiscall // calling convention
);
}
$execute{ HookTheGetMainLevelFunc(); }

0 comments on commit 0734652

Please sign in to comment.