Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: PowerPanda on April 02, 2017, 06:34:27 pm

Title: Megaman X Buster Upgrade
Post by: PowerPanda on April 02, 2017, 06:34:27 pm
Hi there. I'm working on a small hack to Megaman X that affects the way capsules are found. The Dash Boots are now skippable, and none of the other equipment requires the dash boots to obtain. The purpose of this hack is 2-fold:
1. For normal players, to allow them to change up their route through the game, trying new combinations of armors and powerups. There is no longer a need to do Chill Penguin first!
2. For hardcore players/speedrunners, to allow them to do an armor-free speedrun.

I've accomplished the first part of my hack with just a level editor. All 4 equipment capsules can be reached with precise jumps and wall kicks. However, there are 2 more things I'd like to add before releasing the patch. Unfortunately, both require a rom map, which does not exist anywhere I can find for Megaman X.
1. Zero's Buster - After you fight Vile, the game does a check to see if you've obtained the arm upgrade or not, then plays one of two versions of the cutscene. (One where Zero gives you the upgrade, and the other where he doesn't). I want to remove this check and always play the scene where he doesn't upgrade you. This is probably a 1-byte change. Does anyone know where this is in the Rom?
2. Sigma Final Form - Only 2 things damage Sigma in his final form: the Rolling Shield (2 pts damage) and an upgraded X-Buster at charge level 3 (1 pt damage). I would like to change this so that the X-Buster charge level 2 does 1 pt damage, and level 3 2 pts. This would allow a speed runner to do a buster-only no upgrade run. Any idea where this damage table is located?
Title: Re: Megaman X Buster Upgrade
Post by: ThegreatBen on April 04, 2017, 05:10:55 pm
I dont know asm but I like what youre doing so I'll try to help, looking at game genie codes I can tell you that all armor parts are saved to a saved to a single ram byte (7E1F99) if I mess around I might be able to tell you the value of the buster part.

Title: Re: Megaman X Buster Upgrade
Post by: PowerPanda on April 04, 2017, 08:07:23 pm
I dont know asm but I like what youre doing so I'll try to help, looking at game genie codes I can tell you that all armor parts are saved to a saved to a single ram byte (7E1F99) if I mess around I might be able to tell you the value of the buster part.

I'm fairly certain that the values are
$01 - Subtank 1 - Storm Eagle
$02 - Subtank 2 - Armored Armadillo
$04 - Subtank 3 - Spark Mandrill
$08 - Subtank 4 - Flame Mammoth
$10 - Leg Parts
$20 - Body Parts
$40 - Arm Parts
$80 - Head Parts
(So if you had the Arm Parts and all 4 Subtanks, the byte would read $4F.) All of the upgrades would equal FF.)

What I don't know where to find is where the rom CHECKS the ram value to determine which of the 2 cutscenes to play.
Title: Re: Megaman X Buster Upgrade
Post by: justin3009 on April 05, 2017, 04:25:20 pm
Code: [Select]
$88/D746 AD 99 1F    LDA $1F99  [$86:1F99]   A:0B30 X:001C Y:0008 P:envMXdizC
$88/D749 89 02       BIT #$02                A:0BFD X:001C Y:0008 P:eNvMXdizC
$88/D74B D0 01       BNE $01    [$D74E]      A:0BFD X:001C Y:0008 P:eNvMXdiZC
$88/D74D E8          INX                     A:0BFD X:001C Y:0008 P:eNvMXdiZC

NOP this (EA) so that when you go to Zero and initiate dialogue, it'll ALWAYS be the dialogue that's him with his failing power system instead of saying you're stronger but need an edge.

Code: [Select]
$88/D7C0 AD 99 1F    LDA $1F99  [$86:1F99]   A:05CC X:000C Y:000D P:envMXdiZc
$88/D7C3 89 02       BIT #$02                A:05FD X:000C Y:000D P:eNvMXdizc
$88/D7C5 F0 0C       BEQ $0C    [$D7D3]      A:05FD X:000C Y:000D P:eNvMXdiZc

NOP this (EA) so after dialogue you no longer get the X-Buster upgrade.

I haven't tested the 2nd section fully as I'm not sure if that actually breaks capsules or not.  Otherwise, that's all you need and it's good to go.
Title: Re: Megaman X Buster Upgrade
Post by: PowerPanda on April 05, 2017, 08:52:42 pm
Code: [Select]
$88/D746 AD 99 1F    LDA $1F99  [$86:1F99]   A:0B30 X:001C Y:0008 P:envMXdizC
$88/D749 89 02       BIT #$02                A:0BFD X:001C Y:0008 P:eNvMXdizC
$88/D74B D0 01       BNE $01    [$D74E]      A:0BFD X:001C Y:0008 P:eNvMXdiZC
$88/D74D E8          INX                     A:0BFD X:001C Y:0008 P:eNvMXdiZC

