diff options
author | Paul Gilbert | 2019-04-14 18:43:30 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-04-17 20:46:06 -0700 |
commit | 8e11a14939365c3a2994602b5db11a4fe6e8eaac (patch) | |
tree | a0bc1be59cf578317f3a0bd0d809d1b194388a2f /engines/glk/glk_dispa.cpp | |
parent | e271cdc6534763f4472c3ff70c22292268300814 (diff) | |
download | scummvm-rg350-8e11a14939365c3a2994602b5db11a4fe6e8eaac.tar.gz scummvm-rg350-8e11a14939365c3a2994602b5db11a4fe6e8eaac.tar.bz2 scummvm-rg350-8e11a14939365c3a2994602b5db11a4fe6e8eaac.zip |
GLK: GLULXE: Set up method definitions, glkop methods
Diffstat (limited to 'engines/glk/glk_dispa.cpp')
-rw-r--r-- | engines/glk/glk_dispa.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/engines/glk/glk_dispa.cpp b/engines/glk/glk_dispa.cpp index 38b03e5b42..dfb638fa0a 100644 --- a/engines/glk/glk_dispa.cpp +++ b/engines/glk/glk_dispa.cpp @@ -335,6 +335,46 @@ static gidispatch_function_t function_table[] = { #endif /* GLK_MODULE_GARGLKTEXT */ }; +void GlkAPI::gidispatch_set_object_registry(gidispatch_rock_t(*regi)(void *obj, uint objclass), + void(*unregi)(void *obj, uint objclass, gidispatch_rock_t objrock)) { + Window *win; + Stream *str; + frefid_t fref; + + gli_register_obj = regi; + gli_unregister_obj = unregi; + + if (gli_register_obj) + { + /* It's now necessary to go through all existing objects, and register + them. */ + for (win = glk_window_iterate(NULL, NULL); + win; + win = glk_window_iterate(win, NULL)) + { + win->_dispRock = (*gli_register_obj)(win, gidisp_Class_Window); + } + for (str = glk_stream_iterate(NULL, NULL); + str; + str = glk_stream_iterate(str, NULL)) + { + str->_dispRock = (*gli_register_obj)(str, gidisp_Class_Stream); + } + for (fref = glk_fileref_iterate(NULL, NULL); + fref; + fref = glk_fileref_iterate(fref, NULL)) + { + fref->_dispRock = (*gli_register_obj)(fref, gidisp_Class_Fileref); + } + } +} + +void GlkAPI::gidispatch_set_retained_registry(gidispatch_rock_t(*regi)(void *array, uint len, char *typecode), + void(*unregi)(void *array, uint len, char *typecode, gidispatch_rock_t objrock)) { + gli_register_arr = regi; + gli_unregister_arr = unregi; +} + uint32 GlkAPI::gidispatch_count_classes() const { return NUMCLASSES; } @@ -1491,4 +1531,22 @@ void GlkAPI::gidispatch_call(uint32 funcnum, uint32 numargs, gluniversal_t *argl } } +gidispatch_rock_t GlkAPI::gidispatch_get_objrock(void *obj, uint objclass) { + switch (objclass) { + case gidisp_Class_Window: + return ((Window *)obj)->_dispRock; + case gidisp_Class_Stream: + return ((Stream *)obj)->_dispRock; + case gidisp_Class_Fileref: + return ((FileReference *)obj)->_dispRock; + case gidisp_Class_Schannel: + return ((SoundChannel *)obj)->_dispRock; + default: { + gidispatch_rock_t dummy; + dummy.num = 0; + return dummy; + } + } +} + } // End of namespace Glk |