Holdem is finally running, woot!
Backed up from a local Blogger export (5792651307365165109/5792651307365165109.html) on 2026-01-01.
And it looks amazing! For the record Dragonfly by Lemon D was the song that was playing when the app actually started up and ran and the time is 3am. I have been pursuing this goal of having this game engine run on a symbian smart phone for some time now. I finally tracked down the finaly serious problem pretty much by accident.
The line that was crashing first was:
if(path.compare(rec->name, rec->namelen))
This looks totally innocent.. I’ll just say right away that it wasn’t any of the usual suspects. Keep in mind that this ran fine on other hardware architectures. The problem was actually memory alignment.
The records that are being referenced here are part of a block of index records stored in the resource file. I have a tool that transforms and packs files into a single file and creates one block of memory to be used as a searchable index. The structure in memory used to look like this:
struct RecordRef { uint32 offset; uint16 nextrec; uint16 namelen; // char name[namelen + 1] };
If I tried to access offset or nextrec and the field didn’t lay on a 4 or 2 byte boundary respectively my application would crash. This kind of problems are pretty hard to track down without a debugger. I used loglines traced to a text file on the phones internal memory through multiple builds to track this down.
The new structure looks like this:
struct RecordRef { uint32 offset; uint16 nextrec; uint16 namelen; uint16 padding; uint16 reserved; // char name[namelen + 1] };
I calculate the padding when the records are built in memory and before they are stored into the resource file. When they load from the file they are all nicely aligned and the code that searches the index just has to take into account padding when doing any pointer/index math.
Seeing the title screen on my phone makes me very happy!