NOP this (EA) so that when you go to Zero and initiate dialogue, it'll ALWAYS be the dialogue that's him with his failing power system instead of saying you're stronger but need an edge.

You are a gentleman and a scholar.

April 07, 2017, 09:15:54 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
I have spoken to the guy who created the MegaED editor for the MMX series, and he has said that the damage charts for enemies have never been determined in the rom, so I think I'll drop that one from my scope for now. The rest has been tested and is working. Problem is, I made all the edits to a rom hash that RHDN doesn't recognize, so I'll need a bit of time to re-do my work on a recognized dump before I can post it here. I estimate the work will be done within the next 2 weeks. Look for it on the front page.
Title: Re: Megaman X Buster Upgrade
Post by: rainponcho on April 09, 2017, 08:32:00 pm
Rev 1 rom
Code: [Select]
$84/9E6E A5 27       LDA $27    [$00:0F0F]   A:0000 X:1228 Y:00A0 P:eNvMxdizc
$84/9E70 29 7F       AND #$7F                A:0020 X:1228 Y:00A0 P:envMxdizc
$84/9E72 38          SEC                     A:0020 X:1228 Y:00A0 P:envMxdizc
$84/9E73 F9 37 EF    SBC $EF37,y[$86:EFD7]   A:0020 X:1228 Y:00A0 P:envMxdizC
$84/9E76 30 21       BMI $21    [$9E99]      A:001F X:1228 Y:00A0 P:envMxdizC

Put a breakpoint on 84:9E73 to see damage amounts to enemies. Or use it to cheat very quickly.

Code: [Select]
$84/9E45 B9 37 EF    LDA $EF37,y[$86:F199]   A:0002 X:1228 Y:0262 P:envMxdizc
$84/9E48 10 0E       BPL $0E    [$9E58]      A:0080 X:1228 Y:0262 P:eNvMxdizc

Sigma Final uses this value. $80 means no damage for normal shot. Edited and 1-shot kill.

Have fun testing all values. ;)
Title: Re: Megaman X Buster Upgrade
Post by: ThegreatBen on April 10, 2017, 08:25:38 am
Since this project is about getting (or not getting) capsule upgrades would you consider speeding up the process for getting the hadouken? For completists like me who play the series once a year you tend to get really sick of armored armadillos stage.
Title: Re: Megaman X Buster Upgrade
Post by: DarkSamus993 on April 10, 2017, 10:23:20 am
Since this project is about getting (or not getting) capsule upgrades would you consider speeding up the process for getting the hadouken? For completists like me who play the series once a year you tend to get really sick of armored armadillos stage.
@PowerPanda If you would like to add this to your project: change $87:CA96 to CMP #$01. This will make it so the the capsule will appear on the first visit with all the upgrades.

