aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-05-20 17:52:12 +0000
committerMax Horn2009-05-20 17:52:12 +0000
commit7d54385dea265b3fa26016a191fb6223203a5f27 (patch)
tree0cf83ab260bd8452e514506e3029dd67e2cde805
parentf5f48fff3a8de6ac2f0bcb54514dd955009c3742 (diff)
downloadscummvm-rg350-7d54385dea265b3fa26016a191fb6223203a5f27.tar.gz
scummvm-rg350-7d54385dea265b3fa26016a191fb6223203a5f27.tar.bz2
scummvm-rg350-7d54385dea265b3fa26016a191fb6223203a5f27.zip
SCI: Moved some private decls from kernel.h to kernel.cpp; removed pointless (and incorrect) fallback code in k_Unknown
svn-id: r40739
-rw-r--r--engines/sci/engine/kernel.cpp16
-rw-r--r--engines/sci/engine/kernel.h15
-rw-r--r--engines/sci/engine/kmisc.cpp43
3 files changed, 33 insertions, 41 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index d7f200ee77..a0968c70ba 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -34,6 +34,19 @@
namespace Sci {
+enum KernelFunctionType {
+ KF_NEW = 1,
+ KF_NONE = -1, /**< No mapping, but name is known */
+ KF_TERMINATOR = -42 /**< terminates kfunct_mappers */
+};
+
+struct SciKernelFunction {
+ KernelFunctionType type;
+ const char *name;
+ kfunct *fun; /* The actual function */
+ const char *signature; /* kfunct signature */
+};
+
static int sci_max_allowed_unknown_kernel_functions[] = {
0,
0x72, // SCI0
@@ -382,6 +395,9 @@ int script_map_kernel(EngineState *s) {
kernel_compile_signature(&(s->_kfuncTable[functnr].signature));
++mapped;
break;
+ case KF_TERMINATOR:
+ error("Unexpectedly encountered KF_TERMINATOR");
+ break;
}
} // for all functions requesting to be mapped
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 65d79a5da4..da3dca9ec4 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -303,21 +303,6 @@ struct kfunct_sig_pair_t {
};
-enum {
- KF_NEW = 1,
- KF_NONE = -1, /* No mapping, but name is known */
- KF_TERMINATOR = -42 /* terminates kfunct_mappers */
-};
-
-struct SciKernelFunction {
- int type; /* KF_* */
- const char *name;
- kfunct *fun; /* The actual function */
- const char *signature; /* kfunct signature */
-};
-
-extern SciKernelFunction kfunct_mappers[];
-
// New kernel functions
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 84c45a205a..396fba72e2 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -93,19 +93,8 @@ reg_t kMemoryInfo(EngineState *s, int funct_nr, int argc, reg_t *argv) {
// kfunct_mappers below doubles for unknown kfunctions
reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- if (funct_nr >= SCI_MAPPED_UNKNOWN_KFUNCTIONS_NR) {
- warning("Unhandled Unknown function %04x", funct_nr);
- return NULL_REG;
- } else {
- switch (kfunct_mappers[funct_nr].type) {
- case KF_NEW:
- return kfunct_mappers[funct_nr].fun(s, funct_nr, argc, argv);
- case KF_NONE:
- default:
- warning("Unhandled Unknown function %04x", funct_nr);
- return NULL_REG;
- }
- }
+ warning("Unhandled Unknown function %04x", funct_nr);
+ return NULL_REG;
}
reg_t kFlushResources(EngineState *s, int funct_nr, int argc, reg_t *argv) {
@@ -122,10 +111,12 @@ reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return s->r_acc;
}
-#define _K_NEW_GETTIME_TICKS 0
-#define _K_NEW_GETTIME_TIME_12HOUR 1
-#define _K_NEW_GETTIME_TIME_24HOUR 2
-#define _K_NEW_GETTIME_DATE 3
+enum {
+ _K_NEW_GETTIME_TICKS = 0,
+ _K_NEW_GETTIME_TIME_12HOUR = 1,
+ _K_NEW_GETTIME_TIME_24HOUR = 2,
+ _K_NEW_GETTIME_DATE = 3
+};
reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv) {
tm loc_time;
@@ -175,12 +166,14 @@ reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return make_reg(0, retval);
}
-#define K_MEMORY_ALLOCATE_CRITICAL 1
-#define K_MEMORY_ALLOCATE_NONCRITICAL 2
-#define K_MEMORY_FREE 3
-#define K_MEMORY_MEMCPY 4
-#define K_MEMORY_PEEK 5
-#define K_MEMORY_POKE 6
+enum {
+ K_MEMORY_ALLOCATE_CRITICAL = 1,
+ K_MEMORY_ALLOCATE_NONCRITICAL = 2,
+ K_MEMORY_FREE = 3,
+ K_MEMORY_MEMCPY = 4,
+ K_MEMORY_PEEK = 5,
+ K_MEMORY_POKE = 6
+};
reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) {
switch (UKPV(0)) {
@@ -256,11 +249,9 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- int i;
-
sciprintf("Unimplemented syscall: %s[%x](", s->_kernelNames[funct_nr].c_str(), funct_nr);
- for (i = 0; i < argc; i++) {
+ for (int i = 0; i < argc; i++) {
sciprintf(PREG, PRINT_REG(argv[i]));
if (i + 1 < argc) sciprintf(", ");
}