Debug mode: Difference between revisions

From Ukikipedia
Jump to navigation Jump to search
m (MMMMMMMMMMMMM moved page Debug Mode to Debug mode: Sentence casify the wiki)
mNo edit summary
 
Line 436: Line 436:
While the ‘classic display’ shows some variable on a fixed position, there is also a whole system for automatically laying out debug text. The state is stored in a struct:
While the ‘classic display’ shows some variable on a fixed position, there is also a whole system for automatically laying out debug text. The state is stored in a struct:


<syntaxhighlight lang="c">
     typedef struct  
     typedef struct  
     {
     {
Line 445: Line 446:
     short line_y_offset, //0x0A equals -15 (top aligned) or +15 (bottom aligned)
     short line_y_offset, //0x0A equals -15 (top aligned) or +15 (bottom aligned)
     } DprintState;
     } DprintState;
</syntaxhighlight>


There are two of these states, one in the top left corner growing down, and one in the bottom right corner growing up. Note that (0, 0) is the bottom left corner and (320, 240) is the top right corner. Now whenever the developers wanted to show a certain variable, they would call a function that automatically ensures it doesn’t overlap with other variables.
There are two of these states, one in the top left corner growing down, and one in the bottom right corner growing up. Note that (0, 0) is the bottom left corner and (320, 240) is the top right corner. Now whenever the developers wanted to show a certain variable, they would call a function that automatically ensures it doesn’t overlap with other variables.

Latest revision as of 07:34, 18 June 2024

The Debug Mode was a mode used by the developers to test out various features and to find bugs.

Classic Debug Display

This debug menu was one of the first found in-game with the use of a GameShark. It displays information on Mario's angle, speed, and action, as well as memory info.

Access

To enable the classic debug display, enter the appropriate Gameshark code for your version of the game.

Japan USA Europe Japan (Shindou)
A032C658 0059
A032D598 0059
A02F9748 0059
A030CCC8 0059

Items

Label Meaning Description
ANG Angle ANG is the slope of the ground in degrees (0 = flat, 90 = vertical)
SPD Speed SPD is Mario’s forward velocity.
STA State STA is the last 9 bits of Mario’s state variable.
MEM Memory Current RAM usage.
BUF Buffer BUF is how many bytes are left in the draw buffer. Display lists and transformation matrices are allocated and freed every frame.

Complex Debug Display

This more comprehensive debug display depicts everything from map information to the current number of loaded objects. There also an unused function in the game’s code that toggles between the two debug modes when you enter a button sequence on the D-pad: Up up down down left right left right toggles a profiler Down down up up left right left right toggles some variable displays, dubbed ‘classic debug’

Access

To enable the complex debug display, enter the appropriate Gameshark code for your version of the game.

Japan USA Europe Japan (Shindou)
8033BEF3 0001
D0339C30 0008
8032FF34 0001
D0339C30 0001
8032FF34 0002
D0339C30 0004
8032FF34 0003
D0339C30 0002
8032FF34 0004
D0339C31 0020
8032FF34 0005
8033D263 0001
D033AFA0 0008
80330E94 0001
D033AFA0 0001
80330E94 0002
D033AFA0 0004
80330E94 0003
D033AFA0 0002
80330E94 0004
D033AFA1 0020
80330E94 0005
8030AE93 0001
D0309260 0008
802FD054 0001
D0309260 0001
802FD054 0002
D0309260 0004
802FD054 0003
D0309260 0002
802FD054 0004
D0309261 0020
802FD054 0005
8031F423 0001
D031D560 0008
803105C4 0001
D031D560 0001
803105C4 0002
D031D560 0004
803105C4 0003
D031D560 0002
803105C4 0004
D031D561 0020
803105C4 0005

Options

D-Right - Map Info

Press D-Right to display the "MAPINFO" screen.

