diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e962961e..c1d949fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ on: jobs: build: name: Build binaries - runs-on: windows-latest + runs-on: windows-2022 strategy: matrix: configuration: @@ -36,11 +36,11 @@ jobs: lfs: false - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v1.1 - name: Generate project files - #run: tools/premake5 vs2019 --ci-build - run: tools/premake5 vs2019 --ac-disable + #run: tools/premake5 vs2022 --ci-build --ac-disable + run: tools/premake5 vs2022 --ac-disable - name: Set up problem matching uses: ammaraskar/msvc-problem-matcher@master diff --git a/README.md b/README.md index f04e11dc..173cf31d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## How to compile -- Run `premake5 vs2019` or use the delivered `generate.bat`. +- Run `premake5 vs2022` or use the delivered `generate.bat`. - Build via solution file in `build\iw4x.sln`. (You can use the `build.bat` script to do it quick and easy.) ## Premake arguments diff --git a/appveyor.yml b/appveyor.yml index da4851e8..2f9649cd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,8 +4,8 @@ version: "#{build} ({branch})" environment: matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PREMAKE_ACTION: vs2019 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PREMAKE_ACTION: vs2022 configuration: - Debug diff --git a/generate.bat b/generate.bat index f00a84e9..b3823287 100644 --- a/generate.bat +++ b/generate.bat @@ -1,4 +1,4 @@ @echo off echo Updating submodules... call git submodule update --init --recursive -call tools\premake5 %* vs2019 --ac-disable +call tools\premake5 %* vs2022 --ac-disable diff --git a/premake/iw4mvm.lua b/premake/iw4mvm.lua deleted file mode 100644 index c2823227..00000000 --- a/premake/iw4mvm.lua +++ /dev/null @@ -1,54 +0,0 @@ -iw4mvm = { - settings = nil -} - -function iw4mvm.setup(settings) - if not settings.source then error("Missing source.") end - - iw4mvm.settings = settings - - if not iw4mvm.settings.defines then iw4mvm.settings.defines = {} end -end - -function iw4mvm.import() - if not iw4mvm.settings then error("You need to call iw4mvm.setup first") end - - links { "iw4mvm" } - iw4mvm.includes() -end - -function iw4mvm.includes() - if not iw4mvm.settings then error("You need to call iw4mvm.setup first") end - - includedirs { iw4mvm.settings.source } - libdirs { path.join(iw4mvm.settings.source, "IW4MVM") } - defines(iw4mvm.settings.defines) -end - -function iw4mvm.project() - if not iw4mvm.settings then error("You need to call iw4mvm.setup first") end - - project "iw4mvm" - language "C++" - - characterset ("MBCS") - - defines("_CRT_SECURE_NO_WARNINGS") - - iw4mvm.includes() - files - { - path.join(iw4mvm.settings.source, "IW4MVM/*.h"), - path.join(iw4mvm.settings.source, "IW4MVM/*.cpp"), - } - - removefiles - { - --path.join(iw4mvm.settings.source, "IW4MVM/detours.cpp"), - path.join(iw4mvm.settings.source, "IW4MVM/DllMain.cpp"), - } - - -- not our code, ignore POSIX usage warnings for now - warnings "Off" - kind "StaticLib" -end \ No newline at end of file diff --git a/premake5.lua b/premake5.lua index 91bee2df..9076cd87 100644 --- a/premake5.lua +++ b/premake5.lua @@ -193,7 +193,6 @@ require "premake/pdcurses" require "premake/protobuf" require "premake/zlib" require "premake/udis86" -require "premake/iw4mvm" require "premake/dxsdk" json11.setup @@ -240,15 +239,6 @@ udis86.setup { source = path.join(depsBasePath, "udis86"), } -iw4mvm.setup -{ - defines = { - "IW4X", - "DETOURS_X86", - "DETOURS_32BIT", - }, - source = path.join(depsBasePath, "iw4mvm"), -} dxsdk.setup { source = path.join(depsBasePath, "dxsdk"), @@ -260,34 +250,44 @@ workspace "iw4x" objdir "%{wks.location}/obj" targetdir "%{wks.location}/bin/%{cfg.buildcfg}" buildlog "%{wks.location}/obj/%{cfg.architecture}/%{cfg.buildcfg}/%{prj.name}/%{prj.name}.log" + configurations { "Debug", "Release" } + + language "C++" + cppdialect "C++17" + architecture "x86" platforms "x86" - --exceptionhandling ("SEH") + systemversion "latest" + symbols "On" staticruntime "On" + editandcontinue "Off" + warnings "Extra" + characterset "ASCII" - configuration "windows" - defines { "_WINDOWS", "WIN32" } + flags { "NoIncrementalLink", "NoMinimalRebuild", "MultiProcessorCompile", "No64BitChecks" } - configuration "Release*" - defines { "NDEBUG" } - flags { "MultiProcessorCompile", "LinkTimeOptimization", "No64BitChecks" } + filter "platforms:x86" + defines {"_WINDOWS", "WIN32"} + filter {} + + filter "configurations:Release" optimize "On" + buildoptions { "/GL" } + linkoptions { "/IGNORE:4702", "/LTCG" } + defines { "NDEBUG" } + flags { "FatalCompileWarnings", "FatalLinkWarnings" } if not _OPTIONS["force-unit-tests"] then rtti ("Off") end + filter {} - configuration "Debug*" - defines { "DEBUG", "_DEBUG" } - flags { "MultiProcessorCompile", "No64BitChecks" } + filter "configurations:Debug" optimize "Debug" - if symbols ~= nil then - symbols "On" - else - flags { "Symbols" } - end + defines { "DEBUG", "_DEBUG" } + filter {} project "iw4x" kind "SharedLib" @@ -347,7 +347,6 @@ workspace "iw4x" protobuf.import() zlib.import() udis86.import() - --iw4mvm.import() dxsdk.import() -- fix vpaths for protobuf sources @@ -401,23 +400,6 @@ workspace "iw4x" } end - -- Specific configurations - flags { "UndefinedIdentifiers" } - warnings "Extra" - - if symbols ~= nil then - symbols "On" - else - flags { "Symbols" } - end - - configuration "Release*" - flags { - "FatalCompileWarnings", - "FatalLinkWarnings", - } - configuration {} - --[[ -- Generate source code from protobuf definitions rules { "ProtobufCompiler" } @@ -461,11 +443,6 @@ workspace "iw4x" protobuf.project() zlib.project() udis86.project() - --iw4mvm.project() - -workspace "*" - cppdialect "C++17" - defines { "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS" } rule "ProtobufCompiler" display "Protobuf compiler" diff --git a/src/Components/Loader.cpp b/src/Components/Loader.cpp index ec1f5dea..59fb8a01 100644 --- a/src/Components/Loader.cpp +++ b/src/Components/Loader.cpp @@ -48,9 +48,6 @@ namespace Components Loader::Register(new Party()); Loader::Register(new Zones()); Loader::Register(new D3D9Ex()); -#if (!defined(VLD_RPTHOOK_INSTALL) || defined(VLDEnable)) && defined(COMPILE_IW4MVM) // IW4MVM uses detours which produces memory leaks, but those are not really relevant - Loader::Register(new IW4MVM()); -#endif Loader::Register(new Logger()); Loader::Register(new Script()); Loader::Register(new Weapon()); diff --git a/src/Components/Loader.hpp b/src/Components/Loader.hpp index ba7eef63..02ac2007 100644 --- a/src/Components/Loader.hpp +++ b/src/Components/Loader.hpp @@ -88,7 +88,6 @@ namespace Components #include "Modules/Node.hpp" #include "Modules/RCon.hpp" #include "Modules/Party.hpp" // Destroys the order, but requires network classes :D -#include "Modules/IW4MVM.hpp" #include "Modules/Logger.hpp" #include "Modules/Friends.hpp" #include "Modules/IPCPipe.hpp" diff --git a/src/Components/Modules/AntiCheat.cpp b/src/Components/Modules/AntiCheat.cpp index af7b678d..01dbea5c 100644 --- a/src/Components/Modules/AntiCheat.cpp +++ b/src/Components/Modules/AntiCheat.cpp @@ -634,7 +634,7 @@ namespace Components LUID luid; TOKEN_PRIVILEGES tp = { 0 }; DWORD cb = sizeof(TOKEN_PRIVILEGES); - if (!LookupPrivilegeValueW(nullptr, SE_DEBUG_NAME, &luid)) return; + if (!LookupPrivilegeValueA(nullptr, SE_DEBUG_NAME, &luid)) return; tp.PrivilegeCount = 1; tp.Privileges[0].Luid = luid; diff --git a/src/Components/Modules/IW4MVM.cpp b/src/Components/Modules/IW4MVM.cpp deleted file mode 100644 index 9b6b3fb8..00000000 --- a/src/Components/Modules/IW4MVM.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "STDInclude.hpp" - -#ifdef COMPILE_IW4MVM -#include -#endif - -namespace Components -{ - IW4MVM::IW4MVM() - { - if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled() || Loader::IsPerformingUnitTests()) return; - - DWORD oldProtect; - std::uint8_t* _module = reinterpret_cast(GetModuleHandle(nullptr)); - VirtualProtect(_module + 0x1000, 0x2D6000, PAGE_EXECUTE_READWRITE, &oldProtect); - -#ifdef COMPILE_IW4MVM - client_main::Init(); - Scheduler::Once(client_main::PostInit); -#endif - Scheduler::OnFrame([]() - { - if (!Game::CL_IsCgameInitialized()) - { - Dvar::Var("com_timescale").set(1.0f); - } - }); - - VirtualProtect(_module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); - } - - IW4MVM::~IW4MVM() - { - - } -} diff --git a/src/Components/Modules/IW4MVM.hpp b/src/Components/Modules/IW4MVM.hpp deleted file mode 100644 index 92541d4f..00000000 --- a/src/Components/Modules/IW4MVM.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -// Disabled for public release -//#define COMPILE_IW4MVM - -namespace Components -{ - class IW4MVM : public Component - { - public: - IW4MVM(); - ~IW4MVM(); - }; -} diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 97ec8f61..b18a8ce1 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -784,7 +784,7 @@ namespace Components { if (pack.index == dlc) { - ShellExecute(0, 0, L"https://xlabs.dev/support_iw4x_client.html", 0, 0, SW_SHOW); + ShellExecuteW(0, 0, L"https://xlabs.dev/support_iw4x_client.html", 0, 0, SW_SHOW); return; } } diff --git a/src/Utils/Utils.cpp b/src/Utils/Utils.cpp index 71d0af14..71445d52 100644 --- a/src/Utils/Utils.cpp +++ b/src/Utils/Utils.cpp @@ -107,12 +107,12 @@ namespace Utils void SetEnvironment() { wchar_t exeName[512]; - GetModuleFileName(GetModuleHandle(nullptr), exeName, sizeof(exeName) / 2); + GetModuleFileNameW(GetModuleHandle(nullptr), exeName, sizeof(exeName) / 2); wchar_t* exeBaseName = wcsrchr(exeName, L'\\'); exeBaseName[0] = L'\0'; - SetCurrentDirectory(exeName); + SetCurrentDirectoryW(exeName); } HMODULE GetNTDLL() diff --git a/tools/premake5.exe b/tools/premake5.exe index 9048d51e..c73da1fb 100644 Binary files a/tools/premake5.exe and b/tools/premake5.exe differ