From 2d4d5c64e521ab866032b277e8d0e1c798e502e6 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 22 Jul 2023 11:08:06 +0200 Subject: [PATCH] Logs the current application version on each start --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ source/main.cpp | 4 ++++ source/version.h | 2 ++ 4 files changed, 20 insertions(+) create mode 100644 source/version.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0af8e78..b59e6c2 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 MOUDLE_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 1ffefe7..d203480 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 f014e19..d8b93ec 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,5 +1,6 @@ #include "kernel.h" #include "logger.h" +#include "version.h" #include #include #include @@ -10,6 +11,8 @@ WUMS_MODULE_EXPORT_NAME("homebrew_usbseriallogging"); WUMS_MODULE_SKIP_INIT_FINI(); WUMS_DEPENDS_ON(homebrew_kernel); +#define MODULE_VERSION "v0.1" + extern "C" void SC_0x51(); WUMS_INITIALIZE() { @@ -46,6 +49,7 @@ WUMS_INITIALIZE() { #define IopShell_CreateThread ((void (*)(void))(0x101C400 + 0x19504)) WUMS_APPLICATION_STARTS() { + OSReport("Running USBSerialLoggingModule " MODULE_VERSION MODULE_VERSION_EXTRA "\n"); initLogging(); DEBUG_FUNCTION_LINE("Register IopShell_UserCallback"); IopShell_RegisterCallback(IopShell_UserCallback, 0x100978f8, 0x10097900, 0x10097c40); 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