Skip to content

Play your Steam library's Windows games on a jailbroken PS5.

C++

Give the PS5 package the app's version

Leonardo Lobato3ebbeee10fc8
diff --git a/cmake/HomebrewPS5.cmake b/cmake/HomebrewPS5.cmake
index e44c636..0923636 100644
--- a/cmake/HomebrewPS5.cmake
+++ b/cmake/HomebrewPS5.cmake
@@ -247,7 +247,8 @@ function(playden_add_homebrew_ps5_title)
COMMAND "${CMAKE_COMMAND}" -DAPP_DIR=${app} -DBOILERPLATE=${boilerplate}
-DASSETS_DIR=${CMAKE_SOURCE_DIR}/fixtures/ui-comparison/assets -DFONTS_DIR=${CMAKE_SOURCE_DIR}/build/homebrew-fonts
-DPARAM_SOURCE=${gl_source}/native-app/param.json -DPARAM_DEST=${app}/sce_sys/param.json
- -DTITLE_ID=${PLAYDEN_PS5_TITLE_ID} "-DTITLE_NAME=${playden_title_name}" -P "${CMAKE_SOURCE_DIR}/cmake/PackagePS5.cmake"
+ -DTITLE_ID=${PLAYDEN_PS5_TITLE_ID} "-DTITLE_NAME=${playden_title_name}" -DAPP_VERSION=${PROJECT_VERSION}
+ -P "${CMAKE_SOURCE_DIR}/cmake/PackagePS5.cmake"
${simulation_package_commands}
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_SOURCE_DIR}/runtime" "${app}/runtime"
${native_helper_package_commands}
diff --git a/cmake/PackagePS5.cmake b/cmake/PackagePS5.cmake
index 2160f77..fb6ccc1 100644
--- a/cmake/PackagePS5.cmake
+++ b/cmake/PackagePS5.cmake
@@ -1,4 +1,4 @@
-foreach(required APP_DIR BOILERPLATE ASSETS_DIR FONTS_DIR PARAM_SOURCE PARAM_DEST TITLE_ID TITLE_NAME)
+foreach(required APP_DIR BOILERPLATE ASSETS_DIR FONTS_DIR PARAM_SOURCE PARAM_DEST TITLE_ID TITLE_NAME APP_VERSION)
if(NOT DEFINED ${required})
message(FATAL_ERROR "${required} is required")
endif()
@@ -20,6 +20,30 @@ string(SUBSTRING "${TITLE_ID}" 4 5 concept_id)
string(JSON param SET "${param}" conceptId "\"${concept_id}\"")
string(JSON param SET "${param}" contentId "\"UP9000-${TITLE_ID}_00-PLAYDENLAUNCHER1\"")
string(JSON param SET "${param}" localizedParameters en-US titleName "\"${TITLE_NAME}\"")
+# The package version follows the project version: major.minor.patch as MM.mmm.ppp (0.2.0 is 00.002.000), so
+# every release has its own value and later releases sort higher.
+if(NOT APP_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
+ message(FATAL_ERROR "APP_VERSION must be major.minor.patch, got '${APP_VERSION}'")
+endif()
+set(version_parts "${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}" "${CMAKE_MATCH_3}")
+set(version_widths 2 3 3)
+set(content_version "")
+foreach(index RANGE 2)
+ list(GET version_parts ${index} part)
+ list(GET version_widths ${index} width)
+ string(LENGTH "${part}" length)
+ if(length GREATER width)
+ message(FATAL_ERROR "APP_VERSION ${APP_VERSION} does not fit the package version format MM.mmm.ppp")
+ endif()
+ math(EXPR pad "${width} - ${length}")
+ string(REPEAT "0" ${pad} zeros)
+ if(content_version STREQUAL "")
+ set(content_version "${zeros}${part}")
+ else()
+ set(content_version "${content_version}.${zeros}${part}")
+ endif()
+endforeach()
+string(JSON param SET "${param}" contentVersion "\"${content_version}\"")
string(JSON attribute3 GET "${param}" attribute3)
math(EXPR attribute3 "(${attribute3} & ~0x80040) | 0x80040")
string(JSON param SET "${param}" attribute3 "${attribute3}")