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

Author Topic: Mega Man - Refill Weapon Energy after Death  (Read 1547 times)

Thirteen 1355

  • Sr. Member
  • ****
  • Posts: 395
    • View Profile
Re: Mega Man - Restore Weapon Energy after Death
« Reply #20 on: September 14, 2019, 06:30:42 pm »
Okay, so, Mega Man 1 and 2 should be all good. Tested them quite a bit and they seem to work. However, with Mega Man 3, I start off with all weapons without having defeated any Robot Master. The weapons refill after death like they should, though. Does this problem have to do with Mega Man 3 having more banks to load than the earlier games? Also, when I get hit my health goes to 6 immediately, when I use a weapon, its energy gets reduced to 6 as well.
Helicoptering about till I find some ROM hacking treasure.

Cyneprepou4uk

  • Full Member
  • ***
  • Posts: 176
  • Самый лысый ромхакер
    • View Profile
Re: Mega Man - Restore Weapon Energy after Death
« Reply #21 on: September 14, 2019, 06:43:22 pm »
Quote
Mega Man 3, I start off with all weapons without having defeated any Robot Master
This will be harder. You need to find some flags in RAM that tell the game if player has a particular weapon or not (it can be a single address if you are unlucky). Then use these addresses to check for necessity of refilling those weapons, one by one. Creating a loop would be nice.

Quote
Does this problem have to do with Mega Man 3 having more banks to load than the earlier games?
Nope. It's how game code works, not how many banks or whatever.

Quote
Also, when I get hit my health goes to 6 immediately, when I use a weapon, its energy gets reduced to 6 as well
I can't tell from here, I need to see original and your code to say what can be wrong. Obviously original game works fine, then it must be something that you've done.
I am the baldest romhacker
NES Romhacking Guide

DarkSamus993

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: Mega Man - Restore Weapon Energy after Death
« Reply #22 on: September 15, 2019, 12:35:47 am »
Now, I looked a little bit into doing this for MM7 and the X games, and it seems like a ten times bigger job.
Here's the patch files and source code I made for weapon refilling for MM7 and MMX1-3: https://drive.google.com/open?id=10w5bmcswE8VmJdBkLV4w9jfXn_JgI6YK

The process was simple:
1) find the subroutine for filling weapon energy when a stage is loaded.
2) find when the life counter is decreased (player died) and hijack it to also run the 'refill weapon energy' subroutine.

The 'refill weapon energy' subroutine checks if the boss is beaten by seeing if the proper bit is set in the weapon energy RAM value. This results in circular checks:
 - you beat the boss so you have the weapon (when starting a stage).
 - you earned the weapon so you beat the boss (when going through the boss doors).

Thirteen 1355

  • Sr. Member
  • ****
  • Posts: 395
    • View Profile
Re: Mega Man - Restore Weapon Energy after Death
« Reply #23 on: September 15, 2019, 05:25:41 am »
Here's the patch files and source code I made for weapon refilling for MM7 and MMX1-3: https://drive.google.com/open?id=10w5bmcswE8VmJdBkLV4w9jfXn_JgI6YK

The process was simple:
1) find the subroutine for filling weapon energy when a stage is loaded.
2) find when the life counter is decreased (player died) and hijack it to also run the 'refill weapon energy' subroutine.

The 'refill weapon energy' subroutine checks if the boss is beaten by seeing if the proper bit is set in the weapon energy RAM value. This results in circular checks:
 - you beat the boss so you have the weapon (when starting a stage).
 - you earned the weapon so you beat the boss (when going through the boss doors).

Great job as always. Thanks a load!
After all these I plan to give Mega Man V for the Game Boy a try, and if I'm able to, Wily Wars for Genesis (though that one I can see some roadblocks for).

September 15, 2019, 09:10:58 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Fiddled around with flags for MM3, and I think I found a way to help this all.

September 16, 2019, 03:20:02 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
With some help from DarkSamus, Mega Man 3 now has a working health refill edit!

4, 5 and 6 should follow suit!

September 19, 2019, 03:32:00 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Mega Man 4's doing a little strange, in that I got energy refilling working all right, except it's only working in the stage I triggered the breakpoint in (Bright Man's stage). Upon selecting another stage, the screen goes and stays black instead of loading the stage.

September 19, 2019, 06:46:34 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Another update no one will notice since my posts keep merging, but Mega Man 5's refill edit seems to work all good. Very strange considering MM4's situation.
« Last Edit: September 19, 2019, 06:46:34 pm by Thirteen 1355 »
Helicoptering about till I find some ROM hacking treasure.

Thirteen 1355

  • Sr. Member
  • ****
  • Posts: 395
    • View Profile
Re: Mega Man - Refill Weapon Energy after Death
« Reply #24 on: September 26, 2019, 04:07:49 pm »
The Mega Man 4 patch is all done! The Mega Man 1 and 2 refill patches have been uploaded to romhacking.net

Mega Man 5 is probably done but needs to be tested still. All that remains is the Mega Man 6 patch and maybe the Game Boy Mega Man games, and Mega Man & Bass but that one's being covered by DarkSamus993.

Right now I'd like to focus on the Game Boy Mega Man games. Anyone got any leads on that?
« Last Edit: September 29, 2019, 07:27:54 am by Thirteen 1355 »
Helicoptering about till I find some ROM hacking treasure.

Cyneprepou4uk

  • Full Member
  • ***
  • Posts: 176
  • Самый лысый ромхакер
    • View Profile
Re: Mega Man - Refill Weapon Energy after Death
« Reply #25 on: October 02, 2019, 08:39:31 am »
It's basically the same method for other platforms as well. Find addresses, find free space, write code and execute it. Or use existing refilling weapons routine if you've got the skills, like DarkSamus993.

I'm not a gameboy romhacker, so I can't help with that. I would start with googling for an emulator with debugger.
« Last Edit: October 02, 2019, 09:27:49 am by Cyneprepou4uk »
I am the baldest romhacker
NES Romhacking Guide

Thirteen 1355

  • Sr. Member
  • ****
  • Posts: 395
    • View Profile
Re: Mega Man - Refill Weapon Energy after Death
« Reply #26 on: October 02, 2019, 12:56:25 pm »
Yep, right now me and a friend are in the process of tackling all the GB games (maybe the Xtreme games as well). I found BGB, a GB emu with debugger. Finding the right values was easy. Now it's just a matter of understanding Game Boy coding. What helps is that finding free space in these games is way easier.

After that I have time to test the games, including MM4 and 5, whose patches I will upload once done with them. Then only MM6 remains.

October 03, 2019, 06:57:17 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
EDIT
I managed to edit all the Game Boy Mega Man games (save for Xtreme, which will likely follow). Trying the weapons out in Wily Stages produces satisfactory results for each of the five games. Now I just need to play through all of them. If they are 100% alright, I will submit them shortly after.
« Last Edit: October 03, 2019, 06:57:17 pm by Thirteen 1355 »
Helicoptering about till I find some ROM hacking treasure.