From fe6a06d298df7fcfaf57f21c22fa45161210df7d Mon Sep 17 00:00:00 2001 From: Alexandros Mandravillis Date: Mon, 31 Aug 2026 00:14:33 +0300 Subject: [PATCH] Preserve explicit recomp UI root --- recompiler/CMakeLists.txt | 1 + runtime/runtime.cmake | 5 +++-- runtime/tests/test_recomp_ui_root_override.py | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 runtime/tests/test_recomp_ui_root_override.py diff --git a/recompiler/CMakeLists.txt b/recompiler/CMakeLists.txt index 4e74eddc..bdc573a3 100644 --- a/recompiler/CMakeLists.txt +++ b/recompiler/CMakeLists.txt @@ -610,6 +610,7 @@ if(BUILD_TESTING) release_zip overlay_decodable_fallback overlay_init_guard + recomp_ui_root_override pal_cadence_host_refresh sdl3_main_single_include spu_sample_scheduler_default diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index e9b9aa7c..19757ebe 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -1878,8 +1878,9 @@ function(psxrecomp_add_game_runtime target) "-DPSX_GAME_VERSION=${_psxg_release_version} or delete the build cache.") endif() - # Prefer game-root recomp-ui (runtime.cmake also auto-discovers this). - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/recomp-ui/recomp_ui.cmake") + # Use a game-root recomp-ui only when the caller did not select one. + if((NOT RECOMP_UI_ROOT OR RECOMP_UI_ROOT STREQUAL "") + AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/recomp-ui/recomp_ui.cmake") set(RECOMP_UI_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/recomp-ui" CACHE PATH "Path to recomp-ui launcher" FORCE) endif() diff --git a/runtime/tests/test_recomp_ui_root_override.py b/runtime/tests/test_recomp_ui_root_override.py new file mode 100644 index 00000000..103d3ac8 --- /dev/null +++ b/runtime/tests/test_recomp_ui_root_override.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +"""Guard the caller-selected recomp-ui root against game-root replacement.""" + +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[2] +RUNTIME_CMAKE = ROOT / "runtime" / "runtime.cmake" + + +def main() -> None: + text = RUNTIME_CMAKE.read_text(encoding="utf-8") + expected = """if((NOT RECOMP_UI_ROOT OR RECOMP_UI_ROOT STREQUAL \"\") + AND EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/recomp-ui/recomp_ui.cmake\")""" + assert expected in text, ( + "runtime packaging must preserve an explicit RECOMP_UI_ROOT before " + "falling back to the game-root recomp-ui" + ) + + +if __name__ == "__main__": + main()