Mercurial > repos > blastem
changeset 2701:5ca4e0fd761b
Update debug views while paused in the debug (except on Windows... for now)
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 04 Jul 2025 19:35:50 -0700 |
parents | 1cfd000dc750 |
children | 0a6d644c47aa |
files | coleco.c debug.c genesis.c nuklear_ui/debug_ui.c sms.c system.h vdp.c vdp.h |
diffstat | 8 files changed, 39 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/coleco.c Sun Jun 29 23:38:56 2025 -0700 +++ b/coleco.c Fri Jul 04 19:35:50 2025 -0700 @@ -472,6 +472,12 @@ { } +static vdp_context *get_vdp(system_header *system) +{ + coleco_context *coleco = (coleco_context *)system; + return coleco->vdp; +} + coleco_context *alloc_configure_coleco(system_media *media) { coleco_context *coleco = calloc(1, sizeof(coleco_context)); @@ -559,6 +565,7 @@ coleco->header.serialize = serialize; coleco->header.deserialize = deserialize; coleco->header.toggle_debug_view = toggle_debug_view; + coleco->header.get_vdp = get_vdp; coleco->header.type = SYSTEM_COLECOVISION; return coleco;
--- a/debug.c Sun Jun 29 23:38:56 2025 -0700 +++ b/debug.c Fri Jul 04 19:35:50 2025 -0700 @@ -2317,6 +2317,10 @@ process_events(); #ifndef IS_LIB render_update_display(); + vdp_context *vdp = current_system->get_vdp(current_system); + if (vdp) { + vdp_update_per_frame_debug(vdp); + } #endif #ifndef _WIN32 timeout.tv_sec = 0;
--- a/genesis.c Sun Jun 29 23:38:56 2025 -0700 +++ b/genesis.c Fri Jul 04 19:35:50 2025 -0700 @@ -2606,6 +2606,12 @@ #endif } +static vdp_context *get_vdp(system_header *system) +{ + genesis_context *gen = (genesis_context *)system; + return gen->vdp; +} + static void *tmss_rom_write_16(uint32_t address, void *context, uint16_t value) { m68k_context *m68k = context; @@ -2781,6 +2787,7 @@ gen->header.start_vgm_log = start_vgm_log; gen->header.stop_vgm_log = stop_vgm_log; gen->header.toggle_debug_view = toggle_debug_view; + gen->header.get_vdp = get_vdp; gen->header.type = SYSTEM_GENESIS; gen->header.info = *rom; set_region(gen, rom, force_region); @@ -3255,6 +3262,7 @@ gen->header.start_vgm_log = start_vgm_log; gen->header.stop_vgm_log = stop_vgm_log; gen->header.toggle_debug_view = toggle_debug_view; + gen->header.get_vdp = get_vdp; gen->header.type = stype; gen->header.info = info; set_region(gen, &info, force_region);
--- a/nuklear_ui/debug_ui.c Sun Jun 29 23:38:56 2025 -0700 +++ b/nuklear_ui/debug_ui.c Fri Jul 04 19:35:50 2025 -0700 @@ -29,33 +29,13 @@ } #ifndef DISABLE_OPENGL -vdp_context *get_vdp(void) -{ - if (!current_system) { - return NULL; - } - switch (current_system->type) - { - case SYSTEM_GENESIS: - case SYSTEM_SEGACD: - case SYSTEM_PICO: - case SYSTEM_COPERA: - return ((genesis_context *)current_system)->vdp; - case SYSTEM_SMS: - case SYSTEM_GAME_GEAR: - case SYSTEM_SG1000: - case SYSTEM_SC3000: - return ((sms_context *)current_system)->vdp; - case SYSTEM_COLECOVISION: - return ((coleco_context *)current_system)->vdp; - default: - return NULL; - } -} static void plane_debug_ui(void) { - vdp_context *vdp = get_vdp(); + if (!current_system || !current_system->get_vdp) { + return; + } + vdp_context *vdp = current_system->get_vdp(current_system); if (!vdp) { return; } @@ -149,7 +129,10 @@ void write_cram_internal(vdp_context * context, uint16_t addr, uint16_t value); static void cram_debug_ui(void) { - vdp_context *vdp = get_vdp(); + if (!current_system || !current_system->get_vdp) { + return; + } + vdp_context *vdp = current_system->get_vdp(current_system); if (!vdp) { return; }
--- a/sms.c Sun Jun 29 23:38:56 2025 -0700 +++ b/sms.c Fri Jul 04 19:35:50 2025 -0700 @@ -1530,6 +1530,12 @@ load_cassette(sms, media); } +static vdp_context *get_vdp(system_header *system) +{ + sms_context *sms = (sms_context *)system; + return sms->vdp; +} + sms_context *alloc_configure_sms(system_media *media, system_type stype, uint32_t opts, uint8_t force_region) { sms_context *sms = calloc(1, sizeof(sms_context)); @@ -1680,6 +1686,7 @@ sms->header.stop_vgm_log = stop_vgm_log; sms->header.toggle_debug_view = toggle_debug_view; sms->header.cassette_action = cassette_action; + sms->header.get_vdp = get_vdp; sms->header.type = stype; if (is_sc3000) { sms->header.lockon_change = lockon_change;
--- a/system.h Sun Jun 29 23:38:56 2025 -0700 +++ b/system.h Fri Jul 04 19:35:50 2025 -0700 @@ -104,6 +104,7 @@ uint8_t byte_storage[3]; }; +typedef struct vdp_context vdp_context; typedef void (*system_fun)(system_header *); typedef uint16_t (*system_fun_r16)(system_header *); typedef void (*system_str_fun)(system_header *, char *); @@ -117,6 +118,7 @@ typedef uint8_t *(*system_ptrszt_fun_rptr8)(system_header *, size_t *); typedef void (*system_ptr8_sizet_fun)(system_header *, uint8_t *, size_t); typedef void (*system_media_fun)(system_header *, system_media *); +typedef vdp_context *(*system_fun_rvdp)(system_header *); #include "arena.h" #include "romdb.h" @@ -151,6 +153,7 @@ system_u8_fun toggle_debug_view; system_u8_fun cassette_action; system_media_fun lockon_change; + system_fun_rvdp get_vdp; rom_info info; arena *arena; char *next_rom;
--- a/vdp.c Sun Jun 29 23:38:56 2025 -0700 +++ b/vdp.c Fri Jul 04 19:35:50 2025 -0700 @@ -2911,7 +2911,7 @@ { } -static void vdp_update_per_frame_debug(vdp_context *context) +void vdp_update_per_frame_debug(vdp_context *context) { if (context->enabled_debuggers & (1 << DEBUG_PLANE)) {
--- a/vdp.h Sun Jun 29 23:38:56 2025 -0700 +++ b/vdp.h Fri Jul 04 19:35:50 2025 -0700 @@ -178,7 +178,6 @@ VDP_TMS9918A }; -typedef struct vdp_context vdp_context; typedef void (*vdp_hook)(vdp_context *); typedef void (*vdp_reg_hook)(vdp_context *, uint16_t reg, uint16_t value); typedef void (*vdp_data_hook)(vdp_context *, uint16_t value); @@ -319,6 +318,7 @@ void vdp_reacquire_framebuffer(vdp_context *context); void vdp_serialize(vdp_context *context, serialize_buffer *buf); void vdp_deserialize(deserialize_buffer *buf, void *vcontext); +void vdp_update_per_frame_debug(vdp_context *context); void vdp_force_update_framebuffer(vdp_context *context); void vdp_toggle_debug_view(vdp_context *context, uint8_t debug_type); void vdp_inc_debug_mode(vdp_context *context);