Last Updated: October 9, 2025 Status: Active
This document provides a comprehensive guide to debugging and testing the yaze
application. It covers strategies for developers and provides the necessary information for AI agents to interact with, test, and validate the application.
For all print-based debugging, yaze
uses a structured logging system defined in util/log.h
. This is the only approved method for logging; direct use of printf
or std::cout
should be avoided and replaced with the appropriate LOG_*
macro.
LOG_DEBUG(category, "message", ...)
: For verbose, development-only information.LOG_INFO(category, "message", ...)
: For general, informational messages.LOG_WARN(category, "message", ...)
: For potential issues that don't break functionality.LOG_ERROR(category, "message", ...)
: For errors that cause a specific operation to fail.Categories allow you to filter logs to focus on a specific subsystem. Common categories include:
"Main"
"TestManager"
"EditorManager"
"APU"
, "CPU"
, "SNES"
(for the emulator)You can control logging behavior using command-line flags when launching yaze
or yaze_test
.
bash ./build/bin/yaze --debug
bash ./build/bin/yaze --log_file=yaze_debug.log
bash @section autotoc_md498 Only show logs from the APU and CPU emulator components ./build/bin/yaze_emu --emu_debug_apu=true --emu_debug_cpu=true
Best Practice: When debugging a specific component, add detailed LOG_DEBUG
statements with a unique category. Then, run yaze
with the appropriate flags to isolate the output.
The yaze
ecosystem provides several executables and flags to streamline testing and debugging.
--rom_file
flag. This bypasses the welcome screen. bash ./build/bin/yaze --rom_file /path/to/your/zelda3.sfc
z3ed
CLI to automate the GUI, you must start yaze
with the gRPC server enabled. bash ./build/bin/yaze --rom_file zelda3.sfc --enable_test_harness
--editor
and --cards
flags. This is especially useful for debugging complex UIs like the Dungeon Editor. ```bash ./build/bin/yaze –rom_file zelda3.sfc –editor=Dungeon –cards="Room Matrix,Room 0,Room 105"
```
Quick Examples: ```bash
./build/bin/yaze –rom_file=zelda3.sfc –editor=Dungeon –cards="Room 0"
./build/bin/yaze –rom_file=zelda3.sfc –editor=Dungeon –cards="Room 0,Room 1,Room 105"
./build/bin/yaze –rom_file=zelda3.sfc –editor=Dungeon \ –cards="Rooms List,Room Matrix,Object Editor,Palette Editor"
./build/bin/yaze –rom_file=zelda3.sfc –editor=Overworld ```
For a complete reference, see docs/debugging-startup-flags.md.
The yaze_test
executable is used to run the project's suite of unit, integration, and E2E tests.
bash ./build_ai/bin/yaze_test
./build_ai/bin/yaze_test –unit
./build_ai/bin/yaze_test –rom-dependent –rom-path /path/to/zelda3.sfc ```
bash @section autotoc_md514 Run E2E tests and watch the GUI interactions ./build_ai/bin/yaze_test --e2e --show-gui
The z3ed
CLI is a powerful tool for inspecting ROM data without launching the full GUI. This is ideal for quick checks and scripting.
bash z3ed rom info --rom zelda3.sfc
bash z3ed dungeon list-sprites --rom zelda3.sfc --dungeon 2
The primary way for an AI agent to test its changes and interact with yaze
is through the GUI automation framework. This system consists of the yaze
gRPC server (Test Harness) and the z3ed
CLI client.
yaze
(Server)**: When launched with --enable_test_harness
, it starts a gRPC server that exposes the UI for automation.z3ed
(Client)**: The z3ed agent test
commands connect to the gRPC server to send commands and receive information.z3ed
commands to drive the UI and verify its actions.The AI must first ensure the yaze
GUI is running and ready for automation.
Before interacting with the UI, the agent needs to know the stable IDs of the widgets.
This will return a list of widget IDs (e.g., Dungeon/Canvas/Map
) that can be used in scripts.
Tip: You can also launch yaze
with the --editor
flag to automatically open a specific editor:
An agent can either generate a test script from scratch or use a pre-recorded one.
bash z3ed agent test record --suite my_test.jsonl
json // my_test.jsonl {"action": "click", "target": "Dungeon/Toolbar/Open Room"} {"action": "wait", "duration_ms": 500} {"action": "type", "target": "Room Selector/Filter", "text": "Room 105"} {"action": "click", "target": "Room Selector/List/Room 105"} {"action": "assert_visible", "target": "Room Card 105"}
./build/bin/yaze –rom_file zelda3.sfc –enable_test_harness \ –editor=Dungeon –cards="Room 105"
{"action": "assert_visible", "target": "Room Card 105"} {"action": "assert_visible", "target": "Dungeon/Canvas"} ```
The agent executes the script to perform the actions and validate the outcome.
The --watch
flag streams results back to the CLI in real-time. The agent can parse this output to confirm its actions were successful.
For more complex issues, especially within the emulator, yaze
provides several advanced debugging windows. These are covered in detail in the Emulator Development Guide.
These tools are accessible from the Debug menu in the main application.