diff options
-rw-r--r-- | scumm/boxes.cpp | 2 | ||||
-rw-r--r-- | scumm/debugger.cpp | 2 | ||||
-rw-r--r-- | scumm/gfx.cpp | 6 | ||||
-rw-r--r-- | scumm/input.cpp | 2 | ||||
-rw-r--r-- | scumm/object.cpp | 4 | ||||
-rw-r--r-- | scumm/resource.cpp | 58 | ||||
-rw-r--r-- | scumm/resource_v3.cpp | 2 | ||||
-rw-r--r-- | scumm/resource_v4.cpp | 2 | ||||
-rw-r--r-- | scumm/saveload.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 6 | ||||
-rw-r--r-- | scumm/script_v72he.cpp | 3 | ||||
-rw-r--r-- | scumm/scumm.cpp | 12 | ||||
-rw-r--r-- | scumm/scumm.h | 11 | ||||
-rw-r--r-- | scumm/sound.cpp | 34 | ||||
-rw-r--r-- | scumm/verbs.cpp | 6 | ||||
-rw-r--r-- | scumm/wiz_he.cpp | 6 |
17 files changed, 81 insertions, 81 deletions
diff --git a/scumm/boxes.cpp b/scumm/boxes.cpp index ab3643b9bb..43c9fddd42 100644 --- a/scumm/boxes.cpp +++ b/scumm/boxes.cpp @@ -1000,7 +1000,7 @@ void ScummEngine::createBoxMatrix() { // the boxes 7,8,9,10,11 the shortest way is to go via box 15. // See also getPathToDestBox. - byte *matrixStart = createResource(rtMatrix, 1, BOX_MATRIX_SIZE); + byte *matrixStart = res.createResource(rtMatrix, 1, BOX_MATRIX_SIZE); const byte *matrixEnd = matrixStart + BOX_MATRIX_SIZE; #define addToMatrix(b) do { *matrixStart++ = (b); assert(matrixStart < matrixEnd); } while (0) diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index dd33095b2f..056ade82ee 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -324,7 +324,7 @@ bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) { file.seek(-8, SEEK_CUR); } - file.read(_vm->createResource(rtScript, resnum, size), size); + file.read(_vm->res.createResource(rtScript, resnum, size), size); } else DebugPrintf("Unknown importres type '%s'\n", argv[1]); diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 34d15e0e4d..332b54f5d4 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -331,12 +331,12 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int number, int top, int } } - createResource(rtBuffer, slot + 1, size); + res.createResource(rtBuffer, slot + 1, size); vs->pixels = getResourceAddress(rtBuffer, slot + 1); memset(vs->pixels, 0, size); // reset background if (twobufs) { - vs->backBuf = createResource(rtBuffer, slot + 5, size); + vs->backBuf = res.createResource(rtBuffer, slot + 5, size); } if (slot != 3) { @@ -709,7 +709,7 @@ void ScummEngine::initBGBuffers(int height) { size = itemsize * gdi._numZBuffer; - memset(createResource(rtBuffer, 9, size), 0, size); + memset(res.createResource(rtBuffer, 9, size), 0, size); for (i = 0; i < (int)ARRAYSIZE(gdi._imgBufOffs); i++) { if (i < gdi._numZBuffer) diff --git a/scumm/input.cpp b/scumm/input.cpp index d94f51b9dc..483ccd2cf7 100644 --- a/scumm/input.cpp +++ b/scumm/input.cpp @@ -69,7 +69,7 @@ void ScummEngine::parseEvents() { else if (event.kbd.keycode == 'd') _debugger->attach(); else if (event.kbd.keycode == 's') - resourceStats(); + res.resourceStats(); else _keyPressed = event.kbd.ascii; // Normal key press, pass on to the game. } else if (event.kbd.flags & OSystem::KBD_ALT) { diff --git a/scumm/object.cpp b/scumm/object.cpp index 9d7464ccac..e0a4b32928 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -1125,7 +1125,7 @@ void ScummEngine::addObjectToInventory(uint obj, uint room) { slot = getInventorySlot(); _inventory[slot] = obj; - dst = createResource(rtInventory, slot, size); + dst = res.createResource(rtInventory, slot, size); assert(dst); memcpy(dst, ptr, size); @@ -1661,7 +1661,7 @@ void ScummEngine::loadFlObject(uint object, uint room) { // Allocate slot & memory for floating object slot = findFlObjectSlot(); - flob = createResource(rtFlObject, slot, flob_size); + flob = res.createResource(rtFlObject, slot, flob_size); assert(flob); // Copy object code + object image to floating object diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 82adc89f91..a31676e536 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -648,7 +648,7 @@ int ScummEngine::loadResource(int type, int idx) { size = _fileHandle->readUint32BE(); _fileHandle->seek(-8, SEEK_CUR); } - _fileHandle->read(createResource(type, idx, size), size); + _fileHandle->read(res.createResource(type, idx, size), size); // dump the resource if requested if (_dumpScripts && type == rtScript) { @@ -743,15 +743,15 @@ void ResourceManager::setResourceCounter(int type, int idx, byte flag) { /* 2 bytes safety area to make "precaching" of bytes in the gdi drawer easier */ #define SAFETY_AREA 2 -byte *ScummEngine::createResource(int type, int idx, uint32 size) { +byte *ResourceManager::createResource(int type, int idx, uint32 size) { byte *ptr; CHECK_HEAP - debugC(DEBUG_RESOURCE, "createResource(%s,%d,%d)", resTypeFromId(type), idx, size); + debugC(DEBUG_RESOURCE, "res.createResource(%s,%d,%d)", resTypeFromId(type), idx, size); - if (!res.validateResource("allocating", type, idx)) + if (!validateResource("allocating", type, idx)) return NULL; - res.nukeResource(type, idx); + nukeResource(type, idx); expireResources(size); @@ -761,11 +761,11 @@ byte *ScummEngine::createResource(int type, int idx, uint32 size) { error("Out of memory while allocating %d", size); } - res._allocatedSize += size; + _allocatedSize += size; - res.address[type][idx] = ptr; + address[type][idx] = ptr; ((MemBlkHeader *)ptr)->size = size; - res.setResourceCounter(type, idx, 1); + setResourceCounter(type, idx, 1); return ptr + sizeof(MemBlkHeader); /* skip header */ } @@ -857,32 +857,32 @@ bool ScummEngine::isResourceInUse(int type, int i) const { } } -void ScummEngine::expireResources(uint32 size) { +void ResourceManager::expireResources(uint32 size) { int i, j; byte flag; byte best_counter; int best_type, best_res = 0; uint32 oldAllocatedSize; - if (res._expireCounter != 0xFF) { - res._expireCounter = 0xFF; - res.increaseResourceCounter(); + if (_expireCounter != 0xFF) { + _expireCounter = 0xFF; + increaseResourceCounter(); } - if (size + res._allocatedSize < res._maxHeapThreshold) + if (size + _allocatedSize < _maxHeapThreshold) return; - oldAllocatedSize = res._allocatedSize; + oldAllocatedSize = _allocatedSize; do { best_type = 0; best_counter = 2; for (i = rtFirst; i <= rtLast; i++) - if (res.mode[i]) { - for (j = res.num[i]; --j >= 0;) { - flag = res.flags[i][j]; - if (!(flag & RF_LOCK) && flag >= best_counter && res.address[i][j] && !isResourceInUse(i, j)) { + if (mode[i]) { + for (j = num[i]; --j >= 0;) { + flag = flags[i][j]; + if (!(flag & RF_LOCK) && flag >= best_counter && address[i][j] && !_vm->isResourceInUse(i, j)) { best_counter = flag; best_type = i; best_res = j; @@ -892,12 +892,12 @@ void ScummEngine::expireResources(uint32 size) { if (!best_type) break; - res.nukeResource(best_type, best_res); - } while (size + res._allocatedSize > res._minHeapThreshold); + nukeResource(best_type, best_res); + } while (size + _allocatedSize > _minHeapThreshold); - res.increaseResourceCounter(); + increaseResourceCounter(); - debugC(DEBUG_RESOURCE, "Expired resources, mem %d -> %d", oldAllocatedSize, res._allocatedSize); + debugC(DEBUG_RESOURCE, "Expired resources, mem %d -> %d", oldAllocatedSize, _allocatedSize); } void ResourceManager::freeResources() { @@ -927,7 +927,7 @@ void ScummEngine::loadPtrToResource(int type, int resindex, const byte *source) if (len <= 0) return; - alloced = createResource(type, resindex, len); + alloced = res.createResource(type, resindex, len); if (!source) { alloced[0] = fetchScriptByte(); @@ -945,21 +945,21 @@ bool ResourceManager::isResourceLoaded(int type, int idx) const { return address[type][idx] != NULL; } -void ScummEngine::resourceStats() { +void ResourceManager::resourceStats() { int i, j; uint32 lockedSize = 0, lockedNum = 0; byte flag; for (i = rtFirst; i <= rtLast; i++) - for (j = res.num[i]; --j >= 0;) { - flag = res.flags[i][j]; - if (flag & RF_LOCK && res.address[i][j]) { - lockedSize += ((MemBlkHeader *)res.address[i][j])->size; + for (j = num[i]; --j >= 0;) { + flag = flags[i][j]; + if (flag & RF_LOCK && address[i][j]) { + lockedSize += ((MemBlkHeader *)address[i][j])->size; lockedNum++; } } - debug(1, "Total allocated size=%d, locked=%d(%d)", res._allocatedSize, lockedSize, lockedNum); + debug(1, "Total allocated size=%d, locked=%d(%d)", _allocatedSize, lockedSize, lockedNum); } void ScummEngine::readMAXS(int blockSize) { diff --git a/scumm/resource_v3.cpp b/scumm/resource_v3.cpp index 4ea5a5b7b0..94d2888b71 100644 --- a/scumm/resource_v3.cpp +++ b/scumm/resource_v3.cpp @@ -118,7 +118,7 @@ void ScummEngine_v3::loadCharset(int no) { } size = file.readUint16LE(); - file.read(createResource(rtCharset, no, size), size); + file.read(res.createResource(rtCharset, no, size), size); } } // End of namespace Scumm diff --git a/scumm/resource_v4.cpp b/scumm/resource_v4.cpp index 6eb65f7882..523274279b 100644 --- a/scumm/resource_v4.cpp +++ b/scumm/resource_v4.cpp @@ -141,7 +141,7 @@ void ScummEngine_v4::loadCharset(int no) { } size = file.readUint32LE() + 11; - file.read(createResource(rtCharset, no, size), size); + file.read(res.createResource(rtCharset, no, size), size); } void ScummEngine_v4::readMAXS(int blockSize) { diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index afd2180ed6..fcf73bb1af 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -941,7 +941,7 @@ void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) { } else { size = ser->loadUint32(); if (size) { - createResource(type, idx, size); + res.createResource(type, idx, size); ser->loadBytes(getResourceAddress(type, idx), size); if (type == rtInventory) { _inventory[idx] = ser->loadUint16(); @@ -992,7 +992,7 @@ void ScummEngine::loadResource(Serializer *ser, int type, int idx) { if (res.mode[type] == 0) { uint32 size = ser->loadUint32(); assert(size); - createResource(type, idx, size); + res.createResource(type, idx, size); ser->loadBytes(getResourceAddress(type, idx), size); if (type == rtInventory) { diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 0ab699e34c..57fc2bfefa 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -2289,7 +2289,7 @@ void ScummEngine_v5::o5_stringOps() { b = getVarOrDirectByte(PARAM_2); res.nukeResource(rtString, a); if (b) { - ptr = createResource(rtString, a, b); + ptr = res.createResource(rtString, a, b); if (ptr) { for (i = 0; i < b; i++) ptr[i] = 0; diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 9f7131c666..736f103ce1 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -451,7 +451,7 @@ ScummEngine_v6::ArrayHeader *ScummEngine_v6::defineArray(int array, int type, in size *= dim2 + 1; size *= dim1 + 1; - ah = (ArrayHeader *)createResource(rtString, id, size + sizeof(ArrayHeader)); + ah = (ArrayHeader *)res.createResource(rtString, id, size + sizeof(ArrayHeader)); ah->type = TO_LE_16(type); ah->dim1 = TO_LE_16(dim1 + 1); @@ -3095,7 +3095,7 @@ void ScummEngine_v6::o6_setBoxSet() { error("ScummEngine_v6::o6_setBoxSet: Can't find dboxes for set %d", arg); dboxSize = READ_BE_UINT32(boxd + 4) - 8; - byte *matrix = createResource(rtMatrix, 2, dboxSize); + byte *matrix = res.createResource(rtMatrix, 2, dboxSize); assert(matrix); memcpy(matrix, boxd + 8, dboxSize); @@ -3108,7 +3108,7 @@ void ScummEngine_v6::o6_setBoxSet() { error("ScummEngine_v6::o6_setBoxSet: Can't find mboxes for set %d", arg); mboxSize = READ_BE_UINT32(boxm + 4) - 8; - matrix = createResource(rtMatrix, 1, mboxSize); + matrix = res.createResource(rtMatrix, 1, mboxSize); assert(matrix); memcpy(matrix, boxm + 8, mboxSize); diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index b38f8c15a7..4ad0803763 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -20,7 +20,6 @@ * */ - #include "stdafx.h" #include "common/config-manager.h" @@ -411,7 +410,7 @@ ScummEngine_v72he::ArrayHeader *ScummEngine_v72he::defineArray(int array, int ty size *= dim1end - dim1start + 1; size >>= 3; - ah = (ArrayHeader *)createResource(rtString, id, size + sizeof(ArrayHeader)); + ah = (ArrayHeader *)res.createResource(rtString, id, size + sizeof(ArrayHeader)); ah->type = TO_LE_32(type); ah->dim1start = TO_LE_32(dim1start); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 76b02fe6b4..71c72e5fd9 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -2371,13 +2371,13 @@ void ScummEngine::initRoomSubBlocks() { else size = numOfBoxes * SIZEOF_BOX + 1; - createResource(rtMatrix, 2, size); + res.createResource(rtMatrix, 2, size); memcpy(getResourceAddress(rtMatrix, 2), ptr, size); ptr += size; size = getResourceDataSize(ptr - size - _resourceHeaderSize) - size; if (size > 0) { // do this :) - createResource(rtMatrix, 1, size); + res.createResource(rtMatrix, 1, size); memcpy(getResourceAddress(rtMatrix, 1), ptr, size); } @@ -2386,7 +2386,7 @@ void ScummEngine::initRoomSubBlocks() { ptr = findResourceData(MKID('BOXD'), roomptr); if (ptr) { int size = getResourceDataSize(ptr); - createResource(rtMatrix, 2, size); + res.createResource(rtMatrix, 2, size); roomptr = getResourceAddress(rtRoom, _roomResource); ptr = findResourceData(MKID('BOXD'), roomptr); memcpy(getResourceAddress(rtMatrix, 2), ptr, size); @@ -2395,7 +2395,7 @@ void ScummEngine::initRoomSubBlocks() { ptr = findResourceData(MKID('BOXM'), roomptr); if (ptr) { int size = getResourceDataSize(ptr); - createResource(rtMatrix, 1, size); + res.createResource(rtMatrix, 1, size); roomptr = getResourceAddress(rtRoom, _roomResource); ptr = findResourceData(MKID('BOXM'), roomptr); memcpy(getResourceAddress(rtMatrix, 1), ptr, size); @@ -2709,7 +2709,7 @@ void ScummEngine_v3old::initRoomSubBlocks() { else size = numOfBoxes * SIZEOF_BOX_V3 + 1; - createResource(rtMatrix, 2, size); + res.createResource(rtMatrix, 2, size); memcpy(getResourceAddress(rtMatrix, 2), ptr, size); ptr += size; if (_version <= 2) { @@ -2720,7 +2720,7 @@ void ScummEngine_v3old::initRoomSubBlocks() { } if (size > 0) { // do this :) - createResource(rtMatrix, 1, size); + res.createResource(rtMatrix, 1, size); memcpy(getResourceAddress(rtMatrix, 1), ptr, size); } diff --git a/scumm/scumm.h b/scumm/scumm.h index c686f9b505..06f8a03ebe 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -344,6 +344,7 @@ public: public: ResourceManager(ScummEngine *vm); + byte *createResource(int type, int index, uint32 size); void nukeResource(int type, int i); void freeResources(); @@ -356,6 +357,9 @@ public: void setResourceCounter(int type, int index, byte flag); void increaseResourceCounter(); + + void resourceStats(); + void expireResources(uint32 size); }; class ScummEngine : public Engine { @@ -363,6 +367,7 @@ class ScummEngine : public Engine { friend class SmushPlayer; friend class Insane; friend class CharsetRenderer; + friend class ResourceManager; void errorString(const char *buf_input, char *buf_output); public: @@ -699,7 +704,7 @@ protected: void loadPtrToResource(int type, int i, const byte *ptr); virtual void readResTypeList(int id, uint32 tag, const char *name); void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode); - byte *createResource(int type, int index, uint32 size); +// 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); @@ -736,10 +741,6 @@ public: int getResourceDataSize(const byte *ptr) const; void dumpResource(const char *tag, int index, const byte *ptr, int length = -1); -protected: - void resourceStats(); - void expireResources(uint32 size); - public: /* Should be in Object class */ byte OF_OWNER_ROOM; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index fbff939923..2c945e2de8 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1265,7 +1265,7 @@ int ScummEngine::readSoundResource(int type, int idx) { if (basetag == MKID('MIDI') || basetag == MKID('iMUS')) { if (_midiDriver != MD_PCSPK && _midiDriver != MD_PCJR) { _fileHandle->seek(-8, SEEK_CUR); - _fileHandle->read(createResource(type, idx, total_size + 8), total_size + 8); + _fileHandle->read(res.createResource(type, idx, total_size + 8), total_size + 8); return 1; } } else if (basetag == MKID('SOU ')) { @@ -1327,7 +1327,7 @@ int ScummEngine::readSoundResource(int type, int idx) { if (best_pri != -1) { _fileHandle->seek(best_offs - 8, SEEK_SET); - _fileHandle->read(createResource(type, idx, best_size), best_size); + _fileHandle->read(res.createResource(type, idx, best_size), best_size); return 1; } } else if (basetag == MKID('Mac0')) { @@ -1342,27 +1342,27 @@ int ScummEngine::readSoundResource(int type, int idx) { } else if (basetag == MKID('Mac1')) { _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE(); - _fileHandle->read(createResource(type, idx, total_size), total_size - 8); + _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8); return 1; } else if (basetag == MKID('RIFF')) { _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE(); - _fileHandle->read(createResource(type, idx, total_size), total_size - 8); + _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8); return 1; } else if (basetag == MKID('HSHD')) { _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE(); - _fileHandle->read(createResource(type, idx, total_size), total_size - 8); + _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8); return 1; } else if (basetag == MKID('TALK')) { _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE(); - _fileHandle->read(createResource(type, idx, total_size), total_size - 8); + _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8); return 1; } else if (basetag == MKID('DIGI')) { _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE(); - _fileHandle->read(createResource(type, idx, total_size), total_size - 8); + _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8); return 1; } else if (basetag == MKID('FMUS')) { // Used in 3DO version of puttputt joins the parade and probably others @@ -1396,19 +1396,19 @@ int ScummEngine::readSoundResource(int type, int idx) { total_size = dmuFile.readUint32BE(); debugC(DEBUG_SOUND, "dmu file size %d", total_size); dmuFile.seek(-8, SEEK_CUR); - dmuFile.read(createResource(type, idx, total_size), total_size); + dmuFile.read(res.createResource(type, idx, total_size), total_size); dmuFile.close(); return 1; } else if (basetag == MKID('Crea')) { _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE(); - _fileHandle->read(createResource(type, idx, total_size), total_size - 8); + _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8); return 1; } else if (FROM_LE_32(basetag) == max_total_size) { _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE(); _fileHandle->seek(-8, SEEK_CUR); - _fileHandle->read(createResource(type, idx, total_size), total_size); + _fileHandle->read(res.createResource(type, idx, total_size), total_size); return 1; } else { warning("Unrecognized base tag 0x%08x in sound %d", basetag, idx); @@ -1645,7 +1645,7 @@ void ScummEngine::convertMac0Resource(int type, int idx, byte *src_ptr, int size */ #if 0 - byte *ptr = createResource(type, idx, size); + byte *ptr = res.createResource(type, idx, size); memcpy(ptr, src_ptr, size); #else const int ppqn = 480; @@ -1687,7 +1687,7 @@ void ScummEngine::convertMac0Resource(int type, int idx, byte *src_ptr, int size assert(*src_ptr == 0x09); // Create sound resource - start_ptr = createResource(type, idx, total_size); + start_ptr = res.createResource(type, idx, total_size); // Insert MIDI header ptr = writeMIDIHeader(start_ptr, "GMD ", ppqn, total_size); @@ -1794,7 +1794,7 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size) int total_size = kMIDIHeaderSize + 7 + 8 * sizeof(ADLIB_INSTR_MIDI_HACK) + size; total_size += 24; // Up to 24 additional bytes are needed for the jump sysex - ptr = createResource(type, idx, total_size); + ptr = res.createResource(type, idx, total_size); src_ptr += 2; size -= 2; @@ -2187,7 +2187,7 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) { _fileHandle->seek(ro_offs + 4, SEEK_SET); _fileHandle->read(src_ptr, ro_size -4); - ptr = createResource(type, idx, ro_size + 2); + ptr = res.createResource(type, idx, ro_size + 2); memcpy(ptr, "RO", 2); ptr += 2; memcpy(ptr, src_ptr, ro_size - 4); ptr += ro_size - 4; return 1; @@ -2268,15 +2268,15 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) { } else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && wa_offs != 0) { if (_features & GF_OLD_BUNDLE) { _fileHandle->seek(wa_offs, SEEK_SET); - _fileHandle->read(createResource(type, idx, wa_size), wa_size); + _fileHandle->read(res.createResource(type, idx, wa_size), wa_size); } else { _fileHandle->seek(wa_offs - 6, SEEK_SET); - _fileHandle->read(createResource(type, idx, wa_size + 6), wa_size + 6); + _fileHandle->read(res.createResource(type, idx, wa_size + 6), wa_size + 6); } return 1; } else if (ro_offs != 0) { _fileHandle->seek(ro_offs - 2, SEEK_SET); - _fileHandle->read(createResource(type, idx, ro_size - 4), ro_size - 4); + _fileHandle->read(res.createResource(type, idx, ro_size - 4), ro_size - 4); return 1; } res.roomoffs[type][idx] = 0xFFFFFFFF; diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index e22bdb9de9..bca8751687 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -633,7 +633,7 @@ void ScummEngine::setVerbObject(uint room, uint object, uint verb) { if (_objs[i].obj_nr == object) { findObjectInRoom(&foir, foImageHeader, object, room); size = READ_LE_UINT16(foir.obim); - byte *ptr = createResource(rtVerb, verb, size + 2); + byte *ptr = res.createResource(rtVerb, verb, size + 2); obcdptr = getResourceAddress(rtRoom, room) + getOBCDOffs(object); ptr[0] = *(obcdptr + 9); // Width ptr[1] = *(obcdptr + 15); // Height @@ -652,7 +652,7 @@ void ScummEngine::setVerbObject(uint room, uint object, uint verb) { size = READ_LE_UINT32(foir.obim); obcdptr = getResourceAddress(rtRoom, room) + getOBCDOffs(object); size2 = READ_LE_UINT32(obcdptr); - createResource(rtVerb, verb, size + size2); + res.createResource(rtVerb, verb, size + size2); obimptr = getResourceAddress(rtRoom, room) - foir.roomptr + foir.obim; obcdptr = getResourceAddress(rtRoom, room) + getOBCDOffs(object); memcpy(getResourceAddress(rtVerb, verb), obimptr, size); @@ -663,7 +663,7 @@ void ScummEngine::setVerbObject(uint room, uint object, uint verb) { } else { findObjectInRoom(&foir, foImageHeader, object, room); size = READ_BE_UINT32(foir.obim + 4); - createResource(rtVerb, verb, size); + res.createResource(rtVerb, verb, size); obimptr = getResourceAddress(rtRoom, room) - foir.roomptr + foir.obim; memcpy(getResourceAddress(rtVerb, verb), obimptr, size); } diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index a941cb5965..a12195b133 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -810,7 +810,7 @@ void ScummEngine_v72he::captureWizImage(int resNum, const Common::Rect& r, bool dataSize = (dataSize + 1) & ~1; int wizSize = headerSize + dataSize; // write header - uint8 *wizImg = createResource(rtImage, resNum, dataSize + headerSize); + uint8 *wizImg = res.createResource(rtImage, resNum, dataSize + headerSize); *(uint32 *)(wizImg + 0x00) = MKID('AWIZ'); *(uint32 *)(wizImg + 0x04) = TO_BE_32(wizSize); *(uint32 *)(wizImg + 0x08) = MKID('WIZH'); @@ -1374,7 +1374,7 @@ void ScummEngine_v90he::createWizEmptyImage(const WizParameters *params) { } res_size += 8 + img_w * img_h; - uint8 *res_data = createResource(rtImage, params->img.resNum, res_size); + uint8 *res_data = res.createResource(rtImage, params->img.resNum, res_size); if (!res_data) { VAR(119) = -1; } else { @@ -1478,7 +1478,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) { } else { uint32 size = f.readUint32BE(); f.seek(0, SEEK_SET); - byte *p = createResource(rtImage, params->img.resNum, size); + byte *p = res.createResource(rtImage, params->img.resNum, size); if (f.read(p, size) != size) { res.nukeResource(rtImage, params->img.resNum); warning("i/o error when reading '%s'", params->filename); |