mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-27 18:52:11 -04:00
5b7e69b441
The tier mis-compiled and has been hard-gated off since 2026-06-25; overlay
gaps fall to gcc/tcc shards and the dirty-RAM interpreter, unchanged.
Re-do on master of the removal validated on the stale branch (6da8c02),
reconciled with everything master grew since the fork:
- Delete overlay_sljit.{c,h}, overlay_compile_worker.{c,h}, lib/sljit,
runtime/tests/sljit_*.c, and the runtime.cmake sources/include-dirs.
- Strip the sljit provider/backend from code_provider.{c,h},
overlay_backend.{c,h} ("sljit" in overlay_backend/PSX_OVERLAY_BACKEND now
degrades to auto so stale configs still boot), main.cpp, debug_server.c
(sljit_status/sljit_async/sljit_try TCP commands), overlay_loader.{c,h}
(live policy, JIT-on-miss, persisted-shard cache, async worker glue,
psx_sljit_call/cop2/memx host helpers — reachable only via the removed
cpu->sljit_helpers table), and cpu_state.h (SLJIT_HLP_* enum + the
sljit_helpers[] member; CPUState layout change reshards via the cg tag).
- Master-only entanglement resolved before deletion: 28165d6's Einhander WS
player-X bound emit existed in three paths (gcc code_generator, sljit,
dirty_ram_interp). The gcc shard link contract now forwards
psx_ws_player_x_bound (ABI v13, previous commit), so deleting the sljit
emit path loses no widescreen behavior; ffc6688's game-dispatch block
inside the dead psx_sljit_call helper goes with it.
- Reword comments that described sljit as a live backend (gpu.{c,h},
ws_*_detect.h, cosim_state.c, dirty_ram_interp.c, autocompile.h,
boot_state.h, config_loader.h, compile_overlays.py, and the CPS marker
comments the recompiler emits).
recompiler psxrecomp-game builds clean; game runtimes rebuilt + boot-verified
separately.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
67 lines
2.7 KiB
C
67 lines
2.7 KiB
C
/* overlay_backend.c — compiler-neutral overlay tier-selection policy.
|
|
* See overlay_backend.h. (Originally split out of overlay_sljit.c, whose
|
|
* sljit tier was removed 2026-07-15: tier selection was never sljit's job.) */
|
|
|
|
#include "overlay_backend.h"
|
|
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
static OverlayBackend s_active = OVERLAY_BACKEND_AUTO;
|
|
static int s_resolved = 0;
|
|
static char s_last_msg[256];
|
|
|
|
static void backend_log(const char *fmt, ...) {
|
|
va_list ap; va_start(ap, fmt);
|
|
vsnprintf(s_last_msg, sizeof(s_last_msg), fmt, ap);
|
|
va_end(ap);
|
|
}
|
|
|
|
const char *overlay_backend_name(OverlayBackend b) {
|
|
switch (b) {
|
|
case OVERLAY_BACKEND_GCC: return "gcc";
|
|
case OVERLAY_BACKEND_TCC: return "tcc";
|
|
case OVERLAY_BACKEND_AUTO_NO_GCC: return "auto-no-gcc";
|
|
default: return "auto";
|
|
}
|
|
}
|
|
|
|
static OverlayBackend parse_backend(const char *s, OverlayBackend dflt) {
|
|
if (!s || !*s) return dflt;
|
|
if (!strcmp(s, "gcc")) return OVERLAY_BACKEND_GCC;
|
|
/* "sljit" (removed 2026-07-15) is no longer recognized — a stale config
|
|
* value falls through to `dflt` (AUTO), so old game.toml still boots. */
|
|
if (!strcmp(s, "tcc")) return OVERLAY_BACKEND_TCC;
|
|
if (!strcmp(s, "auto-no-gcc")) return OVERLAY_BACKEND_AUTO_NO_GCC;
|
|
if (!strcmp(s, "auto")) return OVERLAY_BACKEND_AUTO;
|
|
return dflt;
|
|
}
|
|
|
|
OverlayBackend overlay_backend_resolve(const char *cfg, int gcc_toolchain_available) {
|
|
/* Precedence: env PSX_OVERLAY_BACKEND > game.toml [runtime] overlay_backend
|
|
* (cfg) > AUTO. Tier order is static > gcc > tcc > interp. AUTO prefers gcc
|
|
* when a gcc TOOLCHAIN is actually present (a dev /
|
|
* production box), else tcc (the bundled toolchain-free user fallback).
|
|
* AUTO_NO_GCC forces the tcc branch even when gcc IS present — it simulates a
|
|
* toolchain-less user box on a dev machine (gcc shards still LOAD via the
|
|
* loader; only the gap-fill compiler is forced to tcc). */
|
|
OverlayBackend want = parse_backend(getenv("PSX_OVERLAY_BACKEND"),
|
|
parse_backend(cfg, OVERLAY_BACKEND_AUTO));
|
|
OverlayBackend eff = want;
|
|
if (want == OVERLAY_BACKEND_AUTO)
|
|
eff = gcc_toolchain_available ? OVERLAY_BACKEND_GCC : OVERLAY_BACKEND_TCC;
|
|
else if (want == OVERLAY_BACKEND_AUTO_NO_GCC)
|
|
eff = OVERLAY_BACKEND_TCC;
|
|
|
|
s_active = eff;
|
|
s_resolved = 1;
|
|
backend_log("backend resolved: want=%s effective=%s (gcc_toolchain=%d)",
|
|
overlay_backend_name(want), overlay_backend_name(eff),
|
|
gcc_toolchain_available);
|
|
return eff;
|
|
}
|
|
|
|
OverlayBackend overlay_backend_active(void) { return s_active; }
|