mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
SCI: Add more support for >16-bit SCI3 offsets
Basically just grepped for getOffset calls being assigned to uint16s and expanded those to uint32 when they looked trivial. While some of these changes seem superfluous, at least for the US/English SCI3 games where potentially impacted game scripts are not large enough to have a problem with 16-bit offsets (e.g. when feature detecting the sound type), at least some of these changes are necessary for correct operation of the find_callk debugger command in SCI3 games. There should not be a reason why any of these variables need to be kept as uint16, in any case.
This commit is contained in:
parent
14a521a211
commit
66efb750a0
@ -1104,8 +1104,8 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) {
|
||||
debugPrintf("Error: script and heap %d together are larger than 64KB (%u bytes)\n",
|
||||
itr->getNumber(), script->size() + heap->size());
|
||||
} else { // SCI3
|
||||
if (script && script->size() > 65535)
|
||||
debugPrintf("Error: script %d is larger than 64KB (%u bytes)\n",
|
||||
if (script && script->size() > 0x3FFFF)
|
||||
debugPrintf("Error: script %d is larger than 256KB (%u bytes)\n",
|
||||
itr->getNumber(), script->size());
|
||||
}
|
||||
}
|
||||
@ -1922,7 +1922,7 @@ bool Console::cmdSavedBits(int argc, const char **argv) {
|
||||
Common::Array<reg_t> entries = hunks->listAllDeallocatable(id);
|
||||
|
||||
for (uint i = 0; i < entries.size(); ++i) {
|
||||
uint16 offset = entries[i].getOffset();
|
||||
uint32 offset = entries[i].getOffset();
|
||||
const Hunk& h = hunks->at(offset);
|
||||
if (strcmp(h.type, "SaveBits()") == 0) {
|
||||
byte* memoryPtr = (byte *)h.mem;
|
||||
@ -3556,7 +3556,7 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
|
||||
// Now dissassemble each method of the script object
|
||||
for (uint16 i = 0; i < obj->getMethodCount(); i++) {
|
||||
reg_t fptr = obj->getFunction(i);
|
||||
uint16 offset = fptr.getOffset();
|
||||
uint32 offset = fptr.getOffset();
|
||||
int16 opparams[4];
|
||||
byte extOpcode;
|
||||
byte opcode;
|
||||
|
@ -77,7 +77,7 @@ bool GameFeatures::autoDetectSoundType() {
|
||||
if (!addr.getSegment())
|
||||
return false;
|
||||
|
||||
uint16 offset = addr.getOffset();
|
||||
uint32 offset = addr.getOffset();
|
||||
Script *script = _segMan->getScript(addr.getSegment());
|
||||
uint16 intParam = 0xFFFF;
|
||||
bool foundTarget = false;
|
||||
@ -224,7 +224,7 @@ bool GameFeatures::autoDetectLofsType(Common::String gameSuperClassName, int met
|
||||
if (!addr.getSegment())
|
||||
return false;
|
||||
|
||||
uint16 offset = addr.getOffset();
|
||||
uint32 offset = addr.getOffset();
|
||||
Script *script = _segMan->getScript(addr.getSegment());
|
||||
|
||||
while (true) {
|
||||
@ -323,7 +323,7 @@ bool GameFeatures::autoDetectGfxFunctionsType(int methodNum) {
|
||||
if (!addr.getSegment())
|
||||
return false;
|
||||
|
||||
uint16 offset = addr.getOffset();
|
||||
uint32 offset = addr.getOffset();
|
||||
Script *script = _segMan->getScript(addr.getSegment());
|
||||
|
||||
while (true) {
|
||||
@ -485,7 +485,7 @@ bool GameFeatures::autoDetectSci21KernelType() {
|
||||
if (!addr.getSegment())
|
||||
return false;
|
||||
|
||||
uint16 offset = addr.getOffset();
|
||||
uint32 offset = addr.getOffset();
|
||||
Script *script = _segMan->getScript(addr.getSegment());
|
||||
|
||||
while (true) {
|
||||
@ -620,7 +620,7 @@ bool GameFeatures::autoDetectMoveCountType() {
|
||||
if (!addr.getSegment())
|
||||
return false;
|
||||
|
||||
uint16 offset = addr.getOffset();
|
||||
uint32 offset = addr.getOffset();
|
||||
Script *script = _segMan->getScript(addr.getSegment());
|
||||
bool foundTarget = false;
|
||||
|
||||
|
@ -160,7 +160,7 @@ reg_t kClone(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
debugC(kDebugLevelMemory, "Attempting to clone from %04x:%04x", PRINT_REG(parentAddr));
|
||||
|
||||
uint16 infoSelector = parentObj->getInfoSelector().getOffset();
|
||||
uint16 infoSelector = parentObj->getInfoSelector().toUint16();
|
||||
cloneObj = s->_segMan->allocateClone(&cloneAddr);
|
||||
|
||||
if (!cloneObj) {
|
||||
@ -211,7 +211,7 @@ reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv) {
|
||||
// At least kq4early relies on this behavior. The scripts clone "Sound", then set bit 1 manually
|
||||
// and call kDisposeClone later. In that case we may not free it, otherwise we will run into issues
|
||||
// later, because kIsObject would then return false and Sound object wouldn't get checked.
|
||||
uint16 infoSelector = object->getInfoSelector().getOffset();
|
||||
uint16 infoSelector = object->getInfoSelector().toUint16();
|
||||
if ((infoSelector & 3) == kInfoFlagClone)
|
||||
object->markAsFreed();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user