News: 11 March 2016 - Forum Rules

Author Topic: Some helpful advice from a mistake I made with Wily Wars  (Read 1775 times)

pianohombre

  • Sr. Member
  • ****
  • Posts: 337
    • View Profile
    • My personal website of short stories and comics
Some helpful advice from a mistake I made with Wily Wars
« on: May 23, 2017, 05:32:20 am »
I enjoy rom hacking, so I don't really feel like the last mistake I did was too cumbersome, and pathetic. I'm not asking for sympathy. I enjoy solving puzzles so that's why this is so appealing to me.

Anyways, I had thought that a rom I was playing was damaged so planned to release a bug fix to patch it. It was a Sega Genesis rom so I was excited to learn about z80 and 68000 assembly since I haven't approached it before. I downloaded Regen debugger, HivePal, and snasm68k assembler. Unfortunately, Exodus couldn't handle roms that use EEPROM saving instead of the more popular SRAM so I ditched that. The problem was that in Mega Man Wily Wars after defeating a boss it would save the weapon I got, but wouldn't shade the boss in the select screen, so it was hard to keep track of how many I beat. There was so many issues with this game- 50hz instead of 60hz, non-US release, it wouldn't save properly because of EEPROM, etc.

Before I go any further I'll explain the real issue. I was playing MM Wily Wars on a ps2 memory card using pgen 1.1 (because the version I had was patched and pgen wasn't detecting my mass port). What I actually thought was a damaged rom was most likely a problem with an old version of pgen. I still haven't tested if pgen 1.5.1 actually fixes the problem. But I have seen that Fusion runs and saves everything properly.

So unknowing this, over the weekend I tried to fix the "bug" that I thought was in the European version, and still surprised that no one else had made a bug release. So I got the Japanese version, the original version, and noticed the bosses were shaded after defeating them. Great! I thought. I won't have to try and just manually change the palettes using assembly. Anyways, if I wanted to copy most of the code I'd have to set a breakpoint somewhere, but I obviously didn't know where in the RAM that the values were stored. So probably doing this incorrectly and the hard way I dumped the ram after beating a boss then compared it to a ram dump not beating any bosses and just evaluated any changes using a program called FlexHex. I figured if everything was exactly the same it shouldn't have too many different bytes. Well, there was quite a few maybe 50-100 blocks of code that were different, most of them probably having something to do with VRAM.

I did eventually find the address locations that controlled the weapons MM obtained, and whether or not to shade the bosses on the boss select screen in-game, and the file select screen (since WW doesn't use the traditional password system). But it was all in vain!! It was most likely caused by the emulator. I probably played all the way through Bombman level 20-30 times trying to get the address location, so tired of that damn level but it's the recommended first level for MM1. Oh well, now that I know the address locations for bosses I can just beat them all by typing a few numbers into Regen, but Game Genie already unlocked the Wily Tower anyways.

Long story short if you don't want to spend 2 or 3 8-hour days scrolling through hex, and guides all over the Internet on how to use Genesis debuggers and how 68k assembly works try doing something the easy way first, then the hard way. If I had just checked the European version of the rom in an emulator before I had the address locations I would have noticed it recorded everything fine to begin with.
"Programming in itself is beauty,
whether or not the operating system actually functions." - Linus Torvalds

8.bit.fan

  • Sr. Member
  • ****
  • Posts: 317
    • View Profile
    • 8-bit fan's Hacking Projects
Re: Some helpful advice from a mistake I made with Wily Wars
« Reply #1 on: May 23, 2017, 03:25:00 pm »
Thanks for the advice and sharing your experience.
For checking a change that requires clearing a boss or level, and that you have to do it repeatedly, the way I did it was always to make a save state right before the boss is defeated. This way, each time I make a change, I can easily load the save state and see if the changes I made registered or not.

Hope this helps! :)
In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/
FF4 Ultima Discord: https://discord.gg/4MqjwJt

pianohombre

  • Sr. Member
  • ****
  • Posts: 337
    • View Profile
    • My personal website of short stories and comics
Re: Some helpful advice from a mistake I made with Wily Wars
« Reply #2 on: May 23, 2017, 07:43:33 pm »
Thanks for the advice and sharing your experience.
For checking a change that requires clearing a boss or level, and that you have to do it repeatedly, the way I did it was always to make a save state right before the boss is defeated. This way, each time I make a change, I can easily load the save state and see if the changes I made registered or not.

Hope this helps! :)

Hi thanks for the help. Actually what I did was just load up the ram dump file. Unfortuntely, since MM: Wily Wars has problems saving using EEPROM and SRAM it didn't necessarily save correctly. I should have probably used your method. Unfortunately, the bug in the game wasn't fixed by using the latest version of pgen, Pgen 1.5.1. I've e-mailed the developers for some help. For some reason Pgen messes up the values that are traditionally stored in RAM. I'd prefer to use Pgen so I can play on my TV but until this problem is fixed I'll most likely have to play on PC.
"Programming in itself is beauty,
whether or not the operating system actually functions." - Linus Torvalds