Hi,
Is anyone familiar with the source code for tads2 ?
I’ve been wanting to play interactive fiction on mobile devices for a while, and noticed that many devices really run linux underneath and almost all of them support the linux framebuffer. So I finally broke down and rooted my sony PRS900, down to native Linux, wrote a morse code keyboard for it along with a VT52 terminal emulator for e-ink displays so I could play all things UNIX terminal oriented: eg: run frotz and frob on it for z-machine and tads interactive fiction games respectively.
source code for linux frob is here: tads.org/frobtads.htm
My programs work!!! and at very decent speeds!!! (It’s a 250MHz processor, with native C compiled files) and I’m getting fast enough at morse code to be contented. (It takes about a week of practice to get proficient at it and to learn gnu readline shortcuts…)
However, I’m a perfectionist and want to go further – I would love to at least be able to see the illustrations that come with some games like “escape from the crazy place”… It’s part of the fun; There’s no QT or X11 on the Sony, and they’re too big and difficult to install. So , sadly I cant run QTADS.
But: If I could just get the resource files for the images to extract from the tads2 game files, at the appropriate time, I could easily modify the VT52 terminal to display those images; but I got stuck:
I figured out this much, in the source code: frobtads-1.2.3/tads2/output.c – the HTML code is parsed and stripped when being passed to the unix terminal; and I can add a few lines of source code to make it tell me the url of multimedia resources when they would normally be used: eg: (add this to ~line 2192)
else if (!stricmp(attrname, "src")
&& !stream->html_in_ignore
&& stream->html_allow_alt)
{
outstring_stream(stream, "(<" );
/* Write out the image URL */
outstring_stream(stream, attrval );
outstring_stream(stream,">)" );
}
So, when playing escape from the crazy place, in the middle of the text, where the image should have been displayed – it will print (<Pics/Donald.jpg>) which says that the picture has a file name of Pics/Donald.jpg , and it is embedded inside the Escape.gam file somewhere. Therefore, if instead of printing the name – I could write a short bit of code to extract the resource to a temporary file, or at least run a C progarm on it inside “output.c”, I could easily send a binay bimap image escape sequence and have my VT52 terminal emulator print the picture on the linux framebuffer; or I could play .wav soundfiles, etc.
This should be very easy to do – but I’m just not familiar enough with the code/coding style to figure out how to do it:
There is supposed to be a function called osfiledef* (*find_resource)( *appctxdat, *resname, renamelen, ulong *res_size ) which is supposed to open resources that the interpreter has opened, and seek out the place in the resource file where a particular image or sound is stored.
However, as you can see – it’s defined as a dynamic function – and I can’t find any source code or initialization of that dynamic function, and I don’t see a single example of it in use in the source code…
Can anyone point me to a working example of it?
Or does anyone know of source code which is capable of extracting resources given the name of the resource?