ksys/res: Add GameData

This commit is contained in:
Léo Lam
2020-10-17 17:05:41 +02:00
parent eb222dc784
commit 27da317935
9 changed files with 609 additions and 7 deletions
+2
View File
@@ -1,4 +1,6 @@
target_sources(uking PRIVATE
gdtFlag.cpp
gdtFlag.h
gdtManager.cpp
gdtManager.h
)
+6
View File
@@ -186,6 +186,7 @@ public:
virtual bool setValue(T value);
virtual FlagDebugData* getDebugData() const;
void setDebugData(FlagDebugData* data);
private:
sead::SizedEnum<typename FlagType::ValueType, u8> mType = FlagType::Invalid;
@@ -381,4 +382,9 @@ inline FlagDebugData* Flag<T>::getDebugData() const {
return mDebugData;
}
template <typename T>
inline void Flag<T>::setDebugData(FlagDebugData* data) {
mDebugData = data;
}
} // namespace ksys::gdt
+7
View File
@@ -0,0 +1,7 @@
#include "KingSystem/GameData/gdtManager.h"
namespace ksys::gdt {
SEAD_SINGLETON_DISPOSER_IMPL(Manager)
}
+49
View File
@@ -0,0 +1,49 @@
#pragma once
#include <container/seadSafeArray.h>
#include <heap/seadDisposer.h>
#include "KingSystem/Resource/resHandle.h"
#include "KingSystem/Utils/Types.h"
namespace ksys::gdt {
class IManager {
public:
virtual ~IManager() = 0;
};
inline IManager::~IManager() = default;
/// GameDataMgr communication.
class ManagerCom {
public:
virtual const char* getName() const { return "GameData"; }
virtual void syncData();
void* _8 = nullptr;
void* _10 = nullptr;
};
KSYS_CHECK_SIZE_NX150(ManagerCom, 0x18);
// FIXME: very incomplete. This is only here because res::GameData needs to use the Manager's heaps
class Manager : public IManager, public ManagerCom {
SEAD_SINGLETON_DISPOSER(Manager)
Manager();
virtual ~Manager();
public:
sead::Heap* getGameDataHeap() const { return mGameDataHeap; }
sead::Heap* getSaveAreaHeap() const { return mSaveAreaHeap; }
sead::Heap* getGameDataComHeap() const { return mGameDataComHeap; }
private:
sead::Heap* mGameDataHeap = nullptr;
sead::Heap* mSaveAreaHeap = nullptr;
sead::Heap* mGameDataComHeap = nullptr;
res::Handle mGameDataArcHandle;
sead::SafeArray<res::Handle, 31> mBgdataHandles;
};
// FIXME: the size should be 0xDC8
KSYS_CHECK_SIZE_NX150(Manager, 0xa58);
} // namespace ksys::gdt