the cutting room mirror

Unused Code

This is a sub-page of Castlevania (Nintendo 64).

Debugging Features#

Crash Screen#

CV64_crashScreen.png

Code exists for a crash screen, which displays information such as registers and stack, when the game crashes. This code is disabled by default, as the thread associated with the crash screen is never created nor started.
By manually creating and starting the thread, the game will print the message => faultproc - waiting for message.... If the game crashes, the string => faultproc - got a fault message... is printed, and the contents of the registers and the stack (as well as the cause of the crash) will be printed to a debug console.

Use this code to make the crash screen work. It initializes the crash screen thread, which replaces a useless branch in the audio initialization function with a call to the crash thread init and start function at 0x80019b48 (have the cheat enabled before booting the game, or do a hard reset with the code enabled for the effects to take place).

Then, make the game crash and the contents should be printed to the debugging console (on emulator, this script works for simulating a debugging console). The game can be crashed in various ways. An easy method is by setting $ra in a "jr ra" assembly instruction to 0. For example, set a breakpoint at 0x80015464 (USA v1.0) and set the contents of $ra to 0, then continue the game and the game will crash.

Version

GameShark code

USA 1.0

810798d8 0C00
810798da 66D2

Functions#

The functions associated with this crash screen start in the following RAM addresses. These addresses are for the USA v1.0 version of the game:

Address

Description

0x80019b48

Creates the crash screen thread and starts it.

0x80019560

Prints the thread data, including registers, stack, etc.

0x80019968

Prints information such as the cause of the crash, called from the function above.

0x80019a44

This function is accessed after the thread is started. It checks if a crash has happened, and if that's the case, it prints the information to the console using the functions above. This function was likely called faultproc, judging by some of the strings in the ROM.

Explanation#

  • Fault in thread X. X = thread ID (5 = Main thread)
  • epc: Address of instruction that caused exception
  • cause: Type of exception and pending interrupt bits
  • sr: Interrupt mask, enable bits, and status when exception occurred
  • badvaddr: Memory address where exception occurred
  • at, v0-v1, a0-a3, t0-t7, s0-s8, t8-t9, gp, sp, ra: Registers
  • fpcsr: FPU control and status register
  • d0-d30: Floating point-registers

Process Meter#

There's unused code for handling and rendering a process meter, which can be found in other Konami games for the N64, such as Mystical Ninja Starring Goemon (Nintendo 64).

Each bar is supposed to represent a timer value that would be updated regularly, perhaps the time some specific threads would have taken (like with Super Mario 64). If a bar exceeds a certain limit, it either turn red, or the meter would be subdivided into more pieces (the game renders 3 divisions by default). Unfortunately, no code calls the update function for the process meter, so it's not possible to tell precisely where it would have been used.

