geode/loader/src/hooks/save.cpp

25 lines
689 B
C++
Raw Normal View History

2022-07-30 12:24:03 -04:00
#include <Geode/loader/Loader.hpp>
using namespace geode::prelude;
2022-07-30 12:24:03 -04:00
#include <Geode/modify/AppDelegate.hpp>
struct SaveLoader : Modify<SaveLoader, AppDelegate> {
2022-07-30 12:24:03 -04:00
void trySaveGame() {
2023-11-11 11:38:01 -05:00
log::info("Saving mod data...");
log::pushNest();
2022-07-30 12:24:03 -04:00
2023-11-11 11:38:01 -05:00
auto begin = std::chrono::high_resolution_clock::now();
2022-07-30 12:24:03 -04:00
2023-11-11 11:38:01 -05:00
(void)Loader::get()->saveData();
auto end = std::chrono::high_resolution_clock::now();
auto time = std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count();
log::info("Took {}s", static_cast<float>(time) / 1000.f);
log::popNest();
2022-07-30 12:24:03 -04:00
return AppDelegate::trySaveGame();
}
};