the cutting room mirror

Debugging Functions

This article has a talk page!
view on tcrf.net

This is a sub-page of MiniCopter: Adventure Flight.

Debug Menu#

Scene index

02

A debug menu exists in the game, known as PetitCopter Wii Simple Menu, with several options and submenus to navigate by using the D-Pad to select between options and the 2 button to enter a submenu (assuming the Wii Remote is held sideways).

At boot, the function CApp::StartLocal checks whether the simple_menu option in /PCopter/Config.txt is set to 0 or not. If it's 0, the game boots normally, otherwise it loads into this debug menu.
Because the Config.txt file is first loaded after this function is executed, the flag will always be read as 0, so the game will always boot normally, even if this number is changed in the file. Either way, there seems to be no code left to parse this flag.

When accessing a mission using this menu, quitting/beating the mission or losing the game will return the player to this menu instead of the usual mission select menu (unless the player chooses the Title option). The debug System/User free heap displays appear in this menu.

Enable the following code and boot (or reboot) the game to access this menu:

JPN

USA

EUR

Gecko Code

0401410C 38600001
0401436C 38600001
0401438C 38600001

The main screen plays the Map Selection music, while in each submenu the Shop theme is played.

Option Name

Description

Options

Go Flight

Starts the game with the selected options.

Parts Select

Goes into the Parts Select submenu.

Room

Selects a map.

  • KidsRoom: Kids Room
  • Hospital: Hospital
  • Park: Park
  • Hotel: Resort Hotel
  • Company: Office Building
  • BGShop: Hamburger Shop
  • Japan: Japanese House
  • JapanOld1/2: Early Japanese House map

Scenary

Selects a mission.

  • FreeFlight1: Loads the unused FreeFlight mission.
  • Mission_X: with X = a mission number from 1 to 5.
  • Treasure: Coin/Star Mission.

Control

Selects a controller layout.

  • Motion: Wii Remote (sideways)
  • Pointing: Wii Remote (vertical)
  • Classic1: Classic Controller (Type A)
  • Classic2: Classic Controller (Type B)

Sound Setting

Goes into the Sound Setting submenu.

Cheat Setting

Goes into the Cheat Setting submenu.

Multiplay

Goes into the MultiPlay submenu.

Title

Goes into the Title Screen.

When using this option, the player will start from the beginning of the game, as if they created a brand new save file. Although this is temporary, players must be careful not to save the game while in this state, or it may overwrite existing save files. To prevent this, players can always just load a save file.

1: This option is disabled by default. It can be enabled by using the following code:

JPN

USA

EUR

Gecko Code

04054F3C 2c030000
0405551C 2c000000
04054E00 2c030007
040554B8 2c000007
04065E1C 2c030007
04066794 2c000007
0405619C 2c030000
0405677C 2c000000
04056060 2c030007
04056718 2c000007
04067670 2c030007
04067FE8 2c000007
04056818 2c030000
04056df8 2c000000
040566dc 2c030007
04056d94 2c000007
040680d0 2c030007
04068a48 2c000007

2: This option only works in the Japanese version. This is because its associated models are stored in MDL0 v10 format (the western versions only supports v11).

Parts Select#

Scene index

03

This menu lets the player select between all the different helicopter bodies and accessories.

Option Name

Description

Options

Notes

Body

Helicopter's frame selection.

  • NRM_01: B44 Pronghorn
  • NRM_02: XK-117 Rhinoceros
  • NRM_03: RC135 Lynx
  • SPD_01: GH-66 Golden Eagle
  • SPD_02: RC155 Red Kite
  • SPD_03: GH-64 Grey Hawk
  • PWR_01: MV107 Megamouth
  • PWR_02: HH-53E Hammerhead
  • PWR_03: Sa-52 Sand Tiger

Color

Helicopter's color selection.

  • Color01: Unused variant.
  • Color1: Red (named *_aka.brres in the files).
  • Color2: Blue (named *_ao.brres in the files).
  • Color3: Yellow (named *_ki.brres in the files).
  • Color4: Black (named *_kuro.brres in the files).
  • Color5: Green (named *_midori.brres in the files).
  • Color6: Black and White (named *_siro.brres in the files).
  • Color7: Special (named *_spl.brres in the files).
  • Color81: Unused variant.
  • Color91: Unused variant.

Not all frames have the special variant. Attempting to load this color with a frame that doesn't have it will load the unused variant in the Japanese version, and crash in the rest of the versions.

Rotor

Helicopter's rotor selection.

  • Normal: Normal Blade
  • Wood: Wood Blade
  • Grass: Fiberglass Blade
  • Carbon: Carbon Blade
  • GrassSP: Fiberglass Blade SP
  • CarbonSP: Carbon Blade SP
  • T_Wood: Triple Wood Blade
  • CarbonIII: Carbon Blade III
  • T_Grass: Triple Glass Blade
  • T_Carbon: Triple Carbon Blade
  • Ninja: NINJA Blade

