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

Author Topic: Mega Man 2 hacking a classic  (Read 11298 times)

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Mega Man 2 hacking a classic
« on: September 03, 2014, 03:35:09 am »
i decided to make another thread before someone gets mad at me... ok where was i?

10 lives right from the start, you have No excuse to not beat this awesome game
4 free E-tanks: 10 lives are not enough? well take these with you...

theres less lag when you pick a energy pill, when the e-tank reills you energy or when the boss bar is being filled, less waiting, more action. note: i havent touch the weapon refill item yet, so you can see the diference between the original and the hacked one.

crash bomb detonates 4 times faster, again, less wating more action

overall the weapon usage has been reduced (not all of them yet)

you can walk with the leaf shield on, and only consumes 1 point when thrown, ill try to balance its usage in the future (for now is just a little overpowered)
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #1 on: September 03, 2014, 11:47:17 am »
i decided to make another thread before someone gets mad at me... ok where was i?

10 lives right from the start, you have No excuse to not beat this awesome game
4 free E-tanks: 10 lives are not enough? well take these with you...

theres less lag when you pick a energy pill, when the e-tank reills you energy or when the boss bar is being filled, less waiting, more action. note: i havent touch the weapon refill item yet, so you can see the diference between the original and the hacked one.

crash bomb detonates 4 times faster, again, less wating more action

overall the weapon usage has been reduced (not all of them yet)

you can walk with the leaf shield on, and only consumes 1 point when thrown, ill try to balance its usage in the future (for now is just a little overpowered)
Good thing you created another topic, this way we can keep track on a much better way and more clrearly :)

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #2 on: September 03, 2014, 03:35:25 pm »
Wow that was pretty damn fast!
Can't you move the part in which it shoots it down with a pointer or somethong to the left/right part of the code?
One question, what is a opcode?
How many limitations you have for those?

1- i`m using a debugger now instead of pure hex, it arranges the code automaticly and you can analize it faster

2- i don`t get the question, do you mean if i can fix the "not holding a dir" bug?

3- an opcode is an instruction you give the cpu to do something, my current limitation is that the subroutine i`m working on only has 3 free opcodes left to fix the bug, otherwise i gonna have to use some free space on other area of the ROM, that option may or may not be easy

right now the most straightforward solution i see is to move the code down those 3 spaces and reduce the posible outcomes down to 3

hold left, hold right, not hold any dir = shoot to the side
hold up = shot up
hold down = shot down

the only draw back of moving code around is that you must recalculate all jumps and thats tedious
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #3 on: September 03, 2014, 04:39:42 pm »
1- i`m using a debugger now instead of pure hex, it arranges the code automaticly and you can analize it faster

2- i don`t get the question, do you mean if i can fix the "not holding a dir" bug?

3- an opcode is an instruction you give the cpu to do something, my current limitation is that the subroutine i`m working on only has 3 free opcodes left to fix the bug, otherwise i gonna have to use some free space on other area of the ROM, that option may or may not be easy

right now the most straightforward solution i see is to move the code down those 3 spaces and reduce the posible outcomes down to 3

hold left, hold right, not hold any dir = shoot to the side
hold up = shot up
hold down = shot down

the only draw back of moving code around is that you must recalculate all jumps and thats tedious
What I meant was that if there is no way to redirect the "not pressing any button" to the Face Left/Right codes, are you working with Hex or ASM?
Why would the code for the Leaf shield direction modification need to recalculate the jumps?

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #4 on: September 03, 2014, 10:27:45 pm »
Quote
What I meant was that if there is no way to redirect the "not pressing any button" to the Face Left/Right codes

Yes, that÷s what i÷ll try to do

Quote
are you working with Hex or ASM

i open the ROM with Hex workshop

Quote
Why would the code for the Leaf shield direction modification need to recalculate the jumps

My bad, by Jump i meant the JMP instructions, these tell the processor to go forward or backward in the code, not the JUMP megaman does...

suppose you have these hypotetical instructions

go 3 lines down -> from here the cpu will jump to
do something
do something
do something
eat lunch            -> Here, in other words, the do something lines will not be executed

lets say you remove 1 line

go 3 lines down           -> from here the cpu will jump to
do something
do something
eat lunch
*** nothing here *** -> wtf? what do i do now?

your code will either crash or do weird things
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #5 on: September 03, 2014, 10:54:02 pm »
My bad, by Jump i meant the JMP instructions, these tell the processor to go forward or backward in the code, not the JUMP megaman does...

suppose you have these hypotetical instructions

go 3 lines down -> from here the cpu will jump to
do something
do something
do something
eat lunch            -> Here, in other words, the do something lines will not be executed

lets say you remove 1 line

go 3 lines down           -> from here the cpu will jump to
do something
do something
eat lunch
*** nothing here *** -> wtf? what do i do now?

