WASM debug inspector for yaze - palette, overworld, and emulator access. More...
#include <emscripten.h>#include <emscripten/bind.h>#include <atomic>#include <iomanip>#include <sstream>#include <unordered_map>#include "yaze.h"#include "app/emu/emulator.h"#include "app/emu/snes.h"#include "app/emu/video/ppu.h"#include "app/gfx/resource/arena.h"#include "rom/rom.h"#include "zelda3/dungeon/palette_debug.h"#include "zelda3/game_data.h"#include "app/editor/editor_manager.h"#include "app/editor/editor.h"#include "app/editor/agent/agent_session.h"#include "app/editor/agent/agent_editor.h"#include "app/editor/agent/agent_chat.h"#include "cli/service/agent/conversational_agent_service.h"#include "cli/service/ai/common.h"#include "nlohmann/json.hpp"Go to the source code of this file.
Namespaces | |
| namespace | yaze |
| namespace | yaze::cli |
| Namespace for the command line interface. | |
| namespace | yaze::app |
| namespace | anonymous_namespace{yaze_debug_inspector.cc} |
Functions | |
| Rom * | yaze::cli::GetGlobalRom () |
| yaze::emu::Emulator * | yaze::app::GetGlobalEmulator () |
| yaze::editor::EditorManager * | yaze::app::GetGlobalEditorManager () |
| const char * | Z3edProcessCommand (const char *command) |
| yaze::emu::Emulator * | anonymous_namespace{yaze_debug_inspector.cc}::GetGlobalEmulator () |
| yaze::editor::EditorManager * | anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager () |
| anonymous_namespace{yaze_debug_inspector.cc}::EM_JS (void, CallJsAiDriver,(const char *history_json), { if(window.yaze &&window.yaze.ai &&window.yaze.ai.processAgentRequest) { window.yaze.ai.processAgentRequest(UTF8ToString(history_json));} else { console.error("AI Driver not found in window.yaze.ai.processAgentRequest");} }) | |
| nlohmann::json | anonymous_namespace{yaze_debug_inspector.cc}::MessageToJson (const yaze::cli::agent::ChatMessage &msg) |
| std::string | anonymous_namespace{yaze_debug_inspector.cc}::registerExternalAiDriver () |
| void | anonymous_namespace{yaze_debug_inspector.cc}::onExternalAiResponse (std::string response_json) |
| yaze::editor::EditorType | anonymous_namespace{yaze_debug_inspector.cc}::ParseEditorType (const std::string &name) |
| std::string | getEditorState () |
| std::string | executeCommand (std::string command) |
| std::string | switchToEditor (std::string editor_name) |
| std::string | switchToEditorAsync (std::string editor_name) |
| Switch to an editor asynchronously with operation tracking. | |
| std::string | getOperationStatus (uint32_t op_id) |
| Get the status of an async operation. | |
| std::string | showPanel (std::string card_id) |
| Show a card by ID. | |
| std::string | hidePanel (std::string card_id) |
| Hide a card by ID. | |
| std::string | togglePanel (std::string card_id) |
| Toggle a card's visibility. | |
| std::string | getPanelState () |
| Get the visibility state of all cards. | |
| std::string | getPanelsInCategory (std::string category) |
| Get cards in a specific category. | |
| std::string | showPanelGroup (std::string group_name) |
| Show a predefined group of cards. | |
| std::string | hidePanelGroup (std::string group_name) |
| Hide a predefined group of cards. | |
| std::string | getPanelGroups () |
| Get available card groups. | |
| bool | isTreeViewMode () |
| Check if tree view mode is enabled. | |
| std::string | setTreeViewMode (bool enabled) |
| Set tree view mode. | |
| std::string | toggleTreeViewMode () |
| Toggle tree view mode. | |
| std::string | getSidebarState () |
| Get sidebar state including view mode and width. | |
| std::string | openRightPanel (std::string panel_name) |
| Open a specific right panel. | |
| std::string | closeRightPanel () |
| Close the currently open right panel. | |
| std::string | toggleRightPanel (std::string panel_name) |
| Toggle a specific right panel. | |
| std::string | getRightPanelState () |
| Get the state of the right panel. | |
| std::string | getDungeonPaletteEvents () |
| std::string | getColorComparisons () |
| std::string | samplePixelAt (int x, int y) |
| void | clearPaletteDebugEvents () |
| std::string | getFullPaletteState () |
| std::string | getPaletteData () |
| std::string | getEventTimeline () |
| std::string | getDiagnosticSummary () |
| std::string | getHypothesisAnalysis () |
| std::string | getArenaStatus () |
| std::string | getGfxSheetInfo (int index) |
| std::string | getRomStatus () |
| std::string | readRomBytes (int address, int count) |
| std::string | getRomPaletteGroup (const std::string &group_name, int palette_index) |
| std::string | getOverworldMapInfo (int map_id) |
| std::string | getOverworldTileInfo (int map_id, int tile_x, int tile_y) |
| std::string | getEmulatorStatus () |
| Get the current emulator status including CPU state. | |
| std::string | readEmulatorMemory (int address, int count) |
| Read memory from the emulator's WRAM. | |
| std::string | getEmulatorVideoState () |
| Get PPU (video) state from the emulator. | |
| std::string | getYazeVersion () |
| std::string | getRomSessions () |
| std::string | getFileManagerDebugInfo () |
| void | resumeAudioContext () |
| std::string | getGraphicsDiagnostics () |
| std::string | getFullDebugState () |
| EMSCRIPTEN_BINDINGS (yaze_debug_inspector) | |
Variables | |
| std::atomic< uint32_t > | anonymous_namespace{yaze_debug_inspector.cc}::g_operation_counter {0} |
| std::unordered_map< uint32_t, std::string > | anonymous_namespace{yaze_debug_inspector.cc}::g_pending_operations |
WASM debug inspector for yaze - palette, overworld, and emulator access.
This file provides JavaScript bindings for debugging infrastructure used by Gemini/Antigravity AI integration to analyze rendering issues and game state.
Definition in file yaze_debug_inspector.cc.
| const char * Z3edProcessCommand | ( | const char * | command | ) |
Referenced by executeCommand().
| std::string getEditorState | ( | ) |
Definition at line 237 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager(), yaze::editor::kDungeon, and yaze::editor::kEditorNames.
Referenced by EMSCRIPTEN_BINDINGS().

