mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-25 18:05:12 -04:00
Runtime tests: link gpu_timeline where needed, no-debug ring stub, guards for span replay
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -255,6 +255,7 @@ if(BUILD_TESTING)
|
||||
tests/psx_ram_runtime_map_stubs.c
|
||||
src/memory.c
|
||||
src/dma.c
|
||||
src/gpu_timeline.c
|
||||
src/boot_state.c
|
||||
src/psx_icache.c
|
||||
src/psx_ram_geometry.c)
|
||||
|
||||
@@ -6081,6 +6081,7 @@ static void gp0_ring_record(const uint32_t *words, int n) {
|
||||
(void)n;
|
||||
}
|
||||
|
||||
void gpu_gp0_ring_set_frozen(int frozen) { (void)frozen; }
|
||||
uint64_t gpu_gp0_ring_total(void) { return 0; }
|
||||
uint32_t gpu_gp0_ring_capacity(void) { return 0; }
|
||||
uint32_t gpu_gp0_ring_max_words(void) { return GPU_GP0_RING_MAX_WORDS; }
|
||||
|
||||
@@ -18,6 +18,7 @@ import tempfile
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[2]
|
||||
GPU_C = ROOT / "runtime" / "src" / "gpu.c"
|
||||
GPU_TIMELINE_C = ROOT / "runtime" / "src" / "gpu_timeline.c"
|
||||
DEFAULT_GCC = pathlib.Path(r"C:\msys64\mingw64\bin\gcc.exe")
|
||||
|
||||
DRIVER_C = r"""
|
||||
@@ -201,6 +202,7 @@ STUBS_C = r"""
|
||||
#include <string.h>
|
||||
|
||||
uint64_t s_frame_count = 0;
|
||||
uint64_t psx_cycle_count = 0;
|
||||
uint32_t g_debug_last_store_pc = 0x80012340u;
|
||||
uint32_t g_psx_ram_size = 0x00200000u;
|
||||
uint32_t g_psx_ram_mask = 0x001FFFFFu;
|
||||
@@ -242,8 +244,8 @@ int ws_cull_should_keep(uint32_t addr) { (void)addr; return 1; }
|
||||
int ws_ui_group_should_keep(uint32_t addr) { (void)addr; return 1; }
|
||||
uint32_t psx_mod_gpu_dma_resolve_address(uint32_t address) { return address; }
|
||||
void ws_ui_group_assign(WsUiGroupItem *items, size_t count,
|
||||
int32_t display_width, int dense_menu)
|
||||
{ (void)items; (void)count; (void)display_width; (void)dense_menu; }
|
||||
int32_t display_width, int dense_menu, int in_place)
|
||||
{ (void)items; (void)count; (void)display_width; (void)dense_menu; (void)in_place; }
|
||||
int32_t ws_ui_anchor_for_bounds(int32_t x, int32_t width, int32_t display_width)
|
||||
{ (void)x; (void)width; return display_width / 2; }
|
||||
int gte_geometry_correction_enabled(void) { return 0; }
|
||||
@@ -436,6 +438,7 @@ def build(cc: str, work: pathlib.Path, name: str, prod: bool) -> pathlib.Path:
|
||||
cmd.extend([
|
||||
str(work / "driver.c"),
|
||||
str(GPU_C),
|
||||
str(GPU_TIMELINE_C),
|
||||
str(work / "stubs.c"),
|
||||
])
|
||||
if platform.system() == "Darwin":
|
||||
|
||||
@@ -21,7 +21,10 @@ def main():
|
||||
assert source.count('psx_mod_function_entry(cpu, addr)') == 1
|
||||
# Every interpreted entry reaches these calls: without an active hook they
|
||||
# must cost one load, never a call into the plugin table.
|
||||
assert 'if (g_psx_mod_function_entry_hooks && psx_mod_function_entry(cpu, addr)) return 1;' in source
|
||||
# A forced span replay (psx_mod_run_guest_span) runs inside a hook
|
||||
# already: it must not re-enter the entry hooks, so the check leads.
|
||||
assert ('if (!forced && g_psx_mod_function_entry_hooks && '
|
||||
'psx_mod_function_entry(cpu, addr))\n return 1;') in source
|
||||
assert 'if (g_psx_mod_function_entry_hooks &&\n' in source
|
||||
local_start = source.index('if (allow_local_dirty_flow && target != 0 &&')
|
||||
local_end = source.index('current_page = target_phys >> 12;', local_start)
|
||||
|
||||
@@ -48,7 +48,8 @@ def main():
|
||||
block = block[:block.index('#endif\n\n /* B-2')]
|
||||
assert re.search(r'clean_game_text_miss = psx_game_address_in_text\(addr\) \? 1 : 0;', block), \
|
||||
'a compiled-dispatch miss in game text no longer sets clean_game_text_miss'
|
||||
hook = re.search(r'if \(clean_game_text_miss\)\s*\(void\)psx_segment_miss_note\(addr, '
|
||||
# A forced span replay interprets compiled text on purpose: not a miss.
|
||||
hook = re.search(r'if \(clean_game_text_miss && !forced\)\s*\(void\)psx_segment_miss_note\(addr, '
|
||||
r'psx_game_is_function_entry,\s*cpu->gpr\[31\], cpu->gpr\[29\],', block)
|
||||
assert hook, 'dirty_ram_dispatch_inner no longer notes segment misses on a clean-text miss'
|
||||
assert block.index('psx_dispatch_game_compiled(cpu, addr)') < hook.start(), \
|
||||
|
||||
Reference in New Issue
Block a user