OXYGENHUB
# 9120e87480a6 enhanced-x16-emulator / src / debug_ui / debug_ui_settings.h
5.2 KiB · Objective-C · last changed chore(): initial commit 25 days ago source blame history raw
1
// Commander X16 Emulator — debugger user preferences.
2
//
3
// One place for the debugger's behavioural toggles, so panels read a single
4
// source of truth instead of each keeping its own static, and so the user can
5
// see and change them together (System > Settings).
6
//
7
// Preferences persist in imgui.ini through an ImGuiSettingsHandler, alongside
8
// the window layout ImGui already stores there — no extra config file.
9
#ifndef DEBUG_UI_SETTINGS_H
10
#define DEBUG_UI_SETTINGS_H
11
12
#include <stdbool.h>
13
14
struct DebugUiSettings {
15
    // --- Appearance ---------------------------------------------------------
16
    // Global interface scale: the whole debugger, not just panel text. Per-panel
17
    // Ctrl+wheel zoom stacks on top of this. Scales widget metrics (padding,
18
    // spacing, scrollbars) as well as the font, so menus, tab bars and buttons
19
    // grow with it instead of staying tiny.
20
    float ui_scale = 1.0f;
21
22
    // --- Navigation ---------------------------------------------------------
23
    // Where execution stops is not always where the user is looking. These make
24
    // the debugger follow the PC between the Source and Disassembly views.
25
    bool auto_switch_disasm = true;  // stop with no source -> focus Disassembly
26
    bool auto_switch_source = true;  // stop with source    -> focus Source
27
28
    // --- Execution ----------------------------------------------------------
29
    bool follow_interrupts = false;  // stepping stops at a handler that fires
30
    bool break_on_interrupt = false; // stop on every interrupt entry
31
32
    // --- Memory -------------------------------------------------------------
33
    bool  mem_highlight_changes = true;  // pulse bytes that changed
34
    float mem_highlight_seconds = 1.5f;  // how long the pulse takes to fade
35
36
    // --- Audio --------------------------------------------------------------
37
    bool audio_hold_on_pause = true; // freeze audio panels instead of blanking
38
39
    // --- I/O trace ----------------------------------------------------------
40
    // The I/O panel records a ring of register accesses and decoded device
41
    // events. Capture is off by default and every device with it: this is the
42
    // one debugger feature that costs the running machine anything -- a test
43
    // and a branch on every I/O access, and a copy on every captured one --
44
    // and the I/O page is the busiest address range in the system. The panel's
45
    // live state tabs all work without it; only the Activity log needs it.
46
    bool io_trace_capture = false;
47
    int  io_trace_capacity = 4096; // events retained; clamped by io_trace.c
48
49
    // Per-device capture, all off by default so that switching capture on
50
    // records nothing until the user says what they are actually looking for.
51
    // Rates differ by orders of magnitude -- see the tooltips in the panel.
52
    bool io_cap_via = false;
53
    bool io_cap_vera = false;
54
    bool io_cap_spi = false;
55
    bool io_cap_ym = false;
56
    bool io_cap_emu = false;
57
    bool io_cap_midi = false;
58
    bool io_cap_openbus = false;
59
60
    // Decoded device events, split per device rather than lumped together
61
    // because their rates differ by orders of magnitude.
62
    bool io_cap_sd = false;
63
    bool io_cap_files = false;
64
    bool io_cap_i2c = false;
65
    bool io_cap_joy = false;
66
67
    // Index the filesystem inside an attached SD image, so block traffic can be
68
    // named. Off means the SD tab still works, it just reports LBAs.
69
    bool io_fat_autoindex = true;
70
71
    // --- Performance budget --------------------------------------------------
72
    // The Performance panel arms profiling while it is open, so this is only
73
    // for the cases where that is not what is wanted: leaving it running after
74
    // the panel is closed (to keep a DAP client fed), or holding it off
75
    // entirely. Like the I/O trace, this is a feature that costs the running
76
    // machine something -- an add and a table lookup on every instruction.
77
    bool  perf_always_on   = false; // keep profiling when the panel is closed
78
    float perf_target_fps  = 60.0f;
79
    int   perf_idle_mode   = 0;    // perf_idle_mode_t
80
    int   perf_capacity    = 3600; // frames of history; 60s at 60Hz
81
    int   perf_graph_frames = 240; // frames drawn in the panel's graph
82
83
    // --- Safety -------------------------------------------------------------
84
    // Most register edits are recoverable pokes. A few are not: they change
85
    // machine state the running program has already committed to, and it will
86
    // usually crash rather than cope. Those are gated behind this and are off by
87
    // default, so nobody reaches for one thinking it is a display option.
88
    //
89
    // The E (emulation) flag is the clearest case - see cpu_panel.cpp.
90
    bool allow_breaking_changes = false;
91
};
92
93
// The live settings. Mutating these takes effect immediately.
94
DebugUiSettings &debug_ui_settings();
95
96
// Install the imgui.ini persistence hook. Call once, before ImGui loads its
97
// ini file (i.e. before the first NewFrame).
98
void debug_ui_settings_register(void);
99
100
// The Settings window itself (System > Settings).
101
void debug_ui_draw_settings_window(bool *p_open);
102
103
// Note that a preference changed so it gets written back to imgui.ini. Panels
104
// that expose the same toggle call this instead of pulling in imgui_internal.h.
105
void debug_ui_settings_mark_dirty(void);
106
107
#endif