aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kernel_tables.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/kernel_tables.h')
-rw-r--r--engines/sci/engine/kernel_tables.h111
1 files changed, 82 insertions, 29 deletions
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 2cbd79366d..49dfa17554 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -34,6 +34,15 @@ namespace Sci {
// . -> any type
// i* -> optional multiple integers
// .* -> any parameters afterwards (or none)
+//
+// data types:
+// i - regular integer
+// o - object
+// r - reference
+// n - node
+// 0 - NULL
+// . - any
+// ! - invalid reference/offset
struct SciKernelMapSubEntry {
SciVersion fromVersion;
@@ -56,7 +65,8 @@ struct SciKernelMapSubEntry {
#define SIG_SCI1 SCI_VERSION_1_EGA_ONLY, SCI_VERSION_1_LATE
#define SIG_SCI11 SCI_VERSION_1_1, SCI_VERSION_1_1
#define SIG_SINCE_SCI11 SCI_VERSION_1_1, SCI_VERSION_NONE
-#define SIG_SCI21 SCI_VERSION_2_1, SCI_VERSION_3
+#define SIG_SINCE_SCI21 SCI_VERSION_2_1_EARLY, SCI_VERSION_3
+#define SIG_UNTIL_SCI21MID SCI_VERSION_2_1_EARLY, SCI_VERSION_2_1_MIDDLE
#define SIG_SCI16 SCI_VERSION_NONE, SCI_VERSION_1_1
#define SIG_SCI32 SCI_VERSION_2, SCI_VERSION_NONE
@@ -65,7 +75,7 @@ struct SciKernelMapSubEntry {
#define SIG_SOUNDSCI0 SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE
#define SIG_SOUNDSCI1EARLY SCI_VERSION_1_EARLY, SCI_VERSION_1_EARLY
#define SIG_SOUNDSCI1LATE SCI_VERSION_1_LATE, SCI_VERSION_1_LATE
-#define SIG_SOUNDSCI21 SCI_VERSION_2_1, SCI_VERSION_3
+#define SIG_SOUNDSCI21 SCI_VERSION_2_1_EARLY, SCI_VERSION_3
#define SIGFOR_ALL 0x3f
#define SIGFOR_DOS 1 << 0
@@ -190,7 +200,7 @@ static const SciKernelMapSubEntry kGraph_subops[] = {
// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kPalVary_subops[] = {
- { SIG_SCI21, 0, MAP_CALL(PalVaryInit), "ii(i)(i)(i)", NULL },
+ { SIG_SINCE_SCI21, 0, MAP_CALL(PalVaryInit), "ii(i)(i)(i)", NULL },
{ SIG_SCIALL, 0, MAP_CALL(PalVaryInit), "ii(i)(i)", NULL },
{ SIG_SCIALL, 1, MAP_CALL(PalVaryReverse), "(i)(i)(i)", NULL },
{ SIG_SCIALL, 2, MAP_CALL(PalVaryGetCurrentStep), "", NULL },
@@ -246,6 +256,7 @@ static const SciKernelMapSubEntry kFileIO_subops[] = {
#ifdef ENABLE_SCI32
+// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kSave_subops[] = {
{ SIG_SCI32, 0, MAP_CALL(SaveGame), "[r0]i[r0](r0)", NULL },
{ SIG_SCI32, 1, MAP_CALL(RestoreGame), "[r0]i[r0]", NULL },
@@ -261,31 +272,73 @@ static const SciKernelMapSubEntry kSave_subops[] = {
// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kList_subops[] = {
- { SIG_SCI21, 0, MAP_CALL(NewList), "", NULL },
- { SIG_SCI21, 1, MAP_CALL(DisposeList), "l", NULL },
- { SIG_SCI21, 2, MAP_CALL(NewNode), ".(.)", NULL },
- { SIG_SCI21, 3, MAP_CALL(FirstNode), "[l0]", NULL },
- { SIG_SCI21, 4, MAP_CALL(LastNode), "l", NULL },
- { SIG_SCI21, 5, MAP_CALL(EmptyList), "l", NULL },
- { SIG_SCI21, 6, MAP_CALL(NextNode), "n", NULL },
- { SIG_SCI21, 7, MAP_CALL(PrevNode), "n", NULL },
- { SIG_SCI21, 8, MAP_CALL(NodeValue), "[n0]", NULL },
- { SIG_SCI21, 9, MAP_CALL(AddAfter), "lnn.", NULL },
- { SIG_SCI21, 10, MAP_CALL(AddToFront), "ln.", NULL },
- { SIG_SCI21, 11, MAP_CALL(AddToEnd), "ln(.)", NULL },
- { SIG_SCI21, 12, MAP_CALL(AddBefore), "ln.", NULL },
- { SIG_SCI21, 13, MAP_CALL(MoveToFront), "ln", NULL },
- { SIG_SCI21, 14, MAP_CALL(MoveToEnd), "ln", NULL },
- { SIG_SCI21, 15, MAP_CALL(FindKey), "l.", NULL },
- { SIG_SCI21, 16, MAP_CALL(DeleteKey), "l.", NULL },
- { SIG_SCI21, 17, MAP_CALL(ListAt), "li", NULL },
- { SIG_SCI21, 18, MAP_CALL(ListIndexOf) , "l[io]", NULL },
- { SIG_SCI21, 19, MAP_CALL(ListEachElementDo), "li(.*)", NULL },
- { SIG_SCI21, 20, MAP_CALL(ListFirstTrue), "li(.*)", NULL },
- { SIG_SCI21, 21, MAP_CALL(ListAllTrue), "li(.*)", NULL },
- { SIG_SCI21, 22, MAP_CALL(Sort), "ooo", NULL },
+ { SIG_SINCE_SCI21, 0, MAP_CALL(NewList), "", NULL },
+ { SIG_SINCE_SCI21, 1, MAP_CALL(DisposeList), "l", NULL },
+ { SIG_SINCE_SCI21, 2, MAP_CALL(NewNode), ".(.)", NULL },
+ { SIG_SINCE_SCI21, 3, MAP_CALL(FirstNode), "[l0]", NULL },
+ { SIG_SINCE_SCI21, 4, MAP_CALL(LastNode), "l", NULL },
+ { SIG_SINCE_SCI21, 5, MAP_CALL(EmptyList), "l", NULL },
+ { SIG_SINCE_SCI21, 6, MAP_CALL(NextNode), "n", NULL },
+ { SIG_SINCE_SCI21, 7, MAP_CALL(PrevNode), "n", NULL },
+ { SIG_SINCE_SCI21, 8, MAP_CALL(NodeValue), "[n0]", NULL },
+ { SIG_SINCE_SCI21, 9, MAP_CALL(AddAfter), "lnn.", NULL },
+ { SIG_SINCE_SCI21, 10, MAP_CALL(AddToFront), "ln.", NULL },
+ { SIG_SINCE_SCI21, 11, MAP_CALL(AddToEnd), "ln(.)", NULL },
+ { SIG_SINCE_SCI21, 12, MAP_CALL(AddBefore), "ln.", NULL },
+ { SIG_SINCE_SCI21, 13, MAP_CALL(MoveToFront), "ln", NULL },
+ { SIG_SINCE_SCI21, 14, MAP_CALL(MoveToEnd), "ln", NULL },
+ { SIG_SINCE_SCI21, 15, MAP_CALL(FindKey), "l.", NULL },
+ { SIG_SINCE_SCI21, 16, MAP_CALL(DeleteKey), "l.", NULL },
+ { SIG_SINCE_SCI21, 17, MAP_CALL(ListAt), "li", NULL },
+ { SIG_SINCE_SCI21, 18, MAP_CALL(ListIndexOf) , "l[io]", NULL },
+ { SIG_SINCE_SCI21, 19, MAP_CALL(ListEachElementDo), "li(.*)", NULL },
+ { SIG_SINCE_SCI21, 20, MAP_CALL(ListFirstTrue), "li(.*)", NULL },
+ { SIG_SINCE_SCI21, 21, MAP_CALL(ListAllTrue), "li(.*)", NULL },
+ { SIG_SINCE_SCI21, 22, MAP_CALL(Sort), "ooo", NULL },
+ SCI_SUBOPENTRY_TERMINATOR
+};
+
+// version, subId, function-mapping, signature, workarounds
+static const SciKernelMapSubEntry kString_subops[] = {
+ { SIG_SCI32, 0, MAP_CALL(StringNew), "i(i)", NULL },
+ { SIG_SCI32, 1, MAP_CALL(StringSize), "[or]", NULL },
+ { SIG_SCI32, 2, MAP_CALL(StringAt), "[or]i", NULL },
+ { SIG_SCI32, 3, MAP_CALL(StringPutAt), "[or]i(i*)", NULL },
+ // StringFree accepts invalid references
+ { SIG_SCI32, 4, MAP_CALL(StringFree), "[or0!]", NULL },
+ { SIG_SCI32, 5, MAP_CALL(StringFill), "[or]ii", NULL },
+ { SIG_SCI32, 6, MAP_CALL(StringCopy), "[or]i[or]ii", NULL },
+ { SIG_SCI32, 7, MAP_CALL(StringCompare), "[or][or](i)", NULL },
+
+ // =SCI2.1 Early and SCI2.1 Middle=
+ { SIG_UNTIL_SCI21MID, 8, MAP_CALL(StringDup), "[or]", NULL },
+ { SIG_UNTIL_SCI21MID, 9, MAP_CALL(StringGetData), "[or]", NULL },
+ { SIG_UNTIL_SCI21MID, 10, MAP_CALL(StringLen), "[or]", NULL },
+ { SIG_UNTIL_SCI21MID, 11, MAP_CALL(StringPrintf), "[or](.*)", NULL },
+ { SIG_UNTIL_SCI21MID, 12, MAP_CALL(StringPrintfBuf), "[or](.*)", NULL },
+ { SIG_UNTIL_SCI21MID, 13, MAP_CALL(StringAtoi), "[or]", NULL },
+ // exact functionality of Trim is unknown atm
+ { SIG_UNTIL_SCI21MID, 14, MAP_CALL(StringTrim), "[or]", NULL },
+ { SIG_UNTIL_SCI21MID, 15, MAP_CALL(StringUpper), "[or]", NULL },
+ { SIG_UNTIL_SCI21MID, 16, MAP_CALL(StringLower), "[or]", NULL },
+ // the following 2 are unknown atm (happen in Phantasmagoria)
+ // possibly translate?
+ { SIG_UNTIL_SCI21MID, 17, MAP_CALL(StringTrn), "[or]", NULL },
+ { SIG_UNTIL_SCI21MID, 18, MAP_CALL(StringTrnExclude), "[or]", NULL },
+
+ // SCI2.1 Late + SCI3 - kStringDup + kStringGetData were removed
+ { SIG_SCI32, 8, MAP_CALL(StringLen), "[or]", NULL },
+ { SIG_SCI32, 9, MAP_CALL(StringPrintf), "[or](.*)", NULL },
+ { SIG_SCI32, 10, MAP_CALL(StringPrintfBuf), "[or](.*)", NULL },
+ { SIG_SCI32, 11, MAP_CALL(StringAtoi), "[or]", NULL },
+ { SIG_SCI32, 12, MAP_CALL(StringTrim), "[or]", NULL },
+ { SIG_SCI32, 13, MAP_CALL(StringUpper), "[or]", NULL },
+ { SIG_SCI32, 14, MAP_CALL(StringLower), "[or]", NULL },
+ { SIG_SCI32, 15, MAP_CALL(StringTrn), "[or]", NULL },
+ { SIG_SCI32, 16, MAP_CALL(StringTrnExclude), "[or]", NULL },
SCI_SUBOPENTRY_TERMINATOR
};
+
#endif
struct SciKernelMapEntry {
@@ -429,7 +482,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(Said), SIG_EVERYWHERE, "[r0]", NULL, NULL },
{ MAP_CALL(SaveGame), SIG_EVERYWHERE, "[r0]i[r0](r0)", NULL, NULL },
{ MAP_CALL(ScriptID), SIG_EVERYWHERE, "[io](i)", NULL, NULL },
- { MAP_CALL(SetCursor), SIG_SCI21, SIGFOR_ALL, "i(i)([io])(i*)", NULL, NULL },
+ { MAP_CALL(SetCursor), SIG_SINCE_SCI21, SIGFOR_ALL, "i(i)([io])(i*)", NULL, NULL },
// TODO: SCI2.1 may supply an object optionally (mother goose sci21 right on startup) - find out why
{ MAP_CALL(SetCursor), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(iiiiii)", NULL, NULL },
{ MAP_CALL(SetCursor), SIG_EVERYWHERE, "i(i)(i)(i)(i)", NULL, kSetCursor_workarounds },
@@ -513,7 +566,7 @@ static SciKernelMapEntry s_kernelMap[] = {
// our garbage collector (i.e. the SCI0-SCI1.1 semantics).
{ "Purge", kFlushResources, SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(SetShowStyle), SIG_EVERYWHERE, "ioiiiii([ri])(i)", NULL, NULL },
- { MAP_CALL(String), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(String), SIG_EVERYWHERE, "(.*)", kString_subops, NULL },
{ MAP_CALL(UpdatePlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(UpdateScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(ObjectIntersect), SIG_EVERYWHERE, "oo", NULL, NULL },
@@ -570,7 +623,7 @@ static SciKernelMapEntry s_kernelMap[] = {
// SCI2.1 Kernel Functions
{ MAP_CALL(CD), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(IsOnMe), SIG_EVERYWHERE, "iioi", NULL, NULL },
- { MAP_CALL(List), SIG_SCI21, SIGFOR_ALL, "(.*)", kList_subops, NULL },
+ { MAP_CALL(List), SIG_SINCE_SCI21, SIGFOR_ALL, "(.*)", kList_subops, NULL },
{ MAP_CALL(MulDiv), SIG_EVERYWHERE, "iii", NULL, NULL },
{ MAP_CALL(PlayVMD), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(Robot), SIG_EVERYWHERE, "(.*)", NULL, NULL },