your code will either crash or do weird things
Oh ok I got.
So basically you will have to add another opcode but you ran out of the limited space for those.
In order to implement another one you would have to change the JMPs that such routine does, am I right?

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #6 on: September 03, 2014, 11:22:39 pm »
yes, another option im considering is to recycle the two opcodes that decrement the weapon points (DEC 009E, or C6 9E) and move the weapon decrease cycle to the * spawn shield * routine, that would make room for a comparison and a branch
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #7 on: September 03, 2014, 11:32:41 pm »
yes, another option im considering is to recycle the two opcodes that decrement the weapon points (DEC 009E, or C6 9E) and move the weapon decrease cycle to the * spawn shield * routine, that would make room for a comparison and a branch
Sounds good, try it out and see how it turns out.
Another thing, are you working over a fresh rom, or with the SRAM hack with extended memory?

PD: Acabo de notar que eres de Mexico tambien haha XD.

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #8 on: September 04, 2014, 12:21:26 am »
Quote
Another thing, are you working over a fresh rom, or with the SRAM hack with extended memory

im working on the original ntsc ROM, thats why i dont have much free space to move around

something i just thought, what happens if i check for the B button, check the dpad AND then branch to the * shoot leaf shield * subroutine?, you keep the shield on unless you press the Dpad AND B, in theory must work but i dont know what happens when 2 consecutive AND are executed on a 6502, to be honest mostly i do x86 coding, i only have been coding 6502 for like 2 weeks now...

PD: asi es paisano, puro mexican power jajaja
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #9 on: September 04, 2014, 12:26:08 am »
im working on the original ntsc ROM, thats why i dont have much free space to move around

something i just thought, what happens if i check for the B button, check the dpad AND then branch to the * shoot leaf shield * subroutine?, you keep the shield on unless you press the Dpad AND B, in theory must work but i dont know what happens when 2 consecutive AND are executed on a 6502, to be honest mostly i do x86 coding, i only have been coding 6502 for like 2 weeks now...

PD: asi es paisano, puro mexican power jajaja
You lost me there, I am not following the explanation.
What I could gather is that you are making a requirement to press both D-Pad and B to shoot?
What would happen if you just press B then?

PD: Haha es raro encontrar paisanos por aca, pero si... MEX POWER.

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #10 on: September 04, 2014, 01:54:02 am »
Quote
What would happen if you just press B then?

nothing, the shield would still be around megaman

screw it, ill leave like that for now, besides is not a game breaking bug anyway

now, the flash stopper
« Last Edit: September 04, 2014, 02:08:13 am by omega_rugal »
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #11 on: September 04, 2014, 11:58:57 am »
nothing, the shield would still be around megaman

screw it, ill leave like that for now, besides is not a game breaking bug anyway

now, the flash stopper
So the Shield stays in Megaman without pressing the D-Pad?
Hey don't lose patience there, :P

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #12 on: September 04, 2014, 11:13:34 pm »
Quote
So the Shield stays in Megaman without pressing the D-Pad?

Thats what ill try to do

for now, i may have more luck with the time stopper, there is a large chunk of apparently unused rom space right before the time stopper code, i put break points all around around it, played through the ENTIRE game and this code was never called, neither read, written or executed, and its a series of 00s and FFs mixed with some other values with no discernible pattern, the only thing i can think it may be is a color palette, but then again i didnt noticed anything miscoloured during my playtrough...

ill NOP it and give it another go to see if it breaks anything, if it plays Ok would be great.
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #13 on: September 04, 2014, 11:30:28 pm »
Thats what ill try to do

for now, i may have more luck with the time stopper, there is a large chunk of apparently unused rom space right before the time stopper code, i put break points all around around it, played through the ENTIRE game and this code was never called, neither read, written or executed, and its a series of 00s and FFs mixed with some other values with no discernible pattern, the only thing i can think it may be is a color palette, but then again i didnt noticed anything miscoloured during my playtrough...

ill NOP it and give it another go to see if it breaks anything, if it plays Ok would be great.
If you played through it without any major issues then you are good to go.
Next step would be to try to modify that "spare" rom space to implement some of the code in there, and then give it a go with a playthrough to see if something is different.
It would be easier to verify if the game is modified or garbled in some way by doing so.

standigz

  • Jr. Member
  • **
  • Posts: 32
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #14 on: September 05, 2014, 11:21:37 am »
Cool.

Any plans for:

Saving?
Switch weapons by pressing select?
Ability to toggle the time stopper?

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #15 on: September 05, 2014, 02:56:45 pm »
Quote
Saving?
Switch weapons by pressing select?
Ability to toggle the time stopper?

Saving: not sure, my expertise doesn`t go that far but who knows, time will tell

Weapon switch: already on the "to do" list

TIme stopper: i`m working on it, good news, the extra space i was talking about is really free, bad news, while the time stopper is on i can`t get any reading on the controller, weird, maybe the loop is too short expecting the button press, i`ll be busy today so i guess i`ll continue tomorrow night
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #16 on: September 05, 2014, 04:25:48 pm »
Saving: not sure, my expertise doesn`t go that far but who knows, time will tell

