mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-28 20:55:19 +00:00
The code that loads saved game from the launcher
can now load SCI2 saved games. Added an explanation why the injected call is necessary svn-id: r49349
This commit is contained in:
parent
a963917e89
commit
cc025ace18
@ -593,19 +593,25 @@ static void callKernelFunc(EngineState *s, int kernelFuncNum, int argc) {
|
|||||||
|
|
||||||
//warning("callk %s", kernelFunc.orig_name.c_str());
|
//warning("callk %s", kernelFunc.orig_name.c_str());
|
||||||
|
|
||||||
// TODO: SCI2/SCI2.1+ equivalent, once saving/loading works in SCI2/SCI2.1+
|
// TODO: SCI2.1 equivalent
|
||||||
if (g_loadFromLauncher >= 0 && kernelFuncNum == 0x8) {
|
if (g_loadFromLauncher >= 0 &&
|
||||||
// A game is being loaded from the launcher, and kDisplay is called, all initialization has taken
|
(kernelFuncNum == 0x8 && getSciVersion() <= SCI_VERSION_1_1) || // DrawPic
|
||||||
// place (i.e. menus have been constructed etc). Therefore, inject a kRestoreGame call
|
(kernelFuncNum == 0x3d && getSciVersion() == SCI_VERSION_2)) { // GetSaveDir
|
||||||
// here, instead of the requested function.
|
//(kernelFuncNum == 0x28 && getSciVersion() == SCI_VERSION_2_1)) { // AddPlane
|
||||||
int saveSlot = g_loadFromLauncher;
|
|
||||||
g_loadFromLauncher = -1; // invalidate slot, so that we don't load again
|
|
||||||
|
|
||||||
if (saveSlot < 0)
|
// A game is being loaded from the launcher, and the game is about to draw something on
|
||||||
error("Requested to load invalid save slot"); // should never happen, really
|
// screen, hence all initialization has taken place (i.e. menus have been constructed etc).
|
||||||
|
// Therefore, inject a kRestoreGame call here, instead of the requested function.
|
||||||
|
// The restore call is injected here mainly for games which have a menu, as the menu is
|
||||||
|
// constructed when the game starts and is not reconstructed when a saved game is loaded.
|
||||||
|
int saveSlot = g_loadFromLauncher;
|
||||||
|
g_loadFromLauncher = -1; // invalidate slot, so that we don't load again
|
||||||
|
|
||||||
reg_t restoreArgv[2] = { NULL_REG, make_reg(0, saveSlot) }; // special call (argv[0] is NULL)
|
if (saveSlot < 0)
|
||||||
kRestoreGame(s, 2, restoreArgv);
|
error("Requested to load invalid save slot"); // should never happen, really
|
||||||
|
|
||||||
|
reg_t restoreArgv[2] = { NULL_REG, make_reg(0, saveSlot) }; // special call (argv[0] is NULL)
|
||||||
|
kRestoreGame(s, 2, restoreArgv);
|
||||||
} else {
|
} else {
|
||||||
// Call kernel function
|
// Call kernel function
|
||||||
s->r_acc = kernelFunc.fun(s, argc, argv);
|
s->r_acc = kernelFunc.fun(s, argc, argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user