diff --git a/CMakeLists.txt b/CMakeLists.txt index ef2425aff..e993061bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,6 +134,7 @@ if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "") ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) + message("got remote: ${GIT_REMOTE_NAME}") endif() # If running in GitHub Actions and the above fails @@ -177,7 +178,7 @@ if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "") set(GIT_BRANCH "${GITHUB_BRANCH}") elseif ("${PR_NUMBER}" STREQUAL "" AND NOT "${GITHUB_REF}" STREQUAL "") set(GIT_BRANCH "${GITHUB_REF}") - else() + elseif("${GIT_BRANCH}" STREQUAL "") message("couldn't find branch") set(GIT_BRANCH "detached-head") endif() @@ -186,8 +187,8 @@ else() string(FIND "${GIT_REMOTE_NAME}" "/" INDEX) if (INDEX GREATER -1) string(SUBSTRING "${GIT_REMOTE_NAME}" 0 "${INDEX}" GIT_REMOTE_NAME) - else() - # If no remote is present (only a branch name), default to origin + elseif("${GIT_REMOTE_NAME}" STREQUAL "") + message("reset to origin") set(GIT_REMOTE_NAME "origin") endif() endif() diff --git a/src/emulator.cpp b/src/emulator.cpp index ebb34054b..9a0429d5d 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -190,16 +190,24 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector", id, title, app_version); std::string window_title = ""; - if (Common::g_is_release) { - window_title = fmt::format("shadPS4 v{} | {}", Common::g_version, game_title); - } else { - std::string remote_url(Common::g_scm_remote_url); - std::string remote_host; - try { - remote_host = remote_url.substr(19, remote_url.rfind('/') - 19); - } catch (...) { - remote_host = "unknown"; + std::string remote_url(Common::g_scm_remote_url); + std::string remote_host; + try { + if (*remote_url.rbegin() == '/') { + remote_url.pop_back(); } + remote_host = remote_url.substr(19, remote_url.rfind('/') - 19); + } catch (...) { + remote_host = "unknown"; + } + if (Common::g_is_release) { + if (remote_host == "shadps4-emu" || remote_url.length() == 0) { + window_title = fmt::format("shadPS4 v{} | {}", Common::g_version, game_title); + } else { + window_title = + fmt::format("shadPS4 {}/v{} | {}", remote_host, Common::g_version, game_title); + } + } else { if (remote_host == "shadps4-emu" || remote_url.length() == 0) { window_title = fmt::format("shadPS4 v{} {} {} | {}", Common::g_version, Common::g_scm_branch, Common::g_scm_desc, game_title); diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index 8eeec3536..1966aa52b 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -55,16 +55,23 @@ bool MainWindow::Init() { // show ui setMinimumSize(720, 405); std::string window_title = ""; - if (Common::g_is_release) { - window_title = fmt::format("shadPS4 v{}", Common::g_version); - } else { - std::string remote_url(Common::g_scm_remote_url); - std::string remote_host; - try { - remote_host = remote_url.substr(19, remote_url.rfind('/') - 19); - } catch (...) { - remote_host = "unknown"; + std::string remote_url(Common::g_scm_remote_url); + std::string remote_host; + try { + if (*remote_url.rbegin() == '/') { + remote_url.pop_back(); } + remote_host = remote_url.substr(19, remote_url.rfind('/') - 19); + } catch (...) { + remote_host = "unknown"; + } + if (Common::g_is_release) { + if (remote_host == "shadps4-emu" || remote_url.length() == 0) { + window_title = fmt::format("shadPS4 v{}", Common::g_version); + } else { + window_title = fmt::format("shadPS4 {}/v{}", remote_host, Common::g_version); + } + } else { if (remote_host == "shadps4-emu" || remote_url.length() == 0) { window_title = fmt::format("shadPS4 v{} {} {}", Common::g_version, Common::g_scm_branch, Common::g_scm_desc);