Motor

Helicopter's motor selection.

  • Normal: Normal Motor
  • Power: Power Motor
  • PowerDX: Power Motor DX
  • GigaSilver: Giga Power · Silver
  • GigaGold: Giga Power · Gold
  • GigaPlatinum: Giga Power · Platinum
  • Custom22: Custom Motor 22
  • Zeek1: Sieg / Lambda
  • Zeek2: Sieg / Sigma
  • Zeek3: Sieg / Zeta
  • Griffin: Griffon
  • S_Evolution: Speed Evolution

S_Evolution seems to be unused?

Gyro

Helicopter's gyro selection.

  • Normal: Normal Gyro
  • Mini: Mini Gyro
  • Micro: Micro Gyro
  • Quick: Quick Gyro
  • Dream: Dream Gyro

Battery

Helicopter's battery selection.

  • Normal: Normal Battery
  • PowerMAX: Power MAX
  • PowerMAX2: Power MAX 2
  • MachPow: Mach Power
  • ThunderPow: Thunder Power
  • Dynamics_E: Dynamics Energy
  • Poseidon: Poseidon

Cannon

Helicopter's cannon selection.

  • AirCannon: Air Cannon
  • Magnum: Air Cannon · Magnum
  • TwinCannon: Air Cannon · Twin
  • TripleCannon: Air Cannon · Triple

LiftCup

Helicopter's suction cup selection.

  • LiftCup: Suction Cup
  • LiftCupWide: Suction Cup · Wide

Etc

Unused Helicopter Accessories

  • ReserveBatt
  • Treasure_RD
  • Attack_RD
  • Sonic_RD
  • LightSet
  • SoundKit

Return

Goes back to the main Debug Menu screen.

1: This option only works in the Japanese version (except if the Body option is set to NRM_01). This is because all the models the game loads (except for that one) are stored in MDL0 v10 format (the western versions only supports v11).

Sound Setting#

To do:
Find out if the unused sound modes have any effect in-game or not.

Scene index

04

This menu lets the player change various sound-related settings, such as the sound mode and volume.

Option Name

Description

Options

SoundOutPut

Selects the sound mode.

  • Stereo: Stereo
  • Surround: Surround (Unused)
  • DPL_2: Dolby Pro Logic II? (Unused)
  • Mono: Mono

SE_Volume

Selects the sound effects volume.

  • Volume select in the range of 0 to 100 (each option being added +10).

BGM_Volume

Selects the music volume.

  • Volume select in the range of 0 to 100 (each option being added +10).

ENV_Volume

Selects the environmental sound effects volume.

  • Volume select in the range of 0 to 100 (each option being added +10).

Return

Goes back to the main Debug Menu screen.

Cheat Setting#

Scene index

05

This menu lets the player choose between many cheats used by developers to debug and test the game.

Option Name

Description

Options

HideInfo

Disables the HUD

  • OFF: Disabled
  • ON: Enabled

MoveCam

Free camera debug functionality.

  • OFF: Disabled
  • ON: Enabled

CollDraw

Collision display debug functionality.

  • OFF: Disabled
  • ON: Enabled

CollDisable

Collision disable debug functionality.

  • OFF: Disabled
  • ON: Enabled

InfiniteBatt

Grants infinite battery.

  • OFF: Disabled
  • ON: Enabled

InfiniteLife

Grants infinite lives.

  • OFF: Disabled
  • ON: Enabled

DebugInfo

Debug information display functionality.

  • OFF: Disabled
  • ON: Enabled

Return

Goes back to the main Debug Menu screen.

MultiPlay#

Scene index

06

This menu lets the player start a multiplayer game (in the Type A mission variant only) with the selected settings. The reason why it doesn't support loading the Type B missions is likely due to the fact that these didn't exist in the Japanese version.

Option Name

Description

Options

Start

Starts the game

Player1 Body2

Helicopter's body selection for the 1st player.

  • NRM_01: B44 Pronghorn
  • NRM_02: XK-117 Rhinoceros
  • NRM_03: RC135 Lynx
  • SPD_01: GH-66 Golden Eagle
  • SPD_02: RC155 Red Kite
  • SPD_03: GH-64 Grey Hawk
  • PWR_01: MV107 Megamouth
  • PWR_02: HH-53E Hammerhead
  • PWR_03: Sa-52 Sand Tiger

Player2 Body2

