summaryrefslogtreecommitdiff
path: root/src/wmresourcemng.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wmresourcemng.h')
-rw-r--r--src/wmresourcemng.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/wmresourcemng.h b/src/wmresourcemng.h
new file mode 100644
index 0000000..910acf1
--- /dev/null
+++ b/src/wmresourcemng.h
@@ -0,0 +1,57 @@
+#ifndef __NEWER_WMRESOURCEMNG_H
+#define __NEWER_WMRESOURCEMNG_H
+
+struct WMResSetEntry {
+ u32 key;
+ u32 offset;
+};
+
+struct WMResSetHeader {
+ u32 magic;
+ u32 count;
+ WMResSetEntry entries[1]; // dynamic size
+
+ char *getName(int index) {
+ return (char*)((u32)this + entries[index].offset);
+ }
+};
+
+class dWMResourceMng_c {
+private:
+ bool hasSetPath;
+ bool isSetLoaded;
+ bool isLoadingComplete;
+
+ char setPath[0x40];
+ dDvdLoader_c setLoader;
+ dDvdLoader_c *resLoaders;
+
+ WMResSetHeader *setData;
+
+ void prepareResources();
+
+public:
+ dWMResourceMng_c();
+ ~dWMResourceMng_c();
+
+ bool loadSet(const char *setName);
+ void *operator[](u32 key);
+
+ bool isLoaded();
+
+
+ u32 resCount() {
+ return setData->count;
+ }
+
+ u32 keyForIndex(u32 index) {
+ return setData->entries[index].key;
+ }
+
+ void *dataForIndex(u32 index) {
+ return resLoaders[index].buffer;
+ }
+};
+
+#endif
+