| std::string executeCommand | ( | std::string | command | ) |
Definition at line 262 of file yaze_debug_inspector.cc.
References Z3edProcessCommand().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string switchToEditor | ( | std::string | editor_name | ) |
Definition at line 268 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager(), yaze::editor::kAgent, yaze::editor::kSettings, yaze::editor::kUnknown, and anonymous_namespace{yaze_debug_inspector.cc}::ParseEditorType().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string switchToEditorAsync | ( | std::string | editor_name | ) |
Switch to an editor asynchronously with operation tracking.
Returns an operation ID that can be polled with getOperationStatus(). The operation completes on the next ImGui frame when the deferred action executes.
| editor_name | Name of the editor to switch to |
Definition at line 312 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::g_operation_counter, anonymous_namespace{yaze_debug_inspector.cc}::g_pending_operations, yaze::app::GetGlobalEditorManager(), yaze::editor::kAgent, yaze::editor::kSettings, yaze::editor::kUnknown, and anonymous_namespace{yaze_debug_inspector.cc}::ParseEditorType().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getOperationStatus | ( | uint32_t | op_id | ) |
Get the status of an async operation.
| op_id | The operation ID returned by switchToEditorAsync |
Definition at line 365 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::g_pending_operations.
Referenced by EMSCRIPTEN_BINDINGS().
| std::string showPanel | ( | std::string | card_id | ) |
Show a card by ID.
| card_id | Panel identifier (e.g., "dungeon.room_selector") |
Definition at line 427 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string hidePanel | ( | std::string | card_id | ) |
Hide a card by ID.
Definition at line 448 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string togglePanel | ( | std::string | card_id | ) |
Toggle a card's visibility.
Definition at line 467 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getPanelState | ( | ) |
Get the visibility state of all cards.
Definition at line 498 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getPanelsInCategory | ( | std::string | category | ) |
Get cards in a specific category.
Definition at line 540 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string showPanelGroup | ( | std::string | group_name | ) |
Show a predefined group of cards.
Definition at line 574 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string hidePanelGroup | ( | std::string | group_name | ) |
Hide a predefined group of cards.
Definition at line 606 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getPanelGroups | ( | ) |
Get available card groups.
Definition at line 641 of file yaze_debug_inspector.cc.
Referenced by EMSCRIPTEN_BINDINGS().
| bool isTreeViewMode | ( | ) |
Check if tree view mode is enabled.
Definition at line 671 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string setTreeViewMode | ( | bool | enabled | ) |
Set tree view mode.
Definition at line 681 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string toggleTreeViewMode | ( | ) |
Toggle tree view mode.
Definition at line 695 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getSidebarState | ( | ) |
Get sidebar state including view mode and width.
Definition at line 710 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager(), yaze::editor::PanelManager::GetSidebarWidth(), and yaze::editor::PanelManager::GetSidePanelWidth().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string openRightPanel | ( | std::string | panel_name | ) |
Open a specific right panel.
Definition at line 743 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string closeRightPanel | ( | ) |
Close the currently open right panel.
Definition at line 778 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string toggleRightPanel | ( | std::string | panel_name | ) |
Toggle a specific right panel.
Definition at line 796 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getRightPanelState | ( | ) |
Get the state of the right panel.
Definition at line 834 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getDungeonPaletteEvents | ( | ) |
Definition at line 882 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getColorComparisons | ( | ) |
Definition at line 886 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string samplePixelAt | ( | int | x, |
| int | y ) |
Definition at line 890 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS().