Weapon switch: already on the "to do" list

TIme stopper: i`m working on it, good news, the extra space i was talking about is really free, bad news, while the time stopper is on i can`t get any reading on the controller, weird, maybe the loop is too short expecting the button press, i`ll be busy today so i guess i`ll continue tomorrow night
Maybe by applying the work you've been doing over the SRAM hack might be good to make saving a feature.

As for the Time stopper, no resding AT ALL?
Isn't the character supposed to move and jump while having the Time stopper on?
Doesn't matter though, take your time to solve any pending stuff on your end :)

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #17 on: September 06, 2014, 04:46:45 am »
I dont know how but i fixed the problem, the free space i found above the flash stopper code wasnt entirely free, a few bytes are used as constants by other subroutines, both time stopper and item 2 read from these at some point, so in the end i only got 6 more opcodes to work with... for now the time stopper works as the flash stopper from mm4: you shot it and all objects get frozen by 4 secs and then return to normal, you cant shoot thought, so its not like i originally intended it to be but is more useful now, and only uses 2 points per shot, and i personally think is cool because i only flipped a few opcodes to get this result

now the items...
Done your packing?, your life journey is over...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #18 on: September 06, 2014, 05:07:51 pm »
I dont know how but i fixed the problem, the free space i found above the flash stopper code wasnt entirely free, a few bytes are used as constants by other subroutines, both time stopper and item 2 read from these at some point, so in the end i only got 6 more opcodes to work with... for now the time stopper works as the flash stopper from mm4: you shot it and all objects get frozen by 4 secs and then return to normal, you cant shoot thought, so its not like i originally intended it to be but is more useful now, and only uses 2 points per shot, and i personally think is cool because i only flipped a few opcodes to get this result

now the items...
Pretty neat!
What items are you going to work on?
Item 1, 2, 3 or items in the game (objects)?

omega_rugal

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Mega Man 2 hacking a classic
« Reply #19 on: September 06, 2014, 09:37:27 pm »
items 1 2 and 3, its done, they are infinite now.

some of you may think "that`s cheap, it`s gonna ruin the game" but when you think about it, you can`t really "abuse" the items even if you wanted to.

item 1 is used only in a few parts of the game, the worse thing it can happen is when you miss the jumps and have to restart the part, you have less item 1 energy to do so.

item 2 is mandatory only in 1 single part of the entire game (2 if you suck at heast man`s stage, other than that, there aren`t many place where it can be used to cheat or skip large portions of the game

same for item 3

as for the rest of the weapons (which i gonna start tweaking tomorrow)

Atomic fire: seriusly, do you even USE this weapon? no much, why? it doesn`t last shit for a start, the weird charge mechanics make it difficult to aim properly and what`s the point of charging it? only a handful of enemies get good damage from this weapon and then again, you can just use the default weapon

what to tweak: lower weapon usage, faster charge rate

Bubble lead: not real complaints, just it doesn`t last too long, only useful against ground enemies and to pinpoint false floors (which appear only in dr. wily`s castle)

what to tweak: lower weapon usage. DONE

Air shooter: spends too much ammo and has no special use, not effective against some enemies

what to tweak: lower weapon usage. DONE

Quick boomerang: it`s fine as it is (a bit over powered, you can easily use it instead of the normal weapon)

Metal blade: TOO OVERPOWERED: can shoot in all 8 directions, can fire 3 consecutive blades in rapid succesion and kills 99.9% of the enemies in MM2

what to tweak: limit it to 3 way shooting (fwd, diagup, diagdown) and only 1 blade at a time

September 07, 2014, 02:41:34 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Behold the Almighty

ATOMIC FIRE 2.0

Level 0 requires no power, since you can only have 2 on screen at a time and its damage is pathetic, its free

Level 2 shots need 1 points, like the previous one, but bigger so you can aim more easily, Does a little more damage so it worth 1 point

Full charge needs 3 points, the biggest fireball, btw it will burn anything in its path, even woodman with 1 shot

You like it? well thats not all it charges TWICE as fast than before

dont you find annoying that as soon as you press B megamans palette begins to flash? well no more, Megaman will flash only after reaching level 2 of charge so no more seizure-inducding effects

the downside: the charging effect looks weird since it lack 1 color, ill see if i can find a combination of colors that look good

extra info: since i have been toying around with the Atomic fire i think i have discorevered a leftover from the first Megaman: charge the Atomic fire to max, shot and enemy with it and at the same time get hit: for a split second, instead of the standar get hit animation youll see the "ground stomp type" seen in MegaMan1 (remember? when gutsman stomps the ground and megaman falls on his butt?) but not only the sprite is there, if you do this while in midair, Megaman will fall to the ground and get stunned, which mean some code is also present in the ROM
« Last Edit: September 07, 2014, 03:31:07 am by omega_rugal »
Done your packing?, your life journey is over...