#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; } // TODO: refactor this, it's a bit strange atm bool isResFile_byIndex(u32 index) { return (memcmp(dataForIndex(index), "bres", 4) == 0); } }; #endif