With the goal of getting Git Glulx interpreter working on Android, I’m hacking on the code and hoping to draw attention from C developers who can help out. Be warned: I’m pretty weak on C programming, but this project is teaching me the nasty issues of all the ways a 64-bit long can go from C to Java.
C code - based off Gargoyle - Garglk
From what I have been able to put together from forum comments, support issues, and source code… the basic design of Son of Hunky Punk is to use function and data structures of Garglk when possible. Notable is this comment from retrobits on this very forum from 3 years ago: “I’ve recently began a new direction for Hunky Punk. Instead of building a new Android Glk implementation in Java (as the original author was doing), I plan to re-use most of the back-end C code from Gargoyle/garglk by interfacing with the Java UI elements of Android. I believe this will enable Hunky Punk to more easily stay up to date with the modern interpreters.” https://intfiction.org/t/tads-for-android/5462/1
The current need
I have upgraded Git interpreter to the latest 1.3.4 and solved a serious crash problem related to that upgrade. So what is next?
- Unicode support. Right now the C functions for Unicode via Glk are not implemented and garbled output ends up on the screen.
- Glulx windows. The basic windowing features of Glulx do not work. For example, Inform 7 code that uses “Flexible Windows by Jon Ingold” won’t work on Hunky Punk.
- JPG/PNG graphic image display
- many more smaller features and optional features such as sound
I consider Unicode the most important and first task to tackle, I need it for my current project, and Twisty for Android on Github already has working Unicode using the Git 1.3.4 interpreter. This is useful as a C to Java reference. However, it does not base itself off Gargoyle and has a very different C to Java interface setup. This branch of Twisty is now converted to Android Studio 2.2.2 and has the updated Git 1.3.4 interpreter: github.com/BroadcastGames/twist … _fleshout0
What to do in C, what to do in Java for Son of Hunkypunk
I’d like to try and keep things as much as possible in C, but I’m not really understanding the C code. I checked out the latest Gargoyle and cross-referenced some of the current files. From what I have been able to figure out so far:
- functions that start with glk_ are the API wrappers, often stub functions. functions that start with gli_ are implementation?
- garglk.h is mostly unmodified from Gargoyle’s current code. Sometimes ‘const’ is added to function parameters - as in the function gli_new_fileref - is this required for jaava?
- I’m a bit lost why some functions like glk_stream_iterate return “stride_t” vs “stream_t” types and why these changes were made from Gargoyle when going to Android? Maybe this is a newer change in Gargoyle’s code since it was integrated?
- A lot of the desired Unicode functions hit by #define GLK_MODULE_UNICODE are in Gargoyle’s source code file cgstream.c - for example, the function glk_put_string_uni. Attempts to simply add this file have proven fruitless. That file is built, you can see it in the make file: github.com/retrobits/son_of_hun … Android.mk - what needs to be done?