aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/glulxe
diff options
context:
space:
mode:
authorPaul Gilbert2019-04-28 15:27:52 +1000
committerPaul Gilbert2019-04-28 15:27:52 +1000
commit5196ae1cd49b879f0497c5ad863dfa6dfebe61c7 (patch)
tree2a5f5a0947f30f7afb594a5c8f549ca36db8cb1b /engines/glk/glulxe
parent70febd034a6ff16c2945c52198386729a75a68e2 (diff)
downloadscummvm-rg350-5196ae1cd49b879f0497c5ad863dfa6dfebe61c7.tar.gz
scummvm-rg350-5196ae1cd49b879f0497c5ad863dfa6dfebe61c7.tar.bz2
scummvm-rg350-5196ae1cd49b879f0497c5ad863dfa6dfebe61c7.zip
GLK: GLULXE: init_dispatch wasn't being called
Diffstat (limited to 'engines/glk/glulxe')
-rw-r--r--engines/glk/glulxe/glkop.cpp5
-rw-r--r--engines/glk/glulxe/glulxe.cpp39
-rw-r--r--engines/glk/glulxe/glulxe.h2
3 files changed, 23 insertions, 23 deletions
diff --git a/engines/glk/glulxe/glkop.cpp b/engines/glk/glulxe/glkop.cpp
index 2595a870b1..68e60c7bec 100644
--- a/engines/glk/glulxe/glkop.cpp
+++ b/engines/glk/glulxe/glkop.cpp
@@ -91,11 +91,6 @@ void Glulxe::glkopInit() {
bool Glulxe::init_dispatch() {
int ix;
- /* What with one thing and another, this *could* be called more than
- once. We only need to allocate the tables once. */
- if (classes)
- return true;
-
/* Set up the game-ID hook. (This is ifdeffed because not all Glk
libraries have this call.) */
#ifdef GI_DISPA_GAME_ID_AVAILABLE
diff --git a/engines/glk/glulxe/glulxe.cpp b/engines/glk/glulxe/glulxe.cpp
index 617bcb08c8..5251b30d46 100644
--- a/engines/glk/glulxe/glulxe.cpp
+++ b/engines/glk/glulxe/glulxe.cpp
@@ -30,24 +30,26 @@ namespace Glulxe {
Glulxe *g_vm;
Glulxe::Glulxe(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc), _random("glulxe"),
- vm_exited_cleanly(false), gamefile_start(0), gamefile_len(0), memmap(nullptr), stack(nullptr),
- ramstart(0), endgamefile(0), origendmem(0), stacksize(0), startfuncaddr(0), checksum(0),
- stackptr(0), frameptr(0), pc(0), prevpc(0), origstringtable(0), stringtable(0), valstackbase(0),
- localsbase(0), endmem(0), protectstart(0), protectend(0),
- stream_char_handler(nullptr), stream_unichar_handler(nullptr),
- // main
- library_autorestore_hook(nullptr),
- // accel
- classes_table(0), indiv_prop_start(0), class_metaclass(0), object_metaclass(0),
- routine_metaclass(0), string_metaclass(0), self(0), num_attr_bytes(0), cpv__start(0),
- accelentries(nullptr),
- // heap
- heap_start(0), alloc_count(0), heap_head(nullptr), heap_tail(nullptr),
- // serial
- max_undo_level(8), undo_chain_size(0), undo_chain_num(0), undo_chain(nullptr), ramcache(nullptr),
- // string
- iosys_mode(0), iosys_rock(0), tablecache_valid(false), glkio_unichar_han_ptr(nullptr) {
+ vm_exited_cleanly(false), gamefile_start(0), gamefile_len(0), memmap(nullptr), stack(nullptr),
+ ramstart(0), endgamefile(0), origendmem(0), stacksize(0), startfuncaddr(0), checksum(0),
+ stackptr(0), frameptr(0), pc(0), prevpc(0), origstringtable(0), stringtable(0), valstackbase(0),
+ localsbase(0), endmem(0), protectstart(0), protectend(0),
+ stream_char_handler(nullptr), stream_unichar_handler(nullptr),
+ // main
+ library_autorestore_hook(nullptr),
+ // accel
+ classes_table(0), indiv_prop_start(0), class_metaclass(0), object_metaclass(0),
+ routine_metaclass(0), string_metaclass(0), self(0), num_attr_bytes(0), cpv__start(0),
+ accelentries(nullptr),
+ // heap
+ heap_start(0), alloc_count(0), heap_head(nullptr), heap_tail(nullptr),
+ // serial
+ max_undo_level(8), undo_chain_size(0), undo_chain_num(0), undo_chain(nullptr), ramcache(nullptr),
+ // string
+ iosys_mode(0), iosys_rock(0), tablecache_valid(false), glkio_unichar_han_ptr(nullptr) {
g_vm = this;
+
+ glkopInit();
}
void Glulxe::runGame() {
@@ -55,6 +57,9 @@ void Glulxe::runGame() {
return;
setup_vm();
+ if (!init_dispatch())
+ return;
+
if (library_autorestore_hook)
library_autorestore_hook();
diff --git a/engines/glk/glulxe/glulxe.h b/engines/glk/glulxe/glulxe.h
index cdb3735bb7..b5f13dc492 100644
--- a/engines/glk/glulxe/glulxe.h
+++ b/engines/glk/glulxe/glulxe.h
@@ -719,7 +719,7 @@ public:
_random.setSeed(seed);
}
inline uint glulx_random() {
- return _random.getRandomNumber(0xffffffff);
+ return _random.getRandomNumber(0xfffffff);
}
void glulx_sort(void *addr, int count, int size, int(*comparefunc)(const void *p1, const void *p2));