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

Author Topic: [Help] MIPS ASM help for one MIPS hack for Majora's Mask (US v1.0)  (Read 914 times)

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1484
    • View Profile
Good day, Romhacking community.

I've been working on a LOT of small improvements for both Ocarina of Time/Majora's Mask Redux.
Ocarina of Time are mostly done by now, and Majora's Mask without a doubt has been the one that has the most effort put into it.

For Majora's Mask, I have already ported a lot of things over from the Gamecube and Japanese v1.0, and even some added features from MM 3D.

However, from the vast amount of changes I've done, I am currently stuck at the very last point I wanted to touch upon to finally finish all the changes I want to make for Majora's Mask, which is one done in Majora's Mask 3D.

This is why I'm asking for help on this last point, as I think this is the very last point that requires some MIPS assembly to get them to work for the hack I'm working on.



  • 1) Ocarina item icon, item name and item description changes depending on Link's form (from Majora's Mask 3D)
One feature that Majora's Mask 3D had over original MM was that, when you use one of the transformation masks, the Ocarina of Time item completely changes to a new instrument depending on the form.
Deku Link changes the Ocarina to the Deku Pipes, Goron Link to Goron Drums, and Zora Link to Zora Guitar (or Guitar of Waves).

Actually, the original Japanese v1.0 release of Majora's Mask (N64) had unused icons for these instruments, which is where the following assets were taken from. I modified the Deku Pipes icon myself to make it look closer to the actual pipes used by Deku Link in-game.

What's important here is to:

1) Make the "Ocarina of Time" icon in Subscreen/HUD change to the new icon instrument icon depending on Link's form.
2) Make the "Ocarina of Time" item text (that shows up when you press A on the item at the Subscreen) change to the new instrument text depending on Link's form.

Patch link:
https://www.dropbox.com/s/o4w0vrf4mzryyo6/OcarinaInstruments.bps?dl=0

Apply over a Majora's Mask v1.0 US ROM:
CRC32: b428d8a7
MD5: 2a0a8acb61538235bc1094d297fb6556

Latest findings towards this (including a cheat code for testing) and instructions on how to decompress the ROM for hacking:
https://www.romhacking.net/forum/index.php?topic=31054.msg399519#msg399519

Spoiler:
Item ID documentation:
https://wiki.cloudmodding.com/mm/Item_List#U_1.0

I documented and added the assets required for how to import the graphics to a US v1.0 (Decompressed) ROM for both the icons and my custom made item names into the ROM here:
https://www.dropbox.com/s/p8xf1bgpzf4x4mc/Instruments%20Assets.zip?dl=0

Here's a PoC in-game with the Ocarina text, icon and name properly changed with my assets (text taken directly from Majora's Mask 3D):


Now with that said, here are two important notes to take into consideration:

a) From what I know, the Deku Nuts item seems to have some quirks in its code that could help for this implementation, as the Deku Nuts description changes depending on whether Link is in human or in Deku form, so this one could be used as the basis for the automatic description change between each form/instrument.
b) For the actual item switching, once the item icon has been changed to either of the unused items depending on form, the general/global item ID for the Slingshot/Blue Fire/Hylian Loach should be treated as Item ID $00 in-game. This is due to the game having hard-coded checks for certain events for this particular item ID. This could also help so the changed items behave as the ocarina as well.


As for the item text itself, is not as important, I already have the text implemented properly as you can see in the picture.

If anyone jumps in to help with this code, whoever decides to help could instead
work over the Slingshot, Blue Fire and Hylian Loach unused items for the instrument forms, as those are the ones I have replaced so far.

If someone wants to give this a try, post in this thread, or hit me up through PM for further details!

