1
0
mirror of synced 2025-03-03 16:44:23 +01:00

fix msvc compiling

This commit is contained in:
Hay1tsme 2025-02-22 12:57:53 -05:00
parent 9f08815a0d
commit c7681e3d02
3 changed files with 92 additions and 29 deletions

View File

@ -38,7 +38,7 @@ void debug_hook_init()
debug_hook_initted = true;
hook_table_apply(NULL, "kernel32.dll", debug_hooks, _countof(debug_hooks));
dprintf("debug: hook enabled.\n");
dprintf("IsDebuggerPresent: hook enabled\n");
}
BOOL WINAPI hook_IsDebuggerPresent()

View File

@ -1,4 +1,6 @@
@echo off
setlocal enabledelayedexpansion
set BUILD_DIR=build
set BUILD_DIR_32=%BUILD_DIR%\build32
set BUILD_DIR_64=%BUILD_DIR%\build64
@ -6,11 +8,33 @@ 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
REM Set your Visual Studio install path if Visual Studio installation can not be detected
set VS_INSTALLATION=C:\Program Files\Microsoft Visual Studio\2022\Community
if /I "%1"=="build" (
call :build
call :detect-visual-studio
if ERRORLEVEL 2 exit /b
if ERRORLEVEL 1 (
echo Failed to detect Visual Studio installation path.
echo.
echo If Visual Studio is installed then edit VS_INSTALLATION in this file
echo to manually specify Visual Studio install path.
exit /b
)
call :detect-meson
if ERRORLEVEL 1 (
echo Meson is not installed.
exit /b
)
set VSVARSALL=!VSVARSALL!
set MESON=!MESON!
call :build %2
echo.
echo Build done!
exit /b
)
if /I "%1"=="zip" (
@ -18,56 +42,95 @@ if /I "%1"=="zip" (
exit /b
)
echo %~nx0 [action]
echo %~nx0 [action] [switch]
echo build: Build the for both x86 and x64
echo /PROJECTONLY: Only create projects
echo.
echo zip: Make zip file
echo.
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 This should works for Visual Studio 2017+
:detect-visual-studio (
rem Who the hell on earth is still using a 32bit Windows in 2024
if "%ProgramFiles(x86)%"=="" (
set VSWHERE="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
) else (
set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
)
REM Check Meson
if exist %VSWHERE% (
REM get vcvarsall by using vswhere
set VSVARSALL=""
for /f "tokens=* usebackq" %%i in (`%VSWHERE% -find VC\Auxiliary\Build\vcvarsall.bat`) do set VSVARSALL="%%i"
) else (
REM fallback to old method
set VSVARSALL="%VS_INSTALLATION%\VC\Auxiliary\Build\vcvarsall.bat"
)
:check-vcvarsall
if /i %VSVARSALL%=="" (
echo Microsoft Visual C++ Component is not installed
echo Install it from Visual Studio Installer
exit /b 2
)
rem if a path is returned by vswhere, then it's sure that the result path exists
rem if path not exists than it was assumed from VS_INSTALLATION
if not exist %VSVARSALL% (
echo vsvarsall.bat not exists in VS_INSTALLATION,
echo either Visual C++ Component is not installed
echo or VS_INSTALLATION is wrong.
exit /b 1
)
exit /b 0
)
:detect-meson (
set MESON=""
for /f "tokens=* usebackq" %%i in (`where meson`) do set MESON="%%i"
if not exist %MESON% (
echo Meson is not Installed
goto end
exit /b 1
)
exit /b 0
)
:build (
:build_x64 (
call %VSVARALL% x64
call %VSVARSALL% x64
if exist %BUILD_DIR_64% (
%MESON% setup %BUILD_DIR_64% --backend vs --buildtype release --reconfigure
%MESON% setup %BUILD_DIR_64% --buildtype release --reconfigure
) else (
%MESON% setup %BUILD_DIR_64% --backend vs --buildtype release
)
if /I not "%1"=="/PROJECTONLY" (
pushd %BUILD_DIR_64%
msbuild /m /p:Configuration=release /p:Platform=x64 segatools.sln
msbuild /m /p:Configuration=release /p:Platform=x64 bananatools.sln
popd
)
)
:build_x86 (
call %VSVARALL% x86
call %VSVARSALL% x86
if exist %BUILD_DIR_32% (
%MESON% setup %BUILD_DIR_32% --backend vs --buildtype release --reconfigure
%MESON% setup %BUILD_DIR_32% --buildtype release --reconfigure
) else (
%MESON% setup %BUILD_DIR_32% --backend vs --buildtype release
)
if /I not "%1"=="/PROJECTONLY" (
pushd %BUILD_DIR_32%
msbuild /m /p:Configuration=release /p:Platform=Win32 segatools.sln
msbuild /m /p:Configuration=release /p:Platform=Win32 bananatools.sln
popd
)
)
:end (
endlocal
exit /b
)
)

View File

@ -129,7 +129,7 @@ static uint32_t (WINAPI *next_IcmpSendEcho)(
DWORD ReplySize,
DWORD Timeout);
static struct hostent* (*WSAAPI next_gethostbyname)(const char *name);
static struct hostent* (*next_gethostbyname)(const char *name);
static const struct hook_symbol netenv_hook_syms[] = {
{
@ -579,7 +579,7 @@ static uint32_t WINAPI hook_IcmpSendEcho(
return 1;
}
static struct hostent WSAAPI *my_gethostbyname(const char *name)
static struct hostent *WSAAPI my_gethostbyname(const char *name)
{
char my_hostname[256];
gethostname(my_hostname, 256);