Option Meaning Description Notes
AREA Area What cell of the collision grid Mario is in.
WX World X Mario's current X coordinate.
WY World Y Mario's current Y coordinate.
WZ World Z Mario's current Z coordinate.
BGY Boundary Ground Y Y coordinate of the ground below Mario.
ANGY Angle Y Y angle of the ground below Mario.
BGCODE Boundary Ground Code Type of the triangle below Mario. Terrain types can denote slipperiness, camera mode, special properties (sand, snow, wind, water flow), special triangles (painting entrances)
BGSTATUS Boundary Ground Status Status bits of the triangle below Mario. 1 means the triangle is part of an object, 2 means the camera won't collide with this triangle. 3 means both apply.
BGAREA Boundary Ground Area Which room the floor triangle belongs to. In the castle, Hazy Maze Cave and Big Boo's haunt the area is split up into rooms which are defined by this property of triangles.
DPRINT OVER Debug Print Overflow Appears when text doesn't fit on the screen anymore.
WATER Water level Y coordinate of the surface of the water if Mario is standing or swimming in it Only appears when you ensure DPRINT OVER doesn't happen
OBJ Objects Number of objects currently loaded. Only appears when you ensure DPRINT OVER doesn't happen

D-Down - Stage Info

Press D-Down to display the "STAGEINFO" screen.

Option Meaning Description Notes
STAGE PARAM Stage Parameter At what time you entered Tick-Tock Clock. 0 means that the long hand was pointing to 3, resulting in slow time; 1 means that the long hand was pointing to 9, resulting in fast time; 2 means that the long hand was pointing to 6, resulting in things moving at random; 3 means that the long hand was pointing to 12, resulting in a still stage.
OBJ Objects Number of objects currently loaded.

D-Left - Effect Info

Press D-Left to display the "EFFECTINFO" screen.

Option Meaning Description Notes
A ? Currently unknown. Value does not seem to change.
A0 ? Currently unknown. Value does not seem to change.
A1 ? Currently unknown. Value does not seem to change.
A2 ? Currently unknown. Value does not seem to change.
A3 ? Currently unknown. Value does not seem to change.
A4 ? Currently unknown. Value does not seem to change.
A5 ? Currently unknown. Value does not seem to change.
A6 ? Currently unknown. Value does not seem to change.
A7 ? Currently unknown. Value does not seem to change.
OBJ Objects Number of objects currently loaded.

D-Up - Check Info

Press D-Up to display the "CHECKINFO" screen. This screen shows info related to collision checking.

Option Meaning Description Notes
AREA Area What cell of the collision grid Mario is in.
DG Data Ground? Amount of floor triangle checks / such triangles in Mario's area. Two columns
DW Data Wall? Amount of wall triangle checks / such triangles in Mario's area.
DR Data Roof? Amount of ceiling triangle checks / such triangles in Mario's area.
LISTAL List Area Length? Amount of triangle nodes loaded.
STATBG Static Boundraries Amount of level triangles loaded.
MOVEBG Moving Boundraries Amount of object triangles loaded.
NULLBG Null Background How often a floor-check couldn't find a triangle this frame.
OBJ Objects Number of objects currently loaded.

L - Enemy Info

Press L to display the "ENEMYINFO" screen.

Option Meaning Description Notes
B ? Currently unknown. Value does not seem to change.
B0 ? Currently unknown. Value does not seem to change.
B1 ? Currently unknown. Value does not seem to change.
B2 ? Currently unknown. Value does not seem to change.
B3 ? Currently unknown. Value does not seem to change.
B4 ? Currently unknown. Value does not seem to change.
B5 ? Currently unknown. Value does not seem to change.
B6 ? Currently unknown. Value does not seem to change.
B7 ? Currently unknown. Value does not seem to change.
OBJ Objects Number of objects currently loaded.

Debug Resource Meter

30 fps.png

The profiler shows how well the game can maintain its frame rate of 30 fps.

There are four colored bars acting as a timescale on the bottom. Each bar represents 1/60th of a second. On top of it, the time of the audio thread (red), game logic thread (yellow) and video thread (orange) are plotted. When the top bars reach the orange reference bar, it means they took more than 1/30th of a second so a lag frame is introduced. A little red bar is drawn in the middle left when that occurs. When it reaches red, two lag frames are introduced. During room transitions, tens of lag frames are introduced because loading takes several frames. The profiler will spike for a frame then. When you press L, the bars are shown in a different way. The time bars are moved to the right, and on top of the blue bar, a yellow bar is now drawn. It seems like in this view, the red, yellow and orange times are not grouped. It rather shows a timeline of which thread is active.

Press l.png

This profiler also exists in Mario Kart 64.

