mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-13 09:36:21 +00:00
TEENAGENT: Remove final usages of code segment blob.
The loading of cseg is now replaced by skipping, so that the external dat file remains the same, but RAM usage is reduced. The callbacks code will now error on unknown callback addresses, which should not happen as all cases should now be covered, though the callback tables need to be checked to ensure this is guaranteed.
This commit is contained in:
parent
7f8d15d008
commit
31cb5ce3f1
@ -4926,43 +4926,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
|
||||
break;
|
||||
|
||||
default:
|
||||
warning("unknown callback %04x called", addr);
|
||||
|
||||
// try decoding trivial callbacks by cseg if not in switch
|
||||
byte *code = res->cseg.ptr(addr);
|
||||
if (code[0] == 0xbb && code[3] == 0xe8 && code[6] == 0xc3) {
|
||||
// call display_message, r
|
||||
uint16 msg = READ_LE_UINT16(code + 1);
|
||||
uint16 func = 6 + addr + READ_LE_UINT16(code + 4);
|
||||
warning("call %04x and return (csAddr_displayMsg = 0x%04x) msg:0x%04x", func, csAddr_displayMsg, msg);
|
||||
if (func == csAddr_displayMsg) {
|
||||
warning("trivial callback, showing message \"%s\"", (const char *)res->dseg.ptr(msg));
|
||||
displayMessage(msg);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (code[0] == 0xe8 && code[3] == 0xc3) {
|
||||
uint func = 3 + addr + READ_LE_UINT16(code + 1);
|
||||
warning("call %04x and return (csAddr_rejectMsg = 0x%04x)", func, csAddr_rejectMsg);
|
||||
if (func == csAddr_rejectMsg) {
|
||||
rejectMessage();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (code[0] == 0xc7 && code[1] == 0x06 && code[2] == 0xf3 && code[3] == 0xb4 &&
|
||||
code[6] == 0xb8 && code[9] == 0xbb && code[12] == 0xbf &&
|
||||
code[22] == 0xe8 && code[25] == 0xc3) {
|
||||
warning("callback -> loadScene(%d, Common::Point(%d, %d)); scene->setOrientation(%d)", code[4],
|
||||
(READ_LE_UINT16(code + 7) + READ_LE_UINT16(code + 13) + 1) / 2,
|
||||
READ_LE_UINT16(code + 10), code[21]);
|
||||
loadScene(code[4], Common::Point(
|
||||
(READ_LE_UINT16(code + 7) + READ_LE_UINT16(code + 13) + 1) / 2 ,
|
||||
READ_LE_UINT16(code + 10)));
|
||||
scene->setOrientation(code[21]);
|
||||
return true;
|
||||
}
|
||||
error("unknown callback 0x%04x called", addr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ bool Resources::loadArchives(const ADGameDescription *gd) {
|
||||
}
|
||||
#endif
|
||||
|
||||
cseg.read(dat, CSEG_SIZE);
|
||||
dat->skip(CSEG_SIZE);
|
||||
dseg.read(dat, DSEG_SIZE);
|
||||
eseg.read(dat, ESEG_SIZE);
|
||||
delete dat;
|
||||
|
@ -1164,7 +1164,7 @@ public:
|
||||
FilePack off, on, ons, lan000, lan500, sam_mmm, sam_sam, mmm, voices;
|
||||
#endif
|
||||
|
||||
Segment cseg, dseg;
|
||||
Segment dseg;
|
||||
Font font7, font8;
|
||||
|
||||
//const byte *getDialog(uint16 dialogNum) { return eseg.ptr(dialogOffsets[dialogNum]); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user