mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 02:47:02 +02:00
feat: identify build provenance in window title (#159)
* feat: identify build provenance in window title * fix: propagate generated version dependency --------- Co-authored-by: nmzik <Nmzik@mail.ru>
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
#define KYTY_VERSION "@KYTY_VERSION@"
|
||||
#define KYTY_BUILD_REPOSITORY "@KYTY_BUILD_REPOSITORY@"
|
||||
#define KYTY_RELEASE_TAG "@KYTY_RELEASE_TAG@"
|
||||
#cmakedefine KYTY_OFFICIAL_BUILD
|
||||
#cmakedefine KYTY_FORK_BUILD
|
||||
#define KYTY_ENDIAN @KYTY_ENDIAN@
|
||||
#define KYTY_PLATFORM @KYTY_PLATFORM@
|
||||
#define KYTY_COMPILER KYTY_COMPILER_@KYTY_COMPILER@
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
set(KYTY_GIT_VERSION "unknown")
|
||||
set(KYTY_GIT_HASH "unknown")
|
||||
if(GIT_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --tags --always
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty
|
||||
WORKING_DIRECTORY "${GIT_WORKING_DIRECTORY}"
|
||||
OUTPUT_VARIABLE KYTY_GIT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -11,5 +12,27 @@ if(GIT_EXECUTABLE)
|
||||
if(NOT GIT_RESULT EQUAL 0)
|
||||
set(KYTY_GIT_VERSION "unknown")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse --short=7 HEAD
|
||||
WORKING_DIRECTORY "${GIT_WORKING_DIRECTORY}"
|
||||
OUTPUT_VARIABLE KYTY_GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE GIT_HASH_RESULT
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(NOT GIT_HASH_RESULT EQUAL 0)
|
||||
set(KYTY_GIT_HASH "unknown")
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY "${GIT_WORKING_DIRECTORY}"
|
||||
RESULT_VARIABLE GIT_DIRTY_RESULT
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(NOT GIT_DIRTY_RESULT EQUAL 0)
|
||||
string(APPEND KYTY_GIT_HASH "-dirty")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
configure_file("${INPUT_FILE}" "${OUTPUT_FILE}")
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "graphics/host_gpu/vulkanCommon.h"
|
||||
#include "graphics/presentation/renderDoc.h"
|
||||
#include "graphics/presentation/window/windowInternal.h"
|
||||
#include "kytyGitVersion.h"
|
||||
#include "libs/controller.h"
|
||||
#include "loader/systemContent.h"
|
||||
|
||||
@@ -937,6 +938,22 @@ void WindowContext::UpdateTitle() {
|
||||
static uint64_t fps_frames = 0;
|
||||
static double current_fps = 0.0;
|
||||
|
||||
#if KYTY_BUILD == KYTY_BUILD_DEBUG
|
||||
static constexpr auto build_type = "Debug";
|
||||
#elif KYTY_BUILD == KYTY_BUILD_RELEASE
|
||||
static constexpr auto build_type = "Release";
|
||||
#else
|
||||
static constexpr auto build_type = "Unknown";
|
||||
#endif
|
||||
|
||||
#if defined(KYTY_OFFICIAL_BUILD)
|
||||
static constexpr auto build_label = "Official build " KYTY_RELEASE_TAG;
|
||||
#elif defined(KYTY_FORK_BUILD)
|
||||
static constexpr auto build_label = "Fork build " KYTY_BUILD_REPOSITORY " " KYTY_GIT_HASH;
|
||||
#else
|
||||
static constexpr auto build_label = "Source build " KYTY_GIT_HASH;
|
||||
#endif
|
||||
|
||||
const auto now = Common::Timer::QueryPerformanceCounter();
|
||||
const auto frequency = Common::Timer::QueryPerformanceFrequency();
|
||||
frame_num++;
|
||||
@@ -948,11 +965,11 @@ void WindowContext::UpdateTitle() {
|
||||
fps_frames = 0;
|
||||
}
|
||||
|
||||
auto fps =
|
||||
fmt::format("{}{}{}{}{}{}[{}] [{}], frame: {}, fps: {:f}", (has_title ? title : ""),
|
||||
(has_title ? ", " : ""), (has_title_id ? title_id : ""),
|
||||
(has_title_id ? ", " : ""), (has_app_ver ? app_ver : ""),
|
||||
(has_app_ver ? " " : ""), device_name, processor_name, frame_num, current_fps);
|
||||
auto fps = fmt::format("[{} | {}] {}{}{}{}{}{}[{}] [{}], frame: {}, fps: {:f}", build_label,
|
||||
build_type, (has_title ? title : ""), (has_title ? ", " : ""),
|
||||
(has_title_id ? title_id : ""), (has_title_id ? ", " : ""),
|
||||
(has_app_ver ? app_ver : ""), (has_app_ver ? " " : ""), device_name,
|
||||
processor_name, frame_num, current_fps);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// AppKit traps on title changes off the main thread; fire-and-forget keeps present pacing.
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
#define KYTY_GIT_VERSION "@KYTY_GIT_VERSION@"
|
||||
#define KYTY_GIT_VERSION "@KYTY_GIT_VERSION@"
|
||||
#define KYTY_GIT_HASH "@KYTY_GIT_HASH@"
|
||||
|
||||
@@ -37,7 +37,6 @@ elseif(LINUX)
|
||||
set_target_properties(launcher PROPERTIES LINK_FLAGS "${KYTY_LD_OPTIONS}")
|
||||
endif()
|
||||
|
||||
add_dependencies(launcher KytyGitVersion)
|
||||
add_dependencies(launcher kyty_emulator)
|
||||
|
||||
if(KYTY_CLANG_CL)
|
||||
|
||||
Reference in New Issue
Block a user