From 7268239e43905301159b263fd46221534e13d624 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Sun, 1 Jan 2023 12:37:20 +0100 Subject: [PATCH 1/2] GitHub Workflow improvements - Automatically pre-release master as "latest" - Build all languages - Parallelize workflow - Support tag based releases --- .github/workflows/build.yml | 357 ++++++++++++++++++--------- .github/workflows/build_language.yml | 216 ++++++++++++++++ .gitignore | 1 + GameSettings.cpp | 2 +- GameVersion.cpp | 27 +- GameVersion.h | 11 +- MainMenuScreen.cpp | 6 +- README.md | 32 +-- SaveLoadGame.cpp | 4 +- SaveLoadScreen.cpp | 2 +- jascreens.cpp | 6 +- 11 files changed, 498 insertions(+), 166 deletions(-) create mode 100644 .github/workflows/build_language.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4cee0a57..85a063272 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,128 +1,251 @@ name: build -on: [push, workflow_dispatch] +on: + push: + branches: + - '**' + tags: + - 'v*' + # allows to manually trigger a build + workflow_dispatch: + inputs: + build_all_languages: + description: build all languages + required: false + default: false + type: boolean + assemble_release: + description: create release + required: false + default: false + type: boolean + +permissions: + contents: write jobs: + workflow_setup: + runs-on: ubuntu-latest + outputs: + languages_json_array: ${{ steps.global_vars.outputs.languages_json_array }} + assemble_release: ${{ steps.global_vars.outputs.assemble_release }} + steps: + - id: global_vars + name: Set global variables + run: | + set -eux + + full_release='${{ ( github.repository == '1dot13/source' && github.ref_name == 'master' ) || startsWith(github.ref, 'refs/tags/v') }}' + + if [[ '${{ inputs.build_all_languages }}' == 'true' || ( '${{ inputs.build_all_languages }}' == '' && "$full_release" == 'true' ) ]] + then + # the two letter short form could be removed if JA2LangPrefix is removed + # the casing of the long form adheres to the one found in the gamedir-languages repo + # for compilation only, the long form is transformed to upper case + languages_json_array='["CN_Chinese", "DE_German", "EN_English", "FR_French", "PL_Polish", "IT_Italian", "NL_Dutch", "RU_Russian"]'; + else + # English + some other language for compilation testing + languages_json_array='["DE_German", "EN_English"]' + fi + echo "languages_json_array=$languages_json_array" >> $GITHUB_OUTPUT + + if [[ '${{ inputs.assemble_release }}' == 'true' || ( '${{ inputs.assemble_release }}' == '' && "$full_release" == 'true' ) ]] + then + assemble_release='true' + else + assemble_release='false' + fi + echo "assemble_release=$assemble_release" >> $GITHUB_OUTPUT + + - name: Clone repos metadata + run: | + set -eux + + GAMEDIR_REPOSITORY=1dot13/gamedir + GAMEDIR_LANGUAGES_REPOSITORY=1dot13/gamedir-languages + + # filter tree is what makes this fast + git clone --config transfer.fsckobjects=false --tags --no-checkout --filter=tree:0 \ + "https://github.com/$GITHUB_REPOSITORY" \ + source + + git clone --config transfer.fsckobjects=false --no-checkout --filter=tree:0 \ + https://github.com/$GAMEDIR_REPOSITORY \ + gamedir + + git clone --config transfer.fsckobjects=false --no-checkout --filter=tree:0 \ + https://github.com/$GAMEDIR_LANGUAGES_REPOSITORY \ + gamedir-languages + + mkdir dist/ + echo -n " + GAMEDIR_REPOSITORY=$GAMEDIR_REPOSITORY + GAMEDIR_LANGUAGES_REPOSITORY=$GAMEDIR_LANGUAGES_REPOSITORY + " > dist/versions.env + + - name: Generate source version information + working-directory: source + run: | + set -eux + + SOURCE_COMMIT_DATETIME=$(TZ=UTC0 git log -1 --date=iso-strict-local --format=%cd $GITHUB_SHA) + SOURCE_COMMIT_DATE=$(TZ=UTC0 git log -1 --date=short-local --format=%cd $GITHUB_SHA) + + # GAME_VERSION is used to detect outdated save games and is the main version used for tracking + if [[ "$GITHUB_REF_TYPE" == 'tag' ]] + then + # if we build for a specific tag, use that as the game version + # examples: + # - v1.3.3 + # - v1.3.2-rc2 + GAME_VERSION="$GITHUB_REF_NAME" + else + # tag the very first commit as v1.13, fixes git describe if no tags are around + if ! git rev-list v1.13 2>/dev/null + then + git tag v1.13 $(git rev-list --max-parents=0 HEAD) && git push origin v1.13 + fi + + # uses `git describe`, which tries to find a tag in the commit hierarchy + # example five (5) commits after v1.13: + # - v1.13-5-7g7ffa + GAME_VERSION="$(git describe --tags --match='v[0-9]*' $GITHUB_SHA)" + fi + # max 15 CHAR8 + GAME_VERSION="${GAME_VERSION:0:15}" + + GAME_BUILD_INFORMATION="$SOURCE_COMMIT_DATE GitHub $GITHUB_REPOSITORY" + # in case of a branch or if the tag is truncated + if [[ "$GAME_VERSION" != *"$GITHUB_REF_NAME"* ]] + then + GAME_BUILD_INFORMATION="$GAME_BUILD_INFORMATION $GITHUB_REF_TYPE $GITHUB_REF_NAME" + fi + # max 255 CHAR16 + GAME_BUILD_INFORMATION="${GAME_BUILD_INFORMATION:0:255}" + + echo -n " + SOURCE_COMMIT_DATETIME=$SOURCE_COMMIT_DATETIME + GAME_VERSION=$GAME_VERSION + GAME_BUILD_INFORMATION=$GAME_BUILD_INFORMATION + " >> ../dist/versions.env + + # due to building everything in parallel, versions should be pinned at the start so everything builds based on the same versions + - name: Generate gamedir version information + working-directory: gamedir + run: | + set -eux + + GAMEDIR_COMMIT_SHA=$(git rev-parse HEAD) + GAMEDIR_COMMIT_DATETIME=$(TZ=UTC0 git log -1 --date=iso-strict-local --format=%cd $GAMEDIR_COMMIT_SHA) + + echo -n " + GAMEDIR_COMMIT_SHA=$GAMEDIR_COMMIT_SHA + GAMEDIR_COMMIT_DATETIME=$GAMEDIR_COMMIT_DATETIME + " >> ../dist/versions.env + + # due to building everything in parallel, versions should be pinned at the start so everything builds based on the same versions + - name: Generate gamedir-languages version information + working-directory: gamedir-languages + run: | + set -eux + + GAMEDIR_LANGUAGES_COMMIT_SHA=$(git rev-parse HEAD) + GAMEDIR_LANGUAGES_COMMIT_DATETIME=$(TZ=UTC0 git log -1 --date=iso-strict-local --format=%cd $GAMEDIR_LANGUAGES_COMMIT_SHA) + + echo -n " + GAMEDIR_LANGUAGES_COMMIT_SHA=$GAMEDIR_LANGUAGES_COMMIT_SHA + GAMEDIR_LANGUAGES_COMMIT_DATETIME=$GAMEDIR_LANGUAGES_COMMIT_DATETIME + " >> ../dist/versions.env + + - name: Show version information summary + run: | + set -eux + cat dist/versions.env + + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: versions.env + path: dist/ + build: - if: github.repository == '1dot13/source' && github.ref_name == 'master' - runs-on: windows-latest + needs: [ workflow_setup ] + strategy: + fail-fast: false + matrix: + language: ${{ fromJson(needs.workflow_setup.outputs.languages_json_array) }} + uses: ./.github/workflows/build_language.yml + with: + language: ${{ matrix.language }} + assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }} + # at least English and some other lang have to work + continue-on-error: ${{ matrix.language != 'EN_English' && matrix.language != 'DE_German' }} + + release: + needs: [ workflow_setup, build ] + if: needs.workflow_setup.outputs.assemble_release == 'true' + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: microsoft/setup-msbuild@v1.1 - - - name: Get short SHA and date (source) - run: | - echo "SHA_SHORT=$(git rev-parse --short ${{ github.sha }})" | Out-File -FilePath $env:GITHUB_ENV -Append - echo "DATE=$(git log -1 --date=format:'%Y%m%d' --format=%cd)" | Out-File -FilePath $env:GITHUB_ENV -Append - - - name: Checkout gamedir - uses: actions/checkout@v3 + - name: Download artifacts + uses: actions/download-artifact@v3 with: - repository: 1dot13/gamedir - path: ja2 - - - name: Get short SHA and date (gamedir) - run: | - cd ja2 - echo "GAMEDIR_SHA_SHORT=$(git rev-parse --short HEAD)" | Out-File -FilePath $env:GITHUB_ENV -Append - echo "GAMEDIR_DATE=$(git log -1 --date=format:'%Y%m%d' --format=%cd)" | Out-File -FilePath $env:GITHUB_ENV -Append - cd .. - - - name: Check vars - run: | - echo "Source SHA: ${{ env.SHA_SHORT }}" - echo "Source Date: ${{ env.DATE }}" - echo "Gamedir SHA: ${{ env.GAMEDIR_SHA_SHORT }}" - echo "Gamedir Date: ${{ env.GAMEDIR_DATE }}" + path: artifacts - - name: Create version info text file - run: | - echo @" - If you encounter problems during gameplay, please provide the following version information: - Source SHA: ${{ env.SHA_SHORT }} - Source Date: ${{ env.DATE }} - Gamedir SHA: ${{ env.GAMEDIR_SHA_SHORT }} - Gamedir Date: ${{ env.GAMEDIR_DATE }} - "@ | Out-File -FilePath ja2/ja2_1.13_release.txt - - - name: Replace GameVersion.cpp (Map Editor) + - name: Move release archives to dist/ + shell: bash run: | - rm GameVersion.cpp - echo @" - #include "Types.h" - #include "GameVersion.h" - - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13 (Development Build) (Github)" }; - CHAR8 czVersionNumber[16] = { "V ${{ env.DATE }}" }; - CHAR16 zTrackingNumber[16] = { L"Z" }; - CHAR16 zRevisionNumber[16] = { L"Hash ${{ env.SHA_SHORT }}" }; - "@ | Out-File -FilePath GameVersion.cpp - - - name: Build Map Editor - run: msbuild ja2_VS2019.sln -property:Configuration=MapEditor - - - name: Rename Map Editor output - run: mv bin/VS2013/MapEditor_EN_Release_master.exe ja2/ja2mapeditor.exe - - - name: Replace GameVersion.cpp (JA2) - run: | - rm GameVersion.cpp - echo @" - #include "Types.h" - #include "GameVersion.h" - - CHAR16 zVersionLabel[256] = { L"Release v1.13 (Development Build) (Github)" }; - CHAR8 czVersionNumber[16] = { "V ${{ env.DATE }}" }; - CHAR16 zTrackingNumber[16] = { L"Z" }; - CHAR16 zRevisionNumber[16] = { L"Hash ${{ env.SHA_SHORT }}" }; - "@ | Out-File -FilePath GameVersion.cpp - - - name: Build JA2 - run: msbuild ja2_VS2019.sln -property:Configuration=Release - - - name: Rename JA2 output - run: mv bin/VS2013/JA2_EN_Release_master_VS2019.exe ja2/ja2.exe - - - name: Replace GameVersion.cpp and builddefines.h (JA2 UB) - run: | - rm GameVersion.cpp - echo @" - #include "Types.h" - #include "GameVersion.h" - - CHAR16 zVersionLabel[256] = { L"Release Unfinished Business v1.13 (Development Build) (Github)" }; - CHAR8 czVersionNumber[16] = { "V ${{ env.DATE }}" }; - CHAR16 zTrackingNumber[16] = { L"Z" }; - CHAR16 zRevisionNumber[16] = { L"Hash ${{ env.SHA_SHORT }}" }; - "@ | Out-File -FilePath GameVersion.cpp - - rm builddefines.h - echo @" - #ifndef _BUILDDEFINES_H_ - #define _BUILDDEFINES_H_ - #include "Language Defines.h" - #define JA2UB - #define JA2UBMAPS - #define FORCE_ASSERTS_ON - #define _CRT_SECURE_NO_WARNINGS - #define _CRT_NON_CONFORMING_SWPRINTFS - #define _SCL_SECURE_NO_WARNINGS - #include "Profiler.h" - #endif - "@ | Out-File -FilePath builddefines.h - - - name: Build JA2 UB - run: msbuild ja2_VS2019.sln -property:Configuration=Release - - - name: Rename JA2 UB output - run: mv bin/VS2013/JA2_EN_Release_master_VS2019.exe ja2/ja2ub.exe - - - name: Upload output - uses: actions/upload-artifact@v3 + set -eux + mkdir dist/ + mv artifacts/*_release/* dist/ + + - name: Delete Latest + if: startsWith(github.ref, 'refs/tags/v') == false + uses: dev-drprasad/delete-tag-and-release@master with: - name: ja2_113 - path: | - ja2/ - !ja2/.git/ - + tag_name: "latest" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - id: release_latest + name: Release Latest + if: startsWith(github.ref, 'refs/tags/v') == false + uses: ncipollo/release-action@v1 + with: + allowUpdates: false + artifactErrorsFailBuild: true + artifacts: dist/* + draft: false + generateReleaseNotes: true + makeLatest: true + name: "Latest (unstable)" + prerelease: true + tag: "latest" + + - id: release_tag + name: Release Tag + uses: ncipollo/release-action@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + allowUpdates: true + artifactErrorsFailBuild: true + artifacts: dist/* + draft: false + generateReleaseNotes: true + makeLatest: true + omitBodyDuringUpdate: true + omitDraftDuringUpdate: true + omitNameDuringUpdate: true + omitPrereleaseDuringUpdate: true + + - name: Show release outputs + shell: bash + run: | + echo 'id: ' + echo -n '${{ steps.release_tag.outputs.id }}' + echo -n '${{ steps.release_latest.outputs.id }}' + echo '' + echo '' + echo 'url:' + echo -n '${{ steps.release_tag.outputs.html_url }}' + echo -n '${{ steps.release_latest.outputs.html_url }}' + echo '' diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml new file mode 100644 index 000000000..b476cd5e8 --- /dev/null +++ b/.github/workflows/build_language.yml @@ -0,0 +1,216 @@ +name: build language + +on: + workflow_call: + inputs: + language: + description: 'any of CN_Chinese DE_German EN_English FR_French PL_Polish IT_Italian NL_Dutch RU_Russian' + required: true + default: 'EN_English' + type: string + assemble: + description: 'assemble full package' + required: true + default: true + type: boolean + continue-on-error: + description: 'allows a language to fail, used when building all languages' + required: false + default: false + type: boolean + +jobs: + compile: + runs-on: windows-latest # required for msbuild + continue-on-error: ${{ inputs.continue-on-error }} + strategy: + fail-fast: false + matrix: + application: [ja2, ja2mapeditor, ja2ub] + + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Download versions.env + uses: actions/download-artifact@v3 + with: + name: versions.env + path: artifacts + - name: Restore versions.env + shell: bash + run: cat artifacts/versions.env >> $GITHUB_ENV + + - name: Update GameVersion.cpp + shell: bash + run: | + set -eux + INPUTS_LANGUAGE=${{ inputs.language }} + GAME_VERSION=$(echo "$GAME_VERSION" | tr -cd '[:print:]' | tr -d '"\\') + GAME_BUILD="${INPUTS_LANGUAGE:0:2} $GAME_BUILD_INFORMATION" + GAME_BUILD=$(echo "$GAME_BUILD" | tr -cd '[:print:]' | tr -d '"\\') + sed -i "s|@Version@|${GAME_VERSION:0:15}|" GameVersion.cpp + sed -i "s|@Build@|${GAME_BUILD:0:255}|" GameVersion.cpp + cat GameVersion.cpp + + # not sure if needed as per Language Defines.h, but only here can we set both defines I think + - name: Update builddefines.h + if: ${{ matrix.application == 'ja2ub' }} + shell: bash + run: | + set -eux + sed -i 's/\/\/#define JA2UB/#define JA2UB/' builddefines.h + sed -i 's/\/\/#define JA2UBMAPS/#define JA2UBMAPS/' builddefines.h + cat builddefines.h + + - name: Prepare build properties + shell: bash + run: | + set -eux + + if [[ '${{ matrix.application }}' == 'ja2mapeditor' ]] + then + Configuration='MapEditor' + else + Configuration='Release' + fi + + INPUTS_LANGUAGE='${{ inputs.language }}' + JA2LangPrefix="${INPUTS_LANGUAGE:0:2}" + JA2Language=$(echo "${INPUTS_LANGUAGE:3}" | tr '[:lower:]' '[:upper:]') + + if [[ '${{ matrix.application }}' == 'ja2ub' ]] + then + JA2Config='JA2UB' + else + JA2Config='JA2' + fi + + echo " + Configuration=$Configuration + JA2LangPrefix=$JA2LangPrefix + JA2Language=$JA2Language + JA2Config=$JA2Config + " >> $GITHUB_ENV + + - uses: microsoft/setup-msbuild@v1.1 + - name: Build + run: | + msbuild ja2_VS2019.sln ` + /p:Configuration=$Env:Configuration ` + /p:JA2LangPrefix=$Env:JA2LangPrefix ` + /p:JA2Language=$Env:JA2Language ` + /p:JA2Config=$Env:JA2Config + + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.language }}_${{ matrix.application }} + path: bin/VS2013/ + + assemble: + needs: [ compile ] + if: inputs.assemble + runs-on: windows-latest # required for case-insensitive filesystem handling + continue-on-error: ${{ inputs.continue-on-error }} + + steps: + - name: Download versions.env + uses: actions/download-artifact@v3 + with: + name: versions.env + path: artifacts + - name: Restore versions.env + shell: bash + run: cat artifacts/versions.env >> $GITHUB_ENV + + - name: Checkout gamedir + uses: actions/checkout@v3 + with: + repository: ${{ env.GAMEDIR_REPOSITORY }} + ref: ${{ env.GAMEDIR_COMMIT_SHA }} + path: gamedir + + - name: Checkout gamedir-languages + if: inputs.language != 'EN_English' + uses: actions/checkout@v3 + with: + repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }} + ref: ${{ env.GAMEDIR_LANGUAGES_COMMIT_SHA }} + path: gamedir-languages + + - name: Copy gamedir-languages files to gamedir + if: inputs.language != 'EN_English' + shell: bash + run: | + set -eux + DIST_LANG='${{ inputs.language }}' + GAMEDIR_LANGUAGE="${DIST_LANG:3}" + cp -a gamedir-languages/${GAMEDIR_LANGUAGE}_Version/* gamedir/ + + - name: Download ja2 + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.language }}_ja2 + path: artifacts/ja2 + + - name: Download ja2mapeditor + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.language }}_ja2mapeditor + path: artifacts/ja2mapeditor + + - name: Download ja2ub + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.language }}_ja2ub + path: artifacts/ja2ub + + - name: Copy application files to gamedir + shell: bash + run: | + set -eux + for APP in ja2 ja2mapeditor ja2ub + do + mv artifacts/${APP}/*.exe gamedir/${APP}.exe + done + + - name: Create version information file + shell: bash + run: | + set -eux + + # "-" separates words, "_" combines words, see double-click behavior + DIST_NAME="JA2-${GAME_VERSION}-G${GAMEDIR_COMMIT_SHA:0:4}L${GAMEDIR_LANGUAGES_COMMIT_SHA:0:4}-${{ inputs.language }}" + echo "DIST_NAME=$DIST_NAME" >> $GITHUB_ENV + + echo "If you encounter problems during gameplay, please provide the following version information: + Distribution Name: $DIST_NAME + Game Version: $GAME_VERSION + Language: ${{ inputs.language }} + Build Information: $GAME_BUILD_INFORMATION + Source Repository: $GITHUB_REPOSITORY + Source Commit SHA: $GITHUB_SHA + Source Commit Date: $SOURCE_COMMIT_DATETIME + Gamedir Repository: $GAMEDIR_REPOSITORY + Gamedir Commit SHA: $GAMEDIR_COMMIT_SHA + Gamedir Commit Date: $GAMEDIR_COMMIT_DATETIME + Gamedir Languages Repository: $GAMEDIR_LANGUAGES_REPOSITORY + Gamedir Languages Commit SHA: $GAMEDIR_LANGUAGES_COMMIT_SHA + Gamedir Languages Commit Date: $GAMEDIR_LANGUAGES_COMMIT_DATETIME + " > gamedir/ja2_1.13_version.txt + cat gamedir/ja2_1.13_version.txt + + - name: Create release archive + shell: bash + run: | + set -eux + mkdir dist/ + cd gamedir/ + 7z a -bb -xr'!.*' "../dist/${DIST_NAME}.7z" . + + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.language }}_release + path: dist/ diff --git a/.gitignore b/.gitignore index 494724f84..70a647057 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ lib/ .vs/ +.idea/ \ No newline at end of file diff --git a/GameSettings.cpp b/GameSettings.cpp index 2c8a2fbef..7981d3008 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -4573,7 +4573,7 @@ BOOLEAN IsDriveLetterACDromDrive( STR pDriveLetter ) void DisplayGameSettings( ) { //Display the version number - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s (%S) %s", pMessageStrings[ MSG_VERSION ], zVersionLabel, czVersionNumber, zRevisionNumber ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s %S %s", pMessageStrings[ MSG_VERSION ], zProductLabel, czVersionString, zBuildInformation ); //Display the difficulty level ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], zDiffSetting[gGameOptions.ubDifficultyLevel].szDiffName ); diff --git a/GameVersion.cpp b/GameVersion.cpp index 02c9e48c1..25aee3770 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -11,9 +11,9 @@ #ifdef JA2EDITOR #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13 (Development Build)" }; + CHAR16 zProductLabel[64] = { L"Unfinished Business - Map Editor v1.13" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13 (Development Build)" }; + CHAR16 zProductLabel[64] = { L"Map Editor v1.13" }; #endif // ------------------------------ @@ -23,17 +23,17 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13 (Development Build)" }; + CHAR16 zProductLabel[64] = { L"Debug: Unfinished Business - v1.13" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13 (Development Build)" }; + CHAR16 zProductLabel[64] = { L"Debug: JA2 Demo - v1.13" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13 (Development Build)" }; + CHAR16 zProductLabel[64] = { L"Debug: v1.13" }; #endif #elif defined CRIPPLED_VERSION //RELEASE BUILD VERSION s - CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; + CHAR16 zProductLabel[64] = { L"Beta v. 0.98" }; // ------------------------------ // RELEASE BUILD VERSIONS @@ -42,17 +42,16 @@ //RELEASE BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13 (Development Build)" }; + CHAR16 zProductLabel[64] = { L"Unfinished Business - v1.13" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13 (Development Build)" }; + CHAR16 zProductLabel[64] = { L"JA2 Demo - v1.13" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13 (Development Build)" }; + CHAR16 zProductLabel[64] = { L"v1.13" }; #endif #endif - -CHAR8 czVersionNumber[16] = { "Local build" }; -CHAR16 zTrackingNumber[16] = { L"Z" }; -CHAR16 zRevisionNumber[16] = { L"" }; - + +CHAR8 czVersionString[16] = { "@Version@" }; +CHAR16 zBuildInformation[256] = { L"@Build@" }; + // SAVE_GAME_VERSION is defined in header, change it there diff --git a/GameVersion.h b/GameVersion.h index 05d965f9e..d322980c1 100644 --- a/GameVersion.h +++ b/GameVersion.h @@ -11,11 +11,12 @@ extern "C" { // Keeps track of the game version // -extern CHAR16 zVersionLabel[256]; -extern CHAR8 czVersionNumber[16]; -extern CHAR16 zTrackingNumber[16]; -extern CHAR16 zRevisionNumber[16]; - +// name of the product, Unfinished Business, Map Editor etc.. +extern CHAR16 zProductLabel[64]; +// used for save game comparison +extern CHAR8 czVersionString[16]; +// can contain information regarding the build: what git ref was the base (tag, branch), by whom, commit date, build date, etc.. +extern CHAR16 zBuildInformation[256]; //ADB: I needed these here so I moved them, and why put them in *.cpp anyways? // diff --git a/MainMenuScreen.cpp b/MainMenuScreen.cpp index bcf5e2ea8..1db5e1747 100644 --- a/MainMenuScreen.cpp +++ b/MainMenuScreen.cpp @@ -100,9 +100,9 @@ extern void InitSightRange(); //lal UINT32 MainMenuScreenInit( ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version Label: %S, %s", zVersionLabel, zRevisionNumber )); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version #: %s", czVersionNumber )); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Tracking #: %S", zTrackingNumber )); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Product: %S", zProductLabel )); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version: %s", czVersionString )); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Build: %S", zBuildInformation )); return( TRUE ); } diff --git a/README.md b/README.md index cad687bb2..a57b7004d 100644 --- a/README.md +++ b/README.md @@ -24,35 +24,29 @@ Feel free to participate in the development! For more information you can visit the following locations: +- [The Bear's Pit Forum](https://thepit.ja-galaxy-forum.com) +- [Jagged Alliance 2 v1.13 - Starter Documentation](https://github.com/1dot13/documentation) +- [How to get: latest 1.13, 7609, feature-descriptions and more](http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=24648&start=0&) +- [JA2 v1.13 pbworks wiki (outdated)](http://ja2v113.pbworks.com/w/page/4218339/FrontPage) +- [The Bear's Pit Discord](https://discord.gg/GqrVZUM) -[The Bear's Pit Forum](https://thepit.ja-galaxy-forum.com) - -[Jagged Alliance 2 v1.13 - Starter Documentation](https://github.com/1dot13/documentation) - -[How to get: latest 1.13, 7609, feature-descriptions and more](http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=24648&start=0&) - -[JA2 v1.13 pbworks wiki (outdated)](http://ja2v113.pbworks.com/w/page/4218339/FrontPage) - -[The Bear's Pit Discord](https://discord.gg/GqrVZUM) - - In case of any issues, look at [Reports](#Reports) or [Participation](#Participation) ### Downloads - -- [JA2 v1.13 latest release]("link to release") +> **Note** +> All-in-one releases come for different languages and include +> JA2 v1.13, the Map Editor and JA2 Unfinished Business. -For the time being, Bear's Pit Forum "How-to-get..."-thread. -A gitHub workflow for releases is w.i.p., the link will be updated when finished. +Visit the [releases page](https://github.com/1dot13/source/releases) to download the latest all-in-one. ### Installation -1. Install original Jagged Alliance 2 -2. Download latest release and copy its content to JA2 game directory. Overwrite when asked. -3. Modify Ini settings if you like. +1. Install the original Jagged Alliance 2 +2. Download the latest all-in-one release and copy its content to JA2 game directory. Overwrite when asked. +3. Modify ini settings if you like. 4. Play the game. Some additional information on can be found in folder "docs" inside download. @@ -69,6 +63,6 @@ For more information and reports, visit [Bug reports at Bear's Pit Forum](http:/ ### Participation -Feel free to participate on gitHub. If you want to know how, or simply wanna share your thoughts on a topic join the [Bear's Pit Discord](https://discord.gg/GqrVZUM "Bear's Pit Discord") +Feel free to participate on GitHub. If you want to know how, or simply wanna share your thoughts on a topic join the [Bear's Pit Discord](https://discord.gg/GqrVZUM "Bear's Pit Discord") diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 041547870..eeb71e544 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -2654,7 +2654,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) return(FALSE); } - // WANNE - BMP: TODO! Struktur prüfen + // WANNE - BMP: TODO! Struktur prüfen //load some structs, atm just POD but could change //Load STRUCT_AIData numBytesRead = 0; @@ -3592,7 +3592,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameHeader.uiSavedGameVersion = SAVE_GAME_VERSION; wcscpy( SaveGameHeader.sSavedGameDesc, pGameDesc ); - strcpy( SaveGameHeader.zGameVersionNumber, czVersionNumber ); + strcpy( SaveGameHeader.zGameVersionNumber, czVersionString ); SaveGameHeader.uiFlags; diff --git a/SaveLoadScreen.cpp b/SaveLoadScreen.cpp index 39e367d0f..ac9228f1f 100644 --- a/SaveLoadScreen.cpp +++ b/SaveLoadScreen.cpp @@ -2366,7 +2366,7 @@ UINT8 CompareSaveGameVersion( INT32 bSaveGameID ) ubRetVal = SLS_SAVED_GAME_VERSION_OUT_OF_DATE; } - if( strcmp( SaveGameHeader.zGameVersionNumber, czVersionNumber ) != 0 ) + if( strcmp( SaveGameHeader.zGameVersionNumber, czVersionString ) != 0 ) { if( ubRetVal == SLS_SAVED_GAME_VERSION_OUT_OF_DATE ) ubRetVal = SLS_BOTH_SAVE_GAME_AND_GAME_VERSION_OUT_OF_DATE; diff --git a/jascreens.cpp b/jascreens.cpp index 2704b0720..80f5188a1 100644 --- a/jascreens.cpp +++ b/jascreens.cpp @@ -379,12 +379,10 @@ UINT32 InitScreenHandle(void) SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); - //mprintf( 10, 420, zVersionLabel ); - #ifdef _DEBUG - mprintf( 10, 10, L"%s: %s Debug %S %s", pMessageStrings[ MSG_VERSION ], zVersionLabel, czVersionNumber, zRevisionNumber ); + mprintf( 10, 10, L"%s: %s Debug %S %s", pMessageStrings[ MSG_VERSION ], zProductLabel, czVersionString, zBuildInformation ); #else - mprintf( 10, 10, L"%s: %s %S %s", pMessageStrings[ MSG_VERSION ], zVersionLabel, czVersionNumber, zRevisionNumber ); + mprintf( 10, 10, L"%s: %s %S %s", pMessageStrings[ MSG_VERSION ], zProductLabel, czVersionString, zBuildInformation ); #endif #if defined JA2BETAVERSION From 86b0b77669470b6861b42d7da12fc9bb6821d202 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Wed, 11 Jan 2023 00:53:30 +0100 Subject: [PATCH 2/2] GitHub Workflow: Added support for ja2ubmapeditor. --- .github/workflows/build_language.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index b476cd5e8..7aa4ebf43 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - application: [ja2, ja2mapeditor, ja2ub] + application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor] steps: - name: Checkout source @@ -55,7 +55,7 @@ jobs: # not sure if needed as per Language Defines.h, but only here can we set both defines I think - name: Update builddefines.h - if: ${{ matrix.application == 'ja2ub' }} + if: ${{ startsWith(matrix.application, 'ja2ub') }} shell: bash run: | set -eux @@ -68,7 +68,7 @@ jobs: run: | set -eux - if [[ '${{ matrix.application }}' == 'ja2mapeditor' ]] + if [[ '${{ matrix.application }}' == *'mapeditor' ]] then Configuration='MapEditor' else @@ -79,7 +79,7 @@ jobs: JA2LangPrefix="${INPUTS_LANGUAGE:0:2}" JA2Language=$(echo "${INPUTS_LANGUAGE:3}" | tr '[:lower:]' '[:upper:]') - if [[ '${{ matrix.application }}' == 'ja2ub' ]] + if [[ '${{ matrix.application }}' == 'ja2ub'* ]] then JA2Config='JA2UB' else @@ -166,11 +166,17 @@ jobs: name: ${{ inputs.language }}_ja2ub path: artifacts/ja2ub + - name: Download ja2ubmapeditor + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.language }}_ja2ubmapeditor + path: artifacts/ja2ubmapeditor + - name: Copy application files to gamedir shell: bash run: | set -eux - for APP in ja2 ja2mapeditor ja2ub + for APP in ja2 ja2mapeditor ja2ub ja2ubmapeditor do mv artifacts/${APP}/*.exe gamedir/${APP}.exe done