investigate tic80

investigate tic80

task id: investigate-tic80

2024-06-27 08:05: How easy is it to build tic-80? #investigate-tic80 #timelog:00:30:26

Source <<gamedev/tic80/github>>.

Starting on my Mac. Looks like pretty typical CMake stuff.

Seems to work! now off to try Linux.

Going to try the vanilla CMake TIC80 instructions first. I don't expect it'll work and I'll need to install packages.

Holy crap, the CMake script ran without any issues. That's surprising.

Running into Makefile errors. Turning off -j flags.

"RAKE-NOTFOUND: not found": is this a ruby thing? It sounds like a ruby thing. Installed ruby-rake and mruby and then re-ran cmake. The build is moving forward.

TIC-80 seems to include most dependencies in the source directory. This probably makes the thing a bit more portable. Reminds me of how I think.

Wow! It built. It looks like there may be support for JACK via pipewire. I've never actually looked into pipewire, but if there's a way to use it with my existing JACK applications, that would be great.

Oh crap. Alpine just permanently removed jackd when I installed pipewire-jack.

Pipewire-jack research is going to be half a day of research. Going to hold off for now. Fortunately, I managed to re-install old jack.

If there is pipewire support for JACK that works with TIC-80, I'd probably want to use that to get sound working on my Linux box. Further reading <<audio/pipewire_docs>>.

2024-06-28 07:28: Get Sokol example working on new laptop #investigate-tic80

Precursor to getting tic-80 working. Oh wow that was easy. Little did I know I was 30 seconds away from getting this working last night.

2024-06-28 07:30: Back to tic-80 compilation on new laptop #investigate-tic80

Now that sokol example works, I think I figured out all the graphics issues

2024-06-28 07:36: TIC-80 builds, runs tetris, no sound yet #investigate-tic80

2024-06-28 07:47: Sound works. Studying music demo. #investigate-tic80

I like the scale and form factor of this.

2024-06-28 08:08: trying to see where export is hanging #investigate-tic80

2024-06-28 08:12: tried running in gdb and gdb crashed. musl issues? #investigate-tic80

2024-06-28 08:44: tic80 export works on mac #investigate-tic80

The bundle includes the tic80 card and a wasm file. I have no idea where the wasm comes from. It's not a file included in the source, and there doesn't seem to be any clear indication where/how it is being generated. My best guess is that somewhere it gets made with emscripten because I see mentions of it when I grep for wasm-y things.

2024-06-28 13:34: Troubleshooting tic80 export on thinkpad #investigate-tic80 #timelog:00:44:37

2024-06-28 13:42: onExportHTML call seems to return hmmm #investigate-tic80

printf-ing to console works, even if gdb crashes

2024-06-28 13:45: =tic_net_get()=: that doesn't sound great #investigate-tic80

Sounds like it might be trying to download something from the internet? Yeah, that could be a problem here.

2024-06-28 13:51: =tic_net_get()= might not be getting called #investigate-tic80

Firslty, the printf I placed there isn't showing up. Secondly, it makes a call to empscripten_fetch, which I do not (think I) have.

Maybe it is defined elsewhere?

Ah, there are multiple definitions here. Wonder which one is the actual one.

2024-06-28 13:57: =tic_net_get()= is an empty function. #investigate-tic80

The tic cart loaders are pre-compiled wasm files. The path is /export/1.2-dev/html.

2024-06-28 14:08: The tic cart loader, as far as I can tell, is closed source. #investigate-tic80

Basically, HTML export works by fetching from a URL. This downloads a zipfile that already has the wasm in there. Exporting is simply a matter of dropping that TIC file in the in the zip file.

2024-06-28 14:11: Options moving forward #investigate-tic80

So, it's looking like doing any kind of hacking on this would be a fairly ambitious task that would take up most of my time. It looks like this wasm file is the only thing I have. What I'd like to do is to somehow patch it, potentially. And get it to load in custom code for audio playback.

It's not a no, though it would dramatically change what it is I came here to do. Instead of doing funny vocal synth stuff, I'd be going deep into trying to reverse engineer this thing. Feels very much in the spirit of RC. And this is more motivating to me than more frontend-y stuff. There may be less polished things to show, though.

2024-06-28 14:45: thoughts on reverse engineering tic80 #investigate-tic80

Using this to make any sense of tic80 feels like something that would take me maybe months to a year to do maybe. Hacking the tic80 source code itself would take less time. I'd probably have better luck building my own cartridge loader.

I think if I wanted to go deep on wasm rather than frontend stacks, I'd definitely want to look into this. This stuff sparks joy more than javascript/React.

2024-06-28 14:46: how is a tic cart saved? #investigate-tic80 #timelog:00:22:00

I am pretty sure it's lua5.3, based on grepping for version for the built in luajit.

Functions defined in cart.c. Looking at music.tic, the code for the seems to be at the very bottom.