Actor Replacement

From CloudModding MM Wiki
Jump to: navigation, search

This tutorial will show you how to replace any actor, object, or variable in the game, with the exception of those which are dynamically spawned.

Reference Material

Finding Room Headers

To find room headers, you'll need a memory viewer. If your emulator doesn't come with one, enable the audio debugger and use its "memory dump" page.

  1. Open the specific version of Majora's Mask you're making codes for.
  2. Go to the room you whose header you wish to find.
  3. Go to 80460DEC (Debug ROM) in the memory viewer
    • If not using the debug ROM, check the Room Pointers page for the version you are using.
  4. Go to the address at this location (4 bytes long, starts with 80) in the memory viewer.
  5. This will bring you to the room header.

Understanding Room Headers

More details about these commands can be found on the Scenes and Rooms page.

18000000 bboooooo
16000000 000000yy 08xx0000 0000yyzz
12000000 xx010000 10000000 xxxxyy00
0A000000 bboooooo 0Bxx0000 bboooooo
01xx0000 bboooooo 14000000 00000000
  • Alternate Setups List: 18000000 bboooooo
    • Optional. If it doesn't exist, the scene only has one setup. If it does exist, it will have multiple scene setups
  • Sound Settings: 16000000 000000yy
    • y sets the echo level of the sound effects
  • Room Behavior Settings: 08xx0000 0000yyzz
    • x and z affect various properties, such as Link's idling animation. This command hasn't been fully documented yet.
  • Skybox Settings: 12000000 xx000000
    • If x ≠ 0, the skybox will be disabled.
  • Time Settings: 10000000 xxxxyy00
    • x sets the time of day when entering the room.
      • If x = FFFF, the room defaults to the current game time.
    • y sets the speed at which time flows. The value can be negative.
  • Mesh Header Location: 0A000000 bboooooo
    • b is the bank index. 03 is used to reference the current room file.
    • o is the location of the room's mesh header, relative to the start of the file. This renders the room's model.
      • room header address + o = location of mesh header
  • Object List: 0Bxx0000 bboooooo
    • x indicates the number of objects.
    • b is the bank index. 03 is used to reference the current room file.
    • o is the location of the room's object list, relative to the start of the file.
      • room header address + o = location of object list
  • Actor List: 01xx0000 bboooooo
    • x indicates the number of actors.
    • b is the bank index. 03 is used to reference the current room file.
    • o is the location of the room's actor list, relative to the start of the file.
      • room header address + o = location of actor list
  • End of Header Command: 14000000 00000000
    • This command tells the game that the header ends here.

Understanding Actor Lists

Each line represents a different actor.

aaaaxxxx yyyyzzzz ccddee0B 0000vvvv
aaaaxxxx yyyyzzzz ccddee00 0000vvvv
aaaaxxxx yyyyzzzz ccddee9F 0000vvvv
aaaaxxxx yyyyzzzz ccddee00 0000vvvv
aaaaxxxx yyyyzzzz ccddee00 0000vvvv
aaaaxxxx yyyyzzzz ccddee00 0000vvvv
aaaaxxxx yyyyzzzz ccddee00 0000vvvv
  • aaaa = Actor Number
  • xxxx = X Coordinates (Hex)
  • yyyy = Y Coordinates (Hex)
  • zzzz = Z Coordinates (Hex)
  • cc = X Rotation (Hex)
  • dd = Y Rotation (Hex)
  • ee = Z Rotation (Hex)
  • vvvv = Variable Number

Understanding Object Lists

Each group of four digits/two bytes (ex. 01A5) comprises an object number. If a room has an odd number of objects (05 in this example), you only need to pay attention to the first five groups of four digits.

aaaabbbb ccccdddd eeee0000 0163FFC8
  • aaaa = Object #1
  • bbbb = Object #2
  • cccc = Object #3
  • dddd = Object #4
  • eeee = Object #5
  • 0000 = Padding

Look up the object numbers here.

Tutorial: Replacing the Happy Mask Salesman in the Clock Tower

What You'll Need

  1. Majora's Mask Debug ROM
  2. Hex Calculator

Open Windows Calculator, change it to "Programmer" mode, and press the Hex button. Or, use an online calculator like this one.

Room Header

Finding the Room Header

  1. Go to Clock Tower Interior (Map 53-0 in Map Select) as Child Link.
  2. Go to 80460DEC in the memory viewer.
  3. The address at that location will be 80588CB0, go to that location in the memory viewer.
  4. You will now see the room header for the Clock Tower Interior

Deciphering the Room Header

Below is the room header for Mido's House, located at 80588CB0. Use it to find the number of scene setups, the number of objects, the address of the object list, the number of actors, and the address of the actor list.

16000000 0000000A 08010000 00000000
12000000 01010000 10000000 FFFF0000
0A000000 03000110 0B060000 03000040
010C0000 0300004C 14000000 00000000
  • Scene Settings: xx000000 000000yy
    • If xx = 16, the room has one scene setup.
    • If xx = 18, the room has multiple scene setups.
xx = 16 - Mido's house has one scene setup.
  • Object List: 0Bxx0000 000000yy
    • xx indicates the number of objects.
    • yy is the location of the room's object list.
      • room header address + yy = location of object list
xx = 06 - There are 06 objects in the room.
yy = 40 - The location of the object list is 80588CB0 + 40, which is 80588CF0.
  • Actor List: 01xx0000 000000yy
    • xx indicates the number of actors.
    • yy is the location of the room's actor list.
      • room header address + yy = location of actor list
xx = 0C - There are 0C actors in the room.
yy = 4C - The location of the actor list is 80588CB0 + 4C, which is 80588CFC.

Actors

