From 90a34e8f871b7a047aff2637d520bdbc6f98ff4d Mon Sep 17 00:00:00 2001 From: "Robin C. Ladiges" Date: Wed, 15 May 2024 22:15:49 +0200 Subject: [PATCH] [debug menu] new: show mod version fallback to git info if not builded for a specific version --- .github/actions/build/action.yml | 2 +- Makefile | 12 ++++++++++-- source/main.cpp | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index bc48d36..47b4cc3 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -57,7 +57,7 @@ runs: -u `id -u`:`id -g` \ -v "/$PWD/":/app/ \ -e ISEMU=${{ (inputs.emu != 'Switch' && '1') || '0' }} \ - ${{ (steps.env.outputs.version != '' && format('-e BUILDVER={0}', steps.env.outputs.version)) || '' }} \ + ${{ (steps.env.outputs.version != '' && format('-e BUILDVERSTR={0}', steps.env.outputs.version)) || '' }} \ smoo-build-env \ ; cp -r ./romfs/ ./starlight_patch_100/atmosphere/contents/0100000000010000/. diff --git a/Makefile b/Makefile index 1018f35..3f54700 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,17 @@ .PHONY: all clean starlight send + +GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) +GIT_COMMIT := $(shell git rev-parse --short HEAD) +GIT_REV := ${GIT_BRANCH}-${GIT_COMMIT} +ifneq (,$(strip $(shell git status --porcelain 2>/dev/null))) +GIT_REV := $(GIT_REV)-dirty +endif + SMOVER ?= 100 -BUILDVER ?= 101 -BUILDVERSTR ?= 1.0.1 +BUILDVER ?= 101 +BUILDVERSTR ?= $(GIT_REV) IP ?= 10.0.0.221 # ftp server ip (usually is switch's local IP) DEBUGLOG ?= 0 # defaults to disable debug logger SERVERIP ?= 0.0.0.0 # put debug logger server IP here diff --git a/source/main.cpp b/source/main.cpp index 4cddab1..99baf41 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -137,6 +137,12 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: socket->getRecvMaxCount() ); +#if EMU + gTextWriter->printf("Mod version: %s for Emulators\n", TOSTRING(BUILDVERSTR)); +#else + gTextWriter->printf("Mod version: %s for Switch\n", TOSTRING(BUILDVERSTR)); +#endif + al::Scene *curScene = curSequence->curScene; if (curScene && isInGame) {