Spoiler:
  • 2) Alien Cutscene Cow nose ring (from Majora's Mask Japanese v1.0 ROM)
This one can be found at the Majora's Mask (J) v1.0 release.
The cow that shows up in the Alien abduction cutscene when you first talk to Romani (can be done on the 1st day on any cycle) has a nose ring, while in the US v1.0 release, the nose ring was removed.
I already tried porting over both the zactor and the overlay files from the Japanese release into the American one, but I seem to be missing or I'm oblivious to the precise MIPS opcode from the overlay actor to re-implement this properly.

Info on this change listed here:
https://tcrf.net/The_Legend_of_Zelda:_Majora%27s_Mask/Program_Revision_Differences#Aliens_Cutscene

A Japanese v1.0 ROM of Majora's Mask can be used to track down the proper code for this change. My documentation on this:
Quote
For the Alien cutscene cow:
At 0x0107E200 and up to 0x0107FCA0 in a Decompressed v1.0 MM ROM, begins the zovl object "En_Invadepoh_Demo", which is the code for the Alien Invasion cutscene triggered by little Romani. From what I know, seems certain code in this overlay object needs to be modified for the cow's nose ring to show up in-game.

                                  JAP v1.0                                   /                                  USA v1.0


  • 3) The Ikana Fairy Fountain shows up with green textures instead of yellow (Fixed in PAL release)
There is a bug in the USA release of Majora's Mask regarding the Ikana Fairy Fountain.
Both the Fountains at Snowhead and Ikana have the same green textures on the walls.
The PAL release of the game seems to have fixed this issue, as it seems the green colour overwrites the yellow of the room as soon as Link enters it.

For this, a PAL v1.0 ROM of Majora's Mask could be used for tracking down the fix.
Additional info:
https://tcrf.net/The_Legend_of_Zelda:_Majora%27s_Mask#Ikana_Fairy_Fountain

                                  USA v1.0                                   /                                  PAL v1.0




This is basically the very last thing I have left to finally finish with all the Majora's Mask changes I wanted to make. For everything else, I already have proper documentation and I will be releasing all the assets with instructions and documentation on how to accomplish them, and even how to port them to other versions of Majora's Mask if desired :)

To anyone who is willing to lend a hand, I thank you in advance!
« Last Edit: August 28, 2020, 03:58:40 pm by ShadowOne333 »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1484
    • View Profile
Re: [Help] MIPS ASM help for 3 small hacks in Majora's Mask (US v1.0)
« Reply #1 on: July 30, 2020, 04:14:30 pm »
I'm still not sure how to get all of the cows' nose ring working, but I think it's related to the En_Cow object (for both MM and OoT), I am also not sure how the cutscene cow handled it yet, since I know that the cow for the specific Alien cutscene is handled by the En_Invadepoh_Demo object.
No biggie tho, I'll still continue searching around and see what I can find.



So right now, the main focus should be in the Ocarina Instruments Per-Form hack.

Please, if anyone has the skills to help out with this, I'd be really grateful!
All the work done will be properly credited as soon as these last thing is settled.
« Last Edit: August 09, 2020, 02:37:16 pm by ShadowOne333 »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1484
    • View Profile
Re: [Help] MIPS ASM help for 3 small hacks in Majora's Mask (US v1.0)
« Reply #2 on: August 06, 2020, 04:28:14 pm »
Thanks to user @Dybbles, the Ikana Canyon Fairy Fountain bug is now fixed :)
He contacted me with a cheat code he made to fix the bug:

Code: [Select]
Fix Ikana Great Fairy Fountain Glitch by Dybbles
810FADFE 010F

Given that cheat code, I did a little more work to properly implement this cheat code into a ROM patch format, and I managed to successfully make a patch for it :)

Code: [Select]
Ikana Great Fairy Fountain Bugfix.
ROM hack/patch implementation by ShadowOne333, original cheat code by Dybbles

At 0xB9133E in a Majora's Mask US v1.0 Decompressed ROM:
00 10 00 0E -> 01 0F 00 0E




And huge thanks to Dybbles for his amazing work on fixing the Ikana Fairy Fountain bug!