Code: [Select]
$87/CA8D AD 7E 1F    LDA $1F7E  [$86:1F7E]   A:099A X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdiZC
$87/CA90 30 32       BMI $32    [$CAC4]      A:0904 X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdizC
$87/CA92 1A          INC A                   A:0904 X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdizC
$87/CA93 8D 7E 1F    STA $1F7E  [$86:1F7E]   A:0905 X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdizC
$87/CA96 C9 05       CMP #$05                A:0905 X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdizC
$87/CA98 90 2A       BCC $2A    [$CAC4]      A:0905 X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdiZC
$87/CA9A A9 05       LDA #$05                A:0905 X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdiZC
$87/CA9C 8D 7E 1F    STA $1F7E  [$86:1F7E]   A:0905 X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdizC
$87/CA9F AD 99 1F    LDA $1F99  [$86:1F99]   A:0905 X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdizC
$87/CAA2 2D 9C 1F    AND $1F9C  [$86:1F9C]   A:09FF X:0003 Y:0069 D:0E68 DB:86 S:012F P:eNvMXdizC
$87/CAA5 C9 FF       CMP #$FF                A:09FF X:0003 Y:0069 D:0E68 DB:86 S:012F P:eNvMXdizC
$87/CAA7 D0 1B       BNE $1B    [$CAC4]      A:09FF X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdiZC
$87/CAA9 2C 7C 1F    BIT $1F7C  [$86:1F7C]   A:09FF X:0003 Y:0069 D:0E68 DB:86 S:012F P:envMXdiZC
$87/CAAC 50 16       BVC $16    [$CAC4]      A:09FF X:0003 Y:0069 D:0E68 DB:86 S:012F P:enVMXdizC
$87/CAAE AD CF 0B    LDA $0BCF  [$86:0BCF]   A:09FF X:0003 Y:0069 D:0E68 DB:86 S:012F P:enVMXdizC
$87/CAB1 29 7F       AND #$7F                A:0920 X:0003 Y:0069 D:0E68 DB:86 S:012F P:enVMXdizC
$87/CAB3 C9 20       CMP #$20                A:0920 X:0003 Y:0069 D:0E68 DB:86 S:012F P:enVMXdizC
$87/CAB5 D0 0D       BNE $0D    [$CAC4]      A:0920 X:0003 Y:0069 D:0E68 DB:86 S:012F P:enVMXdiZC
$87/CAB7 80 0F       BRA $0F    [$CAC8]      A:0920 X:0003 Y:0069 D:0E68 DB:86 S:012F P:enVMXdiZC
Title: Re: Megaman X Buster Upgrade
Post by: ThegreatBen on April 12, 2017, 08:03:39 am
Damn he released it without adding this, guess I'll try it myself.
Title: Re: Megaman X Buster Upgrade
Post by: PowerPanda on April 12, 2017, 03:41:36 pm
I will definitely look at changing the Hadoken capsule and Final Sigma. Thanks guys! I'm much more of a project coordinator than I am a tech guy, so all of the input here is invaluable.

April 12, 2017, 11:12:03 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
First off, thank you to DarkSamus993! I have tested the code for getting the Hadoken, and it works. Now, as long as you have all weapons/powerups and finish Armored Armadillo with full health, the Hadoken capsule will appear. Should make getting the powerup after entering a code that much faster.

Now, for Wolf Sigma, let's put our brains together and discuss.

Code: [Select]
$84/9E45 B9 37 EF    LDA $EF37,y[$86:F199]   A:0002 X:1228 Y:0262 P:envMxdizc
$84/9E48 10 0E       BPL $0E    [$9E58]      A:0080 X:1228 Y:0262 P:eNvMxdizc

Sigma Final uses this value. $80 means no damage for normal shot. Edited and 1-shot kill.

Have fun testing all values. ;)

Actually, the $80 makes sense! "80" in hexadecimal is "128" in decimal, which is 4*32. It's well-known that Megaman Bosses have 32HP. That could be a starting point.

Right now, the buster does 0:0:0:1 damage (4 numbers denote, uncharged, charge 1, charge 2, charge 3. Charge 3 is only available with the buster parts). I want it to do 0:0:1:1 damage. So that means I want both levels to do either $04 damage (if this is additive) or $7C damage (if this is subtractive).

