Patching Oni for my PowerBook G4
I've been wanting to check out Oni for Mac OS 9, but I have a PowerBook G4 Titanium, which has a "super widescreen" display. This documents my journey to patching it for my purposes!
Oni Mac is big-endian (thanks to PowerPC), unlike Oni for Windows/x86, which is little-endian.
This means all the patches for Oni online are, largely, Windows-specific!
Documentation for persist.dat
available on wiki.oni2.net
gets mixed up by this difference, listing the bytes at 0x4e
as 02 58
when on Windows they are in the order 58 02
(you can see this in the screenshot included above the table!)
There's a common set of patches out there for Oni for Windows, most obviously on wsgf.org
targeting various widescreen resolutions, but these patches appear to only work for the Windows version, probably for the same reason!
Therefore, I am attempting to reverse engineer how the patches work, and make them work on the, admittedly outmoded Mac OS 9 version of Oni.
First things first, I'm using the notes already prepared about the persist.dat
file to my advantage; firing up HexEdit I can see that it matches the notes I've been given; the resolution information begins at offset 0x4c
.
0x4c
is auint16
of the screen width0x4e
is auint16
of the screen height0x50
is auint16
of the screen colour depth (16 (00 10
) or 32 (00 20
))0x52
is auint16
of apparently-unused padding
For example, with the game configured for 800 by 600 and 32 bits per pixel, this area reads 03 20 02 58 00 20 00 00
. A note for the future: the Oni executable has a match for that stanza at offset 0x14fda4
!
So, basically, it seems like we want to replace that area of the persist.dat file with something matching our screen's native resolution, this PowerBook G4 Titanium has a native resolution of 1280 by 854, meaning our desired stanza would be 05 00 03 56 00 20 00 00
. A note for the future: the Oni executable does not contain this stanza!
Putting that value in place and firing up Oni we can see... that it didn't like that! It started up in 640 by 480 at 16 bits per pixel, which isn't what we asked for at all! Now, it doesn't modify the persist.dat to do that, but let's take a peek at what that would be, which turns out to be 02 80 01 e0 00 10 00 00
. Checks out, that's what we would expect! One more note for later (as later is fast approaching): this stanza appears in the Oni executable at offset 0x14fd6c
.
So, my clever solution didn't work; the Oni executable is not happy to start up in a resolution it doesn't already know about, so what can we do? Well, as we know, there are ways to patch the executable to change the resolutions it handles. We also know from the notes above, that the resolutions we've been able to choose and read out of persist.dat
appear in the executable, and we can see some patterns show up.
First up, we can be fairly confident that 640 by 480 at 16 bits per pixel is probably the lowest resolution it supports. We can also see the telltale 03 20 02 58
indicating 800 by 600 directly after the 640 by 480 resolution we identified at offset 0x14fd6c
, but this one is 16 bits per channel, matching 640 by 480, so this indicates to us that we've found the fabled resolution table, and we can guess that the format is consistently just the 8 bytes we've identified as being saved in persist.dat
, with no padding in between.
Looking down the resolution table, we can see some fairly standard resolutions at 16 bits; 640 by 480 and 800 by 600 we've seen, but there's also 1024 by 768 (04 00 03 00
), 1152 by 864 (04 80 03 60
), 1600 by 1200 (06 40 04 b0
) and our good friend 1920 by 1080 (07 80 04 38
). After Full HD, we see each resolution repeat in 32-bit mode, right up to Full HD.
Cool! I'm kind of surprised that widescreen 1080p made it in there circa 2000, but there you go!
Of these, I think 1600 by 1200 and 1152 by 864 are the least useful or interesting resolutions. 1080p is definitely the hard cap of the output I can do on this computer, and I do have the ability to use it on a 1080p display, so that's cool, but I don't own anything which is natively 1600 by 1200 or 1152 by 864! That being the case, let's patch Oni to replace these resolutions with some that are more interesting to us, and see what happens.
I'm going to turn 1152 by 864 into 720p, and 1600 by 1200 into the laptop's native 1280 by 854. How do I do that? Well, I will patch offsets 0x1fd84
and 0x1fdb4
to replace 04 80 03 60
with 05 00 02 d0
, and then offsets 0x1fd8c
and 0x1fdbc
to replace 06 40 04 b0
with 05 00 03 56
. I made a backup, but so did my hex editor. Let's see what happens!
Goodness me, if we open the settings menu we now see our 1280 by 854 resolution! Hooray! 720p doesn’t seem to be an option for the built-in display, but maybe we’ll see if it works on external monitors later.
So, seeking to share the love, I went looking for a patch utility. The only thing I found for Mac OS 9 which could create IPS patches was Knuxbine, a utility mostly for manipulating Sega Mega Drive ROMs to use the lock-on technology of Sonic & Knuckles. Weird, but it works! I uploaded a copy of it to Macintosh Garden just to be sure.
And that’s how I patched an extremely outdated version of Oni to work with the native resolution of my obsolete PowerBook G4 running an extremely outdated operating system! Enjoy! 💜
Files
Get PowerBook G4 Titanium resolution hack for Oni
PowerBook G4 Titanium resolution hack for Oni
Patch to allow playing Oni at the PowerBook G4 Titanium’s native resolution on Mac OS 9