--------------------------------------------------------------------------------------

Aside from that, Dybbles pointed out some stuff I was completely oblivious to, and now in a collaborative effort we managed to restore the nose ring for the Cow in the Alien cutscene!
Not only that, but he also made a cheat code to enable the cows' nose ring for all cows in Majora's Mask too!
I have also made both hacks into ROM patching format :)

Cheat code:
Code: [Select]
Restore Cow Nose Ring In Alien Cutscene by Dybbles
D140EAD4 ACC0
8140EAD4 0000

Restore Nose Ring To All Cows by Dybbles
D1427AA0 ACC0
81427AA0 0000
D14162A0 ACC0
814162A0 0000
D1410560 ACC0
81410560 0000
D14162A0 ACC0
814162A0 0000

ROM hack / Patch:
Code: [Select]
Restore Cow Nose Ring In Alien Cutscene by ShadowOne333
0x107F5C4 in MM v1.0 Decompressed:
AC C0 00 00 -> 00 00 00 00

Restore Nose Ring To All Cows by ShadowOne333
0x0E10270 in MM v1.0 Decompressed:
AC C0 00 00 -> 00 00 00 00




Oh and not just that, but Dybbles also found how to enable the cow ring for the cows in Ocarina of Time as well!

Cheat code:
Code: [Select]
Restore Nose Ring To All Cows by Dybbles (OoT v1.0)
D11EABC8 ACC0
811EABC8 0000
D11E4FE8 ACC0
811E4FE8 0000
D11E33E8 ACC0
811E33E8 0000
D11E9F48 ACC0
811E9F48 0000
D11E6628 ACC0
811E6628 0000
D11E7DF8 ACC0
811E7DF8 0000
D11E3C48 ACC0
811E3C48 0000

And I managed to find it's equivalent in the ROM, if anyone wants to include it in their hacks!
The ROM change is quite small, because that code gets called each time and at different locations in RAM whenever you enter a room that has a cow actor in it. That's why the cheat code is so big, and the ROM patch is just a couple bytes changed.

ROM hack/patch:
Code: [Select]
Restore Nose Ring To All Cows by ShadowOne333 (OoT v1.0)
0x0EF3E68 in OoT v1.0 Decompressed:
AC C0 00 00 -> 00 00 00 00






Once again, huge thanks to Dybbles for his amazing work on both fixes!
With that, only the Ocarina instruments hack remains to finally finish what I want to do for Majora's Mask!
One last stretch. :)
« Last Edit: August 11, 2020, 03:02:27 pm by ShadowOne333 »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1484
    • View Profile
Re: [Help] MIPS ASM help for one MIPS hack for Majora's Mask (US v1.0)
« Reply #3 on: August 28, 2020, 11:22:12 am »
Through some more conversations with Dybbles over at Discord, I got in contact with user punk7890.

With some talks with him, he managed to make a cheat code that changes the ocarina item into the other instruments in the Subscreen when Link changes forms! This also makes the proper icons, text and item name appear properly when changed, without hiccups in the graphics or text :)
However, the code itself still presents some issues:
  • If you have the Ocarina equipped in any of the C-Buttons, then change form, the Ocarina icons remains in the HUD, instead of changing to the other instruments' icon
     
  • Tested all 3 forms, then re-selected/re-equipped the proper instrument from the Subscreen. While Goron and Zora do recognize the item as the Ocarina when used, the Deku Pipes (or any of the other instruments, including the Ocarina) instead cannot be used at all, appearing as blacked out item when in Deku Link form. In other words, right when you become Deku Link, you cannot play any instrument at all, not even the original Ocarina if equipped in a C-Button.
     
  • If you have the instrument equipped as a C Button, and then go to the Subscreen, the game detects other items (marked with a white square) as if they were the ones equipped in a C-Button, instead of always being the Ocarina/instrument the one marked as equipped:
    • Deku Pipes equipped -> Blank item selected in the item column where the Title Deeds/Moon Pearl are
    • Goron Drums equipped -> Great Fairy Mask selected as if it was equipped
    • Zora Guitar equipped -> Kafei Mask selected as if it was equipped]

