Merge remote-tracking branch 'origin/master' into spike/load-time-zero

This commit is contained in:
Matthew Stanley
2026-07-14 23:09:27 -07:00
26 changed files with 868 additions and 60 deletions
+23 -4
View File
@@ -758,6 +758,21 @@ std::string CodeGenerator::translate_instruction(uint32_t addr, uint32_t instr)
std::string code;
for (const auto& site : config_.ws_signed_x_bound_sites) {
if ((site.address & 0x1FFFFFFFu) != (addr & 0x1FFFFFFFu)) continue;
if (instr != site.expected) {
if (config_.overlay_mode) continue;
fmt::print(stderr,
"ERROR: signed_x_bound expected 0x{:08X} at 0x{:08X}, found 0x{:08X}\n",
site.expected, addr, instr);
std::exit(1);
}
const int32_t vanilla = (int32_t)((instr & 0xFFFFu) << 16);
return fmt::format("{} = (uint32_t)psx_ws_player_x_bound((int32_t)0x{:08X});"
" /* typed native-wide signed X bound */{}",
reg_name(get_rt(instr)), (uint32_t)vanilla, comment);
}
// Widescreen automatic far-backdrop column PRELOAD ([widescreen.cull]
// auto_backdrop). At a detected window's START/END finalize, route the value
// through psx_ws_backdrop_value(orig, is_end): identity at 4:3, but in
@@ -1280,11 +1295,14 @@ std::string CodeGenerator::translate_instruction(uint32_t addr, uint32_t instr)
: fmt::format("cpu->gte_data[{}]", rt);
std::string swc2_store_pc = fmt::format("g_debug_last_store_pc = 0x{:08X}u; ", addr);
if (offset == 0) {
code = gte_stall + swc2_store_pc + fmt::format("cpu->write_word({}, {}); /* swc2 gte[{}], ({}) */",
reg_name(rs), value, rt, reg_name(rs));
code = gte_stall + swc2_store_pc + fmt::format(
"cpu->write_word({}, {}); gte_precision_store_word({}, {}); /* swc2 gte[{}], ({}) */",
reg_name(rs), value, reg_name(rs), rt, rt, reg_name(rs));
} else {
code = gte_stall + swc2_store_pc + fmt::format("cpu->write_word({} + {}, {}); /* swc2 gte[{}], {}({}) */",
reg_name(rs), offset, value, rt, offset, reg_name(rs));
code = gte_stall + swc2_store_pc + fmt::format(
"cpu->write_word({} + {}, {}); gte_precision_store_word({} + {}, {}); /* swc2 gte[{}], {}({}) */",
reg_name(rs), offset, value, reg_name(rs), offset, rt,
rt, offset, reg_name(rs));
}
}
break;
@@ -2666,6 +2684,7 @@ std::string CodeGenerator::generate_file(
ss << "extern void psx_ws_sprite_tag(CPUState* cpu); /* widescreen prim tag (gpu.c) */\n";
ss << "extern void psx_ws_mmx6_bg_stage_init(void); /* ws 2D stage reveal invalidation (gpu.c) */\n";
ss << "extern int psx_ws_x_margin(void); /* widescreen cull-margin term (gpu.c) */\n";
ss << "extern int32_t psx_ws_player_x_bound(int32_t vanilla); /* typed gameplay X bound */\n";
ss << "extern int psx_ws_cull_sltiu(uint32_t sx, uint32_t imm); /* ws auto screen-x cull (gpu.c) */\n";
ss << "extern int psx_ws_cull_slti(uint32_t sx, uint32_t imm); /* ws cull signed right edge (gpu.c) */\n";
ss << "extern int psx_ws_cull_bltz(uint32_t v); /* ws cull signed left edge (gpu.c) */\n";