| void clearPaletteDebugEvents | ( | ) |
Definition at line 894 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Clear(), and yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getFullPaletteState | ( | ) |
Definition at line 899 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS(), and getFullDebugState().

| std::string getPaletteData | ( | ) |
Definition at line 903 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getEventTimeline | ( | ) |
Definition at line 907 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getDiagnosticSummary | ( | ) |
Definition at line 911 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS(), and getFullDebugState().

| std::string getHypothesisAnalysis | ( | ) |
Definition at line 915 of file yaze_debug_inspector.cc.
References yaze::zelda3::PaletteDebugger::Get().
Referenced by EMSCRIPTEN_BINDINGS(), and getFullDebugState().

| std::string getArenaStatus | ( | ) |
Definition at line 923 of file yaze_debug_inspector.cc.
References yaze::gfx::Arena::Get().
Referenced by EMSCRIPTEN_BINDINGS(), and getFullDebugState().

| std::string getGfxSheetInfo | ( | int | index | ) |
Definition at line 952 of file yaze_debug_inspector.cc.
References yaze::gfx::Arena::Get().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getRomStatus | ( | ) |
Definition at line 987 of file yaze_debug_inspector.cc.
References yaze::cli::GetGlobalRom().
Referenced by EMSCRIPTEN_BINDINGS(), and getFullDebugState().

