aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/game.cpp5
-rw-r--r--engines/sci/engine/kernel.cpp50
-rw-r--r--engines/sci/engine/kernel.h2
-rw-r--r--engines/sci/engine/savegame.cpp3
-rw-r--r--engines/sci/engine/scriptconsole.cpp14
-rw-r--r--engines/sci/engine/scriptdebug.cpp12
-rw-r--r--engines/sci/engine/state.cpp3
-rw-r--r--engines/sci/engine/state.h3
-rw-r--r--engines/sci/engine/vm.h6
-rw-r--r--engines/sci/scicore/vocab_debug.cpp161
-rw-r--r--engines/sci/scicore/vocabulary.h9
11 files changed, 87 insertions, 181 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 9d79d8e65c..39f1b2135b 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -77,11 +77,10 @@ static void _free_vocabulary(EngineState *s) {
vocab_free_rule_list(s->parser_rules);
s->_selectorNames.clear();
- vocabulary_free_knames(s->kernel_names);
+ s->_kernelNames.clear();
vocabulary_free_opcodes(s->opcodes);
s->opcodes = NULL;
- s->kernel_names = NULL;
s->opcodes = NULL;
}
@@ -477,7 +476,7 @@ int script_init_engine(EngineState *s, sci_version_t version) {
s->execution_stack_base = -1; // No vm is running yet
s->execution_stack_pos = -1; // Start at execution stack position 0
- s->kernel_names = vocabulary_get_knames(s->resmgr, &s->kernel_names_nr);
+ vocabulary_get_knames(s->resmgr, s->_kernelNames);
script_map_kernel(s);
// Maps the kernel functions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index ca940625b3..945fdab3a4 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -232,16 +232,11 @@ reg_t kalloc(EngineState *s, const char *type, int space) {
return reg;
}
-int has_kernel_function(EngineState *s, const char *kname) {
- int i = 0;
+bool has_kernel_function(EngineState *s, const char *kname) {
+ Common::StringList::const_iterator it
+ = Common::find(s->_kernelNames.begin(), s->_kernelNames.end(), kname);
- while (s->kernel_names[i]) {
- if (!strcmp(s->kernel_names[i], kname))
- return 1;
- i++;
- }
-
- return 0;
+ return (it != s->_kernelNames.end());
}
// Returns a pointer to the memory indicated by the specified handle
@@ -496,7 +491,7 @@ 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->kernel_names[funct_nr], funct_nr);
+ sciprintf("Unimplemented syscall: %s[%x](", s->_kernelNames[funct_nr].c_str(), funct_nr);
for (i = 0; i < argc; i++) {
sciprintf(PREG, PRINT_REG(argv[i]));
@@ -508,13 +503,13 @@ reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kNOP(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- const char *problem = (const char*)(s->kfunct_table[funct_nr].orig_name ? "unmapped" : "NOP");
+ warning("Kernel function 0x%02x invoked: unmapped", funct_nr);
- warning("Kernel function 0x%02x invoked: %s", funct_nr, problem);
-
- if (s->kfunct_table[funct_nr].orig_name && strcmp(s->kfunct_table[funct_nr].orig_name, SCRIPT_UNKNOWN_FUNCTION_STRING)) {
- warning(" (but its name is known to be %s)", s->kfunct_table[funct_nr].orig_name);
+/* TODO: re-enable this
+ if (s->kfunct_table[funct_nr].orig_name != SCRIPT_UNKNOWN_FUNCTION_STRING) {
+ warning(" (but its name is known to be %s)", s->kfunct_table[funct_nr].orig_name.c_str());
}
+*/
return NULL_REG;
}
@@ -599,11 +594,10 @@ void kernel_compile_signature(const char **s) {
}
int script_map_kernel(EngineState *s) {
- int functnr;
int mapped = 0;
int ignored = 0;
- int functions_nr = s->kernel_names_nr;
- int max_functions_nr = sci_max_allowed_unknown_kernel_functions[s->resmgr->_sciVersion];
+ uint functions_nr = s->_kernelNames.size();
+ uint max_functions_nr = sci_max_allowed_unknown_kernel_functions[s->resmgr->_sciVersion];
if (functions_nr < max_functions_nr) {
warning("SCI version believed to have %d kernel"
@@ -616,21 +610,21 @@ int script_map_kernel(EngineState *s) {
s->kfunct_table = (kfunct_sig_pair_t*)sci_malloc(sizeof(kfunct_sig_pair_t) * functions_nr);
s->kfunct_nr = functions_nr;
- for (functnr = 0; functnr < functions_nr; functnr++) {
+ for (uint functnr = 0; functnr < functions_nr; functnr++) {
int seeker, found = -1;
- char *sought_name = NULL;
+ Common::String sought_name;
- if (functnr < s->kernel_names_nr)
- sought_name = s->kernel_names[functnr];
+ if (functnr < s->_kernelNames.size())
+ sought_name = s->_kernelNames[functnr];
- if (sought_name)
+ if (!sought_name.empty())
for (seeker = 0; (found == -1) && kfunct_mappers[seeker].type != KF_TERMINATOR; seeker++)
- if (kfunct_mappers[seeker].name && strcmp(kfunct_mappers[seeker].name, sought_name) == 0)
+ if (kfunct_mappers[seeker].name && sought_name == kfunct_mappers[seeker].name)
found = seeker; // Found a kernel function with the same name!
if (found == -1) {
- if (sought_name) {
- warning("Kernel function %s[%x] unmapped", s->kernel_names[functnr], functnr);
+ if (!sought_name.empty()) {
+ warning("Kernel function %s[%x] unmapped", s->_kernelNames[functnr].c_str(), functnr);
s->kfunct_table[functnr].fun = kNOP;
} else {
warning("Flagging kernel function %x as unknown", functnr);
@@ -638,7 +632,9 @@ int script_map_kernel(EngineState *s) {
}
s->kfunct_table[functnr].signature = NULL;
+/* TODO: re-enable this
s->kfunct_table[functnr].orig_name = sought_name;
+*/
} else
switch (kfunct_mappers[found].type) {
case KF_OLD:
@@ -659,7 +655,7 @@ int script_map_kernel(EngineState *s) {
} // for all functions requesting to be mapped
- sciprintf("Handled %d/%d kernel functions, mapping %d", mapped + ignored, s->kernel_names_nr, mapped);
+ sciprintf("Handled %d/%d kernel functions, mapping %d", mapped + ignored, s->_kernelNames.size(), mapped);
if (ignored)
sciprintf(" and ignoring %d", ignored);
sciprintf(".\n");
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 68ebbcc10f..70561bc9c0 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -109,7 +109,7 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index);
#define CHECK_THIS_KERNEL_FUNCTION if (s->debug_mode & (1 << SCIkFUNCCHK_NR)) {\
int i;\
- sciprintf("Kernel CHECK: %s[%x](", s->kernel_names[funct_nr], funct_nr); \
+ sciprintf("Kernel CHECK: %s[%x](", s->_kernelNames[funct_nr].c_str(), funct_nr); \
for (i = 0; i < argc; i++) { \
sciprintf("%04x", 0xffff & UKPV(i)); \
if (i+1 < argc) sciprintf(", "); \
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 40be8bd4a2..77d36d8a3e 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -903,8 +903,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
// static VM/Kernel information:
retval->_selectorNames = s->_selectorNames;
- retval->kernel_names_nr = s->kernel_names_nr;
- retval->kernel_names = s->kernel_names;
+ retval->_kernelNames = s->_kernelNames;
retval->kfunct_table = s->kfunct_table;
retval->kfunct_nr = s->kfunct_nr;
retval->opcodes = s->opcodes;
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index 38acb8458f..b6f09ce8bc 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -1029,25 +1029,23 @@ static int c_selectornames(EngineState * s) {
}
static int c_kernelnames(EngineState * s) {
- int knamectr;
- char **knames = vocabulary_get_knames(s->resmgr, &knamectr);
- int seeker = 0;
+ Common::StringList knames;
if (NULL == s) {
sciprintf("console.c: c_kernelnames NULL passed for parameter s\n");
return -1;
}
- if (!knames) {
+ vocabulary_get_knames(s->resmgr, knames);
+
+ if (knames.empty()) {
sciprintf("No kernel name table found!\n");
return 1;
}
sciprintf("Syscalls in numeric order:\n");
- for (seeker = 0; seeker < knamectr; seeker++)
- sciprintf("%03x: %s\n", seeker, knames[seeker]);
-
- vocabulary_free_knames(knames);
+ for (uint seeker = 0; seeker < knames.size(); seeker++)
+ sciprintf("%03x: %s\n", seeker, knames[seeker].c_str());
return 0;
}
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 8769945b8c..77285f9aca 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -1344,7 +1344,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
if (opcode == op_callk)
sciprintf(" %s[%x]", (param_value < s->kfunct_nr) ?
- ((param_value < s->kernel_names_nr) ? s->kernel_names[param_value] : "[Unknown(postulated)]")
+ ((param_value < s->_kernelNames.size()) ? s->_kernelNames[param_value].c_str() : "[Unknown(postulated)]")
: "<invalid>", param_value);
else
sciprintf(opsize ? " %02x" : " %04x", param_value);
@@ -1564,7 +1564,7 @@ static int c_backtrace(EngineState *s) {
break;
case EXEC_STACK_TYPE_KERNEL: // Kernel function
- sciprintf(" %x:[%x] k%s(", i, call->origin, s->kernel_names[-(call->selector)-42]);
+ sciprintf(" %x:[%x] k%s(", i, call->origin, s->_kernelNames[-(call->selector)-42].c_str());
break;
case EXEC_STACK_TYPE_VARSELECTOR:
@@ -2111,17 +2111,15 @@ static int c_snk(EngineState *s) {
and scan the function table to find out the index. */
callk_index = strtoul(cmd_params [0].str, &endptr, 0);
if (*endptr != '\0') {
- int i;
-
callk_index = -1;
- for (i = 0; i < s->kernel_names_nr; i++)
- if (!strcmp(cmd_params [0].str, s->kernel_names [i])) {
+ for (uint i = 0; i < s->_kernelNames.size(); i++)
+ if (cmd_params [0].str == s->_kernelNames[i]) {
callk_index = i;
break;
}
if (callk_index == -1) {
- sciprintf("Unknown kernel function '%s'\n", cmd_params [0].str);
+ sciprintf("Unknown kernel function '%s'\n", cmd_params[0].str);
return 1;
}
}
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 5fbfd44899..e87212ac3a 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -157,9 +157,6 @@ EngineState::EngineState() : _dirseeker(this) {
seg_manager = 0;
gc_countdown = 0;
- kernel_names_nr = 0;
- kernel_names = 0;
-
kfunct_table = 0;
kfunct_nr = 0;
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 2a3a6a150c..87ed8cf2d4 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -269,8 +269,7 @@ public:
int gc_countdown; /* Number of kernel calls until next gc */
Common::StringList _selectorNames;
- int kernel_names_nr; /* Number of kernel function names */
- char **kernel_names; /* List of kernel names */
+ Common::StringList _kernelNames; /* List of kernel names */
kfunct_sig_pair_t *kfunct_table; /* Table of kernel functions */
int kfunct_nr; /* Number of mapped kernel functions; may be more than
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 78b62b7524..9354ac4676 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -756,7 +756,7 @@ void script_map_selectors(EngineState *s, selector_map_t *map);
int script_map_kernel(EngineState *s);
/* Maps kernel functions
-** Parameters: (EngineState *) s: The state which the kernel_names are retrieved from
+** Parameters: (EngineState *) s: The state which the _kernelNames are retrieved from
** Returns : (void)
** This function reads from and writes to s. It is called by script_run().
*/
@@ -776,11 +776,11 @@ reg_t kalloc(EngineState *s, const char *type, int space);
** Returns : (reg_t) The handle
*/
-int has_kernel_function(EngineState *s, const char *kname);
+bool has_kernel_function(EngineState *s, const char *kname);
/* Detects whether a particular kernel function is required in the game
** Parameters: (EngineState *) s: Pointer to the EngineState to operate on
** (const char *) kname: The name of the desired kernel function
-** Returns : (int) 1 if the kernel function is listed in the kernel table,
+** Returns : (bool) 1 if the kernel function is listed in the kernel table,
** 0 otherwise
*/
diff --git a/engines/sci/scicore/vocab_debug.cpp b/engines/sci/scicore/vocab_debug.cpp
index 9f6c58db82..b918eccf47 100644
--- a/engines/sci/scicore/vocab_debug.cpp
+++ b/engines/sci/scicore/vocab_debug.cpp
@@ -393,86 +393,58 @@ void vocabulary_free_opcodes(opcode *opcodes) {
}
// Alternative kernel func names retriever. Required for KQ1/SCI (at least).
-static char **_vocabulary_get_knames0alt(int *names, Resource *r) {
- unsigned int mallocsize = 32;
- char **retval = (char **)sci_malloc(sizeof(char *) * mallocsize);
- unsigned int i = 0, index = 0;
+static void _vocabulary_get_knames0alt(const Resource *r, Common::StringList &names) {
+ uint idx = 0;
- while (index < r->size) {
- int slen = strlen((char *) r->data + index) + 1;
-
- retval[i] = (char *)sci_malloc(slen);
- memcpy(retval[i++], r->data + index, slen);
- // Wouldn't normally read this, but the cleanup code wants to free() this
-
- index += slen;
-
- if (i == mallocsize)
- retval = (char **)sci_realloc(retval, sizeof(char *) * (mallocsize <<= 1));
+ while (idx < r->size) {
+ Common::String tmp((const char *)r->data + idx);
+ names.push_back(tmp);
+ idx += tmp.size() + 1;
}
- *names = i + 1;
- retval = (char **)sci_realloc(retval, sizeof(char *) * (i + 2));
- retval[i] = (char *)sci_malloc(strlen(SCRIPT_UNKNOWN_FUNCTION_STRING) + 1);
- strcpy(retval[i], SCRIPT_UNKNOWN_FUNCTION_STRING);
// The mystery kernel function- one in each SCI0 package
-
- retval[i + 1] = NULL; // Required for cleanup
-
- return retval;
+ names.push_back(SCRIPT_UNKNOWN_FUNCTION_STRING);
}
-static char **vocabulary_get_knames0(ResourceManager *resmgr, int* names) {
- char** t;
+static void vocabulary_get_knames0(ResourceManager *resmgr, Common::StringList &names) {
int count, i, index = 2, empty_to_add = 1;
Resource *r = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_KNAMES, 0);
if (!r) { // No kernel name table found? Fall back to default table
- t = (char **)sci_malloc((SCI0_KNAMES_DEFAULT_ENTRIES_NR + 1) * sizeof(char*));
- *names = SCI0_KNAMES_DEFAULT_ENTRIES_NR - 1; // index of last element
-
+ names.resize(SCI0_KNAMES_DEFAULT_ENTRIES_NR);
for (i = 0; i < SCI0_KNAMES_DEFAULT_ENTRIES_NR; i++)
- t[i] = sci_strdup(sci0_default_knames[i]);
-
- t[SCI0_KNAMES_DEFAULT_ENTRIES_NR] = NULL; // Terminate list
-
- return t;
+ names[i] = sci0_default_knames[i];
+ return;
}
count = getInt(r->data);
- if (count > 1023)
- return _vocabulary_get_knames0alt(names, r);
+ if (count > 1023) {
+ _vocabulary_get_knames0alt(r, names);
+ return;
+ }
if (count < SCI0_KNAMES_WELL_DEFINED) {
empty_to_add = SCI0_KNAMES_WELL_DEFINED - count;
sciprintf("Less than %d kernel functions; adding %d\n", SCI0_KNAMES_WELL_DEFINED, empty_to_add);
}
- t = (char **)sci_malloc(sizeof(char*) * (count + 1 + empty_to_add));
+ names.resize(count + 1 + empty_to_add);
+
for (i = 0; i < count; i++) {
int offset = getInt(r->data + index);
int len = getInt(r->data + offset);
//fprintf(stderr,"Getting name %d of %d...\n", i, count);
index += 2;
- t[i] = (char *)sci_malloc(len + 1);
- memcpy(t[i], r->data + offset + 2, len);
- t[i][len] = '\0';
+ names[i] = Common::String((const char *)r->data + offset + 2, len);
}
for (i = 0; i < empty_to_add; i++) {
- t[count + i] = (char *)sci_malloc(strlen(SCRIPT_UNKNOWN_FUNCTION_STRING) + 1);
- strcpy(t[count + i], SCRIPT_UNKNOWN_FUNCTION_STRING);
+ names[count + i] = SCRIPT_UNKNOWN_FUNCTION_STRING;
}
-
- t[count+empty_to_add] = 0;
- *names = count + empty_to_add;
-
- return t;
}
-static char **vocabulary_get_knames1(ResourceManager *resmgr, int *count) {
- char **t = NULL;
+static void vocabulary_get_knames1(ResourceManager *resmgr, Common::StringList &names) {
// vocab.999/999.voc is notoriously unreliable in SCI1 games, and should not be used
// We hardcode the default SCI1 kernel names here (i.e. the ones inside the "special"
// 999.voc file from FreeSCI). All SCI1 games seem to be working with this change, but
@@ -480,53 +452,14 @@ static char **vocabulary_get_knames1(ResourceManager *resmgr, int *count) {
// that all SCI1 games use the same kernel vocabulary names though, so this seems to be
// a safe change. If there's any SCI1 game with different kernel vocabulary names, we can
// add special flags to it to our detector
- t = (char **)sci_malloc((SCI1_KNAMES_DEFAULT_ENTRIES_NR + 1) * sizeof(char*));
- *count = SCI1_KNAMES_DEFAULT_ENTRIES_NR;
+ names.resize(SCI1_KNAMES_DEFAULT_ENTRIES_NR);
for (int i = 0; i < SCI1_KNAMES_DEFAULT_ENTRIES_NR; i++)
- t[i] = sci_strdup(sci1_default_knames[i]);
-
- t[SCI1_KNAMES_DEFAULT_ENTRIES_NR] = NULL; // Terminate list
-
- return t;
-
-// Previous code, which used the unreliable 999.voc resource
-#if 0
- unsigned int size = 64, used = 0, pos = 0;
- Resource *r = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_KNAMES, 0);
-
- if (r == NULL) {// failed to open vocab.999 (happens with SCI1 demos)
- t = (char **)sci_malloc((SCI1_KNAMES_DEFAULT_ENTRIES_NR + 1) * sizeof(char*));
- *count = SCI1_KNAMES_DEFAULT_ENTRIES_NR - 1; // index of last element
-
- for (int i = 0; i < SCI1_KNAMES_DEFAULT_ENTRIES_NR; i++)
- t[i] = sci_strdup(sci1_default_knames[i]);
-
- t[SCI1_KNAMES_DEFAULT_ENTRIES_NR] = NULL; // Terminate list
-
- return t;
- }
- while (pos < r->size) {
- int len;
- if ((used == size - 1) || (!t)) {
- size *= 2;
- t = (char **)sci_realloc(t, size * sizeof(char*));
- }
- len = strlen((char *)r->data + pos);
- t[used] = (char *)sci_malloc(len + 1);
- strcpy(t[used], (char *)r->data + pos);
- used++;
- pos += len + 1;
- }
- *count = used;
- t = (char **)sci_realloc(t, (used + 1) * sizeof(char*));
- t[used] = NULL;
-
- return t;
-#endif
+ names[i] = sci1_default_knames[i];
}
+
//
-static char **vocabulary_get_knames11(ResourceManager *resmgr, int *count) {
+static void vocabulary_get_knames11(ResourceManager *resmgr, Common::StringList &names) {
/*
999.voc format for SCI1.1 games:
[b] # of kernel functions
@@ -536,33 +469,29 @@ static char **vocabulary_get_knames11(ResourceManager *resmgr, int *count) {
{[w name-len][function name]}
...
*/
- char **t = NULL;
//unsigned int size = 64, pos = 3;
int len;
Resource *r = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_KNAMES, 0);
if(r == NULL) // failed to open vocab.999 (happens with SCI1 demos)
- return 0; // FIXME: should return a default table for this engine
- byte nCnt = *r->data, i;
- t = (char **)sci_malloc(nCnt * sizeof(char*) + 1);
+ return; // FIXME: should return a default table for this engine
+ const byte nCnt = *r->data;
- for (i = 0; i < nCnt; i++) {
+ names.resize(nCnt);
+ for (int i = 0; i < nCnt; i++) {
int off = READ_LE_UINT16(r->data + 2 * i + 2);
len = READ_LE_UINT16(r->data + off);
- t[i] = (char *)sci_malloc(len + 1);
- memcpy(t[i], (char *)r->data + off + 2, len);
- t[i][len] = 0;
+ names[i] = Common::String((char *)r->data + off + 2, len);
}
- *count = nCnt;
- t[nCnt] = NULL;
-
- return t;
}
-char **vocabulary_get_knames(ResourceManager *resmgr, int *count) {
+void vocabulary_get_knames(ResourceManager *resmgr, Common::StringList &names) {
+ names.clear();
+
switch (resmgr->_sciVersion) {
case SCI_VERSION_0:
case SCI_VERSION_01:
- return vocabulary_get_knames0(resmgr, count);
+ vocabulary_get_knames0(resmgr, names);
+ break;
case SCI_VERSION_01_VGA:
case SCI_VERSION_01_VGA_ODD:
// HACK: KQ5 needs the SCI1 default vocabulary names to work correctly.
@@ -572,27 +501,19 @@ char **vocabulary_get_knames(ResourceManager *resmgr, int *count) {
// return vocabulary_get_knames0(resmgr, count);
case SCI_VERSION_1_EARLY:
case SCI_VERSION_1_LATE:
- return vocabulary_get_knames1(resmgr, count);
+ vocabulary_get_knames1(resmgr, names);
+ break;
case SCI_VERSION_1_1:
- return vocabulary_get_knames11(resmgr, count);
+ vocabulary_get_knames11(resmgr, names);
+ break;
#ifdef ENABLE_SCI32
case SCI_VERSION_32:
- return vocabulary_get_knames11(resmgr, count);
+ vocabulary_get_knames11(resmgr, names);
#endif
+ break;
default:
- return 0;
+ break;
}
}
-void vocabulary_free_knames(char **names) {
- int i = 0;
-
- while (names[i]) {
- free(names[i]);
- i++;
- }
-
- free(names);
-}
-
} // End of namespace Sci
diff --git a/engines/sci/scicore/vocabulary.h b/engines/sci/scicore/vocabulary.h
index e3185d71e5..9a073d2e79 100644
--- a/engines/sci/scicore/vocabulary.h
+++ b/engines/sci/scicore/vocabulary.h
@@ -211,15 +211,14 @@ void vocabulary_free_opcodes(opcode *opcodes);
*/
/**
- * Returns a null terminated array of kernel function names.
+ * Fills a StringList with kernel function names.
*
* This function reads the kernel function name table from resource_map,
- * and returns a null terminated array of deep copies of them.
- * The returned array has the same format regardless of the format of the
+ * and fills the given StringList with them.
+ * The resulting list has the same format regardless of the format of the
* name table of the resource (the format changed between version 0 and 1).
*/
-char **vocabulary_get_knames(ResourceManager *resmgr, int* count);
-void vocabulary_free_knames(char** names);
+void vocabulary_get_knames(ResourceManager *resmgr, Common::StringList &names);
/**