News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Wonderswan ROM Hacking in 2020  (Read 328 times)

Variant

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Wonderswan ROM Hacking in 2020
« on: September 14, 2020, 07:35:29 am »
I've had an interest in creating a fan translation for Medarot Perfect Edition on the Wonderswan for a while, but quite frankly I'm having a hard time finding a central source for information/tools on the Wonderswan.

I've been working with the GB tools for romhacking for a while, and have been spoiled by them. Between BGB, rgbds, and the plethora of documentation on the Gameboy, I've had no real trouble doing whatever I needed to do.

I've had no such luck with the Wonderswan. I've been trying to use Mednafen's Wonderswan emulator + debugger, but the debugger interface leaves a lot to be desired (the terminal-only interface requires me to be quite meticulous and resolution scaling on my monitor has been a bit troublesome). Trying to find docs on google about how the Wonderswan hardware works has also been a nightmare (though, this page has been super helpful), and I haven't even tried figuring out a proper workflow to actually build and apply a patch (has everyone prior just used a disassembler or hex editor or something?).

I'm at wit's end and was hoping someone with more experience with the Wonderswan might be able to point me to anything useful, or let me know if my only hope is just to bite the bullet and keep chugging along.

USC

  • Submission Reviewer
  • Sr. Member
  • *****
  • Posts: 283
  • Obviously Outdated
    • View Profile
Re: Wonderswan ROM Hacking in 2020
« Reply #1 on: September 14, 2020, 12:48:49 pm »
I've done two WonderSwan translations (and beginning work on a third one). Each one's been different in terms of pointer systems, compression, etc unfortunately. Mednafen's probably the best debugger at the moment - there's a few tracers for the older emulators, but they're even more aggravating. As far as building a patch, I created a custom program for my most recent patch, but I realize that's not a solution for everyone.

If you have some specific questions, feel free to PM me or discuss further in this thread, and I'll do my best to provide some assistance. When I have time, I'll try to look at Medarot Perfect Edition and see if I can get any information for you. What have you found so far?

Variant

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: Wonderswan ROM Hacking in 2020
« Reply #2 on: September 14, 2020, 07:47:31 pm »
I was hoping there was a miracle emulator that I hadn't found, but it seems like Mednafen's all we've got.

Quote
When I have time, I'll try to look at Medarot Perfect Edition and see if I can get any information for you. What have you found so far?

Thanks!

It's got some similarities to the original Gameboy version (for reference, this is my dissassembly repo), so with that information and digging, all the dialog text is dumped (with a character map and general idea of the layout).

For things like tilesets and tilemaps though, I'm still familiarizing myself with the actual format and seeing how I'll dump and replace it. I'm not sure about text reinsertion yet either.

In the Gameboy version, it was a matter of just expanding the number of banks and throwing text and tilesets into the new bank and changing some pointer tables (rgbds' overlay feature makes this a breeze), but I'm not sure how well that'll pan out here.

USC

  • Submission Reviewer
  • Sr. Member
  • *****
  • Posts: 283
  • Obviously Outdated
    • View Profile
Re: Wonderswan ROM Hacking in 2020
« Reply #3 on: September 14, 2020, 10:21:43 pm »
Tile maps for background are normally located at $1000, and are two bytes per tile. For instance, I found the tile map for the title screen starting at ED740 in ROM, if you want to take a look. Uncompressed graphics are stored the same way as most GameBoy games. Compressed graphics are some variation of Huffman-style encoding, so you can see part of the graphics if you dig through with a graphics editor.


Variant

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: Wonderswan ROM Hacking in 2020
« Reply #4 on: September 14, 2020, 11:54:15 pm »
Quote
Tile maps for background are normally located at $1000, and are two bytes per tile. For instance, I found the tile map for the title screen starting at ED740 in ROM, if you want to take a look.

Ah, good to know, thanks.

Quote
Compressed graphics are some variation of Huffman-style encoding, so you can see part of the graphics if you dig through with a graphics editor.

I would assume it's some variation of this or this, which was used on the GB game as well.

Regarding expansion/free space, I would assume it's sufficient to change the 'ROM size' at $04 and then just pad data to the end of the actual file? Or is there more to take into account?

USC

  • Submission Reviewer
  • Sr. Member
  • *****
  • Posts: 283
  • Obviously Outdated
    • View Profile
Re: Wonderswan ROM Hacking in 2020
« Reply #5 on: September 15, 2020, 12:40:14 am »
This one reminds me of the algorithm I made to decompress the backgrounds for Tag Tamers, so yes. I need to go back over it and document my function better, come to think of it.

Regarding moving text to free space, it depends. For instance, in Tag Tamers I had an address "17ECA0" for a line of text. The pointer to it was 00 00 CA 7E. The first part of the address, 1, wasn't part of the pointer table but was "implied" when the code ran, for lack of a better term. I have another pointer table in D1-Tamers where the code applies an offset in code - for instance, the address 179BB6 is pointed to as 06 00 BB 39, and the code applies an offset of 0x40 to that last byte. My favorite was when I had a double pointer table - the pointer table pointed to a second pointer table.