I'm not sure I understand how to change the code that you quoted, since I can't figure out how "10 0E" translates to $80 (I'm still very, very new to ASM). But knowing that you're probably looking for either a value of $04 or $7C, does that give you any ideas?
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on April 13, 2017, 04:04:23 am
Panda,
I was actually just working on fixing a bug in a MMX game that deals with the leg capsules (or dash boots as you described). So I got the game to start with leg capsules at the introduction stage and they show up all throughout the entire game, but I had some difficulty getting them to display if the player selects PASS WORD instead of START GAME. So for example, if they type in a password that skips the intro stage it returns to original megaman no dash, or at least in the game I was working on broken dash. I could force leg capsules, but then if someone used a password that for example gave them all armor/weapon upgrades it would override those. I was brainstorming a lot, but I was working with limited memory so couldn't find a location to store the asm instructions.
Title: Re: Megaman X Buster Upgrade
Post by: rainponcho on April 13, 2017, 09:34:27 am
Sorry for not being more clear.

Code: [Select]
LDA $EF37,y[$86:F199] ==> damage tables start at 86:EF37


This tells us that

wolf sigma
86:f199 = rom 37199 = 80  [normal buster]
86:f19a = rom 3719a = 80  [charge 1]
86:f19b = rom 3719b = 01  [charge 3]
86:f19c = rom 3719c = 80  [charge 2] ==> 01


Other examples:

normal sigma
86:f17b = rom 3717B = 01 01 01 01

sigma dog
86:f08b = rom 3708B = 01 02 03 03

Speedrunners could analyze all enemy data and compute optimal damage formulas.
Title: Re: Megaman X Buster Upgrade
Post by: DarkSamus993 on April 13, 2017, 11:12:26 am
Adding to rainponcho's notes:

LDA $EF37,y[$86:F199] ==> $86:EF37 is the index values for all the damage tables. In other words, $86:EF37 + index value = damage table location.
Code: [Select]
0046 = $86:EF7D = enemies
0064 = $86:EF9B = boss i-frames
0082 = $86:EFB9 = ???
00A0 = $86:EFD7 = Vile, Bee Blader, Thunder Slimer, Anglerge
00BE = $86:EFB9 = ???
00DC = $86:F013 = Sting Chameleon, D-Rex, RT-55J, Utuboros
00FA = $86:F031 = Storm Eagle, Rangda Bangda
0118 = $86:F04F = Flame Mammoth, Cruiziler
0136 = $86:F06D = Chill Penguin, Mole Borer
0154 = $86:F08B = Spark Mandrill, Bospider, Velguarder
0172 = $86:F0A9 = Armored Armadillo
0190 = $86:F0C7 = Launch Octopus
01AE = $86:F0E5 = Boomer Kuwanger
01CC = $86:F103 = ???
01EA = $86:F121 = ???
0208 = $86:F13F = ???
0226 = $86:F15D = ???
0244 = $86:F17B = Sigma
0262 = $86:F199 = Wolf Sigma

Code: [Select]
Wolf Sigma damage chart:
$86:F199 = 80 80 01 80 80 [80 80] 80 80 02 80 80 80 80 80 [80] 80 [80] 02 80 80 80 80 80 [80 80 80] 80 [80 01]

buster:
$86:F199 = normal
$86:F19A = charge 1
$86:F19B = charge 3
$86:F19C = charge 2
$86:F19D = hadouken
$86:F19E = ???
$86:F19F = ???

normal:
$86:F1A0 = homing torpedo
$86:F1A1 = chameleon sting
$86:F1A2 = rolling shield
$86:F1A3 = fire wave
$86:F1A4 = storm tornado
$86:F1A5 = electric spark
$86:F1A6 = boomerang cutter
$86:F1A7 = shotgun ice
$86:F1A8 = ???

charged:
$86:F1A9 = homing torpedo
$86:F1AA = ???
$86:F1AB = rolling shield
$86:F1AC = fire wave
$86:F1AD = storm tornado
$86:F1AE = electric spark
$86:F1AF = boomerang cutter
$86:F1B0 = shotgun ice
$86:F1B1 = ???
$86:F1B2 = ???
$86:F1B3 = ???
$86:F1B4 = mine cart
$86:F1B5 = ???
$86:F1B6 = ???
Title: Re: Megaman X Buster Upgrade
Post by: rainponcho on April 13, 2017, 11:56:55 am
Awesome work and thoroughly detailed (and lightning fast)! Thanks - was wondering what most of those values were. :mrgreen:
Title: Re: Megaman X Buster Upgrade
Post by: PowerPanda on April 13, 2017, 12:19:48 pm
DarkSamus, RainPoncho, you are truly incredible. Is there a disassembly you're working off of, or do we need to create a knowledge base here on romhacking?
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on April 13, 2017, 05:51:57 pm
PowerPanda,
there already is a RAM Map with most of the information on the game here at RHDN. If you'd like to edit the information in the RAM Map to include more enemy data you can try editing the RAM MAP at this page:
http://datacrystal.romhacking.net/wiki/Mega_Man_X:RAM_map (http://datacrystal.romhacking.net/wiki/Mega_Man_X:RAM_map)

Learn how to login on the wiki via this page:
http://datacrystal.romhacking.net/wiki/Main_Page (http://datacrystal.romhacking.net/wiki/Main_Page)

Also, in post #2 you talked about the armor/weapon upgrades and listed some numbers. Those figures are actually incorrect. Here's the values for how upgrades are stored:
Format: dcbaZYXW
Upgrades: W = Head; X = Arm (Buster); Y = Body (Armor); Z = Leg (Dash).
Sub-tanks: a = Eagle; b = Armadillo; c = Mandrill; d = Mammoth.

The format is an 8-digit binary "flag" for each upgrade. So for example, if you obtained the Buster (X) and got subtanks on the Eagle stage (a) and the Armadillo stage (b) the binary would look like this:
00110010. You then convert that to hexadecimal (50). So now any part of the game that deals with upgrades/subtanks you store/load that value, which is kept in memory, in this case ($7E:1F99).
Title: Re: Megaman X Buster Upgrade
Post by: rainponcho on April 13, 2017, 07:42:45 pm
Quote
Is there a disassembly you're working off of, or do we need to create a knowledge base here on romhacking?

Think it's safe to say that we both used Geiger Snes9x debugger to fish out all the code posted so far. Basically on-the-fly as needed.

Although DarkSamus993 is definitely the more skilled one at hacking, disassembly, explaining.
Title: Re: Megaman X Buster Upgrade
Post by: PowerPanda on April 13, 2017, 11:37:44 pm
Yeah. I wish I could get the SNES 9x Debugger working on my computer. I plan to give it another go next week and find out exactly what I'm doing wrong.

Anyway, all changes are tested and working. The Hadoken shows up on the first visit through Armored Armadillo, and it's now possible to defeat Wolf Sigma in a no-upgrade buster only challenge (though you must do so without getting hit). I also made the Hadoken 1-hit kill him, but there is only 1 RNG pattern that lifts your character high enough to launch it. Good luck staying alive till then. ;)

I'm planning to make 1 more change (requiring Head Parts to get the Heart Tank in Armored Armadillo's stage), and then I'll compile V1.1 and upload it here. A huge thank you again to all of you guys. All I really did (aside from level editing) was compile your work to make this happen. Does anyone that contributed want to suggest a better name for the patch than "No Forced Upgrades"?
Title: Re: Megaman X Buster Upgrade
Post by: DarkSamus993 on April 14, 2017, 12:58:52 am
Think it's safe to say that we both used Geiger Snes9x debugger to fish out all the code posted so far. Basically on-the-fly as needed.
Yep, that's what I use most of the time. I switch to bsnes-plus when I need to do special tracing.
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on April 14, 2017, 03:14:19 am
Since everyone here is already talking about enemy data does anyone know where the location of Zero's sprite in MMX? X's sprite is already known and I was going to look through the object viewer in MegaEd X to try and find it, but maybe someone here already knows the location. Thanks.
Title: Re: Megaman X Buster Upgrade
Post by: DarkSamus993 on April 14, 2017, 10:22:41 am
Since everyone here is already talking about enemy data does anyone know where the location of Zero's sprite in MMX? X's sprite is already known and I was going to look through the object viewer in MegaEd X to try and find it, but maybe someone here already knows the location. Thanks.

