aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2011-01-08 10:23:27 +0000
committerFilippos Karapetis2011-01-08 10:23:27 +0000
commitfc83afc5f2456d0c560aade835d8c505694b732a (patch)
tree12419b6ed104f60206078edefe5c639ab3bc6692 /engines/sci/engine
parent3ac598624d3e9a3bf86bfc1bcf435b73a663c164 (diff)
downloadscummvm-rg350-fc83afc5f2456d0c560aade835d8c505694b732a.tar.gz
scummvm-rg350-fc83afc5f2456d0c560aade835d8c505694b732a.tar.bz2
scummvm-rg350-fc83afc5f2456d0c560aade835d8c505694b732a.zip
SCI2.1: Added/documented some functionality used by Shivers 1
- Added kFileIO subop 17 (create save slot) - Added information about a (probably debug) kernel function used in a puzzle, kCelInfo - Added some information on two kSave subops - Added 2 workarounds for uninitialized variables svn-id: r55158
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.h2
-rw-r--r--engines/sci/engine/kernel_tables.h3
-rw-r--r--engines/sci/engine/kfile.cpp29
-rw-r--r--engines/sci/engine/kgraphics.cpp27
-rw-r--r--engines/sci/engine/workarounds.cpp2
5 files changed, 62 insertions, 1 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 67b98cce9e..4eded9fd33 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -469,6 +469,7 @@ reg_t kMoveToEnd(EngineState *s, int argc, reg_t *argv);
reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv);
reg_t kWinHelp(EngineState *s, int argc, reg_t *argv);
reg_t kGetConfig(EngineState *s, int argc, reg_t *argv);
+reg_t kGetCelInfo(EngineState *s, int argc, reg_t *argv);
#endif
reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
@@ -542,6 +543,7 @@ reg_t kFileIOReadByte(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv);
+reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv);
#endif
//@}
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index c8f4332a4f..d04dc654cd 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -241,6 +241,7 @@ static const SciKernelMapSubEntry kFileIO_subops[] = {
{ SIG_SCI32, 14, MAP_CALL(FileIOWriteByte), "ii", NULL },
{ SIG_SCI32, 15, MAP_CALL(FileIOReadWord), "i", NULL },
{ SIG_SCI32, 16, MAP_CALL(FileIOWriteWord), "ii", NULL },
+ { SIG_SCI32, 17, MAP_CALL(FileIOCreateSaveSlot), "ir", NULL },
{ SIG_SCI32, 19, MAP_CALL(Stub), "r", NULL }, // for Torin / Torin demo
#endif
SCI_SUBOPENTRY_TERMINATOR
@@ -543,6 +544,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(GetWindowsOption), SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(WinHelp), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(GetConfig), SIG_EVERYWHERE, "ro", NULL, NULL },
+ { MAP_CALL(GetCelInfo), SIG_EVERYWHERE, "iiiiii", NULL, NULL },
// SCI2.1 Empty Functions
@@ -577,7 +579,6 @@ static SciKernelMapEntry s_kernelMap[] = {
// SCI2.1 unmapped functions - TODO!
// SetLanguage - used by MUMG Deluxe from the main menu to switch languages
- // CelInfo - used by Shivers 1
// Bitmap
// MovePlaneItems - used by SQ6
// Font
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 0ea38a82a7..5f1445247f 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -1113,6 +1113,26 @@ reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv) {
return s->r_acc; // FIXME: does this really not return anything?
}
+reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv) {
+ // Used in Shivers when the user enters his name on the guest book
+ // in the beginning to start the game.
+
+ // Creates a new save slot, and returns if the operation was successful
+
+ // Argument 0 denotes the save slot as a negative integer, 2 means "0"
+ // Argument 1 is a string, with the file name, obtained from kSave(5).
+ // The interpreter checks if it can be written to (by checking for free
+ // disk space and write permissions)
+
+ // We don't really use or need any of this...
+
+ uint16 saveSlot = argv[0].toUint16();
+ char* fileName = s->_segMan->lookupString(argv[1])->getRawData();
+ warning("kFileIOCreateSaveSlot(%d, '%s')", saveSlot, fileName);
+
+ return TRUE_REG; // slot creation was successful
+}
+
reg_t kCD(EngineState *s, int argc, reg_t *argv) {
// TODO: Stub
switch (argv[0].toUint16()) {
@@ -1133,8 +1153,17 @@ reg_t kSave(EngineState *s, int argc, reg_t *argv) {
case 2: // GetSaveDir
// Yay! Reusing the old kernel function!
return kGetSaveDir(s, argc - 1, argv + 1);
+ case 5:
+ // TODO
+ // 3 parameters: game ID, a string and an array
+ return s->r_acc;
case 8:
// TODO
+ // This is a timer callback, with 1 parameter: the timer object
+ // (e.g. "timers").
+ // It's used for auto-saving (i.e. save every X minutes, by checking
+ // the elapsed time from the timer object)
+
// This function has to return something other than 0 to proceed
return s->r_acc;
default:
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index ded20167df..20f3263f67 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1490,6 +1490,33 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
+ // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now
+ kStub(s, argc, argv);
+
+ // Used by Shivers 1, room 23601
+
+ // 6 arguments, all integers:
+ // argv[0] - subop (0 - 4). It's constantly called with 4 in Shivers 1
+ // argv[2] - view (used with view 23602 in Shivers 1)
+ // argv[3] - loop
+ // argv[4] - cel
+ // argv[5] - unknown (row?)
+ // argv[6] - unknown (column?)
+
+ // Subops:
+ // 0 - return the view
+ // 1 - return the loop
+ // 2, 3 - nop
+ // 4 - returns some kind of hash (?) based on the view and the two last params
+
+ // This seems to be a debug function, but it could be used to check if
+ // the jigsaw pieces "stick" together (they currently don't, unless I'm missing
+ // something)
+
+ return s->r_acc;
+}
+
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 46c7254592..54c47ad8e9 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -195,6 +195,8 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_RAMA, 12, 64950, -1, "hiliteOptText", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // Demo, right when it starts
{ GID_RAMA, 12, 64950, -1, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // Demo, right when it starts
{ GID_SHIVERS, -1, 952, 0, "SoundManager", "stop", -1, 2, { WORKAROUND_FAKE, 0 } }, // Just after Sierra logo
+ { GID_SHIVERS, -1, 64950, 0, "Feature", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // When clicking on the locked door at the beginning
+ { GID_SHIVERS, -1, 64950, 0, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // When clicking on the gargoyle eye at the beginning
{ GID_SQ1, 103, 103, 0, "hand", "internalEvent", -1, -1, { WORKAROUND_FAKE, 0 } }, // Spanish (and maybe early versions?) only: when moving cursor over input pad, temps 1 and 2
{ GID_SQ1, -1, 703, 0, "", "export 1", -1, 0, { WORKAROUND_FAKE, 0 } }, // sub that's called from several objects while on sarien battle cruiser
{ GID_SQ1, -1, 703, 0, "firePulsar", "changeState", 0x18a, 0, { WORKAROUND_FAKE, 0 } }, // export 1, but called locally (when shooting at aliens)