From 9a69476bb154713b04d6aa723b6d99a1d65576e4 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 18 Sep 2022 00:29:12 +0200 Subject: [PATCH] Display the correct version in the menu --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ src/main.cpp | 2 +- src/main.h | 14 +------------- src/modpackSelector.cpp | 4 +++- src/version.h | 2 ++ 6 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 src/version.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d81c3b8..b210e5c 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 < ./src/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 5e87cc4..befdbe3 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 < ./src/version.h + #pragma once + #define VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/src/main.cpp b/src/main.cpp index d38d9f6..3b27ce0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,7 @@ CRLayerHandle contentLayerHandle __attribute__((section(".data"))) = 0; INITIALIZE_PLUGIN() { // But then use libcontentredirection instead. ContentRedirectionStatus error; - if ((error = ContentRedirection_Init()) != CONTENT_REDIRECTION_RESULT_SUCCESS) { + if ((error = ContentRedirection_InitLibrary()) != CONTENT_REDIRECTION_RESULT_SUCCESS) { DEBUG_FUNCTION_LINE_ERR("Failed to init ContentRedirection. Error %d", error); OSFatal("Failed to init ContentRedirection."); } diff --git a/src/main.h b/src/main.h index dbecffb..2f5bb62 100644 --- a/src/main.h +++ b/src/main.h @@ -1,15 +1,3 @@ #pragma once -/* Main */ -#ifdef __cplusplus -extern "C" { -#endif -#include -#include - - -#ifdef __cplusplus -} -#endif - -#endif +#define VERSION "v0.1" diff --git a/src/modpackSelector.cpp b/src/modpackSelector.cpp index 3bb9c6e..d2a4ea6 100644 --- a/src/modpackSelector.cpp +++ b/src/modpackSelector.cpp @@ -1,4 +1,6 @@ #include "modpackSelector.h" +#include "main.h" +#include "version.h" #include #include #include @@ -114,7 +116,7 @@ void HandleMultiModPacks(uint64_t titleID) { if (initScreen) { OSScreenClearBufferEx(SCREEN_TV, 0); OSScreenClearBufferEx(SCREEN_DRC, 0); - console_print_pos(x_offset, -1, " -- SDCafiine plugin %s by Maschell --"); + console_print_pos(x_offset, -1, "SDCafiine plugin " VERSION VERSION_EXTRA); console_print_pos(x_offset, 1, "Select your options and press A to launch."); console_print_pos(x_offset, 2, "Press B to launch without mods"); int y_offset = 4; diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..66a2c7e --- /dev/null +++ b/src/version.h @@ -0,0 +1,2 @@ +#pragma once +#define VERSION_EXTRA "" \ No newline at end of file