Code: [Select]
Palettes:
0x2C0C0 = Zero
0x2C0E0 = Zero charging 1 (UNUSED)
0x2C100 = Zero charging 2 (UNUSED)
0x2C120 = Zero charge shot

Decompression ptr:
0x3788C = [00 21 F6 E4 A3] = $A3:E4F6, $2100 bytes

Uncompressed gfx:
0x178400 = X & Zero charge shot

Decompressed with Lunar Compress:
(http://i.imgur.com/pd0ISjr.png)
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on April 16, 2017, 05:01:10 am
Thanks a billion DarkSamus!

I've never used Lunar Compress before. I'll have to check it out looks like a great program. Is it able to load the palette for the snes game or do you have to enter that info?
Title: Re: Megaman X Buster Upgrade
Post by: DarkSamus993 on April 16, 2017, 08:05:18 am
It just handles the decompression/compression. I copied the $80 bytes of palette data to the decompressed data and used tile molester to load the graphics/palettes correctly.

Lunar Compress commands:
Code: [Select]
Decompress Zero's gfx:
Usage: decomp.exe FileToDecompress FileToSaveAs OffsetToStart(h) Format1 Format2
Example: decomp MMX.sfc Zero.bin 11E4F6 102 8448

Recompress Zero's gfx:
Usage: recomp.exe FileToRecompress FileToSaveAs/InsertTo OffsetToSave(h) Format1 Format2
Example: recomp Zero.bin MMX.sfc 11E4F6 102 8448
The decompression pointer & length will have to be updated manually if you change that.

Tile Molester viewing settings:
GFX: 4bpp planar, composite ; 1-dimensional
PAL: 15bpp BGR ; 2-dimensional

If you did what I did and copy the palette data to the decompressed file, you can import the palette from there when viewing in TM.
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on April 17, 2017, 02:23:45 am
Thanks again DarkSamus. Hey one more question. I was going to try and make some minor changes to a sprite and this will be my first time doing any sprite editing outside of Tile Layer Pro, do you know if the routine to handle sprites is usually close by to the actual sprite location? I was just going to try and follow breakpoints like I did for my previous patch, but I've edited a rom using hex and assembly before so i'm not completely new to the process. I mainly wanted to find where they store the size of the sprite and then was going to edit that.
Title: Re: Megaman X Buster Upgrade
Post by: justin3009 on April 17, 2017, 03:24:10 am
That's the Sprite Assembly you'd be looking for. If you want to cut a sprite size down that's fine but expanding may be a problem unless there's extra room in the current bank.
Title: Re: Megaman X Buster Upgrade
Post by: DarkSamus993 on April 17, 2017, 01:13:03 pm
Thanks again DarkSamus. Hey one more question. I was going to try and make some minor changes to a sprite and this will be my first time doing any sprite editing outside of Tile Layer Pro, do you know if the routine to handle sprites is usually close by to the actual sprite location? I was just going to try and follow breakpoints like I did for my previous patch, but I've edited a rom using hex and assembly before so i'm not completely new to the process. I mainly wanted to find where they store the size of the sprite and then was going to edit that.

The first thing to note is that Zero is expected to only have up to $400 bytes of graphical data (32 8x8 tiles) loaded in VRAM at any time. It's easy enough to load more tiles, but then you'll be overwriting other tiles if you don't rearrange how data is loaded into VRAM.
Code: [Select]
$7F:2DA0 = Zero gfx (decomp)

Dashing:
$84/9023 BD 00 00    LDA $0000,x[$85:A9B4]   A:0010 X:A9B4 Y:0000 D:0EA8 DB:85 S:012A P:envMxdizc
$84/9026 C2 21       REP #$21                A:0020 X:A9B4 Y:0000 D:0EA8 DB:85 S:012A P:envMxdizc
$84/9028 29 FF 00    AND #$00FF              A:0020 X:A9B4 Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902B 0A          ASL A                   A:0020 X:A9B4 Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902C 0A          ASL A                   A:0040 X:A9B4 Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902D 0A          ASL A                   A:0080 X:A9B4 Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902E 0A          ASL A                   A:0100 X:A9B4 Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902F 99 03 05    STA $0503,y[$85:0503]   A:0200 X:A9B4 Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
...
$84/9023 BD 00 00    LDA $0000,x[$85:A9B9]   A:A920 X:A9B9 Y:0008 D:0EA8 DB:85 S:012A P:envMxdizc
$84/9026 C2 21       REP #$21                A:A920 X:A9B9 Y:0008 D:0EA8 DB:85 S:012A P:envMxdizc
$84/9028 29 FF 00    AND #$00FF              A:A920 X:A9B9 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902B 0A          ASL A                   A:0020 X:A9B9 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902C 0A          ASL A                   A:0040 X:A9B9 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902D 0A          ASL A                   A:0080 X:A9B9 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902E 0A          ASL A                   A:0100 X:A9B9 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902F 99 03 05    STA $0503,y[$85:050B]   A:0200 X:A9B9 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
...
$80/8350 BD 03 05    LDA $0503,x[$80:0503]   A:6500 X:0000 Y:0000 D:0000 DB:80 S:02EE P:envmXdIzc
$80/8353 8D 05 43    STA $4305  [$80:4305]   A:0200 X:0000 Y:0000 D:0000 DB:80 S:02EE P:envmXdIzc
...
DMA[0]: CPU->PPU Mode:1 0x7F2DA0->0x2118 Bytes:200 (inc) V:232 VRAM: 6400 (1,0) word
...
$80/8350 BD 03 05    LDA $0503,x[$80:050B]   A:6500 X:0008 Y:0000 D:0000 DB:80 S:02EE P:envmXdIzc
$80/8353 8D 05 43    STA $4305  [$80:4305]   A:0200 X:0008 Y:0000 D:0000 DB:80 S:02EE P:envmXdIzc
...
DMA[0]: CPU->PPU Mode:1 0x7F2FA0->0x2118 Bytes:200 (inc) V:234 VRAM: 6500 (1,0) word

Standing:
$84/9023 BD 00 00    LDA $0000,x[$85:A9BE]   A:0010 X:A9BE Y:0000 D:0EA8 DB:85 S:012A P:envMxdizc
$84/9026 C2 21       REP #$21                A:0020 X:A9BE Y:0000 D:0EA8 DB:85 S:012A P:envMxdizc
$84/9028 29 FF 00    AND #$00FF              A:0020 X:A9BE Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902B 0A          ASL A                   A:0020 X:A9BE Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902C 0A          ASL A                   A:0040 X:A9BE Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902D 0A          ASL A                   A:0080 X:A9BE Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902E 0A          ASL A                   A:0100 X:A9BE Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902F 99 03 05    STA $0503,y[$85:0503]   A:0200 X:A9BE Y:0000 D:0EA8 DB:85 S:012A P:envmxdizc
...
$84/9023 BD 00 00    LDA $0000,x[$85:A9C3]   A:A920 X:A9C3 Y:0008 D:0EA8 DB:85 S:012A P:envMxdizc
$84/9026 C2 21       REP #$21                A:A920 X:A9C3 Y:0008 D:0EA8 DB:85 S:012A P:envMxdizc
$84/9028 29 FF 00    AND #$00FF              A:A920 X:A9C3 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902B 0A          ASL A                   A:0020 X:A9C3 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902C 0A          ASL A                   A:0040 X:A9C3 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902D 0A          ASL A                   A:0080 X:A9C3 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902E 0A          ASL A                   A:0100 X:A9C3 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
$84/902F 99 03 05    STA $0503,y[$85:050B]   A:0200 X:A9C3 Y:0008 D:0EA8 DB:85 S:012A P:envmxdizc
...
$80/8350 BD 03 05    LDA $0503,x[$80:0503]   A:6400 X:0000 Y:0000 D:0000 DB:80 S:02EE P:envmXdIzc
$80/8353 8D 05 43    STA $4305  [$80:4305]   A:0200 X:0000 Y:0000 D:0000 DB:80 S:02EE P:envmXdIzc
...
DMA[0]: CPU->PPU Mode:1 0x7F31A0->0x2118 Bytes:200 (inc) V:232 VRAM: 6400 (1,0) word
...
$80/8350 BD 03 05    LDA $0503,x[$80:050B]   A:6500 X:0008 Y:0000 D:0000 DB:80 S:02EE P:envmXdIzc
$80/8353 8D 05 43    STA $4305  [$80:4305]   A:0200 X:0008 Y:0000 D:0000 DB:80 S:02EE P:envmXdIzc
...
DMA[0]: CPU->PPU Mode:1 0x7F33A0->0x2118 Bytes:200 (inc) V:234 VRAM: 6500 (1,0) word


That's the Sprite Assembly you'd be looking for. If you want to cut a sprite size down that's fine but expanding may be a problem unless there's extra room in the current bank.

Fortunately, the game uses long pointers so that shouldn't be much of an issue.
Code: [Select]
========================
= Sprite OAM Ptr Table =
========================
Format: 3-bytes
------------------------
$8D:80F9 = ptr to Zero sprite OAM ptrs
[F9 95 8D]


===================
= Sprite OAM Ptrs =
===================
Format: 3-bytes
-------------------
$8D:9605 = Zero standing
[ED E0 8F]


==============
= Sprite OAM =
==============
Format: 
# of tiles
Tile 01:
     byte-1 = xPos
     byte-2 = yPos
     byte-3 = tile index
     byte-4 = v/h flip, palette, tile size
Tile 02
Tile 03
etc...
--------------
$8F:E0ED = Zero standing
[0E]
[04 ED 50 00]
[04 EE 50 00]
[0C 10 50 00]
[0C 08 59 00]
[0C 00 49 00]
[FA E8 51 00]
[04 00 57 00]
[04 10 58 00]
[04 08 48 00]
[04 F8 56 00]
[FC 10 47 00]
[F4 10 46 00]
[F4 00 44 20]
[F4 F0 42 20]

(http://i.imgur.com/AdjyIKi.png) (http://i.imgur.com/Rvma9sZ.png)
Title: Re: Megaman X Buster Upgrade
Post by: ThegreatBen on April 18, 2017, 05:23:08 pm
Just saw that you updated, thanks for adding my suggestion, Thanks to DarkSamus993 for showing how. and downloaded
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on April 18, 2017, 08:32:35 pm
If you did what I did and copy the palette data to the decompressed file, you can import the palette from there when viewing in TM.

Did you use an unheadered or headered rom for MMX? Also version 1.0 or 1.1 of the rom? I just got a bunch of scrambled up graphics and couldn't get any palette to load. Not sure how you loaded the palette from just the bin file since there's no offset to to type in and TM doesn't save palettes. I was able to view the correct palette in the original rom when using TM but not the bin file.

(http://i.imgur.com/gslKSTP.jpg)
Title: Re: Megaman X Buster Upgrade
Post by: DarkSamus993 on April 18, 2017, 10:06:57 pm
Did you use an unheadered or headered rom for MMX? Also version 1.0 or 1.1 of the rom? I just got a bunch of scrambled up graphics and couldn't get any palette to load.
My rom has no header and the palette locations did not change between revisions (so 1.0 or 1.1 will both work). The scrambled graphics are because you tried to decompress at the wrong address (which tells me your rom has a header).

Not sure how you loaded the palette from just the bin file since there's no offset to to type in and TM doesn't save palettes. I was able to view the correct palette in the original rom when using TM but not the bin file.
I copied the $80 bytes of palette data (0x2C0C0-2C13F) and pasted it to the start of the decompressed gfx. Then in TM go to palette\import from\this file...
Code: [Select]
offset: 0; format: 15bpp BGR; size: 64
(http://i.imgur.com/FVo88k1.png)
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on April 19, 2017, 04:32:13 am
Thanks I was able to get the palette and sprite by adding 0x200 bytes for the header when searching for it. Although, I had some trouble because the size of the palette was actually 16 for the rom I was working on not 64, so it loaded the wrong color. Basically, what I'm trying to do is fix 2 bugs. In the MMX- Zero rom hack, that's on this site, X (who replaces Zero because Zero is now the main character) is missing half his blaster and Zero is also missing his hair. This is because Zero is 32x32 and X is 16x16 so I have to try and change the asm accordingly. I'll begin to look into the asm tomorrow. It took me longer than expected to get tile molester working properly. Oh brother (charlie brown sigh)
Title: Re: Megaman X Buster Upgrade
Post by: justin3009 on April 19, 2017, 07:38:14 am
It's not the ASM you have to worry about, it's the sprite assembly.  To have Zero display his full body and hair as a playable character you will have to move ALL of X's Sprite Assembly into a new location and accommodate for it.  Not too mention with hair, you'd have to reorganize all the graphical data to suit it.

This is where I did with X2 was just expand the ROM to X3 size and copy/paste Zero's sprite assembly and animation data into X2.  The problem that came with after that is the actual animation bytes are different between X and Zero.  So those would have to be changed too and boy there is quite a few of them.

It's not exactly hard but is 'extremely' tedious.  THAT portion is where you'd need the ASM if you went that route.  Either way, it'll be time consuming as heck.
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on April 19, 2017, 09:03:29 pm
It's not exactly hard but is 'extremely' tedious.  THAT portion is where you'd need the ASM if you went that route.  Either way, it'll be time consuming as heck.

Well the way you said it makes it seem pretty intimidating. Honestly, it's just a small bug fix that I primarily wanted to tackle to better understand how to handle hex and assembly. The previous rom I worked on I got to edit the RAM map, and injected some assembly to deal with it, but I didn't handle any graphics at all. I'll probably hold off on this for awhile and work on the MegaEd level editor. I'd probably just end up copying and pasting most of your Zero routine anyways lol. There's some assembly on Superfamicon.org that looks for locations in the rom to store 16x16 and 32x32 tiles. It loads the final address on the accumulator and someone could just pull it out during a breakpoint.

No one is really begging to play Zero on MMX1 anyways, and just spending so much time fixing a small thing without doing anything major like editing the levels seems like a waste. But I feel like now that I've started the project I should go all the way through.
Title: Re: Megaman X Buster Upgrade
Post by: pianohombre on May 10, 2017, 06:46:01 am
Lunar Compress commands:
Code: [Select]
Decompress Zero's gfx:
Usage: decomp.exe FileToDecompress FileToSaveAs OffsetToStart(h) Format1 Format2
Example: decomp MMX.sfc Zero.bin 11E4F6 102 8448

Recompress Zero's gfx:
Usage: recomp.exe FileToRecompress FileToSaveAs/InsertTo OffsetToSave(h) Format1 Format2
Example: recomp Zero.bin MMX.sfc 11E4F6 102 8448

I know it's a faux pas to revive a thread from the dead (actually it hasn't been 60-90 days yet). Although, I don't understand Lunar Compress the best. In the command-line you type the flags "Format 1" "Format 2". In your case you typed 102 8448 both for recompression and decompression. In LC documentation I saw MMX uses RLE3 compression. Is 102 just another way of writing that? What is the format 2 thing? Reason I ask is because one of the programs I'm working on has a lot of problems saving some levels. The program was meant to handle only MMX1, but was edited to work with 3 other MMX games. I'm just not sure if maybe they used a different compression algorithm for MMX2 and up. If I knew the formats I could test different compression routines and then fix the save functions.

If you'd like to see what I'm talking about it's level 7 in MMX2 with MegaEd X editor (overdrive ostrich). Basically it screws up the layout when saving so it's buggy when playing in an emulator. The RLE compression routine isn't necessarily a true RLE routine (this is documented in the LC readme), but uses bitwise operators to compress the layout. Anyways, if for some reason MMX2 uses different format to compress the layout that would explain all the bugs. Awkwardly enough, or not awkwardly if you're a computer whiz and understand all the low-level stuff the layout isn't messed up when expanding the rom and then saving.