Skip to content

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

C++

Let nightly builds find their runtime kit

Leonardo Lobato9843bc0eef9d
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4d15b8..bb7f565 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ set(PLAYDEN_PRERELEASE "" CACHE STRING "Pre-release suffix: empty, beta.N (1-999
set(PLAYDEN_FULL_VERSION "${PROJECT_VERSION}")
if(NOT PLAYDEN_PRERELEASE STREQUAL "")
if(NOT PLAYDEN_PRERELEASE MATCHES "^beta\\.[1-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?$" AND
- NOT PLAYDEN_PRERELEASE MATCHES "^nightly\\.20[0-9][0-9][01][0-9][0-3][0-9]\\.[1-9][0-9]?[0-9]?$")
+ NOT PLAYDEN_PRERELEASE MATCHES "^nightly\\.20[0-9][0-9](0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])\\.[1-9][0-9]?[0-9]?$")
message(FATAL_ERROR "PLAYDEN_PRERELEASE must be empty, beta.N (1-999999) or nightly.YYYYMMDD.N (1-999)")
endif()
string(APPEND PLAYDEN_FULL_VERSION "-${PLAYDEN_PRERELEASE}")
@@ -20,11 +20,20 @@ if(GIT_FOUND)
if(NOT playden_git_result EQUAL 0 OR NOT PLAYDEN_BUILD_COMMIT MATCHES "^[0-9a-f]+$")
set(PLAYDEN_BUILD_COMMIT "")
endif()
- execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --path-format=absolute --git-path logs/HEAD
- WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE playden_head_log OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
- if(playden_head_log AND EXISTS "${playden_head_log}")
- set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${playden_head_log}")
+ # HEAD names the branch; the branch's ref (loose or packed) and HEAD's reflog change with each commit.
+ execute_process(COMMAND "${GIT_EXECUTABLE}" symbolic-ref -q HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE playden_head_ref OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+ set(playden_git_paths HEAD logs/HEAD packed-refs)
+ if(playden_head_ref)
+ list(APPEND playden_git_paths "${playden_head_ref}")
endif()
+ foreach(playden_git_path IN LISTS playden_git_paths)
+ execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --path-format=absolute --git-path "${playden_git_path}"
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE playden_git_file OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+ if(playden_git_file AND EXISTS "${playden_git_file}")
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${playden_git_file}")
+ endif()
+ endforeach()
endif()
option(PLAYDEN_UI_SIMULATION "Package selected PS5 UI with developer simulation fixtures" OFF)
diff --git a/src/update/update_service.cpp b/src/update/update_service.cpp
index 8a256b8..32af4d6 100644
--- a/src/update/update_service.cpp
+++ b/src/update/update_service.cpp
@@ -865,9 +865,16 @@ void UpdateService::DoCheckKit() {
std::string error;
const auto releases = FetchReleases(&error);
if (!releases) return FailKit("Playden could not reach GitHub to download its runtime kit.", error);
+ // The running version's release names its kit. A nightly has no release: the newest release before it
+ // stands in, and is used only if it names the same kit (checked below).
const Release* own = nullptr;
- for (const auto& release : *releases)
- if (!release.draft && release.version == config_.current) own = &release;
+ for (const auto& release : *releases) {
+ if (release.draft) continue;
+ if (release.version == config_.current) own = &release;
+ else if (config_.current.nightly() && release.version < config_.current &&
+ (!own || (own->version != config_.current && own->version < release.version)))
+ own = &release;
+ }
if (!own) return unavailable("no release has version " + config_.current.ToString());
const auto* manifest_asset = own->Find(kUpdateManifestAsset);
if (!manifest_asset) return unavailable("release " + own->tag + " has no update information");
diff --git a/tests/self_update_service_test.cpp b/tests/self_update_service_test.cpp
index 6344a40..6a1ec70 100644
--- a/tests/self_update_service_test.cpp
+++ b/tests/self_update_service_test.cpp
@@ -354,6 +354,39 @@ int main() {
CHECK(service.Snapshot().kit.phase == KitInstallPhase::kNotNeeded && test.fixture.server.requests == requests);
service.Shutdown();
}
+ // A nightly has no release of its own: the newest release before it provides the kit when it names the same
+ // kit, and a newer release (its version's stable) is never used.
+ {
+ KitOnly test("kit-nightly", "");
+ Publish(test.fixture.server, "v0.3.0");
+ const auto older = test.fixture.server.latest;
+ test.fixture.server.releases = "[{\"tag_name\":\"v0.4.0\",\"assets\":[]}," + older + "]";
+ auto config = test.Config();
+ config.current = *ParseVersion("0.4.0-nightly.20261027.1");
+ UpdateService service(config);
+ service.Start();
+ service.CheckKit();
+ Wait(service);
+ auto kit = service.Snapshot().kit;
+ CHECK(kit.phase == KitInstallPhase::kAvailable && kit.version == "0.3.0");
+ service.InstallKit();
+ Wait(service);
+ CHECK(service.Snapshot().kit.phase == KitInstallPhase::kInstalled);
+ service.Shutdown();
+ // One naming another kit is not used.
+ KitOnly other("kit-nightly-other", "");
+ Publish(other.fixture.server, "v0.3.0");
+ other.fixture.server.releases = "[" + other.fixture.server.latest + "]";
+ auto other_config = other.Config();
+ other_config.current = *ParseVersion("0.4.0-nightly.20261027.1");
+ other_config.kit_manifest_sha256 = std::string(64, 'd');
+ UpdateService refused(other_config);
+ refused.Start();
+ refused.CheckKit();
+ Wait(refused);
+ CHECK(refused.Snapshot().kit.phase == KitInstallPhase::kUnavailable);
+ refused.Shutdown();
+ }
// Another kit is installed: the right one replaces it, and the old one is left as a ".replaced-" leftover.
{
KitOnly test("kit-replace", std::string(64, 'b'));