From e85d383ec4d99845fdb703051c7edcbe4f705f40 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 4 Jan 2023 22:34:03 +0100 Subject: [PATCH] Log the module version on each application start --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ source/main.cpp | 2 ++ source/utils/globals.h | 4 ++++ source/version.h | 2 ++ 5 files changed, 22 insertions(+) create mode 100644 source/version.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61abc2b..6252dcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v3 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "$GITHUB_SHA") + cat < ./source/version.h + #pragma once + #define MODULE_VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2e3a1ef..ec8e6ce 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,6 +26,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v3 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") + cat < ./source/version.h + #pragma once + #define MODULE_VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/source/main.cpp b/source/main.cpp index 209f3f2..6692f8f 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -117,6 +117,8 @@ WUMS_APPLICATION_STARTS() { return; } + OSReport("Running FunctionPatcherModule " MODULE_VERSION_FULL "\n"); + // Now we can update the pointer with the "real" functions gMEMAllocFromDefaultHeapExForThreads = MEMAllocFromDefaultHeapEx; gMEMFreeToDefaultHeapForThreads = MEMFreeToDefaultHeap; diff --git a/source/utils/globals.h b/source/utils/globals.h index df7d653..19e0bce 100644 --- a/source/utils/globals.h +++ b/source/utils/globals.h @@ -1,9 +1,13 @@ #pragma once #include "../PatchedFunctionData.h" +#include "version.h" #include #include #include +#define MODULE_VERSION "v0.1" +#define MODULE_VERSION_FULL MODULE_VERSION MODULE_VERSION_EXTRA + #define JUMP_HEAP_DATA_SIZE (32 * 1024) extern char gJumpHeapData[]; extern MEMHeapHandle gJumpHeapHandle; diff --git a/source/version.h b/source/version.h new file mode 100644 index 0000000..78433de --- /dev/null +++ b/source/version.h @@ -0,0 +1,2 @@ +#pragma once +#define MODULE_VERSION_EXTRA "" \ No newline at end of file