Dan Salvato
IE
This is not a user-friendly guide.
Unless you are an experienced user, please
do not expect to get anything out of this.
Unless you are an experienced user, please
do not expect to get anything out of this.
Alright, so I started exploring stage files recently, and this thread will serve as an info dump for everything I have learned and discovered.
Note that most of the information currently in this thread has likely been discovered by others (such as Tcll and Milun), but sadly, there is no existing documentation, so I am re-discovering everything.
Stage files are prefixed by "Gr". Here is a list of all stage files:
[COLLAPSE="Stage files"]
Code:
FILE STAGE
GrBb.dat Big Blue
GrCn.dat Corneria (JP)
GrCn.usd Corneria (US)
GrCs.dat Princess Peach's Castle
GrEF1.dat Trophy 1
GrEF2.dat Trophy 2
GrEF3.dat Trophy 3
GrFs.dat Fourside
GrFz.dat Flat Zone
GrGb.dat Great Bay
GrGd.dat Kongo Jungle
GrGr.dat Green Greens
GrHe.dat All-Star safe room
GrHr.dat Home-Run Contest (JP)
GrHr.usd Home-Run Contest (US)
GrI1.dat Mushroom Kingdom
GrI2.dat Mushroom Kingdom 2
GrIm.dat Icicle Mountain
GrIz.dat Fountain of Dreams
GrKg.dat Jungle Japes
GrKr.dat Brinstar Depths
GrMc.dat Mute City
GrNBa.dat Battlefield
GrNBr.dat F-Zero adventure mode race
GrNFg.dat Bonus Stage (collect trophies)
GrNKr.dat Mushroom Kingdom adventure mode stage
GrNLa.dat Final Destination
GrNPo.dat ??
GrNSr.dat Hyrule adventure mode stage
GrNZr.dat ??
GrOk.dat Kongo Jungle 64
GrOp.dat Dream Land 64
GrOt.dat Onett (JP)
GrOt.usd Onett (US)
GrOy.dat Yoshi's Story 64
GrPs.dat Pokemon Stadium (JP)
GrPs.usd Pokemon Stadium (US)
GrPs1.dat Pokemon Stadium transform 1
GrPs2.dat Pokemon Stadium transform 2
GrPs3.dat Pokemon Stadium transform 3
GrPs4.dat Pokemon Stadium transform 4
GrPu.dat Poke Floats
GrRc.dat Rainbow Cruise
GrSh.dat Hyrule Temple
GrSt.dat Yoshi's Story
GrTCa.dat TT: Captain Falcon
GrTCl.dat TT: Young Link
GrTDk.dat TT: Donkey Kong
GrTDr.dat TT: Dr. Mario
GrTe.dat "TEST" stage
GrTFc.dat TT: Falco
GrTFe.dat TT: Roy
GrTFx.dat TT: Fox
GrTGn.dat TT: Ganondorf
GrTGw.dat TT: Mr. Game & Watch
GrTIc.dat TT: Ice Climbers
GrTKb.dat TT: Kirby
GrTKp.dat TT: Bowser
GrTLg.dat TT: Luigi
GrTLk.dat TT: Link
GrTMr.dat TT: Mario
GrTMs.dat TT: Marth
GrTMt.dat TT: Mewtwo
GrTNs.dat TT: Ness
GrTPc.dat TT: Pichu
GrTPe.dat TT: Peach
GrTPk.dat TT: Pikachu
GrTPr.dat TT: Jigglypuff
GrTSk.dat TT: Sheik (test stage)
GrTSs.dat TT: Samus
GrTYs.dat TT: Yoshi
GrTZd.dat TT: Zelda
GrVe.dat Venom (JP)
GrVe.usd Venom (US)
GrYt.dat Yoshi's Island
GrZe.dat Brinstar
For practice or testing, I recommend "GrTFe.dat", Roy's Target Test stage. It's the second smallest stage, and it's better than "GrTSk.dat" because it actually has textures and multiple stage objects. Any examples I list in this post will reference GrTFe.dat, so feel free to follow along.
IMPORTANT NOTE: Add 0x20 to ALL pointers unless otherwise specified, because the file header is 0x20 in size.
[Header and String Table]
Code:
HEADER
00: File size
04: Pointer to pointer table
08: Number of pointer table entries
0C: Number of bases (those strings at the bottom)
10: Number of refs (?)
14: Stages have '30 30 31 42' here, a couple other files do as well
20: Data starts here
Go to offset (pointer to pointer table) + (number of pointer table entries * 4)
For instance, in GrTFe.dat:
Pointer to pointer table: 00 01 6F E0
Number of pointer table entries: 00 00 02 2B
(16FE0) + (22B * 4) = 1788C
So, the string table starts at 1788C (Remember to add 0x20, to get 178AC). To check your work, the value there is: 00 01 3D B0
So, now you have the string table. It works like this:
Code:
0: Pointer to data
4: String offset
By "String offset" I mean the number of bytes from the start of the first string. So, the first letter of the first string is offset 00. Here is the string table for GrTFe.dat:
Code:
00 01 3D B0 00 00 00 00 ALDYakuAll
00 01 64 00 00 00 00 0B GrdTargetBack00_CMPR_image
00 01 54 00 00 00 00 26 GrdTargetEmblemFloorA_CMPR_image
00 01 4C 00 00 00 00 47 GrdTargetEmblemFloorB_CMPR_image
00 01 5C 00 00 00 00 68 GrdTargetEmblemFloorD_CMPR_image
00 01 3C 1C 00 00 00 89 coll_data
00 01 3C AC 00 00 00 93 grGroundParam
00 01 3D 88 00 00 00 A1 itemdata
00 00 01 60 00 00 00 AA map_head
00 01 49 00 00 00 00 B3 map_plit
00 01 6F C8 00 00 00 BC quake_model_set
00 01 3D 90 00 00 00 CC yakumono_param
[map_head]
I don't yet fully understand this format, but this is everything I know.
This area contains object and arena information, including:
-Object nodes for stage elements (holding size, position, and properties of each object)
-Blast zones and camera boundaries
-Spawn and halo locations
This does NOT contain collision data, so moving a platform with this alone will not work. However, aesthetic elements that do not have collision boxes can be moved freely.
To edit stage elements, you travel like this:
map_head --> object group --> head node --> keep going to "child" or "next" nodes until you find the one you want to edit
In our GrTFe.dat example, our string table tells up map_head is at: 00 00 01 60. So, go to address 0x180 (since we add 0x20) to get object group pointers. You'll find a format like this:
Code:
0: Pointer to object group
4: ID?
Code:
00 00 00 54 00 00 00 02
00 00 00 74 00 00 00 03
So, now we go to our object groups. The object group follows this format:
Code:
0: Pointer to head node
4: ??
8: ??
Code:
00 00 C9 88 00 00 00 00 00 00 00 0E
Code:
00 01 49 E0 00 00 00 00 00 00 00 00
For our example, let's go to 0x149E0. This is the node tree for a bunch of stage-related nodes, including camera boundaries, blast zones, character spawns, halo spawns, and item spawns. I figured this out by trial and error, but I'm pretty sure there's some kind of ID or label in the stage file that tells you what's what - I just have yet to find it.
The node structure looks like this:
Code:
0: Empty
4: flags
8: pointer to child node
C: pointer to next node
10: pointer to node data
14: RotateX
18: RotateY
1C: RotateZ
20: SizeX
24: SizeY
28: SizeZ
2C: LocationX
30: LocationY
34: LocationZ
38: inverse (??)
3C: Empty
Usually, the head node contains a "child" but not a "next". Changing values in the head node affect its child nodes as well, so this is usually undesirable as you're moving around the whole stage instead of just single elements. Some more complex stages might contain a more complex hierarchy with multiple parent/child nodes, but I haven't seen this yet. Generally, the head node branches to a "child" and from there, you see no more children, but all "next" nodes. The last node has no child and no next, so that's how you know you've reached the end of the node tree.
I don't yet know what the flags are for.
Here is my map of node tree 0x149E0 in GrTFe.dat; see if you can follow along. Again, I determined what node does what simply by changing values and loading the stage to see what's different.
[COLLAPSE="GrTFe.dat Node Tree 1"]
Code:
Node 1 (Parent Object)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: 14A20
Next: None
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 00
LZ: 00
inverse: 00
Unk2: 00
Node 2 (??)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 14A60
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 00
LZ: 00
inverse: 00
Unk2: 00
Node 3 (Left/top camera boundary)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 14AA0
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C320
LY: 433E
LZ: 00
inverse: 00
Unk2: 00
Node 4 (Right/bottom camera boundary)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 14AE0
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 430C
LY: C2F0
LZ: 00
inverse: 00
Unk2: 00
Node 5 (Left/top blast zone)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 14B20
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C348
LY: 4352
LZ: 00
inverse: 00
Unk2: 00
Node 6 (Right/bottom blast zone)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 14B60
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 4334
LY: C320
LZ: 00
inverse: 00
Unk2: 00
Node 7 (Spawn point 1)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 14BA0
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 4170
LZ: 00
inverse: 00
Unk2: 00
Node 8 (Halo point 1)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: None
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 41A0
LZ: 00
inverse: 00
Unk2: 00
More complex stages contain more nodes, such as more player spawns, more player halos, and item spawns. Again, I have no idea how the game determines which node is which, especially when different stages have different numbers of nodes in different orders.
As reference, here is Mushroom Kingdom II which contains a more complex node tree, with more spawns.
[COLLAPSE="GrI2.dat Node Tree 1"]
Code:
Node 1 (Parent object)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: 15EC8
Next: None
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 3649539C
LY: B68637BD
LZ: 00
inverse: 00
Unk2: 00
Node 2 (??)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 15F08
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 00
LZ: 00
inverse: 00
Unk2: 00
Node 3 (Left/top camera boundary)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 15F48
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C316
LY: 4310
LZ: 00
inverse: 00
Unk2: 00
Node 4 (Right/bottom camera boundary)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 15F88
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 4318
LY: C238
LZ: 00
inverse: 00
Unk2: 00
Node 5 (Left/top blast zone)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 15FC8
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C356
LY: 4372
LZ: 00
inverse: 00
Unk2: 00
Node 6 (Right/bottom blast zone)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16008
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 4356
LY: C2E4
LZ: 00
inverse: 00
Unk2: 00
Node 7 (Item spawn 1?)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16048
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 41F00002
LZ: 00
inverse: 00
Unk2: 00
Node 8 (Item spawn 2?)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16088
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C1F0
LY: 41F00002
LZ: 00
inverse: 00
Unk2: 00
Node 9 (Item spawn 3?)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 160C8
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 41F0
LY: 41F00002
LZ: 00
inverse: 00
Unk2: 00
Node 9 (Item spawn 4?)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16108
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C2B4
LY: 42700001
LZ: 00
inverse: 00
Unk2: 00
Node 10 (Item spawn 5?)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16148
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 42B4
LY: 42700001
LZ: 00
inverse: 00
Unk2: 00
Node 11 (Item spawn 6?)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16188
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C307
LY: 42A00001
LZ: 00
inverse: 00
Unk2: 00
Node 12 (Item spawn 7?)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 161C8
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 4307
LY: 42A00001
LZ: 00
inverse: 00
Unk2: 00
Node 12 (Spawn point 1)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16208
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C1F00002
LY: 40E00000
LZ: 00
inverse: 00
Unk2: 00
Node 13 (Spawn point 2)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16248
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 41F00000
LY: 40E00000
LZ: 00
inverse: 00
Unk2: 00
Node 14 (Spawn point 3)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16288
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: C2BE0000
LY: 42140000
LZ: 00
inverse: 00
Unk2: 00
Node 15 (Spawn point 4)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 162C8
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 42BE0000
LY: 42140000
LZ: 00
inverse: 00
Unk2: 00
Node 16 (Halo point 1)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16308
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 42960000
LZ: 00
inverse: 00
Unk2: 00
Node 17 (Halo point 2)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16348
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 42960000
LZ: 00
inverse: 00
Unk2: 00
Node 18 (Halo point 3)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: 16388
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 42960000
LZ: 00
inverse: 00
Unk2: 00
Node 19 (Halo point 4)
Unk1: 00 00 00 00
Flags1: 00 00 00 08
Child: None
Next: None
Data ptr?: 00
RX: 00
RY: 00
RZ: 00
SX: 3F80
SY: 3F80
SZ: 3F80
LX: 00
LY: 42960000
LZ: 00
inverse: 00
Unk2: 00
Also note that I listed many XYZ values as 16-bit values instead of 32-bit. I did this to be concise. "3F80" is really "3F800000", for example.
There are always at least two object groups, one for stage objects and another for camera, blast zone, and spawn objects. The only way I currently know to figure out which is which is simply by experimenting; change the size or position of objects, load the level, and see what changes. Using the Dolphin emulator, save states, and an extracted Melee iso, this can be done quite rapidly. However, I hope to soon figure out how the stage file knows which node is which, and I will write here when I do.
[grGroundParam]
I am currently working on deciphering the values of the grGroundParam section. I haven't yet figured out what all the values are for. Here is a table of grGroundParam values from GrTFe.dat which I will regularly update with my findings. Values with a "?" are ones which have not yet been verified.
[COLLAPSE="GrTFe.dat grGroundParam table"]
Code:
000 3F 80 00 00 Entire stage size
004 00 C0 00 00
008 00 0A 00 00
00C 00 00 03 20
010 00 00 04 4C
014 FF FF FF F6 ?Minimum tilt & tilt scaling
018 00 00 00 00 ?Horizontal rotation factor
01C 00 00 00 00 ?Vertical rotation factor
020 40 00 00 00 "Fixed"-ness of camera - higher is more fixed
024 3F 80 00 00 ?Character bubble buffer multiplier OR character bubble front mult.
028 3F E6 66 66 Camera speed smoothness - higher is tighter
02C 00 00 00 0A ?Unknown 1
030 00 00 05 78 ?Pause minimum Z position
034 00 00 05 DC ?Pause initial Z position
038 00 00 05 DC ?Pause max Z position
03C 00 00 00 00
040 00 00 00 00 ?Pause max angle up
044 00 00 00 00 ?Pause max angle left
048 00 00 00 00 ?Pause max angle right
04C 00 00 00 00 ?Pause max angle down
050 C1 70 00 00 ?Unknown 3
054 42 F0 00 00 ?Unknown 4
058 43 F5 00 00 ?Unknown 5
05C 41 F0 00 00 ?Unknown 6
060 C1 00 00 00
064 00 00 00 00
068 00 00 00 00
06C 00 00 00 00
070 00 00 00 00
074 00 00 00 00
078 00 00 00 00
07C 00 00 00 00
080 00 00 00 00
084 00 00 00 00
088 00 00 00 00
08C 00 00 00 00
090 00 00 00 00
094 00 00 00 00
098 00 00 00 00
09C 00 00 00 00
0A0 00 00 00 00
0A4 00 00 00 00
0A8 00 00 00 00
0AC 00 00 00 00
0B0 00 01 3C 48 Pointer to ? table
0B4 00 00 00 01 Number of entries in ? table
0B8 07 00 2A FF Bubble color - top left
0BC 07 00 2A FF Bubble color - top middle
0C0 07 00 2A FF Bubble color - top right
0C4 00 07 36 FF Bubble color - sides top
0C8 00 07 36 FF Bubble color - sides middle
0CC 00 07 36 FF Bubble color - sides bottom
0D0 00 12 33 FF Bubble color - bottom left
0D4 00 12 33 FF Bubble color - bottom middle
0D8 00 12 33 FF Bubble color - bottom right
0DC 00 01 48 60
0E0 00 00 00 00
0E4 00 00 00 00
0E8 2C 00 00 06
0EC 03 00 00 00
0F0 00 00 00 00
0F4 05 06 40 00
0F8 05 00 00 07
0FC 10 F4 50 00
000 00 00 00 00
104 00 00 00 00
108 00 01 3D 94
10C 00 00 00 00
110 00 00 00 00
114 42 84 5D F5
118 43 05 4B E4
11C 44 67 7F 7A
120 00 00 00 00
124 00 00 00 00
128 42 84 5D F5
12C 42 21 2D 5C
130 C0 80 F1 24
134 00 00 00 00
138 00 00 00 00
13C 00 00 00 01
140 00 00 02 80
144 00 00 01 E0
148 00 00 02 80
14C 00 00 01 E0
150 00 01 3D BC
154 00 01 3D D0
158 00 00 00 00
15C 00 00 00 00
160 3D CC CC CD
164 47 00 00 00
168 41 D8 00 00
16C 3F 97 0A 3D
170 00 01 3D E4
174 00 00 00 00
178 00 00 00 00
17C 42 84 5D F5
180 43 0A 4B E4
184 44 67 7F 7A
188 00 00 00 00
18C 3F 7D 70 A4
190 46 1C 40 00
194 00 00 00 03
198 00 00 00 00
19C 00 00 00 00
1A0 00 0E 00 00
1A4 FF FF FF FF
1A8 00 01 3E 24
1AC 00 00 00 00
1B0 00 01 3E 38
1B4 00 01 3E 44
1B8 00 00 00 00
1BC 00 00 00 00
1C0 00 00 00 00
1C4 00 04 00 00
1C8 CC CC CC FF
1CC 00 00 00 00
1D0 00 00 00 00
1D4 00 00 00 00
1D8 00 01 3E 68
1DC 00 00 00 00
1E0 00 01 3E 84
1E4 00 01 3E 60
1E8 00 00 00 00
1EC 00 00 00 00
1F0 00 00 00 00