diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kmisc.cpp | 9 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 7 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.h | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 99e02d92f2..5ef4157119 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -236,8 +236,13 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) { s->_segMan->allocDynmem(argv[1].toUint16(), "kMemory() non-critical", &s->r_acc); break; case K_MEMORY_FREE : - if (s->_segMan->freeDynmem(argv[1])) { - error("Attempt to kMemory::free() non-dynmem pointer %04x:%04x", PRINT_REG(argv[1])); + if (!s->_segMan->freeDynmem(argv[1])) { + if (g_sci->getGameId() == GID_QFG1VGA) { + // Ignore script bug in QFG1VGA, when closing any conversation dialog with esc + } else { + // Usually, the result of a script bug. Non-critical + warning("Attempt to kMemory::free() non-dynmem pointer %04x:%04x", PRINT_REG(argv[1])); + } } break; case K_MEMORY_MEMCPY : { diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 25cf1d069f..3fac6925a4 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -851,13 +851,14 @@ byte *SegManager::allocDynmem(int size, const char *descr, reg_t *addr) { return (byte *)(d._buf); } -int SegManager::freeDynmem(reg_t addr) { +bool SegManager::freeDynmem(reg_t addr) { + SegmentType foo = _heap[addr.segment]->getType(); if (addr.segment < 1 || addr.segment >= _heap.size() || !_heap[addr.segment] || _heap[addr.segment]->getType() != SEG_TYPE_DYNMEM) - return 1; // error + return false; // error deallocate(addr.segment, true); - return 0; // OK + return true; // OK } #ifdef ENABLE_SCI32 diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index e0808dbb1b..59ac6f39b6 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -274,7 +274,7 @@ public: * Deallocates a piece of dynamic memory * @param[in] addr Offset of the dynmem chunk to free */ - int freeDynmem(reg_t addr); + bool freeDynmem(reg_t addr); // Generic Operations on Segments and Addresses |