Emit a plain .elf alongside the packaged SELF artifact

create-fself output (eboot.bin, .prx, .sprx) is SELF-wrapped, not plain ELF.
Raw-ELF loader tools identify a file by its magic bytes rather than its
extension, so they cannot load those no matter what the file is renamed to.
Copy the validated .oelf to <name>.elf as well and expose the path as the
ORBIS_ELF_PATH target property, so those tools have something to point at.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Claude CodeandClaude Fable 5 committed 2026-07-28 17:56:35 +02:00
1 parent 895858e650
commit abd288c882
1 file changed
+10 -2
@@ -29,6 +29,11 @@ internal static class OrbisTargetsTemplate
if(NOT ORBIS_SOURCES)
message(FATAL_ERROR "add_orbis_target(${name}): SOURCES is required")
# A plain, unsigned <name>.elf (copy of that same validated .oelf) is
# produced alongside it -- raw-ELF loader tools inspect a file's magic
# bytes rather than its extension, so they can't load eboot.bin/*.prx/
# *.sprx (which are SELF-wrapped, not plain ELF) no matter what it's
# renamed to; point those tools at the .elf instead.
endif()
if(NOT ORBIS_TYPE)
@@ -93,8 +98,9 @@ internal static class OrbisTargetsTemplate
--paid ${ORBIS_PAID}
${_libname_args}
COMMAND "${OO_PS4_TOOLCHAIN_BIN}/readoelf" "$<TARGET_FILE:${name}>.oelf"
BYPRODUCTS "${_out_path}"
COMMENT "orbis: packaging ${name} -> ${_out_name} (type=${ORBIS_TYPE}, ptype=${_ptype})"
COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:${name}>.oelf" "${_elf_path}"
BYPRODUCTS "${_out_path}" "${_elf_path}"
COMMENT "orbis: packaging ${name} -> ${_out_name} + ${name}.elf (type=${ORBIS_TYPE}, ptype=${_ptype})"
VERBATIM
)
@@ -118,6 +124,7 @@ internal static class OrbisTargetsTemplate
set(oneValueArgs TITLE_ID CONTENT_ID TITLE VERSION ASSETS_DIR SCE_MODULE_DIR)
cmake_parse_arguments(PKG "" "${oneValueArgs}" "" ${ARGN})
set(_elf_path "${CMAKE_CURRENT_BINARY_DIR}/${name}.elf")
if(NOT PKG_TITLE_ID OR NOT PKG_CONTENT_ID OR NOT PKG_TITLE)
message(FATAL_ERROR "add_orbis_package(${target}): TITLE_ID, CONTENT_ID, and TITLE are required")
endif()
@@ -137,6 +144,7 @@ internal static class OrbisTargetsTemplate
endif()
set(_sce_sys "${CMAKE_CURRENT_SOURCE_DIR}/sce_sys")
ORBIS_ELF_PATH "${_elf_path}"
# create-gp4's --files list has no separate source-vs-target-path syntax:
# each entry is a path relative to the working directory it runs from,