Wednesday 29 May 2013

Adventures In Graphics (and the search for *useful* emulators)

With the EA checksum skipped, and my first text edits visible in game, I ploughed on. The ROM header has been updated to play on all regions, and every reference to MU (the currency of Starflight) has been rewritten as CR (credits) - much more "Mass Effect" than MU. I've made a few notes as to which races I intend to transform into their ME equivalents, but that's a different post altogether. I haven't properly looked at the date issue yet, so everything is still showing as the year 4620. I've thought about that, but can't even settle on a date to set this in any more... Starflight spans 41 years, which is longer than the gap between the Human-Turian first contact war & the Reaper invasion in the Mass Effect universe, so no time entirely makes sense. But again, that's an issue for another post.

With text-edits going fine, I thought it was time to jump right into doing the first few aesthetic changes, and this is where my troubles became apparent.

This is the main title screen from the game. The changes planned seemed small - remove/change the "licensed by..." text, and replace the STARFLIGHT banner with a low res reproduction of the Mass Effect logo. Seeing as how the "licensed by..." text was in the same font used throughout the game, I thought a simple text edit in my hex editor would be able to remove it - just blank it out with spaces, or replace with "Unlicensed hack by Category, commiserations to EA, BioWare & Binary Systems". But unfortunately, no such text appears in the ROM, at least not in the same easy to change form as the rest of the game's text. Fair enough I thought, maybe the game stores the entire title screen as just a set of tiles. Thinking along this line of thought, I fired up Tile Layer Pro in Wine, and started looking for it. Mixed results.

I found the tiles for the font (I probably won't change it, but good to know I now could), but nothing so obviously laid out as the title screen. Obviously the code references the same font tile locations differently to text in the rest of the game, so once again a more in depth look into the code will be necessary. Luckily, the main title banner was stored right above it in the ROM!  What great luck!

I spent a few minutes trying to reconstruct the banner from the tiles, and noticed two problems almost immediately.
  1. The tiles aren't just laid down for the logo - some of them are reused within it, making the plan of just "importing" some Mass Effect logo from a DVD case spine impossible; and
  2. The colours are not even slightly right
The solution to 1 is not-so-obvious, but will be solvable when I work out the title screen "licensed by..." placement (as I imagine it is all referenced in the same area of the ROM. I prepare to be disappointed). The solution to 2 was very obvious however, but has confounded me for more time than I care to admit (mostly due to my Linux fanboyism - but hey, acceptance is part of the cure!)

I had overlooked the way the Mega Drive actually deals with graphics, by having sprites and palettes as separate entities. I've read the basics of the technical docs for the Mega Drive, and am aware that palette data is stored as RGB values in CRAM. If I can get a dump of the CRAM whilst the title screen is displayed then I can make Tile Layer Pro show the tiles correctly! Converting the hex CRAM dump into a TLP friendly format (or worst case scenario, converting by hand and inputting into TLP by hand) may be time consuming, but will make editing the tiles more obvious.

Getting a dump of the CRAM would also help towards my many many other investigative issues... What I needed was an emulator with debugging features. Being a Linux user bit me right in the ass here. There are some good native emulators for Linux, but none with the features I needed. Gens/GS plays nicely, but has no RAM/CRAM/breakpoints - any of the features I needed to continue. Same story for Kega Fusion - good to play on, but none of the features I really needed. But I have found the following:-
  • DebuGens is a mod of the original Gens, with handy dumping features - even direct TLP palette files from scenes! Seems useful, but under Wine, it crashes out whenever a ROM is loaded, which I put down to being quite low-level code, not just Win32 API calls.
  • GensKMod is another mod of Gens, with even more debugging features - but the same issues of the code base, and crashes exactly like DebuGens.
  • Exodus is a new emulator just released, which seems the best of the crop. Many features, and cycle-accurate emulation, it seemed to be the saviour. But this program is 64-bit Windows only, and Wine 64bit support just plain sucks. I compiled my on wine to run it, but it was buggy, and the wine64 install broke all other windows programs I was running, and that is just unacceptable.
This has left me with two options, which I will just have to suck up and go through with to progress on this project. My laptop has a valid Windows 7 license, and it is time to either dual boot or run a VM of Windows. The Linux acolyte in me feels tainted, but needs must...

...for now, at least. Exodus appears to be going open source soon, which is great news. A native Linux port would save all my issues. But for now, time to spin up a VM.

Until next time... Category


If anybody has any insight into my issues, or ideas in general, feel free to leave a comment.

No comments:

Post a Comment