Those are the last things to tackle based on the cheat code to make the Ocarina instruments fully functional.


CODE:
Now with that said, here's the cheat code punk7890 created:

Code: [Select]
Replace item properties:
D0779E2C 0014
80779E37 0014
D0779E2C 0014
80779E48 0014
D0779E2C 0014
80779E52 0014

Young Link:
D01EF690 0004
801EF6E0 0000
D01EF690 0004
D01EF6BD 000B
801EF6BD 0000
D01EF690 0004
D01EF6CD 000B
801EF6CD 0000
D01EF690 0004
D01EF6BE 000B
801EF6BE 0000
D01EF690 0004
D01EF6CE 000B
801EF6CE 0000
D01EF690 0004
D01EF6BF 000B
801EF6BF 0000
D01EF690 0004
D01EF6CF 000B
801EF6CF 0000
D01EF690 0004
D01EF6BD 001C
801EF6BD 0000
D01EF690 0004
D01EF6CD 001C
801EF6CD 0000
D01EF690 0004
D01EF6BE 001C
801EF6BE 0000
D01EF690 0004
D01EF6CE 001C
801EF6CE 0000
D01EF690 0004
D01EF6BF 001C
801EF6BF 0000
D01EF690 0004
D01EF6CF 001C
801EF6CF 0000
D01EF690 0004
D01EF6BD 0026
801EF6BD 0000
D01EF690 0004
D01EF6CD 0026
801EF6CD 0000
D01EF690 0004
D01EF6BE 0026
801EF6BE 0000
D01EF690 0004
D01EF6CE 0026
801EF6CE 0000
D01EF690 0004
D01EF6BF 0026
801EF6BF 0000
D01EF690 0004
D01EF6CF 0026
801EF6CF 0000

Deku Link:
D01EF690 0003
801EF6E0 000B
D01EF690 0003
D01EF6BD 0000
801EF6BD 000B
D01EF690 0003
D01EF6CD 0000
801EF6CD 000B
D01EF690 0003
D01EF6BD 001C
801EF6BD 000B
D01EF690 0003
D01EF6CD 001C
801EF6CD 000B
D01EF690 0003
D01EF6BD 0026
801EF6BD 000B
D01EF690 0003
D01EF6CD 0026
801EF6CD 000B
D01EF690 0003
D01EF6BE 0000
801EF6BE 000B
D01EF690 0003
D01EF6CE 0000
801EF6CE 000B
D01EF690 0003
D01EF6BE 001C
801EF6BE 000B
D01EF690 0003
D01EF6CE 001C
801EF6CE 000B
D01EF690 0003
D01EF6BE 0026
801EF6BE 000B
D01EF690 0003
D01EF6CE 0026
801EF6CE 000B
D01EF690 0003
D01EF6BF 0026
801EF6BF 000B
D01EF690 0003
D01EF6CF 0026
801EF6CF 000B
D01EF690 0003
D01EF6BF 001C
801EF6BF 000B
D01EF690 0003
D01EF6CF 001C
801EF6CF 000B
D01EF690 0003
D01EF6BF 0000
801EF6BF 000B
D01EF690 0003
D01EF6CF 0000
801EF6CF 000B

