Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
path: |
.\src\extern\zydis\msvc\bin\ReleaseX64
.\src\extern\zydis\msvc\bin\ReleaseX86
key: zydis-${{ runner.os }}-${{ steps.zydishash.outputs.hash }}
key: zydis-${{ runner.os }}-v143-${{ steps.zydishash.outputs.hash }}

- name: Install Python dependencies
uses: py-actions/py-dependency-install@v4
Expand Down
10 changes: 5 additions & 5 deletions MGSM2Fix.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@
<Command>python "$(ProjectDir)M2Install.py" "$(TargetPath)" $(LibrariesArchitecture)</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>call "$(ProjectDir)build_zydis.cmd" $(Platform)</Command>
<Command>call "$(ProjectDir)build_zydis.cmd" $(Platform) $(PlatformToolset)</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -427,7 +427,7 @@
<Command>python "$(ProjectDir)M2Install.py" "$(TargetPath)" $(LibrariesArchitecture)</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>call "$(ProjectDir)build_zydis.cmd" $(Platform)</Command>
<Command>call "$(ProjectDir)build_zydis.cmd" $(Platform) $(PlatformToolset)</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand Down Expand Up @@ -457,7 +457,7 @@
<Command>python "$(ProjectDir)M2Install.py" "$(TargetPath)" $(LibrariesArchitecture)</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>call "$(ProjectDir)build_zydis.cmd" $(Platform)</Command>
<Command>call "$(ProjectDir)build_zydis.cmd" $(Platform) $(PlatformToolset)</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down Expand Up @@ -495,10 +495,10 @@
<Command>python "$(ProjectDir)M2Install.py" "$(TargetPath)" $(LibrariesArchitecture)</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>call "$(ProjectDir)build_zydis.cmd" $(Platform)</Command>
<Command>call "$(ProjectDir)build_zydis.cmd" $(Platform) $(PlatformToolset)</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion MGSM2Fix.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -811,4 +811,4 @@
<Filter>Modules</Filter>
</FxCompile>
</ItemGroup>
</Project>
</Project>
19 changes: 15 additions & 4 deletions build_zydis.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ set "PLAT=%~1"
if "%PLAT%"=="" set "PLAT=%Platform%"
if "%PLAT%"=="" set "PLAT=x64"

REM --- Toolset (arg 2): build Zydis with the same toolset as the main project.
REM Zydis.vcxproj hardcodes v143; a machine with only a newer Visual Studio
REM cannot build it as written, and the main project already knows which
REM toolset it is using.
set "TOOLSET=%~2"
if "%TOOLSET%"=="" set "TOOLSET=v143"
set "TOOLSET_ARG="
if not "%TOOLSET%"=="" set "TOOLSET_ARG=/p:PlatformToolset=%TOOLSET%"

REM --- Locate Zydis project file ---
set "ZY_PROJECT=%~dp0src\extern\zydis\msvc\zydis\Zydis.vcxproj"
if not exist %ZY_PROJECT% (
if not exist "%ZY_PROJECT%" (
echo ERROR: Zydis project file not found at %ZY_PROJECT%
exit /b 1
)
Expand Down Expand Up @@ -41,24 +50,26 @@ if /i "%PLAT%"=="x64" (
)

REM --- Decide if rebuild is needed ---
REM Toolset changes invalidate both this stamp and MSBuild's incremental output.
set "BUILD_KEY=%ZY_HASH%-%TOOLSET%"
set "NEED_BUILD=0"
if not exist "%ZY_LIB%" set "NEED_BUILD=1"
if not exist "%HASH_FILE%" set "NEED_BUILD=1"

if exist "%HASH_FILE%" (
set /p OLD_HASH=<"%HASH_FILE%"
if not "!OLD_HASH!"=="%ZY_HASH%" set "NEED_BUILD=1"
if not "!OLD_HASH!"=="%BUILD_KEY%" set "NEED_BUILD=1"
)

REM --- Build if needed ---
if "%NEED_BUILD%"=="1" (
echo [Zydis] Building Release MT %PLAT%
msbuild %ZY_PROJECT% %MSBUILD_ARGS%
msbuild "%ZY_PROJECT%" %MSBUILD_ARGS% %TOOLSET_ARG% /t:Rebuild
if errorlevel 1 (
echo ERROR: Zydis Release MT %PLAT% build failed
exit /b 1
)
>"%HASH_FILE%" echo %ZY_HASH%
>"%HASH_FILE%" echo %BUILD_KEY%
) else (
echo [Zydis] Release MT %PLAT% up to date, skipping
)
Expand Down
Loading