Z64

Please login or register.

Login with username, password and session length
Advanced search  

News:

Check out and improve the wiki!

Author Topic: Majora's Mask Exit Table  (Read 4416 times)

Zant

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Majora's Mask Exit Table
« on: October 19, 2011, 02:57:04 AM »

Japanese version only right now.

It starts at 0xC77F84. The first entry should be this:

03000000 801BF2CC 801D92E0

Scene has 3 entrances. Only the first byte of the first word is significant. The others are padding.
Entrance index is at RAM offset 0x1BF2CC.
Scene name is at RAM offset 0x1D92E0.

If reading this table is to be implemented in a program, it needs a "hackish" way to follow the RAM pointers. Add 0xAB7960.

Let's check out the scene name. 0x1D92E0 + 0xAB7960 = 0xC90C40. Following 0xC90C40 in the ROM, this scene's name is Z2_SONCHONOIE. For the record, this is NOT Southern Swamp, as mislabeled by the old documentation on the wiki. This is actually the Mayor's Residence. 村長の家 (soncho no ie) translates as "mayor's house".

Now let's look at the entrance index. 0x1BF2CC + 0xAB7960 = 0xC76C2C. Following 0xC76C2C in the ROM, this is the entrance index:

801BF2C0 801BF2C4 801BF2C8

More RAM pointers! You know what to do. And finally, here's the entrances themselves pointed to by those offsets:

12 00 41 02
12 01 41 02
12 02 41 02

The format now is the same as OoT. First byte is the scene number. Second byte is the entrance number. Third byte is the fade-in value. Fourth byte is the fade-out value.

Were you to look at scene 0x12, you would discover that it is indeed the Mayor's Residence. Note that there can be more than one entry per entrance, unlike the example here. The entrance index does not always count by 4. In the case of multiple entries for each entrance, I would assume that it has something to do with the different Link forms, but I don't know what to make of them yet.

Some entrances also use peculiar scene numbers such as 0xF5, which is clearly higher than the total amount. That's another mystery at the moment. But there you go.
Logged

spinout

  • Administrator
  • Sr. Member
  • *****
  • Posts: 310
    • View Profile
    • Email
Re: Majora's Mask Exit Table
« Reply #1 on: October 19, 2011, 08:20:53 AM »

Good job. This has always been a mystery to me.
Logged
biggrin.gif

Zant

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Re: Majora's Mask Exit Table
« Reply #2 on: October 19, 2011, 11:23:43 PM »

I wrote a program to rip the scenes and maps with their names by using the exit table. Could you improve the code?

http://pastebin.com/YqPzXxqu
« Last Edit: October 20, 2011, 03:26:37 AM by Zant »
Logged

spinout

  • Administrator
  • Sr. Member
  • *****
  • Posts: 310
    • View Profile
    • Email
Re: Majora's Mask Exit Table
« Reply #3 on: October 20, 2011, 09:25:21 AM »

http://64.vg/src/49357658b6f42187d7b2a520f41c183e

I was basing it off of the version before you edited your post. I replaced most of the fgetc calls and instead read the ROM to an allocated buffer - in many cases this makes it easier on hard drives. Also added a lot of error checking code. Untested, I don't have the ROM (could you PM it to me perhaps?)
Logged
biggrin.gif

Zant

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Re: Majora's Mask Exit Table
« Reply #4 on: October 20, 2011, 07:55:46 PM »

Check your PMs. :)
Logged

spinout

  • Administrator
  • Sr. Member
  • *****
  • Posts: 310
    • View Profile
    • Email
Re: Majora's Mask Exit Table
« Reply #5 on: October 20, 2011, 08:17:59 PM »

For those other than Zant and I, the code I pasted worked just fine except that one line was off. Here is the fixed code:

http://64.vg/src/79a8566777a8d055a8b59acf15261015

D:\src>test.exe -d mm_scenes C:/users/rmo/roms/mujura_dec.z64
Skipping entry 9 (invalid)
Skipping entry 11 (invalid)
Skipping entry 12 (invalid)
Skipping entry 13 (invalid)
Skipping entry 15 (invalid)
Skipping entry 46 (invalid)
Skipping entry 55 (invalid)

D:\src>cd mm_scenes && ls | wc -l
403
« Last Edit: October 20, 2011, 11:25:01 PM by spinout »
Logged
biggrin.gif

Zant

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Re: Majora's Mask Exit Table
« Reply #6 on: October 21, 2011, 12:53:58 AM »

Logged

Zeth

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Majora's Mask Exit Table
« Reply #7 on: October 21, 2011, 05:34:22 AM »

Could this be applied to the MM Debug as well?
Logged

Zant

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Re: Majora's Mask Exit Table
« Reply #8 on: October 21, 2011, 08:07:18 PM »

Could this be applied to the MM Debug as well?
Yes. Simply change the #define statements for EXIT_TABLE, HACK, and SCENE_TABLE to 0xDECD38, 0xBDE540, and 0xDEB2B0.
Logged

Zant

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Re: Majora's Mask Exit Table
« Reply #9 on: November 15, 2011, 02:28:59 AM »

Logged

spinout

  • Administrator
  • Sr. Member
  • *****
  • Posts: 310
    • View Profile
    • Email
Re: Majora's Mask Exit Table
« Reply #10 on: August 07, 2012, 03:48:56 AM »

I just realized what you did there, Zant. Very clever.
Logged
biggrin.gif