From 1298cd601734bfd5a1455f4d241272da74d7a429 Mon Sep 17 00:00:00 2001 From: IvanDSM Date: Thu, 21 May 2020 14:19:20 -0300 Subject: [PATCH] Add commit hash to window title for nightly builds. This also adds a flag for detecting nightly builds in the code. --- Makefile | 9 +++++++++ src/pc/gfx/gfx_sdl2.c | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ae8b01a4..9356281c 100644 --- a/Makefile +++ b/Makefile @@ -123,6 +123,15 @@ endif endif endif +# Stuff for showing the git hash in the intro on nightly builds +# From https://stackoverflow.com/questions/44038428/include-git-commit-hash-and-or-branch-name-in-c-c-source +ifeq ($(shell git rev-parse --abbrev-ref HEAD),nightly) + $(info Hello Caldera!!! I'm here all week!) + GIT_HASH=`git rev-parse --short HEAD` + COMPILE_TIME=`date -u +'%Y-%m-%d %H:%M:%S UTC'` + VERSION_CFLAGS += -DNIGHTLY -DGIT_HASH="\"$(GIT_HASH)\"" -DCOMPILE_TIME="\"$(COMPILE_TIME)\"" +endif + # Microcode ifeq ($(GRUCODE),f3dex) # Fast3DEX diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c index e86a100c..19ef621f 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -156,13 +156,18 @@ static void gfx_sdl_init(void) { else if (gCLIOpts.FullScreen == 2) configWindow.fullscreen = false; - const char* window_title = + const char window_title[96] = #ifndef USE_GLES "Super Mario 64 PC port (OpenGL)"; #else "Super Mario 64 PC port (OpenGL_ES2)"; #endif + #ifdef NIGHTLY + strcat(window_title, " nightly "); + strcat(window_title, GIT_HASH); + #endif + wnd = SDL_CreateWindow( window_title, configWindow.x, configWindow.y, configWindow.w, configWindow.h,