Helicopter's body selection for the 2nd player.

  • NRM_01: B44 Pronghorn
  • NRM_02: XK-117 Rhinoceros
  • NRM_03: RC135 Lynx
  • SPD_01: GH-66 Golden Eagle
  • SPD_02: RC155 Red Kite
  • SPD_03: GH-64 Grey Hawk
  • PWR_01: MV107 Megamouth
  • PWR_02: HH-53E Hammerhead
  • PWR_03: Sa-52 Sand Tiger

Room

Selects a map.

  • KidsRoom: Kids Room
  • Hospital: Hospital
  • Park: Park
  • Hotel: Resort Hotel
  • Company: Office Building
  • BGShop: Hamburger Shop
  • Japan: Japanese House
  • JapanOld1/2: Early Japanese House map

Window

Selects the window splitting mode.

  • Horizontal
  • Vertical

LimitTime

Selects the game's time limit.

  • 3min: 3 minutes
  • 5min: 5 minutes
  • 10min: 10 minutes
  • Infinite

Return

Goes back to the main Debug Menu screen.

1: This option is disabled by default. It can be enabled by using the following code:

JPN

USA

EUR

Gecko Code

04054F3C 2c030000
0405551C 2c000000
04054E00 2c030007
040554B8 2c000007
04065E1C 2c030007
04066794 2c000007
0405619C 2c030000
0405677C 2c000000
04056060 2c030007
04056718 2c000007
04067670 2c030007
04067FE8 2c000007
04056818 2c030000
04056df8 2c000000
040566dc 2c030007
04056d94 2c000007
040680d0 2c030007
04068a48 2c000007

2: This option only works in the Japanese version. This is because its associated models are stored in MDL0 v10 format (the western versions only supports v11).
In the case of the helicopter frames, the unused variant will be loaded in the Japanese version, while the game will crash in the rest of the versions (unless both players select the NRM_01, the B44 Pronghorn helicopter).

Debugging Functions#

HideInfo#

This function disables most of the HUD. It will also disable the debug information text even if it's set to enabled.

MoveCam#

Watch on YouTube

This enables the ability to move the camera freely around the helicopter by using a Classic Controller plugged in the first Wii Remote (the Controller Setting must be set to either Motion or Pointer in order for this to work).

Controls

Action

D-Pad

Rotates the camera.

A

Stops/Resumes the game. This freezes all objects, including the helicopter.

B

Resets the camera position to the back of the helicopter.

L

Zoom-in.

R

Zoom-out.

CollDraw#

Draws the collision models' wireframe in red for everything present in the scene.

CollDisable#

Watch on YouTube

Disables the collision of the whole map and objects.

The two height limit planes that are defined for each map are still present, preventing the player from exploring farther in the vertical axis.
Even so, the player can endlessly explore horizontally.

DebugInfo#

To do:
Find out the meaning of the COLL parameter.

Menus

Multiplayer


