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:
Pepe20129
2024-08-23 16:17:45 +02:00
committed by GitHub
parent 01245ae81c
commit e07fc59e55
8 changed files with 70 additions and 5 deletions

View File

@@ -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[] = "";

View File

@@ -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);