Japan USA Europe Japan (Shindou)
8032C654 0001
8032D594 0001
802F9744 0001
8030CCC4 0001

Debug Spawn

This function causes various objects to spawn that alter Mario's movement. Press the D-Pad buttons to spawn either nothing, a normal Koopa Shell, a water Koopa Shell, or a Crazy Box. Don't try to use it inside the castle, though, or the game might crash.

Japan USA Europe Japan (Shindou)
8032FF34 0003
8133BF6E 0001
80330E94 0003
8133D2DE 0001
802FD054 0003
8130AF0E 0001
803105C4 0003
8131F49E 0001

Free Movement Mode

Free movement.png

This function enables a free-movement mode that lets Mario zoom about freely. There is collision checking with walls and floors, but not with ceilings. When you hold B, you move with 128 units per frame, and walls are 100 units thick so you can pass through them. No quarter frame checks are done in this mode.

Controls:

  • Joystick: Moves Mario laterally with 32 units per frame.
  • D-Pad: Moves Mario up or down with 16 units per frame
  • Hold B: These speeds are multiplied by 4.
  • Hold L: Multiplies the speed by 0.01, giving very slow and precise movement.
  • A: Make Mario exit to an in-air or underwater state.
Japan USA Europe Japan (Shindou)
D1339C30 2100
8126976E 5F0D
D1339C30 8000
8126976E 97D1
D133AFA0 2100
81269BDA 5FAB
D133AFA0 8000
81269BDA 98D5

Level Select

Access

Japan USA Europe Japan (Shindou)
A032C64C 0001
A032D58C 0001
A02F973C 0001
A030CCBC 0001

Options

This level select features an early version of the title screen. When enabled, it replaces the file select screen. The courses are listed in the order that their data appears in the game's memory.

When a level is selected, Mario will automatically be sent to the first Star, bypassing the Star selection screen. Exiting a course via Star collection, death, or the pause menu will bring you back to the level select screen. Attempting to access one of the removed entries causes the game to reset.

Controls:

  • A: Scroll forward by 1.
  • B: Scroll backward by 1.
  • D-Up: Scroll forward by 1.
  • D-Down: Scroll backward by 1.
  • D-Right: Scroll forward by 10.
  • D-Left: Scroll backward by 10.
  • Start: Enter level.
  • Z + C-Left + C-right + Start: Reboot game without level select
Level Select Name Literal Translation Final Location
1 1: [Removed]
2 2: [Removed]
3 3: [Removed]
4 TERESA OBAKE 4: Boo Apparition Big Boo's Haunt
5 YYAMA1 % YSLD1 5: Snow Mountain 1 & Snow Slide 1 Cool, Cool Mountain
6 SELECT ROOM 6: Select Room Inside Peach's Castle
7 HORROR DUNGEON 7: Horror Dungeon Hazy Maze Cave
8 SABAKU % PYRMD 8: Desert & Pyramid Shifting Sand Land
9 BATTLE FIELD 9: Battlefield Bob-omb Battlefield
10 YUKIYAMA2 10: Snow Mountain 2 Snowman's Land
11 POOL KAI 11: Pool Stage Wet-Dry World
12 WTDG % TINBOUTU 12: Water Dungeon & Submersion Jolly Roger Bay
13 BIG WORLD 13: Big World Tiny-Huge Island
14 CLOCK TOWER 14: Clock Tower Tick Tock Clock
15 RAINBOW CRUISE 15: Rainbow Cruise Rainbow Ride
16 MAIN MAP 16: Main Map Outside the Castle
17 EXT1 YOKO SCRL 17: Bonus 1 - Side-Scroller Bowser in the Dark World
18 EXT7 HORI MINI 18: Bonus 7 - Moat (Mini) Vanish Cap Under the Moat
19 EXT2 TIKA LAVA 19: Bonus 2 - Basement Lava Bowser in the Fire Sea
20 EXT9 SUISOU 20: Bonus 9 - Fish Tank The Secret Aquarium
21 EXT3 HEAVEN 21: Bonus 3 - Heaven Bowser in the Sky
22 FIREB1 % INVLC 22: Fire Bubble & In the Volcano Lethal Lava Land
23 WATER LAND 23: Water Land Dire, Dire Docks
24 MOUNTAIN 24: Mountain Whomp's Fortress
25 ENDING 25: Ending "The End" Image
26 URANIWA 26: Back Garden Castle Courtyard
27 EXT4 MINI SLID 27: Bonus 4 - Mini Slide The Princess's Secret Slide
28 IN THE FALL 28: In the Fall Cavern of the Metal Cap
29 EXT6 MARIO FLY 29: Bonus 6 - Mario Fly Tower of the Wing Cap
30 KUPPA1 30: Bowser 1 Bowser in the Dark World (Boss)
31 EXT8 BLUE SKY 31: Bonus 8 - Blue Sky Wing Mario Over the Rainbow
32 32: [Removed]
33 KUPPA2 33: Bowser 2 Bowser in the Fire Sea (Boss)
34 KUPPA3 34: Bowser 3 Bowser in the Sky (Boss)
35 35: [Removed]
36 DONKEY % SLID2 36: Monkey & Slide 2 Tall Tall Mountain
37 37: [Removed]
38 38: [Removed]

