diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 8fdba761f5f..8d5d81faaff 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -1269,6 +1269,13 @@ int Scumm::getResourceRoomNr(int type, int idx) { return res.roomno[type][idx]; } +int Scumm::getResourceSize(int type, int idx) { + byte *ptr = getResourceAddress(type, idx); + MemBlkHeader *hdr = (MemBlkHeader *)(ptr - sizeof(MemBlkHeader)); + + return hdr->size; +} + byte *Scumm::getResourceAddress(int type, int idx) { byte *ptr; diff --git a/scumm/scumm.h b/scumm/scumm.h index 31aa501677a..1fa4620bdfc 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -623,6 +623,7 @@ protected: byte *createResource(int type, int index, uint32 size); int loadResource(int type, int i); void nukeResource(int type, int i); + int getResourceSize(int type, int idx); public: bool isGlobInMemory(int type, int index) const;