Skip to content

Debugging cheat sheet

When a ROM misbehaves, use a loop — do not random-edit forever.

1. Rebuild & reload hygiene

StepWhy
make -C lessons/<name> clean allStale .z64 is a common false bug (source fixed, binary old)
Fully reload the ROM in AresSome emulators keep the previous image
Enable Homebrew ModeNeeded for advanced header, EEPROM savetype, etc.
Confirm pathLoad the .z64 you just built

2. Logging

c
debug_init_isviewer();  /* Ares / isviewer spew */
debug_init_usblog();    /* USB (SC64, etc.) when available */
debugf("hello %d\n", x); /* goes to those sinks */

Course lessons already call the init helpers early. Use debugf liberally while hunting bugs; remove or gate noise later.

3. Asserts vs silent failure

c
assertf(model != NULL, "missing rom:/island.t3dm");

Prefer loud failures (missing asset, wrong audio rate) over blue clear + HUD only.

4. Common failure → cause

SymptomLikely cause
Blue/clear + text, no 3DMatrix set over camera; wrong scales; missing model; forgot skeleton_use
frequency 48000 exceeds…audio_init below Opus wav64 rate — use 48000
File not found: …sdataglTF convert must output under filesystem/ so paths are rom:/…
1px green/cyan top lineFILTERS_RESAMPLE_ANTIALIAS — use FILTERS_RESAMPLE + opaque clear
Camera/stick spinMove used player yaw; or soft-followed camYaw→player yaw; or radial wall
Assert on bootRead the message; fix the condition
Exception / freezeNULL deref, bad DMA alignment — check log/backtrace

5. Deliberate practice

L37 — When it crashes fires debugf, assertf, and a hard crash on purpose so you can read each path once.

6. Hardware notes

Flashcarts (SC64, EverDrive): use USB loaders that surface libdragon logs when possible. Save types must match the ROM header (N64_ROM_SAVETYPE — see L38).

N64 Educator v1.2.2 — libdragon + Tiny3D · branch master