diff --git a/.vscode/settings.json b/.vscode/settings.json index aaf717d..dd5326e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,6 +14,16 @@ "aime-dll.h": "c", "sg-reader.h": "c", "reg.h": "c", - "type_traits": "c" + "type_traits": "c", + "stdlib.h": "c", + "clock.h": "c", + "cert.h": "c", + "stddef.h": "c", + "misc.h": "c", + "windows.h": "c", + "assert.h": "c", + "io4.h": "c", + "jvs-bus.h": "c", + "jvs.h": "c" } } \ No newline at end of file diff --git a/board/io3.c b/board/io3.c index 369714f..648d1da 100644 --- a/board/io3.c +++ b/board/io3.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "board/io3.h" diff --git a/board/io4.h b/board/io4.h index 1a6cc05..9310eb6 100644 --- a/board/io4.h +++ b/board/io4.h @@ -3,6 +3,7 @@ #include #include +#include enum { /* System buttons in button[0] */ diff --git a/board/meson.build b/board/meson.build index c051a4a..379f77d 100644 --- a/board/meson.build +++ b/board/meson.build @@ -2,7 +2,6 @@ board_lib = static_library( 'board', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), ], diff --git a/gfxhook/meson.build b/gfxhook/meson.build index b973ddd..5c28103 100644 --- a/gfxhook/meson.build +++ b/gfxhook/meson.build @@ -2,7 +2,6 @@ gfxhook_lib = static_library( 'gfxhook', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), dxguid_lib, diff --git a/hooklib/createprocess.c b/hooklib/createprocess.c index 340368d..840cca7 100644 --- a/hooklib/createprocess.c +++ b/hooklib/createprocess.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "hook/table.h" diff --git a/hooklib/cursor.c b/hooklib/cursor.c index 8c66412..44ed25b 100644 --- a/hooklib/cursor.c +++ b/hooklib/cursor.c @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/hooklib/meson.build b/hooklib/meson.build index 0a69e9f..6a6f536 100644 --- a/hooklib/meson.build +++ b/hooklib/meson.build @@ -2,7 +2,6 @@ hooklib_lib = static_library( 'hooklib', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), ], diff --git a/hooklib/spike.c b/hooklib/spike.c index f06166c..60ad04d 100644 --- a/hooklib/spike.c +++ b/hooklib/spike.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "hook/pe.h" diff --git a/iccard/meson.build b/iccard/meson.build index bca1a1d..8fe3be7 100644 --- a/iccard/meson.build +++ b/iccard/meson.build @@ -2,7 +2,6 @@ iccard_lib = static_library( 'iccard', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), ], diff --git a/idmac/idmac.c b/idmac/idmac.c index 2ed28e1..1cc2aab 100644 --- a/idmac/idmac.c +++ b/idmac/idmac.c @@ -1,5 +1,6 @@ #include #include +#include #include "idmac/idmac.h" #include "idmac/jvs.h" diff --git a/idmac/meson.build b/idmac/meson.build index 2549bd9..47c60d6 100644 --- a/idmac/meson.build +++ b/idmac/meson.build @@ -2,7 +2,6 @@ idmac_lib = static_library( 'idmac', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), ], diff --git a/idmac_stub/meson.build b/idmac_stub/meson.build index 46b6194..6f2bf60 100644 --- a/idmac_stub/meson.build +++ b/idmac_stub/meson.build @@ -4,7 +4,6 @@ shared_library( include_directories: inc, vs_module_defs : 'idmac_stub.def', implicit_include_directories : false, - c_pch : '../precompiled.h', link_with : [ util_lib, ], diff --git a/jvs/meson.build b/jvs/meson.build index 49737a0..14a7f66 100644 --- a/jvs/meson.build +++ b/jvs/meson.build @@ -2,7 +2,6 @@ jvs_lib = static_library( 'jvs', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), ], diff --git a/ll3hook/config.c b/ll3hook/config.c index d96cb0c..81fa92a 100644 --- a/ll3hook/config.c +++ b/ll3hook/config.c @@ -1,5 +1,6 @@ #include #include +#include #include "ll3hook/config.h" diff --git a/ll3hook/dllmain.c b/ll3hook/dllmain.c index 56fbdfa..b6516f5 100644 --- a/ll3hook/dllmain.c +++ b/ll3hook/dllmain.c @@ -1,4 +1,5 @@ #include +#include #include "board/io4.h" diff --git a/ll3hook/meson.build b/ll3hook/meson.build index 37eda2f..3d801d3 100644 --- a/ll3hook/meson.build +++ b/ll3hook/meson.build @@ -4,7 +4,6 @@ shared_library( include_directories : inc, implicit_include_directories : false, vs_module_defs : 'll3hook.def', - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), capnhook.get_variable('hooklib_dep'), diff --git a/ll3io/meson.build b/ll3io/meson.build index 1e48d4e..1c0ea4c 100644 --- a/ll3io/meson.build +++ b/ll3io/meson.build @@ -3,7 +3,6 @@ ll3io_lib = static_library( name_prefix : '', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ xinput_lib, ], diff --git a/minihook/meson.build b/minihook/meson.build index 21acfd1..483e4b2 100644 --- a/minihook/meson.build +++ b/minihook/meson.build @@ -3,7 +3,6 @@ shared_library( name_prefix : '', include_directories: inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), ], diff --git a/msvc-build.bat b/msvc-build.bat new file mode 100644 index 0000000..669b31e --- /dev/null +++ b/msvc-build.bat @@ -0,0 +1,73 @@ +@echo off +set BUILD_DIR=build +set BUILD_DIR_32=%BUILD_DIR%\build32 +set BUILD_DIR_64=%BUILD_DIR%\build64 +set BUILD_DIR_ZIP=%BUILD_DIR%\zip +set DIST_DIR=dist +set DOC_DIR=doc + +REM Set Your Visual Studio install path if this one was wrong +if "%VS_INSTALLATION%"=="" set VS_INSTALLATION=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools + +if /I "%1"=="build" ( + call :build + exit /b +) +if /I "%1"=="zip" ( + powershell -NoProfile -ExecutionPolicy Bypass -Command "& './package.ps1'" + exit /b +) + +echo %~nx0 [action] +echo build: Build the for both x86 and x64 +echo zip: Make zip file +exit /b + +:build ( + REM Check VC++ + set VSVARALL="%VS_INSTALLATION%\VC\Auxiliary\Build\vcvarsall.bat" + if not exist %VSVARALL% ( + echo Build tools for Microsoft Visual C++ 2022 is not Installed + echo Edit this file to change the VS_INSTALLATION if you are installed the Visual Studio in other path + goto end + ) + + REM Check Meson + for /f "tokens=* usebackq" %%i in (`where meson`) do set MESON="%%i" + if not exist %MESON% ( + echo Meson is not Installed + goto end + ) + + :build_x64 ( + call %VSVARALL% x64 + + if exist %BUILD_DIR_64% ( + %MESON% setup %BUILD_DIR_64% --backend vs --buildtype release --reconfigure + ) else ( + %MESON% setup %BUILD_DIR_64% --backend vs --buildtype release + ) + + pushd %BUILD_DIR_64% + msbuild /m /p:Configuration=release /p:Platform=x64 segatools.sln + popd + ) + + :build_x86 ( + call %VSVARALL% x86 + + if exist %BUILD_DIR_32% ( + %MESON% setup %BUILD_DIR_32% --backend vs --buildtype release --reconfigure + ) else ( + %MESON% setup %BUILD_DIR_32% --backend vs --buildtype release + ) + + pushd %BUILD_DIR_32% + msbuild /m /p:Configuration=release /p:Platform=Win32 segatools.sln + popd + ) + + :end ( + endlocal + ) +) diff --git a/package.ps1 b/package.ps1 new file mode 100644 index 0000000..bae0e6c --- /dev/null +++ b/package.ps1 @@ -0,0 +1,96 @@ +if ($null -eq $env:BUILD_DIR) { + $BUILD_DIR="build" + $BUILD_DIR_32="$BUILD_DIR\build32" + $BUILD_DIR_64="$BUILD_DIR\build64" + $BUILD_DIR_ZIP="$BUILD_DIR\zip" + $DIST_DIR="dist" + $DOC_DIR="doc" +} else { + $BUILD_DIR = $env:BUILD_DIR; + $BUILD_DIR_32 = $env:BUILD_DIR_32; + $BUILD_DIR_64 = $env:BUILD_DIR_64; + $BUILD_DIR_ZIP = $env:BUILD_DIR_ZIP; + $DIST_DIR = $env:DIST_DIR; + $DOC_DIR = $env:DOC_DIR; +} + +$target = $null; +$line = ''; +[System.Collections.ArrayList]$files = @(); +$folder = Get-Location + +cat .\Package.mk | % { + $trimmed = $_.TrimEnd('\'). + TrimStart("`t "). + Replace('$(V)', ''). + Replace('$(BUILD_DIR)', $BUILD_DIR). + Replace('$(BUILD_DIR_32)', $BUILD_DIR_32). + Replace('$(BUILD_DIR_64)', $BUILD_DIR_64). + Replace('$(BUILD_DIR_ZIP)', $BUILD_DIR_ZIP). + Replace('$(DIST_DIR)', $DIST_DIR). + Replace('$(DOC_DIR)', $DOC_DIR). + Replace('$@', $target). + Replace('/', '\'); + + if ($trimmed.EndsWith(': ') -or $trimmed.EndsWith(':')) { + $target = $trimmed.TrimEnd(': '); + $line = ''; + $files.Clear(); + cd $folder; + + return; + } + + if (-not $trimmed.StartsWith('|')) { + $line += $trimmed; + + if ($_.EndsWith('\')) { + return; + } + } + + $line.Split(';') | % { + $cmd = $_.Trim(' '); + if ($cmd.StartsWith('echo')) { + echo $cmd.TrimStart('echo ') + } elseif ($cmd.StartsWith('mkdir')) { + $cmd = $cmd.Replace('-p', '-Force') + echo " - $cmd" + Invoke-Expression $cmd | Out-Null + } elseif ($cmd.StartsWith('cp')) { + $tokens = $cmd.Replace('cp ', '').Split(' '); + $srcs = $tokens[0..($tokens.Count - 2)]; + $dest = $tokens[$tokens.Count - 1]; + echo " - cp -Path $srcs -Destination $dest"; + cp -Path $srcs -Destination $dest + } elseif ($cmd.StartsWith('cd')) { + echo " - $cmd" + Invoke-Expression $cmd | Out-Null + } elseif ($cmd.StartsWith('zip ')) { + $tokens = $cmd.Substring(4, $cmd.Length - 4).Replace('-r ', '').Replace('-j ', '').Replace('*', '.\*'); + $tokens = $tokens.Split(' '); + $target = $tokens[0] + + if (-not $tokens.Contains('$^')) { + $files.AddRange($tokens[1..($tokens.Count - 1)]); + } + + echo " - Compress-Archive -Path $files -DestinationPath $target -Force" + Compress-Archive -Path $files -DestinationPath $target -Force + } else { + $allExists = $true + $args = $cmd.Split(' '); + $args | ? { -not $_ -eq '' } | % { + if (-not (Test-Path $_)) { + $allExists = $false + } + } + + if ($allExists) { + $files.AddRange($args); + } + } + } + + $line = ''; +} diff --git a/platform/cert.h b/platform/cert.h index c8e22a4..6fad7ff 100644 --- a/platform/cert.h +++ b/platform/cert.h @@ -4,6 +4,7 @@ #include #include +#include struct cert_config { bool enable; diff --git a/platform/clock.c b/platform/clock.c index e163961..b7249fa 100644 --- a/platform/clock.c +++ b/platform/clock.c @@ -2,6 +2,7 @@ #include #include +#include #include "hook/table.h" #include "hook/procaddr.h" diff --git a/platform/meson.build b/platform/meson.build index 40a850e..139b79c 100644 --- a/platform/meson.build +++ b/platform/meson.build @@ -2,7 +2,6 @@ platform_lib = static_library( 'platform', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), shlwapi_lib, diff --git a/platform/misc.h b/platform/misc.h index ec4f06f..a59262b 100644 --- a/platform/misc.h +++ b/platform/misc.h @@ -1,6 +1,7 @@ #pragma once #include +#include struct misc_config { bool enable; diff --git a/platform/netenv.c b/platform/netenv.c index 3be7b3a..4d5a627 100644 --- a/platform/netenv.c +++ b/platform/netenv.c @@ -1,10 +1,15 @@ +#include #include #include #include +#include +#include +#include #include #include #include +#include #include #include diff --git a/platform/syscfg.c b/platform/syscfg.c index 8f7d308..4d73eeb 100644 --- a/platform/syscfg.c +++ b/platform/syscfg.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "hooklib/reg.h" #include "platform/syscfg.h" diff --git a/sivahook/config.c b/sivahook/config.c index 0fd95c4..f7f6d7a 100644 --- a/sivahook/config.c +++ b/sivahook/config.c @@ -1,5 +1,6 @@ #include #include +#include #include "sivahook/config.h" diff --git a/sivahook/dllmain.c b/sivahook/dllmain.c index 4fdd040..e9170aa 100644 --- a/sivahook/dllmain.c +++ b/sivahook/dllmain.c @@ -1,4 +1,6 @@ #include +#include +#include #include "board/io4.h" diff --git a/sivahook/meson.build b/sivahook/meson.build index 57a09ff..1ff4b85 100644 --- a/sivahook/meson.build +++ b/sivahook/meson.build @@ -4,7 +4,6 @@ shared_library( include_directories : inc, implicit_include_directories : false, vs_module_defs : 'sivahook.def', - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), capnhook.get_variable('hooklib_dep'), diff --git a/sivahook/reader.c b/sivahook/reader.c index 09fafec..bb0de7e 100644 --- a/sivahook/reader.c +++ b/sivahook/reader.c @@ -1,4 +1,5 @@ #include +#include #include "jvs/jvs-bus.h" #include "idmac/jvs.h" diff --git a/sivahook/unity.c b/sivahook/unity.c index 3bb0813..bfedf79 100644 --- a/sivahook/unity.c +++ b/sivahook/unity.c @@ -1,6 +1,7 @@ #include #include +#include #include "hook/table.h" #include "hook/iohook.h" diff --git a/sivaio/meson.build b/sivaio/meson.build index 38bc413..68b312e 100644 --- a/sivaio/meson.build +++ b/sivaio/meson.build @@ -3,7 +3,6 @@ sivaio_lib = static_library( name_prefix : '', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ xinput_lib, ], diff --git a/util/lib.c b/util/lib.c index bd7a5eb..42f5c66 100644 --- a/util/lib.c +++ b/util/lib.c @@ -1,6 +1,7 @@ #include #include +#include wchar_t *module_file_name(HMODULE module) { diff --git a/util/meson.build b/util/meson.build index 575d123..5dfa7bc 100644 --- a/util/meson.build +++ b/util/meson.build @@ -2,7 +2,6 @@ util_lib = static_library( 'util', include_directories : inc, implicit_include_directories : false, - c_pch : '../precompiled.h', dependencies : [ capnhook.get_variable('hook_dep'), ],