From 5bff786f9c7d4f425f746bcd203789f0b20b717e Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Thu, 20 Jun 2024 15:38:02 +0100 Subject: [PATCH 1/6] Update github actions to avoid deprecations. --- .github/workflows/linux.yml | 6 +++--- .github/workflows/macos.yml | 6 +++--- .github/workflows/mingw.yml | 4 ++-- .github/workflows/windows.yml | 22 ++++++++++++++-------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index efa2369a..5ee83df6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Create Development release if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/vanilla' }} - uses: "marvinpinto/action-automatic-releases@latest" + uses: "0xDylan/action-auto-releases-n20@v1.1" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "latest" @@ -100,7 +100,7 @@ jobs: - name: Upload development release if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/vanilla' && matrix.networking == 'net' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: name: Development Build tag_name: "latest" @@ -112,7 +112,7 @@ jobs: - name: Upload tagged release if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.networking == 'net' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | artifact/* diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index f1e706c4..e2b7cd1f 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -30,7 +30,7 @@ jobs: - name: Restore cache id: dep-cache - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-dependencies with: @@ -95,7 +95,7 @@ jobs: - name: Upload development release if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/vanilla' && matrix.networking == 'net' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: name: Development Build tag_name: "latest" @@ -107,7 +107,7 @@ jobs: - name: Upload tagged release if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.networking == 'net' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | artifact/* diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index e91433f5..bc92d6dd 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -126,7 +126,7 @@ jobs: - name: Upload development release if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/vanilla' && matrix.networking == 'net' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: name: Development Build tag_name: "latest" @@ -138,7 +138,7 @@ jobs: - name: Upload tagged release if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.networking == 'net' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | artifact/* diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index fa676ac7..b6cc3c11 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -14,13 +14,16 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - uses: ilammy/msvc-dev-cmd@v1.12.1 + - uses: ilammy/msvc-dev-cmd@v1.13.0 with: arch: x86 - name: Set Git Info id: gitinfo - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + shell: pwsh + run: | + $gitoutput = git rev-parse --short HEAD + echo "sha_short=${gitoutput}" >> $env:GITHUB_OUTPUT - name: Install Dependencies run: | @@ -54,7 +57,7 @@ jobs: - name: Upload development release if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/vanilla' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: name: Development Build tag_name: "latest" @@ -66,7 +69,7 @@ jobs: - name: Upload tagged release if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | artifact/* @@ -86,13 +89,16 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - uses: ilammy/msvc-dev-cmd@v1.12.1 + - uses: ilammy/msvc-dev-cmd@v1.13.0 with: arch: ${{ matrix.platform }} - name: Set Git Info id: gitinfo - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + shell: pwsh + run: | + $gitoutput = git rev-parse --short HEAD + echo "sha_short=${gitoutput}" >> $env:GITHUB_OUTPUT - name: Set variables id: vars @@ -152,7 +158,7 @@ jobs: - name: Upload development release if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/vanilla' && matrix.networking == 'net' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: name: Development Build tag_name: "latest" @@ -164,7 +170,7 @@ jobs: - name: Upload tagged release if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.networking == 'net' }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | artifact/* From 19073d6d6022467d4bc1fff3e43cc8e4739833eb Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Sat, 22 Jun 2024 22:59:18 +0100 Subject: [PATCH 2/6] Fix SC* expansion files not caching on none windows. Fixes any mod or expansion that relied on cached resources. --- common/file.cpp | 7 +++++-- common/file.h | 4 ++++ common/file_posix.cpp | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/common/file.cpp b/common/file.cpp index 55779b98..5a639b85 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -12,8 +12,11 @@ static void Resolve_File_Single(char* fname) return; } - if (ffblk->FindFirst(fname) && strlen(fname) == strlen(ffblk->GetName())) { - strncpy(fname, ffblk->GetName(), strlen(fname) + 1); + size_t name_len = strlen(fname); + size_t full_len = strlen(ffblk->GetFullName()); + + if (ffblk->FindFirst(fname) && name_len == full_len) { + strncpy(fname, ffblk->GetFullName(), name_len + 1); } delete ffblk; diff --git a/common/file.h b/common/file.h index 83b447ff..3e05794c 100644 --- a/common/file.h +++ b/common/file.h @@ -231,6 +231,10 @@ class Find_File_Data { } virtual const char* GetName() const = 0; + virtual const char* GetFullName() const + { + return nullptr; + }; virtual unsigned int GetTime() const = 0; virtual bool FindFirst(const char* fname) = 0; diff --git a/common/file_posix.cpp b/common/file_posix.cpp index 233ba0f9..bcc4d64e 100644 --- a/common/file_posix.cpp +++ b/common/file_posix.cpp @@ -18,6 +18,10 @@ class Find_File_Data_Posix : public Find_File_Data virtual ~Find_File_Data_Posix(); virtual const char* GetName() const; + virtual const char* GetFullName() const + { + return DirEntry != nullptr ? FullName : nullptr; + } virtual unsigned int GetTime() const; virtual bool FindFirst(const char* fname); @@ -50,7 +54,7 @@ const char* Find_File_Data_Posix::GetName() const if (DirEntry == nullptr) { return nullptr; } - return FullName; + return DirEntry->d_name; } unsigned int Find_File_Data_Posix::GetTime() const From 9641ffc02987a5376a7c1223c17488d5711a7758 Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Fri, 21 Jun 2024 16:14:06 +0100 Subject: [PATCH 3/6] Cleans up MSVC only warnings pragmas. Any warnings that need to be disabled at the current warning level are disabled through CMakePresets.json now. Also fixes two warnings seen at current warning level. --- CMakePresets.json | 2 +- common/field.cpp | 3 --- common/graphicsviewport.cpp | 2 -- common/ini.cpp | 3 --- common/int.h | 2 -- common/mp.cpp | 1 - common/packet.cpp | 1 - common/shape.h | 1 - common/soscodec.cpp | 1 + redalert/dllinterface.cpp | 6 ------ redalert/ipxmgr.cpp | 3 --- tiberiandawn/conquer.cpp | 1 - tiberiandawn/defines.h | 9 --------- tiberiandawn/dllinterface.cpp | 3 --- tiberiandawn/iomap.cpp | 2 -- tiberiandawn/ioobj.cpp | 2 -- tiberiandawn/ipxmgr.cpp | 3 --- tools/miniposix/dirent/dirent.c | 2 +- 18 files changed, 3 insertions(+), 44 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 79aa6238..21ca4f9a 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -28,7 +28,7 @@ "hidden": true, "cacheVariables": { "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>DLL", - "VC_CXX_FLAGS": "/Zc:strictStrings;-wd4244;-wd4018;-wd4291;-wd4101;-wd4267", + "VC_CXX_FLAGS": "/Zc:strictStrings;-wd4244;-wd4018;-wd4291;-wd4101;-wd4267;-wd4200", "CMAKE_CXX_FLAGS_RELEASE": "/Zi /O2 /Ob2 /DNDEBUG", "CMAKE_EXE_LINKER_FLAGS_RELEASE": "/debug:full /INCREMENTAL:NO", "CMAKE_MODULE_LINKER_FLAGS_RELEASE": "/debug:full /INCREMENTAL:NO", diff --git a/common/field.cpp b/common/field.cpp index fc387fb1..49bf11c2 100644 --- a/common/field.cpp +++ b/common/field.cpp @@ -33,9 +33,6 @@ #include "field.h" #include "endianness.h" -// ST - 12/18/2018 10:14AM -#pragma warning(disable : 4996) - FieldClass::FieldClass(const char* id, char data) { strncpy(ID, id, sizeof(ID)); diff --git a/common/graphicsviewport.cpp b/common/graphicsviewport.cpp index bcdc7b8b..1dda825f 100644 --- a/common/graphicsviewport.cpp +++ b/common/graphicsviewport.cpp @@ -779,8 +779,6 @@ unsigned int GraphicViewPortClass::Print(char const* str, int x, int y, int fcol return (return_code); } -#pragma warning(disable : 4996) - /*************************************************************************** * GVPC::PRINT -- Stub function to print an integer * * * diff --git a/common/ini.cpp b/common/ini.cpp index a11a0501..98f3ac17 100644 --- a/common/ini.cpp +++ b/common/ini.cpp @@ -80,9 +80,6 @@ #include "cstraw.h" #endif -// Disable the "temporary object used to initialize a non-constant reference" warning. -//#pragma warning 665 9 - /*********************************************************************************************** * INIClass::~INIClass -- Destructor for INI handler. * * * diff --git a/common/int.h b/common/int.h index 53258cc9..6e7fc8fc 100644 --- a/common/int.h +++ b/common/int.h @@ -476,8 +476,6 @@ template T Gcd(const T& a, const T& n) return g[(i - 1) % 3]; } -//#pragma warning 604 9 -//#pragma warning 595 9 template T Generate_Prime(Straw& rng, int pbits) { T minQ = (T(1UL) << (unsigned short)(pbits - (unsigned short)2)); diff --git a/common/mp.cpp b/common/mp.cpp index e064cb23..d65f19bf 100644 --- a/common/mp.cpp +++ b/common/mp.cpp @@ -333,7 +333,6 @@ unsigned XMP_Encode(unsigned char* to, unsigned tobytes, digit const* from, int * HISTORY: * * 07/01/1996 JLB : Created. * *=============================================================================================*/ -//#pragma warning 364 9 unsigned XMP_Encode(unsigned char* to, digit const* from, int precision) { int i; diff --git a/common/packet.cpp b/common/packet.cpp index da29423f..2f6907a5 100644 --- a/common/packet.cpp +++ b/common/packet.cpp @@ -402,7 +402,6 @@ bool PacketClass::Get_Field(const char* id, int& data) * HISTORY: * * 04/23/1996 PWG : Created. * *========================================================================*/ -#pragma warning(disable : 4996) bool PacketClass::Get_Field(const char* id, char* data) { FieldClass* field = Find_Field(id); diff --git a/common/shape.h b/common/shape.h index a8224160..197623d6 100644 --- a/common/shape.h +++ b/common/shape.h @@ -129,7 +129,6 @@ typedef struct /* ------------------------------- Shape block --------------------------------- */ -#pragma warning(disable : 4200) #pragma pack(push, 2) typedef struct { diff --git a/common/soscodec.cpp b/common/soscodec.cpp index 47d3e87c..f40b938e 100644 --- a/common/soscodec.cpp +++ b/common/soscodec.cpp @@ -196,6 +196,7 @@ unsigned sosCODECDecompressData(_SOS_COMPRESS_INFO* stream, unsigned bytes) } #endif assert(0 && "Unreachable"); + return 0; } // diff --git a/redalert/dllinterface.cpp b/redalert/dllinterface.cpp index 1ec7194d..e78a9fa7 100644 --- a/redalert/dllinterface.cpp +++ b/redalert/dllinterface.cpp @@ -24,9 +24,6 @@ ** */ -// Exception handling isn't enabled -#pragma warning(disable : 4530) // warning C4530: C++ exception handler used, but unwind semantics are not enabled. - #include #include #include @@ -72,9 +69,6 @@ typedef __int64 int64; ** ** */ -// For compatibility with Watcom in audio enums -#pragma warning(disable : 4091) - // From RedAlert\Audio.cpp typedef enum { diff --git a/redalert/ipxmgr.cpp b/redalert/ipxmgr.cpp index 0a884594..6eee2110 100644 --- a/redalert/ipxmgr.cpp +++ b/redalert/ipxmgr.cpp @@ -85,9 +85,6 @@ #endif // WINSOCK_IPX -// Turn off "expression is not meaningful". -//#pragma warning 628 9 - //#include "WolDebug.h" /*************************************************************************** diff --git a/tiberiandawn/conquer.cpp b/tiberiandawn/conquer.cpp index 0220640c..a8aebd8e 100644 --- a/tiberiandawn/conquer.cpp +++ b/tiberiandawn/conquer.cpp @@ -3613,7 +3613,6 @@ static bool Change_Local_Dir(int cd) * 07/11/1995 JLB : Created. * * 05/22/1996 ST : Handles multiple CD drives / CD changers * *=============================================================================================*/ -#pragma warning(disable : 4101) bool Force_CD_Available(int cd) { diff --git a/tiberiandawn/defines.h b/tiberiandawn/defines.h index 82ff91d8..79269148 100644 --- a/tiberiandawn/defines.h +++ b/tiberiandawn/defines.h @@ -173,13 +173,6 @@ #define FOREIGN_VERSION_NUMBER 6 -// -// typedef enums with -1 will show this warning, even when the type of the enum is signed. It's a compiler bug, -// apparently ST - 1/8/2019 9:23AM -// -#pragma warning(push) -#pragma warning(disable : 4341) - /********************************************************************** ** These enumerations are used to implement RTTI. */ @@ -3042,6 +3035,4 @@ typedef enum StrategyType : unsigned char #endif // USE_RA_AI -#pragma warning(pop) - #endif \ No newline at end of file diff --git a/tiberiandawn/dllinterface.cpp b/tiberiandawn/dllinterface.cpp index 7ccce4b2..28d1c418 100644 --- a/tiberiandawn/dllinterface.cpp +++ b/tiberiandawn/dllinterface.cpp @@ -65,9 +65,6 @@ typedef __int64 int64; ** ** */ -// For compatibility with Watcom in audio enums -#pragma warning(disable : 4091) - // From TiberianDawn\Audio.cpp typedef enum { diff --git a/tiberiandawn/iomap.cpp b/tiberiandawn/iomap.cpp index 2dcee7ef..f4f1ef33 100644 --- a/tiberiandawn/iomap.cpp +++ b/tiberiandawn/iomap.cpp @@ -65,8 +65,6 @@ #include "function.h" -#pragma warning(disable : 4302) // Truncation from pointer to TARGET - /*********************************************************************************************** * CellClass::Should_Save -- Should the cell be written to disk? * * * diff --git a/tiberiandawn/ioobj.cpp b/tiberiandawn/ioobj.cpp index e4f1f917..2c34db7a 100644 --- a/tiberiandawn/ioobj.cpp +++ b/tiberiandawn/ioobj.cpp @@ -130,8 +130,6 @@ #include "function.h" -#pragma warning(disable : 4302) // Truncation from pointer to TARGET - /*********************************************************************************************** * TeamTypeClass::Load -- Loads from a save game file. * * * diff --git a/tiberiandawn/ipxmgr.cpp b/tiberiandawn/ipxmgr.cpp index 4a3e3273..f3002a9c 100644 --- a/tiberiandawn/ipxmgr.cpp +++ b/tiberiandawn/ipxmgr.cpp @@ -89,9 +89,6 @@ /* For `Players` vector */ #include "externs.h" -// Turn off "expression is not meaningful". -//#pragma warning 628 9 - //#include "WolDebug.h" /*************************************************************************** diff --git a/tools/miniposix/dirent/dirent.c b/tools/miniposix/dirent/dirent.c index 4e356d6d..d101424f 100644 --- a/tools/miniposix/dirent/dirent.c +++ b/tools/miniposix/dirent/dirent.c @@ -214,7 +214,7 @@ DIR *opendir(const char *name) __seterrno(ENOENT); return NULL; } - size = wcslen(full) + 1; + size = (int)wcslen(full) + 1; memcpy(wname, L"\\\\?\\", sizeof(wchar_t) * 5); if (size > NTFS_MAX_PATH) { free(wname); From faba183da3300051f56119fb39ef93138befeebf Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Mon, 24 Jun 2024 10:24:11 +0100 Subject: [PATCH 4/6] [TD] Fixes theater for boulder4/5/6. See https://tcrf.net/Command_%26_Conquer_(DOS,_Windows)#Boulder_Tiles --- tiberiandawn/cdata.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tiberiandawn/cdata.cpp b/tiberiandawn/cdata.cpp index 6cc63647..452701f6 100644 --- a/tiberiandawn/cdata.cpp +++ b/tiberiandawn/cdata.cpp @@ -837,11 +837,11 @@ static TemplateTypeClass const Boulder3(TEMPLATE_BOULDER3, LAND_ROCK, NULL); static TemplateTypeClass const - Boulder4(TEMPLATE_BOULDER4, THEATERF_TEMPERATE, "B4", TXT_SLOPE, LAND_ROCK, 1, 1, LAND_ROCK, NULL); + Boulder4(TEMPLATE_BOULDER4, THEATERF_DESERT, "B4", TXT_SLOPE, LAND_ROCK, 1, 1, LAND_ROCK, NULL); static TemplateTypeClass const - Boulder5(TEMPLATE_BOULDER5, THEATERF_TEMPERATE, "B5", TXT_SLOPE, LAND_ROCK, 1, 1, LAND_ROCK, NULL); + Boulder5(TEMPLATE_BOULDER5, THEATERF_DESERT, "B5", TXT_SLOPE, LAND_ROCK, 1, 1, LAND_ROCK, NULL); static TemplateTypeClass const - Boulder6(TEMPLATE_BOULDER6, THEATERF_TEMPERATE, "B6", TXT_SLOPE, LAND_ROCK, 1, 1, LAND_ROCK, NULL); + Boulder6(TEMPLATE_BOULDER6, THEATERF_DESERT, "B6", TXT_SLOPE, LAND_ROCK, 1, 1, LAND_ROCK, NULL); static TemplateTypeClass const Slope1(TEMPLATE_SLOPE1, THEATERF_WINTER | THEATERF_DESERT | THEATERF_TEMPERATE, "S01", From 69c2455079f91a95f2950ffb4b9565a38af676de Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Tue, 25 Jun 2024 10:30:22 +0100 Subject: [PATCH 5/6] Fix startup on linux. Mix file caching fix but more better. --- common/file.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/file.cpp b/common/file.cpp index 5a639b85..d2e727d3 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -13,9 +13,8 @@ static void Resolve_File_Single(char* fname) } size_t name_len = strlen(fname); - size_t full_len = strlen(ffblk->GetFullName()); - if (ffblk->FindFirst(fname) && name_len == full_len) { + if (ffblk->FindFirst(fname) && name_len == strlen(ffblk->GetFullName())) { strncpy(fname, ffblk->GetFullName(), name_len + 1); } From d07e8dad35dd9814bb9474b14208b606fa76cda5 Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Tue, 25 Jun 2024 09:15:28 +0100 Subject: [PATCH 6/6] [TD] Fix loading of zounds.mix. Loading was previously gated behind a check for Special.IsJuvenile which isn't set until later in the init process. --- tiberiandawn/init.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tiberiandawn/init.cpp b/tiberiandawn/init.cpp index f8c79db2..8f3dede3 100644 --- a/tiberiandawn/init.cpp +++ b/tiberiandawn/init.cpp @@ -511,10 +511,6 @@ bool Init_Game(int, char*[]) MFCD::Cache("CONQUER.MIX"); if (SampleType != 0 && !Debug_Quiet) { MFCD::Cache("SOUNDS.MIX"); - if (Special.IsJuvenile) { - new MFCD("ZOUNDS.MIX"); // Cached. - MFCD::Cache("ZOUNDS.MIX"); - } } } Call_Back(); @@ -618,6 +614,14 @@ bool Init_Game(int, char*[]) */ Options.Load_Settings(); + /* + ** Now that conquer.ini has been read, we can check if we need zounds.mix. + */ + if (!Is_Demo() && SampleType != 0 && !Debug_Quiet && Special.IsJuvenile) { + new MFCD("ZOUNDS.MIX"); + MFCD::Cache("ZOUNDS.MIX"); + } + /* ** Dump a default copy of rules.ini. */