diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80e85c3..48fb973 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 cdd68d0..a615b90 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,5 +1,6 @@ #include "function_replacements.h" #include "memory_mapping.h" +#include "version.h" #include #include #include @@ -7,6 +8,8 @@ #include "logger.h" #endif +#define VERSION "v0.1" + WUMS_MODULE_EXPORT_NAME("homebrew_memorymapping"); WUMS_MODULE_SKIP_INIT_FINI(); WUMS_MODULE_INIT_BEFORE_RELOCATION_DONE_HOOK(); @@ -28,11 +31,15 @@ WUMS_INITIALIZE(args) { } } -#ifdef DEBUG + WUMS_APPLICATION_STARTS() { + OSReport("Running MemoryMappingModule " VERSION VERSION_EXTRA "\n"); +#ifdef DEBUG initLogging(); +#endif } +#ifdef DEBUG WUMS_APPLICATION_REQUESTS_EXIT() { deinitLogging(); } 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