From 4373b9afe153b507bce732a7644e5b3b6d128b98 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 9 Oct 2022 15:44:13 +0200 Subject: [PATCH] Log the module version on each application start --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ source/main.cpp | 7 +++++++ source/version.h | 2 ++ 4 files changed, 23 insertions(+) create mode 100644 source/version.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68ffedb..4a1fa9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v2 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "$GITHUB_SHA") + cat < ./source/version.h + #pragma once + #define 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 97584a3..91d65c2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,6 +26,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v2 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") + cat < ./source/version.h + #pragma once + #define 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 2642d95..e59d4ea 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,16 +1,23 @@ #include #include "logger.h" +#include "version.h" #include #include #include #include #include +#define VERSION "v0.1" + WUMS_MODULE_EXPORT_NAME("homebrew_patchmemoryrelocations"); WUMS_MODULE_INIT_BEFORE_RELOCATION_DONE_HOOK(); WUMS_MODULE_SKIP_INIT_FINI(); +WUMS_APPLICATION_STARTS() { + OSReport("Running PatchMemoryRelocationsModule " VERSION VERSION_EXTRA "\n"); +} + bool elfLinkOne(char type, size_t offset, int32_t addend, uint32_t destination, uint32_t symbol_addr, relocation_trampoline_entry_t *trampoline_data, uint32_t trampoline_data_length, RelocationType reloc_type); diff --git a/source/version.h b/source/version.h new file mode 100644 index 0000000..66a2c7e --- /dev/null +++ b/source/version.h @@ -0,0 +1,2 @@ +#pragma once +#define VERSION_EXTRA "" \ No newline at end of file