[Scummvm-tracker] [ScummVM] #10756: QFG4: Grabbing the second bookshelf passage, msg doesn't reflect its closed/open state
Vhati
trac at scummvm.org
Mon Nov 5 12:04:13 CET 2018
#10756: QFG4: Grabbing the second bookshelf passage, msg doesn't reflect its
closed/open state
--------------------------------+----------------------------
Reporter: Vhati | Owner: (none)
Type: defect | Status: new
Priority: low | Component: Engine: SCI
Resolution: | Keywords: SCI32 original
Game: Quest for Glory 4 |
--------------------------------+----------------------------
Comment (by Vhati):
Well, I can confirm it behaves as anticipated tonight.
There were complications, of course.
The CD/floppy editions each got a pair of patches because they disagreed
on class numbers (Polygon/MoveTo/PolyPath) and the location of
sLeaveSecretly. Hope it's not too verbose.
On the plus side, the class inconsistency was a distinct signature to
tailor the address for each edition.
I didn't see a means in "script_patches.cpp" to predict the memory
location of sLeaveSecretly by name.
'''Hopefully it doesn't wander around.'''
That would wreck my solution. I don't know of a selector to look it up
live either; not enough free bytes to do such a query here anyway.
The lofsa relative offset was a pain. None of my landmarks/math fit. I had
to use trial and error.
"view_object sLeaveSecretly" gave me a goal to aim for (CD=0516:0e93,
floppy=0453:0e4c). At first I'd step to discover lofsa's opcode address
and where it pointed. Then I'd adjust away the discrepancy in my code, set
a breakpoint at the opcode, and check again.
"scummvm -d 3 --debugflags=scriptpatcher" helped confirm when signatures
successfully meddled in the room.
Don't know yet if it's stable across playthoughs/platforms. Besides
testing and comments, I'm primed to make a pull request. Does it look all
right?
\\
\\
{{{
static const uint16 qg4CrestBookshelfSignature[] = {
SIG_MAGICDWORD,
0x51, 0x22, // class Polygon
0x4a, SIG_UINT16(0x0004), // send 04
0x4a, SIG_UINT16(0x003e), // send 3e
0x36, // push
0x81, 0x02, // lag global[2] (rm663)
0x4a, SIG_UINT16(0x0008), // send 08
0x38, SIG_SELECTOR16(handsOn), // pushi handsOn (begin
clobbering)
0x76, // push0
0x81, 0x01, // lag global[1] (Glory)
0x4a, SIG_UINT16(0x0004), // send 04
0x38, SIG_SELECTOR16(dispose), // pushi dispose
0x76, // push0
0x54, SIG_UINT16(0x0004), // self 04
0x3a, // toss
0x48, // ret
SIG_END
};
static const uint16 qg4CrestBookshelfPatch[] = {
PATCH_ADDTOOFFSET(+14),
0x38, PATCH_SELECTOR16(setScript), // pushi setScript
0x78, // push1
0x72, PATCH_UINT16(0x01a4), // lofsa sLeaveSecretly
0x36, // push
0x81, 0x02, // lag global[2] (rm663)
0x4a, SIG_UINT16(0x0006), // send 6
0x34, PATCH_UINT16(0), // ldi 0 (waste 3 bytes)
0x3a, // toss (branches will land
here)
0x48, // ret
PATCH_END
};
static const uint16 qg4CrestBookshelfFloppySignature[] = {
SIG_MAGICDWORD,
0x51, 0x21, // class Polygon
0x4a, SIG_UINT16(0x0004), // send 04
0x4a, SIG_UINT16(0x003e), // send 3e
0x36, // push
0x81, 0x02, // lag global[2] (rm663)
0x4a, SIG_UINT16(0x0008), // send 08
0x38, SIG_SELECTOR16(handsOn), // pushi handsOn (begin
clobbering)
0x76, // push0
0x81, 0x01, // lag global[1] (Glory)
0x4a, SIG_UINT16(0x0004), // send 04
0x38, SIG_SELECTOR16(dispose), // pushi dispose
0x76, // push0
0x54, SIG_UINT16(0x0004), // self 04
0x3a, // toss
0x48, // ret
SIG_END
};
static const uint16 qg4CrestBookshelfFloppyPatch[] = {
PATCH_ADDTOOFFSET(+14),
0x38, PATCH_SELECTOR16(setScript), // pushi setScript
0x78, // push1
0x72, PATCH_UINT16(0x018c), // lofsa sLeaveSecretly
0x36, // push
0x81, 0x02, // lag global[2] (rm663)
0x4a, SIG_UINT16(0x0006), // send 6
0x34, PATCH_UINT16(0), // ldi 0 (waste 3 bytes)
0x3a, // toss (branches will land
here)
0x48, // ret
PATCH_END
};
static const uint16 qg4CrestBookshelfMotionSignature[] = {
SIG_MAGICDWORD,
0x38, SIG_SELECTOR16(setMotion), // pushi setMotion
0x38, SIG_UINT16(0x0004), // pushi 04
0x51, 0x1d, // class MoveTo
0x36, // push
0x39, 0x1d, // pushi x = 29d
0x38, SIG_UINT16(0x0097), // pushi y = 151d
0x7c, // pushSelf
0x81, 0x00, // lag global[0] (hero)
0x4a, SIG_UINT16(0x000c), // send 0c
SIG_END
};
static const uint16 qg4CrestBookshelfMotionPatch[] = {
PATCH_ADDTOOFFSET(+6),
0x51, 0x23, // class PolyPath
PATCH_END
};
static const uint16 qg4CrestBookshelfMotionFloppySignature[] = {
SIG_MAGICDWORD,
0x38, SIG_SELECTOR16(setMotion), // pushi setMotion
0x38, SIG_UINT16(0x0004), // pushi 04
0x51, 0x1c, // class MoveTo
0x36, // push
0x39, 0x1d, // pushi x = 29d
0x38, SIG_UINT16(0x0097), // pushi y = 151d
0x7c, // pushSelf
0x81, 0x00, // lag global[0] (hero)
0x4a, SIG_UINT16(0x000c), // send 0c
SIG_END
};
static const uint16 qg4CrestBookshelfMotionFloppyPatch[] = {
PATCH_ADDTOOFFSET(+6),
0x51, 0x22, // class PolyPath
PATCH_END
};
[...]
{ true, 663, "fix crest bookshelf", 1,
qg4CrestBookshelfSignature, qg4CrestBookshelfPatch },
{ true, 663, "fix crest bookshelf (floppy)", 1,
qg4CrestBookshelfFloppySignature, qg4CrestBookshelfFloppyPatch },
{ true, 663, "fix crest bookshelf motion", 1,
qg4CrestBookshelfMotionSignature, qg4CrestBookshelfMotionPatch },
{ true, 663, "fix crest bookshelf motion (floppy)", 1,
qg4CrestBookshelfMotionFloppySignature,
qg4CrestBookshelfMotionFloppyPatch },
}}}
--
Ticket URL: <https://bugs.scummvm.org/ticket/10756#comment:8>
ScummVM <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list