[Scummvm-git-logs] scummvm master -> 89723ae889ff7522836d7b4b10c37b8a2cfd5768
sluicebox
noreply at scummvm.org
Tue Jan 30 21:24:24 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
32fa3679ea SCI: Reduce `g_system` use
a8145c5930 AGI: Cleanup op_cmd.cpp
89723ae889 AGI: Move SQ2 Apple IIgs unknown opcode handling
Commit: 32fa3679eac3d5952855642010f1e66c59906348
https://github.com/scummvm/scummvm/commit/32fa3679eac3d5952855642010f1e66c59906348
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-30T13:22:44-08:00
Commit Message:
SCI: Reduce `g_system` use
Changed paths:
engines/sci/sci.cpp
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 855dfdaf6f8..691b78d62da 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -511,7 +511,7 @@ void SciEngine::suggestDownloadGK2SubTitlesPatch() {
Common::U32String altButton;
Common::U32String downloadMessage;
- if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) {
+ if (_system->hasFeature(OSystem::kFeatureOpenUrl)) {
altButton = _("Download patch");
downloadMessage = _("(or click 'Download patch' button. But note - it only downloads, you will have to continue from there)\n");
}
@@ -533,7 +533,7 @@ void SciEngine::suggestDownloadGK2SubTitlesPatch() {
"- restart the game\n"), altButton, false);
if (result) {
char url[] = "http://www.sierrahelp.com/Files/Patches/GabrielKnight/GK2Subtitles.zip";
- g_system->openUrl(url);
+ _system->openUrl(url);
}
}
@@ -575,7 +575,7 @@ bool SciEngine::initGame() {
if (_vocabulary)
_vocabulary->reset();
- _gamestate->lastWaitTime = _gamestate->_screenUpdateTime = g_system->getMillis();
+ _gamestate->lastWaitTime = _gamestate->_screenUpdateTime = _system->getMillis();
// Load game language into printLang property of game object
setSciLanguage();
@@ -966,8 +966,7 @@ void SciEngine::sleep(uint32 msecs) {
return;
}
- uint32 time;
- const uint32 wakeUpTime = g_system->getMillis() + msecs;
+ const uint32 wakeUpTime = _system->getMillis() + msecs;
for (;;) {
// let backend process events and update the screen
@@ -986,12 +985,12 @@ void SciEngine::sleep(uint32 msecs) {
_gfxFrameout->updateScreen();
}
#endif
- time = g_system->getMillis();
+ uint32 time = _system->getMillis();
if (time + 10 < wakeUpTime) {
- g_system->delayMillis(10);
+ _system->delayMillis(10);
} else {
if (time < wakeUpTime)
- g_system->delayMillis(wakeUpTime - time);
+ _system->delayMillis(wakeUpTime - time);
break;
}
}
Commit: a8145c5930a18baf810ee68e0477bcf2728fd079
https://github.com/scummvm/scummvm/commit/a8145c5930a18baf810ee68e0477bcf2728fd079
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-30T13:22:44-08:00
Commit Message:
AGI: Cleanup op_cmd.cpp
Changed paths:
engines/agi/op_cmd.cpp
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 1e023b73c46..5fe04b07ea9 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -35,31 +35,8 @@
#include "common/system.h"
#include "common/textconsole.h"
-namespace {
-// Creates a unique log file name each time this function is called.
-// We never want to override an existing log file, so here we create one
-// based on the current game and system time.
-//
-// For example: dumps/agi.kq.20221013214511.log
-Common::Path generateLogFileName(Agi::AgiGame *state, Agi::AgiEngine *vm) {
- TimeDate date;
- vm->_system->getTimeAndDate(date, true);
- return Common::Path(Common::String::format("dumps/agi.%s.%d%02d%02d%02d%02d%02d.log",
- vm->getTargetName().c_str(),
- date.tm_year + 1900,
- date.tm_mon + 1,
- date.tm_mday,
- date.tm_hour,
- date.tm_min,
- date.tm_sec), '/');
-}
-} // namespace
-
namespace Agi {
-#define getFeatures() state->_vm->getFeatures()
-#define getLanguage() state->_vm->getLanguage()
-
void cmdIncrement(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
uint16 varNr = parameter[0];
byte varVal = vm->getVar(varNr);
@@ -785,7 +762,7 @@ void cmdSaveGame(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
void cmdLoadGame(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
if (vm->getVersion() >= 0x2272) {
- // this was only donce since 2.272
+ // this was only done since 2.272
state->_vm->_sound->stopSound();
}
@@ -793,7 +770,7 @@ void cmdLoadGame(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
if (state->automaticSave) {
if (vm->loadGameAutomatic()) {
- // automatic restore succeded
+ // automatic restore succeeded
return;
}
// fall back to regular dialog otherwise
@@ -832,8 +809,20 @@ void cmdLog(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
Common::DumpFile *&dumpFile = vm->_logFile;
if (!dumpFile) {
+ // Creates a unique log file based on game and system time.
+ // For example: dumps/agi.kq.20221013214511.log
+ TimeDate date;
+ vm->_system->getTimeAndDate(date, true);
+ Common::Path logFileName(Common::String::format("dumps/agi.%s.%d%02d%02d%02d%02d%02d.log",
+ vm->getTargetName().c_str(),
+ date.tm_year + 1900,
+ date.tm_mon + 1,
+ date.tm_mday,
+ date.tm_hour,
+ date.tm_min,
+ date.tm_sec), '/');
+
dumpFile = new Common::DumpFile();
- Common::Path logFileName = generateLogFileName(state, vm);
dumpFile->open(logFileName);
}
// The logs will only be written if the "dumps" folder has been created by
@@ -948,7 +937,7 @@ void cmdObjStatusF(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
// unk_177: Disable menus completely -- j5
// unk_181: Deactivate keypressed control (default control of ego)
void cmdSetSimple(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
- if (!(getFeatures() & GF_AGI256)) {
+ if (!(state->_vm->getFeatures() & GF_AGI256)) {
// set.simple is called by Larry 1 on Apple IIgs at the store, after answering the 555-6969 phone.
// load.sound(16) is called right before it. Interpreter is 2.440-like.
// it's called with parameter 16.
@@ -1732,7 +1721,7 @@ void cmdMoveObj(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
if (objectNr == 0)
state->playerControl = false;
- // AGI 2.272 (ddp, xmas) doesn't call move_obj!
+ // AGI 2.272 (ddp, xmas) doesn't call moveObj
if (vm->getVersion() > 0x2272)
vm->moveObj(screenObj);
}
@@ -1762,7 +1751,7 @@ void cmdMoveObjF(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
if (objectNr == 0)
state->playerControl = false;
- // AGI 2.272 (ddp, xmas) doesn't call move_obj!
+ // AGI 2.272 (ddp, xmas) doesn't call moveObj
if (vm->getVersion() > 0x2272)
vm->moveObj(screenObj);
}
@@ -2345,7 +2334,15 @@ void cmdNewRoomVV1(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
}
void cmdUnknown(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
- warning("Skipping unknown opcode %2X", *(state->_curLogic->data + state->_curLogic->cIP - 1));
+ byte opcode = *(state->_curLogic->data + state->_curLogic->cIP - 1);
+ Common::String parameterString;
+ for (int i = 0; i < vm->getOpCodesTable()[opcode].parameterSize; i++) {
+ if (i > 0) {
+ parameterString += ",";
+ }
+ parameterString += Common::String::format(" %2X (%d)", parameter[i], parameter[i]);
+ }
+ warning("Unknown opcode: %2X (%d), parameters:%s", opcode, opcode, parameterString.c_str());
}
/**
@@ -2439,7 +2436,7 @@ int AgiEngine::runLogic(int16 logicNr) {
return 1;
default:
if (!_opCodes[op].functionPtr) {
- error("Illegal opcode %x in logic %d, ip %d", op, state->curLogicNr, state->_curLogic->cIP);
+ error("Illegal opcode %2X (%d) in logic %d, ip %d", op, op, state->curLogicNr, state->_curLogic->cIP);
}
curParameterSize = _opCodes[op].parameterSize;
Commit: 89723ae889ff7522836d7b4b10c37b8a2cfd5768
https://github.com/scummvm/scummvm/commit/89723ae889ff7522836d7b4b10c37b8a2cfd5768
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-30T13:22:44-08:00
Commit Message:
AGI: Move SQ2 Apple IIgs unknown opcode handling
Changed paths:
engines/agi/op_cmd.cpp
engines/agi/opcodes.cpp
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 5fe04b07ea9..658429416fb 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1017,17 +1017,7 @@ void cmdShowMouse(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
}
}
-// Seems to have been added for AGI3, at least according to PC AGI
-// Space Quest 2 on Apple IIgs (using AGI ) calls it during the spaceship cutscene in the intro
-// but show.mouse is never called afterwards. Game running under emulator doesn't seem to hide the mouse cursor.
-// TODO: figure out, what exactly happens. Probably some hacked-in command and not related to mouse cursor for that game?
void cmdHideMouse(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
- if (vm->getVersion() < 0x3000) {
- // was not available before 3.086
- warning("hide.mouse, although not available for current AGI version");
- return;
- }
-
if ((vm->getGameID() == GID_MH1) && (vm->getPlatform() == Common::kPlatformApple2GS)) {
// Called right after beating arcade sequence on day 4 in the hospital Parameter is "1".
// Right before cutscene. show.mouse isn't called. Probably different function.
diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index 7814b87836b..667cafda448 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -417,6 +417,16 @@ void AgiEngine::setupOpCodes(uint16 version) {
_opCodes[0x97].parameters = "vvv";
_opCodes[0x98].parameters = "vvv";
}
+
+ // TODO: Opcode B0 is used by SQ2 Apple IIgs, but its purpose is
+ // currently unknown. It takes one parameter, and that parameter
+ // appears to be a variable number. It is not hide.mouse from AGI3.
+ // No other AGI2 games have been discovered that call this opcode.
+ // Logic 1: during the spaceship cutscene in the intro, called with 53
+ // Logic 23: called twice with 39.
+ _opCodes[0xb0].name = "unknown";
+ _opCodes[0xb0].parameters = "v";
+ _opCodes[0xb0].functionPtr = &cmdUnknown;
}
if (version >= 0x3000) {
More information about the Scummvm-git-logs
mailing list