With this flag on, you also won’t lose health from being underwater water, in cold water, or in toxic haze. This is not a side-effect, but explicitly programmed in.

Mario sufficating.png

For some reason, if Peach's Castle is entered via the level select, no background music will play there.

While bonus levels marked "EXT1" to "EXT9" are present (standing for "extra"), "EXT5" is missing. It may have been removed during development, or it may be that the label is simply missing from the entry for Cavern of the Metal Cap.

The use of "Donkey" for "Monkey" is possibly a tongue-in-cheek reference to Donkey Kong.

Frame advance

The short at 0x339EC8 is 0 normally and 2 when the game is paused, 4 during transitions (entering a painting, going through a door, debug level select). When you hack it to 5 you enter a frame advance mode.

The game then only advances a frame if you press D-pad down.

Debug Print

While the ‘classic display’ shows some variable on a fixed position, there is also a whole system for automatically laying out debug text. The state is stored in a struct:

    typedef struct 
    {
    	short disabled,	//0x00	(if not zero, it doesn't draw)
    	short cursor_x,	//0x02
    	short cursor_y,	//0x04
    	short min_y,		//0x06 causes DPRINT OVERFLOW if cursor_y not 
    	short max_y,		//0x08 in this range
    	short line_y_offset, 	//0x0A equals -15 (top aligned) or +15 (bottom aligned)
    } DprintState;

There are two of these states, one in the top left corner growing down, and one in the bottom right corner growing up. Note that (0, 0) is the bottom left corner and (320, 240) is the top right corner. Now whenever the developers wanted to show a certain variable, they would call a function that automatically ensures it doesn’t overlap with other variables.

The bottom right corner is used for all kind of ad-hoc things, while in the top right there are 6 pages that you can scroll through.

Hold L and press C-up, left, down, right to toggle this menu on or off Hold L and press D-pad left to increase the page number and D-pad right to decrease it Press Z to toggle whether the text is collapsed

Things that appear in the Bottom right corner

NULLBG

Oob.png

Every time a floor check returns a null pointer a counter is incremented, and if it is positive it will be drawn with the label NULLBG. In the image, Mario’s four quarter steps are Out of Bounds so the counter is 4.

In some courses, you’ll see NULLBG in the corner whenever an object spawns. That’s because these objects aren’t in the right position right from the start: on the first frame, they are at (0, 0, 0). So if you’re in a stage where this origin point is not above a floor, NULLBG shows up whenever an object spawns.

Similar to NULLBG, there is a WALL counter. It only pop-ups when the wall counter is higher than 0, but that never happens. The counter gets reset to 0 every frame, but nowhere does it get incremented.

SL Penguin

Penguin.png

In Snowman’s Land, the X and Z coordinates of the penguin are shown. (The NULLBG in the image is because the snowman’s wind particles spawn on the origin, which is Out of Bounds in Snowman’s Land)

Break free of Chuckya

King bob omb.png When Mario is grabbed by King Bob-omb / Chuckya, a number appears signifying how many times you pressed A or jolted the control stick. When it reaches 11, you break free. The developers probably displayed this to gauge what a reasonable button mashing rate is for breaking free.

==If you're reading this, remind Thestickman391 to finish this page