geode/loader/src/hooks/save.cpp

21 lines
440 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() {
2022-12-10 11:30:14 -05:00
log::info("Saving...");
2022-07-30 12:24:03 -04:00
auto r = Loader::get()->saveData();
2022-07-30 12:24:03 -04:00
if (!r) {
2022-12-10 11:30:14 -05:00
log::info("{}", r.unwrapErr());
2022-07-30 12:24:03 -04:00
}
2022-12-10 11:30:14 -05:00
log::info("Saved");
2022-07-30 12:24:03 -04:00
return AppDelegate::trySaveGame();
}
};