[Scummvm-cvs-logs] SF.net SVN: scummvm:[43906] scummvm/trunk/engines/sci/engine
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Wed Sep 2 13:35:03 CEST 2009
Revision: 43906
http://scummvm.svn.sourceforge.net/scummvm/?rev=43906&view=rev
Author: fingolfin
Date: 2009-09-02 11:35:00 +0000 (Wed, 02 Sep 2009)
Log Message:
-----------
SCI:
* removed kNOP
* renamed k_Unknown to kUnknown
* added FIXME to kfunct_mappers table
* more cleanup
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kernel.cpp
scummvm/trunk/engines/sci/engine/kernel.h
scummvm/trunk/engines/sci/engine/kmisc.cpp
Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp 2009-09-02 11:33:25 UTC (rev 43905)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp 2009-09-02 11:35:00 UTC (rev 43906)
@@ -273,8 +273,8 @@
/*4e*/ DEFUN("ReadNumber", kReadNumber, "r"),
/*4f*/ DEFUN("BaseSetter", kBaseSetter, "o"),
/*50*/ DEFUN("DirLoop", kDirLoop, "oi"),
- // Opcode 51 is defined twice for a reason. Older SCI versions
- // call CanBeHere, whereas newer ones its inverse, CantBeHere
+ // Opcode 51 is defined twice for a reason: In older SCI versions
+ // it is CanBeHere, whereas in newer version it is CantBeHere
/*51*/ DEFUN("CanBeHere", kCanBeHere, "ol*"),
/*51*/ DEFUN("CantBeHere", kCanBeHere, "ol*"),
/*52*/ DEFUN("OnControl", kOnControl, "i*"),
@@ -346,8 +346,14 @@
// Special and NOP stuff
DEFUN("Dummy", kStub, ".*"),
- {NULL, k_Unknown, NULL},
+ {NULL, kUnknown, NULL},
+ // FIXME: The stub functions below are ignored since the entry
+ // above ( {NULL, kUnknown, NULL} ) terminates this array effectively.
+ // Seems like a bug to me; maybe the line above should just be removed?
+ // If this is on purpose, then whoever knows the reason should replace
+ // this FIXME by a comment explaining it.
+
// Stub functions
DEFUN("ShiftScreen", kStub, ".*"),
DEFUN("MemorySegment", kStub, ".*"),
@@ -572,29 +578,28 @@
if (functnr < getKernelNamesSize())
sought_name = getKernelName(functnr);
- // If the name is known, look it up in kfunct_mappers. This table
- // maps kernel func names to actual function (pointers).
- if (!sought_name.empty()) {
- for (uint seeker = 0; (found == -1) && kfunct_mappers[seeker].name; seeker++)
- if (sought_name == kfunct_mappers[seeker].name)
- found = seeker; // Found a kernel function with the correct name!
- }
-
// Reset the table entry
_kernelFuncs[functnr].fun = NULL;
_kernelFuncs[functnr].signature = NULL;
_kernelFuncs[functnr].orig_name = sought_name;
+ if (sought_name.empty()) {
+ // No name was given -> must be an unknown opcode
+ warning("Flagging kernel function %x as unknown", functnr);
+ _kernelFuncs[functnr].fun = kUnknown;
+ continue;
+ }
+
+ // If the name is known, look it up in kfunct_mappers. This table
+ // maps kernel func names to actual function (pointers).
+ for (uint seeker = 0; (found == -1) && kfunct_mappers[seeker].name; seeker++)
+ if (sought_name == kfunct_mappers[seeker].name)
+ found = seeker; // Found a kernel function with the correct name!
+
if (found == -1) {
- if (!sought_name.empty()) {
- // No match but a name was given -> NOP
- warning("Kernel function %s[%x] unmapped", sought_name.c_str(), functnr);
- _kernelFuncs[functnr].fun = kNOP;
- } else {
- // No match and no name was given -> must be an unknown opcode
- warning("Flagging kernel function %x as unknown", functnr);
- _kernelFuncs[functnr].fun = k_Unknown;
- }
+ // No match but a name was given -> stub
+ warning("Kernel function %s[%x] unmapped", sought_name.c_str(), functnr);
+ _kernelFuncs[functnr].fun = kStub;
} else {
// A match in kfunct_mappers was found
if (kfunct_mappers[found].fun) {
Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h 2009-09-02 11:33:25 UTC (rev 43905)
+++ scummvm/trunk/engines/sci/engine/kernel.h 2009-09-02 11:35:00 UTC (rev 43906)
@@ -503,15 +503,14 @@
reg_t kShowMovie(EngineState *s, int, int argc, reg_t *argv);
reg_t kSetVideoMode(EngineState *s, int, int argc, reg_t *argv);
reg_t kStrSplit(EngineState *s, int, int argc, reg_t *argv);
-reg_t k_Unknown(EngineState *s, int, int argc, reg_t *argv);
reg_t kPlatform(EngineState *s, int, int argc, reg_t *argv);
reg_t kPalVary(EngineState *s, int, int argc, reg_t *argv);
-// The Unknown/Unnamed kernel function
+// for unknown/unnamed kernel function
+reg_t kUnknown(EngineState *s, int, int argc, reg_t *argv);
+
+// for named but unimplemented kernel functions
reg_t kStub(EngineState *s, int, int argc, reg_t *argv);
-// for unimplemented kernel functions
-reg_t kNOP(EngineState *s, int, int argc, reg_t *argv);
-// for kernel functions that don't do anything
} // End of namespace Sci
Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp 2009-09-02 11:33:25 UTC (rev 43905)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp 2009-09-02 11:35:00 UTC (rev 43906)
@@ -92,14 +92,6 @@
return NULL_REG;
}
-#define SCI_MAPPED_UNKNOWN_KFUNCTIONS_NR 0x75
-// kfunct_mappers below doubles for unknown kfunctions
-
-reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- warning("Unhandled Unknown function %04x", funct_nr);
- return NULL_REG;
-}
-
reg_t kFlushResources(EngineState *s, int, int argc, reg_t *argv) {
run_gc(s);
debugC(2, kDebugLevelRoom, "Entering room number %d", argv[0].toUint16());
@@ -268,10 +260,15 @@
return NULL_REG;
}
+reg_t kUnknown(EngineState *s, int funct_nr, int argc, reg_t *argv) {
+ warning("Unknown kernel function 0x%02x", funct_nr);
+ return NULL_REG;
+}
+
reg_t kStub(EngineState *s, int funct_nr, int argc, reg_t *argv) {
char tmpbuf[256];
- snprintf(tmpbuf, sizeof(tmpbuf), "Unimplemented syscall: %s[%x] (",
- ((SciEngine*)g_engine)->getKernel()->getKernelName(funct_nr).c_str(), funct_nr);
+ snprintf(tmpbuf, sizeof(tmpbuf), "Unimplemented kernel function: 0x%02x (%s) (",
+ funct_nr, ((SciEngine*)g_engine)->getKernel()->getKernelName(funct_nr).c_str());
for (int i = 0; i < argc; i++) {
char tmpbuf2[20];
@@ -287,9 +284,4 @@
return NULL_REG;
}
-reg_t kNOP(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- warning("Kernel function 0x%02x (%s) invoked: unmapped", funct_nr, ((SciEngine*)g_engine)->getKernel()->_kernelFuncs[funct_nr].orig_name.c_str());
- return NULL_REG;
-}
-
} // End of namespace Sci
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list