| std::string readRomBytes | ( | int | address, |
| int | count ) |
Definition at line 1005 of file yaze_debug_inspector.cc.
References yaze::cli::GetGlobalRom().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getRomPaletteGroup | ( | const std::string & | group_name, |
| int | palette_index ) |
Definition at line 1032 of file yaze_debug_inspector.cc.
References yaze::gfx::PaletteGroupMap::get_group(), yaze::cli::GetGlobalRom(), yaze::zelda3::LoadGameData(), and yaze::zelda3::GameData::palette_groups.
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getOverworldMapInfo | ( | int | map_id | ) |
Definition at line 1081 of file yaze_debug_inspector.cc.
References yaze::cli::GetGlobalRom().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getOverworldTileInfo | ( | int | map_id, |
| int | tile_x, | ||
| int | tile_y ) |
Definition at line 1124 of file yaze_debug_inspector.cc.
References yaze::cli::GetGlobalRom().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getEmulatorStatus | ( | ) |
Get the current emulator status including CPU state.
Returns JSON with:
CPU status flags (P register):
Definition at line 1169 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetGlobalEmulator().
Referenced by EMSCRIPTEN_BINDINGS(), and getFullDebugState().

| std::string readEmulatorMemory | ( | int | address, |
| int | count ) |
Read memory from the emulator's WRAM.
| address | Starting address (SNES address space, e.g., 0x7E0000 for WRAM) |
| count | Number of bytes to read (max 256) |
Memory map reference:
Definition at line 1244 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetGlobalEmulator().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getEmulatorVideoState | ( | ) |
Get PPU (video) state from the emulator.
Returns JSON with:
Definition at line 1296 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetGlobalEmulator().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getYazeVersion | ( | ) |
Definition at line 1341 of file yaze_debug_inspector.cc.
References YAZE_VERSION_STRING.
Referenced by EMSCRIPTEN_BINDINGS().
| std::string getRomSessions | ( | ) |
Definition at line 1345 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getFileManagerDebugInfo | ( | ) |
Definition at line 1377 of file yaze_debug_inspector.cc.
References yaze::app::GetGlobalEditorManager(), and yaze::cli::GetGlobalRom().
Referenced by EMSCRIPTEN_BINDINGS().

| void resumeAudioContext | ( | ) |
Definition at line 1417 of file yaze_debug_inspector.cc.
References anonymous_namespace{yaze_debug_inspector.cc}::GetGlobalEmulator().
Referenced by EMSCRIPTEN_BINDINGS().

| std::string getGraphicsDiagnostics | ( | ) |
Definition at line 1428 of file yaze_debug_inspector.cc.
References yaze::cli::GetGlobalRom().

| std::string getFullDebugState | ( | ) |
Definition at line 1437 of file yaze_debug_inspector.cc.
References getArenaStatus(), getDiagnosticSummary(), getEmulatorStatus(), getFullPaletteState(), getHypothesisAnalysis(), and getRomStatus().
Referenced by EMSCRIPTEN_BINDINGS().
| EMSCRIPTEN_BINDINGS | ( | yaze_debug_inspector | ) |
Definition at line 1469 of file yaze_debug_inspector.cc.
References clearPaletteDebugEvents(), closeRightPanel(), executeCommand(), getArenaStatus(), getColorComparisons(), getDiagnosticSummary(), getDungeonPaletteEvents(), getEditorState(), getEmulatorStatus(), getEmulatorVideoState(), getEventTimeline(), getFileManagerDebugInfo(), getFullDebugState(), getFullPaletteState(), getGfxSheetInfo(), getHypothesisAnalysis(), getOperationStatus(), getOverworldMapInfo(), getOverworldTileInfo(), getPaletteData(), getPanelGroups(), getPanelsInCategory(), getPanelState(), getRightPanelState(), getRomPaletteGroup(), getRomSessions(), getRomStatus(), getSidebarState(), getYazeVersion(), hidePanel(), hidePanelGroup(), isTreeViewMode(), anonymous_namespace{yaze_debug_inspector.cc}::onExternalAiResponse(), openRightPanel(), readEmulatorMemory(), readRomBytes(), anonymous_namespace{yaze_debug_inspector.cc}::registerExternalAiDriver(), resumeAudioContext(), samplePixelAt(), setTreeViewMode(), showPanel(), showPanelGroup(), switchToEditor(), switchToEditorAsync(), togglePanel(), toggleRightPanel(), and toggleTreeViewMode().