summaryrefslogtreecommitdiff
path: root/src/KingSystem/Resource/resGameResourceSystem.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/KingSystem/Resource/resGameResourceSystem.h')
-rw-r--r--src/KingSystem/Resource/resGameResourceSystem.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/KingSystem/Resource/resGameResourceSystem.h b/src/KingSystem/Resource/resGameResourceSystem.h
new file mode 100644
index 00000000..cab62608
--- /dev/null
+++ b/src/KingSystem/Resource/resGameResourceSystem.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <heap/seadDisposer.h>
+
+namespace ksys::res {
+
+class CompactionMgr;
+
+// Also known as game::ResourceSystem (?)
+class GameResourceSystem {
+ SEAD_SINGLETON_DISPOSER(GameResourceSystem)
+ GameResourceSystem() = default;
+ virtual ~GameResourceSystem();
+
+public:
+ struct InitArg {
+ sead::Heap* heap;
+ };
+
+ bool init(const InitArg& arg);
+
+ void calc();
+ void pauseCompaction();
+ void resumeCompaction();
+
+private:
+ CompactionMgr* mCompactionMgr = nullptr;
+ bool mPauseCompaction = false;
+};
+
+class ScopedCompactionPauser {
+public:
+ ScopedCompactionPauser() { GameResourceSystem::instance()->pauseCompaction(); }
+ ~ScopedCompactionPauser() { GameResourceSystem::instance()->resumeCompaction(); }
+ ScopedCompactionPauser(const ScopedCompactionPauser&) = delete;
+ ScopedCompactionPauser(ScopedCompactionPauser&&) = delete;
+ auto operator=(const ScopedCompactionPauser&) = delete;
+ auto operator=(ScopedCompactionPauser&&) = delete;
+};
+
+} // namespace ksys::res