Goron Link:
D01EF690 0001
801EF6E0 001C
D01EF690 0001
D01EF6BD 000B
801EF6BD 001C
D01EF690 0001
D01EF6CD 000B
801EF6CD 001C
D01EF690 0001
D01EF6BD 0000
801EF6BD 001C
D01EF690 0001
D01EF6CD 0000
801EF6CD 001C
D01EF690 0001
D01EF6BD 000B
801EF6BD 001C
D01EF690 0001
D01EF6CD 000B
801EF6CD 001C
D01EF690 0001
D01EF6BD 0026
801EF6BD 001C
D01EF690 0001
D01EF6CD 0026
801EF6CD 001C
D01EF690 0001
D01EF6BE 000B
801EF6BE 001C
D01EF690 0001
D01EF6CE 000B
801EF6CE 001C
D01EF690 0001
D01EF6BE 0000
801EF6BE 001C
D01EF690 0001
D01EF6CE 0000
801EF6CE 001C
D01EF690 0001
D01EF6BE 0026
801EF6BE 001C
D01EF690 0001
D01EF6CE 0026
801EF6CE 001C
D01EF690 0001
D01EF6BF 0026
801EF6BF 001C
D01EF690 0001
D01EF6CF 0026
801EF6CF 001C
D01EF690 0001
D01EF6BF 0000
801EF6BF 001C
D01EF690 0001
D01EF6CF 0000
801EF6CF 001C
D01EF690 0001
D01EF6BF 000B
801EF6BF 001C
D01EF690 0001
D01EF6CF 000B
801EF6CF 001C

Zora Link:
D01EF690 0002
801EF6E0 0026
D01EF690 0002
D01EF6BD 0000
801EF6BD 0026
D01EF690 0002
D01EF6CD 0000
801EF6CD 0026
D01EF690 0002
D01EF6BD 000B
801EF6BD 0026
D01EF690 0002
D01EF6CD 000B
801EF6CD 0026
D01EF690 0002
D01EF6BD 001C
801EF6BD 0026
D01EF690 0002
D01EF6CD 001C
801EF6CD 0026
D01EF690 0002
D01EF6BE 0000
801EF6BE 0026
D01EF690 0002
D01EF6CE 0000
801EF6CE 0026
D01EF690 0002
D01EF6BE 000B
801EF6BE 0026
D01EF690 0002
D01EF6CE 000B
801EF6CE 0026
D01EF690 0002
D01EF6BE 001C
801EF6BE 0026
D01EF690 0002
D01EF6CE 001C
801EF6CE 0026
D01EF690 0002
D01EF6BF 0000
801EF6BF 0026
D01EF690 0002
D01EF6CF 0000
801EF6CF 0026
D01EF690 0002
D01EF6BF 000B
801EF6BF 0026
D01EF690 0002
D01EF6CF 000B
801EF6CF 0026
D01EF690 0002
D01EF6BF 001C
801EF6BF 0026
D01EF690 0002
D01EF6CF 001C
801EF6CF 0026

All credit for the code goes to punk7890!



Patch:
Seeing how the whole graphics implementation stuff might be somewhat odd for most users, I decided to create a BPS patch so that whoever wants to help with this, can simply patch a Majora's Mask US v1.0 ROM, apply the BPS, and then test the cheat code and/or do any subsequent changes.

Patch link:
https://www.dropbox.com/s/o4w0vrf4mzryyo6/OcarinaInstruments.bps?dl=0

Apply over a Majora's Mask v1.0 US ROM:
CRC32: b428d8a7
MD5: 2a0a8acb61538235bc1094d297fb6556

If whoever decides to tackle this hack directly into the ROM's code, you can use a tool called "ndec", which decompressed both OoT and MM ROMs to their full 64MB size:
http://www.mediafire.com/file/od4y72l0r57d7tl/newdec.7z/file

To use it, simply open CMD and type:
Code: [Select]
ndec.exe inrom outrom [-clean]That should generate a full 64MB ROM out of the 32MB one.
As for the game code, once you decompress the ROM, it begins at 0xB3C000 and ends at 0xC7A4E0 in the decompressed ROM. So whoever wants to tackle this, that's the range or the game code to look for. :)
« Last Edit: August 28, 2020, 03:19:38 pm by ShadowOne333 »