Only two bars are rendered. However, the update function references 4 timer values (2 are for the green and blue bars, so it's possible the other 2 were for other 2 bars). In addition, prerelease footage show that there were originally 4 bars.

Use this code to render the process meter. Note that it will only render the meter, but won't update the bars, so said bars will appear static. Lines 3-4 and 5-6 change the size of the green and blue bar respectively. They're float values, so for example, in the code below, the green bar size value was set to 0x42000000 = 32, and the blue bar size was set to 0x41700000 = 15. The last line changes the number of divisions to 4.

Version

GameShark code

Japan

810006EC 0C00
810006EE 67AA
810D93C0 4200
810D93C2 0000
810D93C4 4170
810D93C6 0000
81098852 0004

USA v1.0

810006DC 0C00
810006DE 679A
810D7140 4200
810D7142 0000
810D7144 4170
810D7146 0000
81096AC2 0004

Europe

810006DC 0C00
810006DE 67B2
810D7C10 4200
810D7C12 0000
810D7C14 4170
810D7C16 0000
81097442 0004

Below are the functions associated with the process meter. These addresses are for the USA v1.0 version of the game:

Address

Arguments

Description

0x80019c00

(OSMesgQueue* unknown1)

-

0x80019ce0

(f32 unknown1)

-

0x80019cec

(s32 unknown1)

Update function. Changes the size of each bar according to the timer value for each.

0x80019e68

(Gfx* display_list)

Draw function. Renders the entire process meter.

0x8001a004

(Gfx* display_list, f32 subdivision_width)

Renders a subdivision of the process meter. The meter has 3 divisions by default.

0x8001a0b8

(Gfx* display_list, u32 color, f32 size, s32 meter_row)

Renders a single bar.

And below is the global / static data associated with the process meter. These addresses are for the USA v1.0 version of the game:

Address

Datatype

Description

0x80019c00

f32

-

0x800d7120

OSTime

Unknown bar timer

0x800d7128

OSTime

Green bar timer

0x800d7130

OSTime

Unknown bar timer

0x800d7138

OSTime

Blue bar timer

0x800d7140

f32

Green bar size

0x800d7144

f32

Blue bar size

0x800a3088

f64

-

0x800a3090

f64

-

0x800a3098

f64

-

0x80096ac0

s32

Number of subdivisions

Stage Select#

CV64_stage_select.png

An unused game state exists, a simple stage select menu. It can be enabled with the use of the below code and pressing L + Z at any time in-game.

The menu is stylized similarly to the rest of the menus from the game. Every time the player access a map, the event flags, items, subweapons, money, etc are all wiped.

It can access 8 locations in the game:

Option

Destination

Stage 1. Forest

Forest of Silence

Stage 2. Inside Of Rampart

Castle Wall (Main)

Stage 3. Courtyard

Villa's front yard

Stage 4. Execution Tower

Tower of Execution

Stage 5. Clock Tower

Clock Tower

Stage 6. VS Death

Castle Keep exterior (Death tower). Note that the battle doesn't start until the player goes to Room of Clocks and comes back.

Stage 7. VS Actriese

Castle Keep exterior (Actriese tower). Note that the battle doesn't start until the player goes to Room of Clocks and comes back.

Stage 8. VS Behimos

Castle Center (Main). "Behemoth" is misspelled as "Behimos."

These are all locations that Reindhart can access. The only exception is "VS Actriese", as he can't battle her in the final game. However, prerelease footage shows Reindhart fighting against her.

An article from IGN covering the appearance of the game at TGS 1998 states that "several areas of the game are now playable (selected via a startup menu), including a forest scene, the castle entrance, and a harrowing battle against Death himself". Said startup menu could be this stage select, as it has options for warping to the forest and to a battle against Death.

Version

GameShark code

Japan

D10D80A0 2020
81342084 FFFF
D10D80A0 2020
81342086 FFFC

USA 1.0

USA 1.1

D10D5E20 2020
81342084 FFFF
D10D5E20 2020
81342086 FFFC

USA 1.2

D10D61C0 2020
81342084 FFFF
D10D61C0 2020
81342086 FFFC

Europe

D10D68F0 2020
81342084 FFFF
D10D68F0 2020
81342086 FFFC

(Source: Original TCRF research)

(Source code: Castlevania 64 Decompilation Project)

Unseen Title Demo Debugging Text#

Whenever the player enters the Title Demo (with Reindhart playing on the tunnel), the following text is printed on the debugging console. Note that the actual text doesn't have newlines. They've been put here for readability.

wait cont = 1
wait cont = 2
wait cont = 3
wait cont = 4
wait cont = 5
wait cont = 6
wait cont = 7
wait cont = 8
wait cont = 9
wait cont = 10
wait cont = 11
wait cont = 12

cont stands for controller. What's being printed is field 0x64 of the struct that handles the title demo. This variable represents the delay time (in frames) from the demo's start until the game starts reading the playback controller data. In this case, there were 12 frames of delay.

Good Ending Castle Map Pieces - Unused Sinking Feature#

Watch on YouTube

The destroyed castle pieces seen in both good endings (which appear static in the game) have an unused feature where they would sink to the ground. These pieces also appear in Carrie's good ending, but they can't be seen without hacks. They don't make any sound whe falling off.

These are not the same castle pieces used in the "Castle Destruction" cutscene that plays before the ending cutscenes, which are handled by completely different actors.

Unused Camera Mode#

The code that handles the player camera defines two modes: Normal / Action view and Boss Battle view. However, a third one exists, which has an empty function associated to it (0x8006bcf4), therefore it does not move the camera at all when activated.

Unused Gardener Variables#

The Gardener's enemy code saves the first variable from the map's actor data, as well as the current time of the day (day, night, dawn / dusk), but they're never read.