geode/loader/src/hooks/persist.cpp
2024-01-12 22:18:24 +03:00

21 lines
652 B
C++

#include <Geode/ui/SceneManager.hpp>
using namespace geode::prelude;
#include <Geode/modify/AchievementNotifier.hpp>
struct SceneSwitch : Modify<SceneSwitch, AchievementNotifier> {
static void onModify(const auto& self) {
if (!Loader::get()->isForwardCompatMode())
return;
log::warn("persist disabled in forward compat");
for (const auto& [_, hook] : self.m_hooks) {
hook->setAutoEnable(false);
}
}
void willSwitchToScene(CCScene* scene) {
AchievementNotifier::willSwitchToScene(scene);
SceneManager::get()->willSwitchToScene(scene);
}
};