Finding the Actor List

  1. Go to 80588CFC, the location of the actor list, in the memory viewer.
  2. Look up the actor numbers.
  3. Look up the variables.
  4. Replace them with whatever you want.

Deciphering the Actor List

Below is the actor list for the Clock Tower Interior, located at 80588CFC. Each line represents an actor. The Clock Town Interior has 0C actors, so there are 0C lines.

01950000 FFE2FFE3 0007007F 007F0000
01B5FF96 FFE2FFB1 0007078B 007F0000
01A20000 002D0120 00075A7F 007F0000
01B60000 FFE2FF38 0007007F 007F0003
01B6009B 01860000 0007007F 007F0000
01B6FF65 01860000 00075A7F 007F0000
01B60000 00500000 0007007F 007F0001
01B60000 FEF2FFC8 0007007F 007F0002
0061FFD3 FED4FD3A 00070009 007F0002
0061002D FED4FD3A 00070009 007F0001
01920000 002D00DA 00075A7F 007F0000
60D80000 003C0122 1687000A 007F0000

The first four digits in each line comprise an actor number. Cross-reference them with this list.

Actor # Filename Actor ID X Y Z Variable # Variable ID Object #
0163 ovl_En_Ko Kokiri Child FFC8 0010 0080 FF04  ??? 0001
016D ovl_En_Md Mido 0003 0030 0086 FF00  ??? 00FB
0163 ovl_En_Ko Kokiri Child FF83 000C 0048 FF00  ??? 0001
000A ovl_En_Box Treasure Chest 003A 0000 FFC9 59A0  ??? 000E
000A ovl_En_Box Treasure Chest 003A 0000 0023 59A1  ??? 000E
000A ovl_En_Box Treasure Chest FFC4 0000 FFC9 5982  ??? 000E
000A ovl_En_Box Treasure Chest FFC4 0000 0023 5903  ??? 000E

Replacing Actors

  1. Find the actor number of the actor you wish to replace.
    • Let's replace the Happy Mask Salesman in line 2. (01B5)
  2. Find the actor number of the actor you wish to replace it with.
    • Let's replace the treasure chest (01B5) with a sign (00A8).
  3. Overwrite the old actor number with the new one.
    • 01B5FF96 FFE2FFB1 0007078B 007F0000 -> 00A8FF96 FFE2FFB1 0007078B 007F0000
    • Since the actor is one line 2, it starts at 80588CFC + 10 * 1 = 80588D0C. The gameshark code to do the replacement is 81588D0C 00A8.
      • The 81 in the gameshark code instead of 80 is for setting a 2-byte number. It's the same address.
  4. Find the variable number of the actor you wish to replace.
    • The variable of the Happy Mask Salesman in line 2 is 0000.
  5. Find the variable number you will use for the new actor.
    • Let's make our sign say "I'll be on vacation for a short while". (0010)
  6. Overwrite the old variable number with the new one.
    • 00A8FF96 FFE2FFB1 0007078B 007F0000 -> 00A8FF96 FFE2FFB1 0007078B 007F0010
    • The variable is at 80588CFC + 10 * 1 + 0E = 80588D1A. The gameshark code to do the replacement is 81588D1A 0010.

Objects

Finding the Object List

  1. Type 802628C0, the location of the object list, into the address box.
    • This will bring you to 802628C0, where you'll find a list of objects.
  2. Look up the object numbers.
  3. Replace them with whatever you want.

Deciphering the Object List

Below is the object list for Mido's House, located at 80588CF0. Each group of four digits comprises an object number. Cross-reference them with this list. Mido's House has 05 objects, so we only need to pay attention to the first five groups of four digits.

0088 0197 0051 01A3 01BD 01C8 0195 0000

These numbers correspond to the following:

Object # Filename Object ID
00C5 object_os_anime Required by human-like npcs
00FC object_km1 Strawberry-Haired Kokiri Boy
00FD object_kw1 Strawberry-Haired Kokiri Girl
00FB object_md Mido
000E object_box Treasure Chest/Boss Key Chest/Light When Opening Chest

Replacing Objects

  1. Use the Actor List to find the object linked to the actor you wish to replace.
    • We've chosen to replace the Happy Mask Salesman, which is linked to object 01A3.
  2. Use the Actor List to find the object linked to the actor you wish to replace it with.
    • We've chosen to replace the Happy Mask Salesman (object 01A3) with a sign (object 00FC).
  3. Overwrite the old object number with the new one.
    • 00880197 005101A3 01BD01C8 01950000 -> 00880197 005100FC 01BD01C8 01950000
    • Since this is the 4th object number, it's located at 80588CF0 + 02 * 03 = 80588CF6. The gameshark code to do the replacement is 81588CF6 00FC

Gameshark Codes

Debug ROM

Happy Mask Salesman in Clock Tower Interior

81588CF6 oooo
81588D0C aaaa
81588D1A vvvv

For objects 0000 and 0001, either remove the object line, or set it to some other object. Actors using objects 0002 and 0003 can't be used with this code.

Owl Statue Replacements

For all of the following codes, objects 0000 and 0002 can't be set on the object line (that line must be removed or set to some other object), and actors using objects 0001 and 0003 can't be used with these codes.

Southern Swamp

This code changes the owl statue in the initial area of the swamp.

815539B0 oooo
81553C40 aaaa
81553C4E vvvv
Mountain Village (Winter)

This code changes the owl statue in the initial area of the Mountain Village, during winter only.

8157D4F4 oooo
8157D750 aaaa
8157D75E vvvv
Great Bay

This code changes the owl statue on the platform under the Marine Research Lab.

81559B44 oooo
81559F00 aaaa
81559F0E vvvv
Ikana Canyon

This code changes the owl statue in the canyon, on the other side of the river.

8154C0B4 oooo
8154C464 aaaa
8154C472 vvvv