mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-26 19:32:17 -05:00
Add git info to title screen & gameplay stats (#4053)
* Add git info to title screen & gameplay stats * Change the branch criteria to starting with `develop` * Update z_title.c * Change the branch criteria to not having a tag * Always show both when not a release build * Only show build version in tagged releases
This commit is contained in:
parent
01245ae81c
commit
e07fc59e55
@ -11,6 +11,37 @@ include(CMake/lus-cvars.cmake)
|
||||
set(PROJECT_BUILD_NAME "MacReady Golf" CACHE STRING "" FORCE)
|
||||
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "" FORCE)
|
||||
|
||||
execute_process(
|
||||
COMMAND git branch --show-current
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
set(CMAKE_PROJECT_GIT_BRANCH "${GIT_BRANCH}" CACHE STRING "Git branch" FORCE)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
set(CMAKE_PROJECT_GIT_COMMIT_HASH "${GIT_COMMIT_HASH}" CACHE STRING "Git commit hash" FORCE)
|
||||
|
||||
execute_process(
|
||||
COMMAND git describe --tags --abbrev=0 --exact-match HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if(NOT GIT_COMMIT_TAG)
|
||||
set(GIT_COMMIT_TAG "" CACHE STRING "Git commit tag" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_PROJECT_GIT_COMMIT_TAG "${GIT_COMMIT_TAG}" CACHE STRING "Git commit tag" FORCE)
|
||||
|
||||
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh)
|
||||
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
|
||||
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/utf-8>)
|
||||
|
@ -49,7 +49,10 @@ extern "C"
|
||||
extern u16 gBuildVersionMajor;
|
||||
extern u16 gBuildVersionMinor;
|
||||
extern u16 gBuildVersionPatch;
|
||||
extern u8 gBuildTeam[];
|
||||
extern u8 gGitBranch[];
|
||||
extern u8 gGitCommitHash[];
|
||||
extern u8 gGitCommitTag[];
|
||||
extern u8 gBuildTeam[];
|
||||
extern u8 gBuildDate[];
|
||||
extern u8 gBuildMakeOption[];
|
||||
extern OSMesgQueue gPiMgrCmdQ;
|
||||
|
@ -69,6 +69,8 @@ extern "C" void CrashHandler_PrintSohData(char* buffer, size_t* pos) {
|
||||
char intCharBuffer[16];
|
||||
append_line(buffer, pos, "Build Information:");
|
||||
WRITE_VAR_LINE(buffer, pos, "Game Version: ", (const char*)gBuildVersion);
|
||||
WRITE_VAR_LINE(buffer, pos, "Git Branch: ", (const char*)gGitBranch);
|
||||
WRITE_VAR_LINE(buffer, pos, "Git Commit: ", (const char*)gGitCommitHash);
|
||||
WRITE_VAR_LINE(buffer, pos, "Build Date: ", (const char*)gBuildDate);
|
||||
|
||||
if (gPlayState != nullptr) {
|
||||
|
@ -437,7 +437,13 @@ void DrawGameplayStatsHeader() {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 4.0f, 4.0f });
|
||||
ImGui::BeginTable("gameplayStatsHeader", 1, ImGuiTableFlags_BordersOuter);
|
||||
ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch);
|
||||
GameplayStatsRow("Build Version:", (char*) gBuildVersion);
|
||||
//if tag is empty (not a release build)
|
||||
if (gGitCommitTag[0] == 0) {
|
||||
GameplayStatsRow("Git Branch:", (char*)gGitBranch);
|
||||
GameplayStatsRow("Git Commit Hash:", (char*)gGitCommitHash);
|
||||
} else {
|
||||
GameplayStatsRow("Build Version:", (char*)gBuildVersion);
|
||||
}
|
||||
if (gSaveContext.sohStats.rtaTiming) {
|
||||
GameplayStatsRow("Total Time (RTA):", formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME), gSaveContext.sohStats.gameComplete ? COLOR_GREEN : COLOR_WHITE);
|
||||
} else {
|
||||
|
@ -864,6 +864,8 @@ const char* SpoilerLog_Write(int language) {
|
||||
jsonData.clear();
|
||||
|
||||
jsonData["version"] = (char*) gBuildVersion;
|
||||
jsonData["git_branch"] = (char*) gGitBranch;
|
||||
jsonData["git_commit"] = (char*) gGitCommitHash;
|
||||
jsonData["seed"] = Settings::seedString;
|
||||
jsonData["finalSeed"] = Settings::seed;
|
||||
|
||||
|
@ -340,7 +340,7 @@ OTRGlobals::OTRGlobals() {
|
||||
|
||||
context->InitAudio();
|
||||
|
||||
SPDLOG_INFO("Starting Ship of Harkinian version {}", (char*)gBuildVersion);
|
||||
SPDLOG_INFO("Starting Ship of Harkinian version {} (Branch: {} | Commit: {})", (char*)gBuildVersion, (char*)gGitBranch, (char*)gGitCommitHash);
|
||||
|
||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 0);
|
||||
|
@ -5,6 +5,10 @@ const u16 gBuildVersionMajor = @CMAKE_PROJECT_VERSION_MAJOR@;
|
||||
const u16 gBuildVersionMinor = @CMAKE_PROJECT_VERSION_MINOR@;
|
||||
const u16 gBuildVersionPatch = @CMAKE_PROJECT_VERSION_PATCH@;
|
||||
|
||||
const char gGitBranch[] = "@CMAKE_PROJECT_GIT_BRANCH@";
|
||||
const char gGitCommitHash[] = "@CMAKE_PROJECT_GIT_COMMIT_HASH@";
|
||||
const char gGitCommitTag[] = "@CMAKE_PROJECT_GIT_COMMIT_TAG@";
|
||||
|
||||
const char gBuildTeam[] = "@PROJECT_TEAM@";
|
||||
const char gBuildDate[] = __DATE__ " " __TIME__;
|
||||
const char gBuildMakeOption[] = "";
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <soh/Enhancements/bootcommands.h>
|
||||
#include <GameVersions.h>
|
||||
#include <soh/SaveManager.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "time.h"
|
||||
|
||||
@ -30,8 +31,24 @@ void Title_PrintBuildInfo(Gfx** gfxp) {
|
||||
GfxPrint_Open(&printer, g);
|
||||
GfxPrint_SetColor(&printer, 131, 154, 255, 255);
|
||||
|
||||
GfxPrint_SetPos(&printer, 1, 25);
|
||||
GfxPrint_Printf(&printer, "%s", gBuildVersion);
|
||||
//if tag is empty (not a release build)
|
||||
bool showGitInfo = gGitCommitTag[0] == 0;
|
||||
|
||||
if (showGitInfo) {
|
||||
GfxPrint_SetPos(&printer, 1, 24);
|
||||
GfxPrint_Printf(&printer, "Git Branch: %s", gGitBranch);
|
||||
|
||||
//truncate the commit to 7 characters
|
||||
char gGitCommitHashTruncated[8];
|
||||
strncpy(gGitCommitHashTruncated, gGitCommitHash, 7);
|
||||
gGitCommitHashTruncated[7] = 0;
|
||||
|
||||
GfxPrint_SetPos(&printer, 1, 25);
|
||||
GfxPrint_Printf(&printer, "Git Commit: %s", gGitCommitHashTruncated);
|
||||
} else {
|
||||
GfxPrint_SetPos(&printer, 1, 25);
|
||||
GfxPrint_Printf(&printer, "%s", gBuildVersion);
|
||||
}
|
||||
GfxPrint_SetPos(&printer, 1, 26);
|
||||
GfxPrint_Printf(&printer, "%s", gBuildDate);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user