intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Aug 18, 2018 10:58 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Oct 27, 2016 7:56 am 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 406
Location: USA
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." viewtopic.php?f=10&t=8111

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: https://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: https://github.com/retrobits/son_of_hun ... Android.mk - what needs to be done?

Help welcome!

_________________
Thunderword not forgotten, will pick back up 2nd half of 2018.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Oct 27, 2016 10:10 am 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 406
Location: USA
some slight progress to report. I was able to compile the NDK code for GLK_MODULE_UNICODE_NORM functions by adding ../garglk/cgunicod.c as a source to the andglk/Android.mk make file.

_________________
Thunderword not forgotten, will pick back up 2nd half of 2018.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Oct 27, 2016 4:53 pm 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 406
Location: USA
Slightly more progress. Using the Gargoyle cgstream.c as a reference, I am now able to get the C code to compile with GLK_MODULE_UNICODE enabled. It's not working (like Twisty app does), still more work to do. Latest is at: https://github.com/BroadcastGames/son_o ... arglk_try0

_________________
Thunderword not forgotten, will pick back up 2nd half of 2018.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 28, 2016 11:06 am 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 406
Location: USA
Some true progress! I took 30 or so lines of code from Twisty, mostly in how it buffers the output characters into a Java string from C code, and now I have working Unicode output!

Screen shot of Son of Hunky Punk, it now displays and behaves just like the Git interpreter built into the Inform 7 IDE when it comes to Unicode output. Screen shot from a real Android 7.0 mobile phone: http://i.imgur.com/Dktd3EB.png -- for reference, here is the Inform 7 source code that was compiled to Glulx to produce that output: https://raw.githubusercontent.com/Broad ... preterA.ni

The code needs cleaned up and organized, but I now know how Twisty 2.0 app was able to get the Unicode data out of the Glulx into Android's screen's! Hacky mess here: https://github.com/BroadcastGames/son_o ... f5c68b3bae

_________________
Thunderword not forgotten, will pick back up 2nd half of 2018.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 28, 2016 6:21 pm 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 406
Location: USA
If someone wants to try out the APK on their Android phone or Tablet, here it is: https://github.com/BroadcastGames/son_o ... code_demo0

_________________
Thunderword not forgotten, will pick back up 2nd half of 2018.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Oct 31, 2016 6:06 am 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 406
Location: USA
I made a new release of the APK if anyone wants to try it out. https://github.com/BroadcastGames/son_o ... code_demo1

_________________
Thunderword not forgotten, will pick back up 2nd half of 2018.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun May 06, 2018 4:49 am 
Offline

Joined: Sun May 06, 2018 4:36 am
Posts: 1
looks great,

However, i cant operate it as needed with any voice keyboard I've tried. When i say the ENTER command ("enter", "return", "new line", "full stop", "new paragraph"), sohp simply does a carriage return and awaits further input on a new line rather than the input being accepted. The app seems to require a soft keypress or hardware keypress of an enter key.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group