game_options.toml template

This commit is contained in:
Alex Vanderveen
2026-08-12 20:07:44 -04:00
parent c4f412be17
commit f3c6caf96c
5 changed files with 33 additions and 0 deletions
@@ -464,6 +464,11 @@ def op_rewrite_cmake_setup_host(root: Path, options: MigrateOptions) -> ApplyRes
_fill(templates_dir() / "CMakeLists.txt.in", cmake, tokens, options.dry_run)
go = root / "game_options.toml"
if not go.is_file():
_fill(templates_dir() / "game_options.toml.in", go, tokens, options.dry_run)
changed.append("game_options.toml")
if extras_bits and not options.dry_run:
extras_note.write_text(
"Preserved notes after setup-host CMake rewrite:\n\n"
@@ -354,6 +354,7 @@ git init -q
Fill-Template (Join-Path $TemplateDir "CMakeLists.txt.in") (Join-Path $Root "CMakeLists.txt")
Fill-Template (Join-Path $TemplateDir "game.toml.in") (Join-Path $Root "game.toml")
Fill-Template (Join-Path $TemplateDir "game_options.toml.in") (Join-Path $Root "game_options.toml")
Fill-Template (Join-Path $TemplateDir "codegen_setup.c.in") (Join-Path $Root "codegen_setup.c")
Fill-Template (Join-Path $TemplateDir "codegen_setup.h.in") (Join-Path $Root "codegen_setup.h")
Fill-Template (Join-Path $TemplateDir "gitignore.in") (Join-Path $Root ".gitignore")
@@ -566,6 +566,7 @@ git init -q
fill_template "$TEMPLATE_DIR/CMakeLists.txt.in" "$ROOT/CMakeLists.txt"
fill_template "$TEMPLATE_DIR/game.toml.in" "$ROOT/game.toml"
fill_template "$TEMPLATE_DIR/game_options.toml.in" "$ROOT/game_options.toml"
fill_template "$TEMPLATE_DIR/codegen_setup.c.in" "$ROOT/codegen_setup.c"
fill_template "$TEMPLATE_DIR/codegen_setup.h.in" "$ROOT/codegen_setup.h"
fill_template "$TEMPLATE_DIR/gitignore.in" "$ROOT/.gitignore"
@@ -25,3 +25,17 @@ psxrecomp_add_game_runtime(psx-runtime
GEN_FULL_GLOB "generated/@BOOT_EXE@_full_*.c"
@CODEGEN_SETUP_ARG@
)
# Stage runtime configs next to the exe for direct build/ launches. Only copy
# files that exist — never fail POST_BUILD when game_options.toml is absent.
foreach(_PSX_RUNTIME_CONFIG game.toml game_options.toml)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_PSX_RUNTIME_CONFIG}")
add_custom_command(TARGET psx-runtime POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/${_PSX_RUNTIME_CONFIG}"
"$<TARGET_FILE_DIR:psx-runtime>/${_PSX_RUNTIME_CONFIG}"
COMMENT "Staging ${_PSX_RUNTIME_CONFIG}"
VERBATIM)
endif()
endforeach()
@@ -0,0 +1,12 @@
# Native in-game OPTION persistence (optional).
# Declared next to game.toml; read by the recompiler (init-store hooks) and
# runtime (restore / save). Omit [[option]] rows until the title needs them.
# See psxrecomp GameOptions / runtime game_options.c.
#
# [[option]]
# name = "example"
# addr = "0x80000000"
# size = 1
# init_store_pc = "0x80000000"
# min = 0
# max = 1