This function prints the free heap available for both the System (whole memory) and User (game's memory) areas. In menus, the function will display said amount both in bytes and as a percentage, while in multiplayer it only shows the percentage. The system's memory displayed is incorrect, as the value that is actually shown is its opposite. The following code corrects this issue:

JPN

USA

EUR

Gecko Code

041194AC 48000010
04119480 4800000C
0411B29C 48000010
0411B270 4800000C
0411C11C 48000010
0411C0F0 4800000C

Exclusive to multiplayer, two additional parameters are shown: FPS which displays the number of frames per second, and a parameter named COLL with two variables.

A screenshot found as an unused texture suggests that this display (as seen in multiplayer) was also present when playing in single player. In the final game, there is no code to display it in single player missions however.

While the exact meaning of both COLL variables is unknown, they seem to be related to the collision. There's code that updates the first variable in RAM address 0x800254f4 (PAL), inside the function CVColl::CheckColl_AreaList. However, it goes unused because it's only calculated in single player missions, but can only be displayed in multiplayer.

To do:
This code breaks the "CollDisable" debug feature

Use the following code to view said value in multiplayer:

JPN

USA

EUR

Gecko Code

040219D0 4800000c
04022298 4800000c
04022460 4800000c

Additionally, playing in the Hamburger Shop's 5th mission will display 3 counters (one for each of the hamburgers that has to be made) for two parameters: BANZ and PATY. For each parameter, each counter will increase by 1 each second, and will stop when the heater for either the burger buns (BANZ) or the patty (PATY) respectively is opened. A counter will resume if the heater is closed again while its associated bun/patty is in it.

The purpose for this seems to be able to see at what moment the burger buns and the patty will be correctly cooked or otherwise burnt.

Disc Read Errors#

Error code = -1

Error code = -3


If an error occurs while loading a file from the disc, two error messages will be displayed depending on the error code returned by the function DVDReadPrio.

Save/Load Save Data BUSY String#

There is code in function CSceneMenuSDataCheak::RenderLocal that prints the string BUSY when loading the save data menu.

Assertion Strings#

Many assertion strings can be found in the executable, which are printed by function nw4r::db::Panic to the console when they trigger.

NW4R:Failed assertion resMdl.IsValid()
NW4R:Failed assertion mat.IsValid()
NW4R:Failed assertion genMode.IsValid()
NW4R:Failed assertion tevColor.IsValid()
NW4R:Failed assertion texCoordGen.IsValid()
NW4R:Failed assertion texObj.IsValid()
NW4R:Failed assertion texSrt.IsValid()
NW4R:Failed assertion tev.IsValid()
NW4R:Failed assertion ! texObj.IsValidTexObj(sdwTexMapId)
NW4R:Failed assertion numTevStages + numAddTevStages == numTevStageData
NW4R:Failed assertion mainCamera.IsValid()
NW4R:Failed assertion texProjCamera.IsValid()
NW4R:Failed assertion tagDL.IsValid()
NW4R:Failed assertion pResFile->GetResMdl(resMdl.GetName()) == resMdl
NW4R:Failed assertion bBindResult
NW4R:Failed assertion resScn.IsValid()
NW4R:Failed assertion bBound
NW4R:Failed assertion bPushBack1
NW4R:Failed assertion soundHeap.IsValid()
NW4R:Failed assertion readBytes > 0
NW4R:Failed assertion bRevision
NW4R:Failed assertion bAllBound
NW4R:Failed assertion bPushBack
NW4R:Failed assertion bTmp
NW4R:Failed assertion resNode.IsValid()

NW4R:Failed assertion mHeapStartAddr < mHeapEndAddr && reinterpret_cast<u8*>(mHeapEndAddr) - reinterpret_cast<u8*>(mHeapStartAddr) > headerSize
NW4R:Failed assertion pp->mParticleManager->GetLifeStatus() == ::nw4r::ef::ReferencedObject::NW4R_EF_LS_ACTIVE || pp->mParticleManager->GetLifeStatus() == ::nw4r::ef::ReferencedObject::NW4R_EF_LS_WAIT || pp->mParticleManager->GetLifeStatus() == ::nw4r::ef::ReferencedObject::NW4R_EF_LS_CLOSING

NW4R:Failed assertion pp->GetRefCount() == 0
NW4R:Failed assertion false
NW4R:Failed assertion !((u32)p & 0x1f)
NW4R:Failed assertion !((u32)p & 0x3)
NW4R:Failed assertion IsValid()
NW4R:Failed assertion GetValueType() == ResUserDataItemData::S32
NW4R:Failed assertion GetValueType() == ResUserDataItemData::F32
NW4R:Failed assertion GetValueType() == ResUserDataItemData::STRING
NW4R:Failed assertion bSuccess
NW4R:Failed assertion arenaSize > HEAP_SIZE_OF_SDK_DEMO
NW4R:Failed assertion sUser1Mem.hHeap != MEM_HEAP_INVALID_HANDLE
NW4R:Failed assertion arenaSize > HEAP_SIZE_OF_SDK_DEMO
NW4R:Failed assertion sSysMem.hHeap != MEM_HEAP_INVALID_HANDLE

OSReport Strings#

Several strings are usually printed to the console by the function OSReport that is common to most Wii games. Some examples are shown below:

Error Reporting#

NAND Close Error
NANDClose() failed.  Result code: %d\n

This is displayed when the NAND has not been closed properly after being open to read/write the save file.

NAND Write Error
NANDWrite() failed.  Result code: %d\n

This is triggered whenever the save file couldn't be read/written properly to the NAND (i.e. the retrieved save file's size is not equal to 0x1DC0).

Error While Loading BREFT/BREFF
cannot load file\n

This is displayed if the PCopterEffect.breft / PCopterEffect.breff file could not be loaded from the disc.

Heap Allocation Error
cannot allocate memory\n

This is displayed if there was a problem while allocating space from the heap before loading the PCopterEffect.breft / PCopterEffect.breff file.

Disc Open Error
cannot open file\n

This error string is displayed if the disc could not be opened.

Loading BREFT/BREFF#

loading file (%s) ...

This is displayed before atemptting to load the PCopterEffect.breft / PCopterEffect.breff file from disc (with %s = filename/object name).

BREFT/BREFF Loaded Successfully#

Done\n

This is printed whenever the PCopterEffect.breft / PCopterEffect.breff file has been loaded correctly.

Loaded BRRES Files#

Load: %s\n

This is displayed whenever a BRRES file is loaded from disc (with %s = filename/object name).

Unloaded Files#

Unload: %s\n

This is displayed whenever a file is unloaded from memory (with %s = filename/object name).

Object Destroyed#

Destroy %s\n

This is displayed whenever an object is destroyed (with %s = filename/object name).

Unhandled Exception#

Whenever the game crashes with an unhandled exception, these contents are printed to the console.