diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9021357 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +# Set the default behavior. +* text=auto + +# Unix shell files should always be LF. +*.sh text eol=lf + +# Windows shell files should always be CRLF. +*.bat text eol=crlf + +# Binary files. +*.jpg binary +*.png binary + diff --git a/.gitignore b/.gitignore index 47acc83..788c645 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,18 @@ -.vs/* -.vscode/* -*.bin -*.o -net.pb.* -*steam_api* -release/* -/build*/ -*.obj -/dll/net.pb.cc -/dll/net.pb.h -base.exp -base.lib -rtlgenrandom* -steamclient.exp -steamclient.lib -out/* +.vs/* +.vscode/* +*.bin +*.o +net.pb.* +*steam_api* +release/* +debug/* +/build*/ +*.obj +/dll/net.pb.cc +/dll/net.pb.h +base.exp +base.lib +rtlgenrandom* +steamclient.exp +steamclient.lib +out/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c158841..1a7612e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,25 +59,33 @@ build_windows: image: fedora:35 script: - - dnf -y install wine wget p7zip sed dos2unix python + - dnf -y install wine wget p7zip sed dos2unix python cpio - unix2dos *.txt - unix2dos files_example/*.txt files_example/*/*.txt - sed -i 's/..\\vcpkg\\installed\\/.\\protobuf_/g' build_set_protobuf_directories.bat - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/48db8f434a193aae872279dc4f5dde6a/sdk_standalone.7z' - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/0119304e030098b4821d73170fe52084/protobuf_x64-windows-static.7z' - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/4185a97ab363ddc1859127e59ec68581/protobuf_x86-windows-static.7z' + # Ancient CI version of wine doesn't support the where.exe cmd. (It's a stub.) Use the version from wine-10.0. + - wget 'https://dl.fedoraproject.org/pub/fedora/linux/updates/41/Everything/x86_64/Packages/w/wine-core-10.0-1.fc41.i686.rpm' + - mkdir wine + - echo './usr/lib/wine/i386-windows/where.exe' > extract.txt; rpm2cpio wine-core-10.0-1.fc41.i686.rpm | cpio -ivdE extract.txt; rm -f extract.txt + - /usr/bin/mv -f ./usr/lib/wine/i386-windows/where.exe wine/; rm -rf ./usr/ + - /usr/bin/cp -f wine/where.exe /usr/lib/wine/i386-windows/where.exe; /usr/bin/cp -f wine/where.exe /usr/lib64/wine/x86_64-windows/where.exe - 7za x protobuf_x86-windows-static.7z -oprotobuf_x86-windows-static - 7za x protobuf_x64-windows-static.7z -oprotobuf_x64-windows-static - 7za x sdk_standalone.7z -osdk_standalone - - DLL_FILES="$(ls dll/*.cpp | tr "\n" " ")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat - - DLL_FILES="$(ls dll/*.proto | tr "\n" " " | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat - sed "s| /MP12 | /MP4 |g" -i *.bat - - python generate_build_win_bat.py + # CI can't produce PDBs. Throws a bunch of errors, and skips building the PEs. + - touch CI_BUILD.TAG - export WINEDEBUG=-all - - wine cmd /c build_win_release_test.bat + - WINEPATH=$PWD/wine wine cmd /c build_win_debug_experimental_steamclient.bat 8 + - WINEPATH=$PWD/wine wine cmd /c build_win_release.bat 8 + artifacts: paths: - release/ + - debug/ expire_in: 1 day build_cmake_linux: @@ -156,9 +164,9 @@ deploy_all: - mv linux release/ - shopt -s extglob - rm -rf .g* - - rm -rf !(release) - - mv release/* ./ - - rm -rf release + - rm -rf !(release|debug) +# - mv release/* ./ +# - rm -rf release - echo $CI_JOB_ID > job_id - tree artifacts: diff --git a/build_env_x64.bat b/build_env_x64.bat index 35b701b..21c181d 100755 --- a/build_env_x64.bat +++ b/build_env_x64.bat @@ -12,6 +12,8 @@ if exist "%VS_Base_Path%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Bu if exist "%VS_Base_Path%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" goto vs2022 if exist "%VS_Base_Path%\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" goto vs2022_bt if exist ".\sdk_standalone\set_vars64.bat" goto gitlabci +if exist "vsinstallloc.txt" goto readloc +if exist "%VS_Base_Path%\Microsoft Visual Studio\Installer\vswhere.exe" goto wherevs :vs2022 call "%VS_Base_Path%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" @@ -44,4 +46,14 @@ goto batend :gitlabci call ".\sdk_standalone\set_vars64.bat" goto batend + +:wherevs +call "%VS_Base_Path%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath > vsinstallloc.txt +goto readloc + +:readloc +set /p VS_LOCAL= vsinstallloc.txt +goto readloc + +:readloc +set /p VS_LOCAL= %CDS_DIR%\DEBUG_SC_DEPS_X86.LKS + +IF DEFINED SKIP_EXPERIMENTAL_BUILD GOTO LK_EXP_STEAMCLIENT_DLL_X86 + +REM Link Non-STEAMCLIENT_DLL debug steam_api.dll. +cd "%OLD_DIR%\build\experimental\debug\x86\" +IF EXIST %CDS_DIR%\DEBUG_STEAMAPI_NON_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_STEAMAPI_NON_X86.LKS ) +echo /link /OUT:%OLD_DIR%\debug\experimental\steam_api.dll > %CDS_DIR%\DEBUG_STEAMAPI_NON_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\experimental\steam_api.pdb >> %CDS_DIR%\DEBUG_STEAMAPI_NON_X86.LKS ) +cl /LD @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\PROTOBUF_X86.LKS @%CDS_DIR%\EXPERIMENTAL.BLD @%CDS_DIR%\EXPERIMENTAL.LKS @%CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS @%CDS_DIR%\DEBUG_SC_DEPS_X86.LKS @%CDS_DIR%\DEBUG_STEAMAPI_NON_X86.LKS + +:LK_EXP_STEAMCLIENT_DLL_X86 + +IF DEFINED SKIP_EXPERIMENTAL_STEAMCLIENT_BUILD GOTO LK_STEAMCLIENT_DLL_X86 + +REM Link STEAMCLIENT_DLL debug steamclient.dll +cd "%OLD_DIR%\build\experimental_steamclient\debug\x86" +IF EXIST %CDS_DIR%\DEBUG_STEAMCLIENT_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_STEAMCLIENT_X86.LKS ) +echo /link /OUT:%OLD_DIR%\debug\experimental_steamclient\steamclient.dll > %CDS_DIR%\DEBUG_STEAMCLIENT_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\experimental_steamclient\steamclient.pdb >> %CDS_DIR%\DEBUG_STEAMCLIENT_X86.LKS ) +cl /LD @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\PROTOBUF_X86.LKS @%CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS @%CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS @%CDS_DIR%\DEBUG_SC_DEPS_X86.LKS @%CDS_DIR%\DEBUG_STEAMCLIENT_X86.LKS + +:LK_STEAMCLIENT_DLL_X86 + +IF DEFINED SKIP_EXPERIMENTAL_BUILD GOTO LK_STEAMCLIENT_LOADER_X86 + +REM Link Non-STEAMCLIENT_DLL debug steamclient.dll. +cd "%OLD_DIR%\build\experimental\debug\x86\" +IF EXIST %CDS_DIR%\DEBUG_STEAMCLIENT_NON_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_STEAMCLIENT_NON_X86.LKS ) +echo /link /OUT:%OLD_DIR%\debug\experimental\steamclient.dll > %CDS_DIR%\DEBUG_STEAMCLIENT_NON_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\experimental\steamclient.pdb >> %CDS_DIR%\DEBUG_STEAMCLIENT_NON_X86.LKS ) +cl /LD @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\STEAMCLIENT.BLD @%CDS_DIR%\DEBUG_STEAMCLIENT_NON_X86.LKS + +:LK_STEAMCLIENT_LOADER_X86 + +IF DEFINED SKIP_STEAMCLIENT_LOADER GOTO LK_X64 + +REM Build steamclient_loader debug x86. +cd "%OLD_DIR%\build\experimental_steamclient\steamclient_loader\debug\x86" +cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\STEAMCLIENT_LOADER.BLD +IF EXIST %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X86.LKS ) +where "*.obj" > %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X86.LKS +echo /link /OUT:%OLD_DIR%\debug\experimental_steamclient\steamclient_loader_x32.exe >> %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\experimental_steamclient\steamclient_loader_x32.pdb >> %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X86.LKS ) +cl @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\STEAMCLIENT_LOADER.LKS @%CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X86.LKS +cd %OLD_DIR% + +:LK_X64 + +endlocal + +setlocal + +IF DEFINED SKIP_X64 GOTO LK_END + +"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x64.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /LD /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD /DEMU_OVERLAY /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steamclient64.dll + +REM Non-STEAMCLIENT_DLL debug sc_deps. +cd "%OLD_DIR%\build\experimental_steamclient\debug\x64\sc_deps" +cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\SC_DEPS.BLD +IF EXIST %CDS_DIR%\DEBUG_SC_DEPS_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_SC_DEPS_X64.LKS ) +where "*.obj" > %CDS_DIR%\DEBUG_SC_DEPS_X64.LKS + +IF DEFINED SKIP_EXPERIMENTAL_BUILD GOTO LK_EXP_STEAMCLIENT_DLL_X64 + +REM Link Non-STEAMCLIENT_DLL debug steam_api64.dll. +cd "%OLD_DIR%\build\experimental\debug\x64\" +IF EXIST %CDS_DIR%\DEBUG_STEAMAPI_NON_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_STEAMAPI_NON_X64.LKS ) +echo /link /OUT:%OLD_DIR%\debug\experimental\steam_api64.dll > %CDS_DIR%\DEBUG_STEAMAPI_NON_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\experimental\steam_api64.pdb >> %CDS_DIR%\DEBUG_STEAMAPI_NON_X64.LKS ) +cl /LD @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\PROTOBUF_X64.LKS @%CDS_DIR%\EXPERIMENTAL.BLD @%CDS_DIR%\EXPERIMENTAL.LKS @%CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS @%CDS_DIR%\DEBUG_SC_DEPS_X64.LKS @%CDS_DIR%\DEBUG_STEAMAPI_NON_X64.LKS + +:LK_EXP_STEAMCLIENT_DLL_X64 + +IF DEFINED SKIP_EXPERIMENTAL_STEAMCLIENT_BUILD GOTO LK_STEAMCLIENT_DLL_X64 + +REM Link STEAMCLIENT_DLL debug steamclient64.dll +cd "%OLD_DIR%\build\experimental_steamclient\debug\x64" +IF EXIST %CDS_DIR%\DEBUG_STEAMCLIENT_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_STEAMCLIENT_X64.LKS ) +echo /link /OUT:%OLD_DIR%\debug\experimental_steamclient\steamclient64.dll > %CDS_DIR%\DEBUG_STEAMCLIENT_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\experimental_steamclient\steamclient64.pdb >> %CDS_DIR%\DEBUG_STEAMCLIENT_X64.LKS ) +cl /LD @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\PROTOBUF_X64.LKS @%CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS @%CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS @%CDS_DIR%\DEBUG_SC_DEPS_X64.LKS @%CDS_DIR%\DEBUG_STEAMCLIENT_X64.LKS + +:LK_STEAMCLIENT_DLL_X64 + +IF DEFINED SKIP_EXPERIMENTAL_BUILD GOTO LK_STEAMCLIENT_LOADER_X64 + +REM Link Non-STEAMCLIENT_DLL debug steamclient64.dll. +cd "%OLD_DIR%\build\experimental\debug\x64\" +IF EXIST %CDS_DIR%\DEBUG_STEAMCLIENT_NON_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_STEAMCLIENT_NON_X64.LKS ) +echo /link /OUT:%OLD_DIR%\debug\experimental\steamclient64.dll > %CDS_DIR%\DEBUG_STEAMCLIENT_NON_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\experimental\steamclient64.pdb >> %CDS_DIR%\DEBUG_STEAMCLIENT_NON_X64.LKS ) +cl /LD @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\STEAMCLIENT.BLD @%CDS_DIR%\DEBUG_STEAMCLIENT_NON_X64.LKS + +:LK_STEAMCLIENT_LOADER_X64 + +IF DEFINED SKIP_STEAMCLIENT_LOADER GOTO LK_END + +REM Build steamclient_loader debug x64. +cd "%OLD_DIR%\build\experimental_steamclient\steamclient_loader\debug\x64" +cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\STEAMCLIENT_LOADER.BLD +IF EXIST %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X64.LKS ) +where "*.obj" > %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X64.LKS +echo /link /OUT:%OLD_DIR%\debug\experimental_steamclient\steamclient_loader_x64.exe >> %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\experimental_steamclient\steamclient_loader_x64.pdb >> %CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X64.LKS ) +cl @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\STEAMCLIENT_LOADER.LKS @%CDS_DIR%\DEBUG_STEAMCLIENT_LOADER_X64.LKS +cd %OLD_DIR% + +:LK_END + +endlocal + +copy Readme_experimental.txt debug\experimental\Readme.txt +copy steamclient_loader\ColdClientLoader.ini debug\experimental_steamclient\ +copy Readme_experimental_steamclient.txt debug\experimental_steamclient\Readme.txt diff --git a/build_win_debug_lobby_connect.bat b/build_win_debug_lobby_connect.bat new file mode 100644 index 0000000..4bb67f1 --- /dev/null +++ b/build_win_debug_lobby_connect.bat @@ -0,0 +1,48 @@ +@echo off +cd /d "%~dp0" + +SET OLD_DIR=%cd% + +IF NOT "%1" == "" ( SET JOB_COUNT=%~1 ) + +IF NOT DEFINED BUILT_ALL_DEPS ( call generate_all_deps.bat ) + +IF EXIST build\debug\lobby_connect\x86\*.* ( DEL /F /S /Q build\debug\lobby_connect\x86\*.* ) +IF EXIST build\debug\lobby_connect\x64\*.* ( DEL /F /S /Q build\debug\lobby_connect\x64\*.* ) + +IF EXIST debug\lobby_connect\*.* ( DEL /F /S /Q debug\lobby_connect\*.* ) + +setlocal +"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto +call build_env_x86.bat +cd %OLD_DIR%\build\lobby_connect\debug\x86 +cl @%CDS_DIR%\RTLGENRANDOM.BLD + +cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD +IF EXIST %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS ) +where "*.obj" > %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS +echo /link /OUT:%OLD_DIR%\debug\lobby_connect\lobby_connect_x32.exe >> %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS +echo /link /IMPLIB:%cd%\lobby_connect_x32.lib >> %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\lobby_connect\lobby_connect_x32.pdb >> %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS ) + +cl @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\PROTOBUF_X86.LKS @%CDS_DIR%\LOBBY_CONNECT.LKS @%CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS +cd %OLD_DIR% +endlocal + +setlocal +"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto +call build_env_x64.bat +cd %OLD_DIR%\build\lobby_connect\debug\x64 +cl @%CDS_DIR%\RTLGENRANDOM.BLD + +cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD +IF EXIST %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS ) +where "*.obj" > %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS +echo /link /OUT:%OLD_DIR%\debug\lobby_connect\lobby_connect_x64.exe >> %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS +echo /link /IMPLIB:%cd%\lobby_connect_x64.lib >> %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\debug\lobby_connect\lobby_connect_x64.pdb >> %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS ) + +cl @%CDS_DIR%\DEBUG.LKS @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\PROTOBUF_X64.LKS @%CDS_DIR%\LOBBY_CONNECT.LKS @%CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS +cd %OLD_DIR% +endlocal +copy Readme_lobby_connect.txt debug\lobby_connect\Readme.txt diff --git a/build_win_find_interfaces.bat b/build_win_find_interfaces.bat index cb1cb48..36f834e 100755 --- a/build_win_find_interfaces.bat +++ b/build_win_find_interfaces.bat @@ -1,9 +1,39 @@ @echo off cd /d "%~dp0" -mkdir release\tools -del /Q release\tools\* + +SET OLD_DIR=%cd% + +IF NOT "%1" == "" ( SET JOB_COUNT=%~1 ) + +IF NOT DEFINED BUILT_ALL_DEPS ( call generate_all_deps.bat ) + +IF EXIST build\release\tools\x86\*.* ( DEL /F /S /Q build\release\tools\x86\*.* ) +IF EXIST build\release\tools\x64\*.* ( DEL /F /S /Q build\release\tools\x64\*.* ) + +IF EXIST release\tools\*.* ( DEL /F /S /Q release\tools\*.* ) + +setlocal call build_env_x86.bat -cl generate_interfaces_file.cpp /EHsc /MP12 /Ox /link /debug:none /OUT:release\tools\generate_interfaces_file.exe -del /Q /S release\tools\*.lib -del /Q /S release\tools\*.exp +cd %OLD_DIR%\build\release\tools\x86 +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\GENERATE_INTERFACES_FILE.BLD +IF EXIST %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X86.LKS ) +where "generate_interfaces_file.obj" > %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X86.LKS +echo /link /OUT:%OLD_DIR%\release\tools\generate_interfaces_file_x32.exe >> %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\tools\generate_interfaces_file_x32.pdb >> %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X86.LKS ) +cl @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\GENERATE_INTERFACES_FILE.LKS @%CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X86.LKS +cd %OLD_DIR% +endlocal + +setlocal +call build_env_x64.bat +cd %OLD_DIR%\build\release\tools\x64 +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\GENERATE_INTERFACES_FILE.BLD +IF EXIST %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X64.LKS ) +where "generate_interfaces_file.obj" > %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X64.LKS +echo /link /OUT:%OLD_DIR%\release\tools\generate_interfaces_file_x64.exe >> %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\tools\generate_interfaces_file_x64.pdb >> %CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X64.LKS ) +cl @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\GENERATE_INTERFACES_FILE.LKS @%CDS_DIR%\RELEASE_GENERATE_INTERFACES_FILE_X64.LKS +cd %OLD_DIR% +endlocal + copy Readme_generate_interfaces.txt release\tools\Readme_generate_interfaces.txt diff --git a/build_win_lobby_connect.bat b/build_win_lobby_connect.bat index 27c83e5..d3dd8b1 100755 --- a/build_win_lobby_connect.bat +++ b/build_win_lobby_connect.bat @@ -1,12 +1,48 @@ @echo off cd /d "%~dp0" -mkdir release\lobby_connect -del /Q release\lobby_connect\* -call build_set_protobuf_directories.bat + +SET OLD_DIR=%cd% + +IF NOT "%1" == "" ( SET JOB_COUNT=%~1 ) + +IF NOT DEFINED BUILT_ALL_DEPS ( call generate_all_deps.bat ) + +IF EXIST build\release\lobby_connect\x86\*.* ( DEL /F /S /Q build\release\lobby_connect\x86\*.* ) +IF EXIST build\release\lobby_connect\x64\*.* ( DEL /F /S /Q build\release\lobby_connect\x64\*.* ) + +IF EXIST release\lobby_connect\*.* ( DEL /F /S /Q release\lobby_connect\*.* ) + +setlocal "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x86.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /DNO_DISK_WRITES /DLOBBY_CONNECT /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ lobby_connect.cpp dll/*.cpp dll/*.cc "%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Comdlg32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\lobby_connect\lobby_connect.exe -del /Q /S release\lobby_connect\*.lib -del /Q /S release\lobby_connect\*.exp +cd %OLD_DIR%\build\lobby_connect\release\x86 +cl @%CDS_DIR%\RTLGENRANDOM.BLD + +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD +IF EXIST %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS +echo /link /OUT:%OLD_DIR%\release\lobby_connect\lobby_connect_x32.exe >> %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS +echo /link /IMPLIB:%cd%\lobby_connect_x32.lib >> %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\lobby_connect\lobby_connect_x32.pdb >> %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS ) + +cl @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\PROTOBUF_X86.LKS @%CDS_DIR%\LOBBY_CONNECT.LKS @%CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS +cd %OLD_DIR% +endlocal + +setlocal +"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto +call build_env_x64.bat +cd %OLD_DIR%\build\lobby_connect\release\x64 +cl @%CDS_DIR%\RTLGENRANDOM.BLD + +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD +IF EXIST %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS +echo /link /OUT:%OLD_DIR%\release\lobby_connect\lobby_connect_x64.exe >> %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS +echo /link /IMPLIB:%cd%\lobby_connect_x64.lib >> %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\lobby_connect\lobby_connect_x64.pdb >> %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS ) + +cl @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\PROTOBUF_X64.LKS @%CDS_DIR%\LOBBY_CONNECT.LKS @%CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS +cd %OLD_DIR% +endlocal copy Readme_lobby_connect.txt release\lobby_connect\Readme.txt diff --git a/build_win_release.bat b/build_win_release.bat index 79e7804..dba8b04 100755 --- a/build_win_release.bat +++ b/build_win_release.bat @@ -1,24 +1,53 @@ @echo off cd /d "%~dp0" -del /Q /S release\* -rmdir /S /Q release\experimental -rmdir /S /Q release\experimental_steamclient -rmdir /S /Q release\lobby_connect -rmdir /S /Q release -mkdir release -call build_set_protobuf_directories.bat + +SET OLD_DIR=%cd% + +IF NOT "%1" == "" ( SET JOB_COUNT=%~1 ) + +IF NOT DEFINED BUILT_ALL_DEPS ( call generate_all_deps.bat ) + +IF EXIST build\release\x86\*.* ( DEL /F /S /Q build\release\x86\*.* ) +IF EXIST build\release\x64\*.* ( DEL /F /S /Q build\release\x64\*.* ) + +IF EXIST release\steam_settings.EXAMPLE ( DEL /F /S /Q release\steam_settings.EXAMPLE ) +IF EXIST release\*.dll ( DEL /F /Q release\*.dll ) +IF EXIST release\*.txt ( DEL /F /Q release\*.txt ) + +setlocal "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x86.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc "%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\steam_api.dll +cd %OLD_DIR%\build\release\x86 +cl @%CDS_DIR%\RTLGENRANDOM.BLD +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\DLL_MAIN_CPP.BLD +IF EXIST %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS +echo /link /OUT:%OLD_DIR%\release\steam_api.dll >> %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\steam_api.pdb >> %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS ) + +cl /LD @%CDS_DIR%/RELEASE.LKS @%CDS_DIR%/PROTOBUF_X86.LKS @%CDS_DIR%/DLL_MAIN_CPP.LKS @%CDS_DIR%\RELEASE_BASE_DLL_X86.LKS +cd %OLD_DIR% +endlocal + +setlocal "%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x64.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc "%PROTOBUF_X64_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\steam_api64.dll +cd %OLD_DIR%\build\release\x64 +cl @%CDS_DIR%\RTLGENRANDOM.BLD + +cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%/DLL_MAIN_CPP.BLD +IF EXIST %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS +echo /link /OUT:%OLD_DIR%\release\steam_api64.dll >> %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\steam_api64.pdb >> %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS ) + +cl /LD @%CDS_DIR%/RELEASE.LKS @%CDS_DIR%/PROTOBUF_X64.LKS @%CDS_DIR%/DLL_MAIN_CPP.LKS @%CDS_DIR%\RELEASE_BASE_DLL_X64.LKS +cd %OLD_DIR% + +endlocal copy Readme_release.txt release\Readme.txt xcopy /s files_example\* release\ -call build_win_release_experimental.bat call build_win_release_experimental_steamclient.bat call build_win_lobby_connect.bat call build_win_find_interfaces.bat diff --git a/build_win_release_experimental.bat b/build_win_release_experimental.bat index 5c3ff84..faa8230 100755 --- a/build_win_release_experimental.bat +++ b/build_win_release_experimental.bat @@ -1,17 +1,9 @@ @echo off cd /d "%~dp0" -mkdir release\experimental -del /Q release\experimental\* -call build_set_protobuf_directories.bat -"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto -call build_env_x86.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /IImGui /I%PROTOBUF_X86_DIRECTORY%\include\ /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api.dll -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG steamclient.cpp /EHsc /MP4 /Ox /link /OUT:release\experimental\steamclient.dll -"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto -call build_env_x64.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api64.dll -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG steamclient.cpp /EHsc /MP4 /Ox /link /OUT:release\experimental\steamclient64.dll -copy Readme_experimental.txt release\experimental\Readme.txt +IF NOT "%1" == "" ( SET JOB_COUNT=%~1 ) + +SET SKIP_EXPERIMENTAL_STEAMCLIENT_BUILD=1 +SET SKIP_STEAMCLIENT_LOADER=1 + +call build_win_release_experimental_steamclient.bat diff --git a/build_win_release_experimental_steamclient.bat b/build_win_release_experimental_steamclient.bat index cd55557..800c195 100644 --- a/build_win_release_experimental_steamclient.bat +++ b/build_win_release_experimental_steamclient.bat @@ -1,16 +1,141 @@ @echo off cd /d "%~dp0" -mkdir release\experimental_steamclient -del /Q release\experimental_steamclient\* -call build_set_protobuf_directories.bat + +SET OLD_DIR=%cd% + +IF NOT "%1" == "" ( SET JOB_COUNT=%~1 ) + +IF NOT DEFINED BUILT_ALL_DEPS ( call generate_all_deps.bat ) + +IF EXIST build\experimental\steamclient\release\x86\*.* ( DEL /F /S /Q build\experimental\steamclient\release\x86\*.* ) +IF EXIST build\experimental\steamclient\release\x64\*.* ( DEL /F /S /Q build\experimental\steamclient\release\x64\*.* ) + +IF EXIST release\experimental_steamclient\*.* ( DEL /F /S /Q release\experimental_steamclient\*.* ) + +setlocal + +IF DEFINED SKIP_X86 GOTO LK_X64 + "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x86.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /IImGui /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient.dll + +REM Non-STEAMCLIENT_DLL release sc_deps. +cd "%OLD_DIR%\build\experimental_steamclient\release\x86\sc_deps" +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\SC_DEPS.BLD +IF EXIST %CDS_DIR%\RELEASE_SC_DEPS_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_SC_DEPS_X86.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_SC_DEPS_X86.LKS + +IF DEFINED SKIP_EXPERIMENTAL_BUILD GOTO LK_EXP_STEAMCLIENT_DLL_X86 + +REM Link Non-STEAMCLIENT_DLL release steam_api.dll. +cd "%OLD_DIR%\build\experimental\release\x86\" +IF EXIST %CDS_DIR%\RELEASE_STEAMAPI_NON_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_STEAMAPI_NON_X86.LKS ) +echo /link /OUT:%OLD_DIR%\release\experimental\steam_api.dll > %CDS_DIR%\RELEASE_STEAMAPI_NON_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\experimental\steam_api.pdb >> %CDS_DIR%\RELEASE_STEAMAPI_NON_X86.LKS ) +cl /LD @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\PROTOBUF_X86.LKS @%CDS_DIR%\EXPERIMENTAL.BLD @%CDS_DIR%\EXPERIMENTAL.LKS @%CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS @%CDS_DIR%\RELEASE_SC_DEPS_X86.LKS @%CDS_DIR%\RELEASE_STEAMAPI_NON_X86.LKS + +:LK_EXP_STEAMCLIENT_DLL_X86 + +IF DEFINED SKIP_EXPERIMENTAL_STEAMCLIENT_BUILD GOTO LK_STEAMCLIENT_DLL_X86 + +REM Link STEAMCLIENT_DLL release steamclient.dll +cd "%OLD_DIR%\build\experimental_steamclient\release\x86" +IF EXIST %CDS_DIR%\RELEASE_STEAMCLIENT_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_STEAMCLIENT_X86.LKS ) +echo /link /OUT:%OLD_DIR%\release\experimental_steamclient\steamclient.dll > %CDS_DIR%\RELEASE_STEAMCLIENT_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\experimental_steamclient\steamclient.pdb >> %CDS_DIR%\RELEASE_STEAMCLIENT_X86.LKS ) +cl /LD @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\PROTOBUF_X86.LKS @%CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS @%CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS @%CDS_DIR%\RELEASE_SC_DEPS_X86.LKS @%CDS_DIR%\RELEASE_STEAMCLIENT_X86.LKS + +:LK_STEAMCLIENT_DLL_X86 + +IF DEFINED SKIP_EXPERIMENTAL_BUILD GOTO LK_STEAMCLIENT_LOADER_X86 + +REM Link Non-STEAMCLIENT_DLL release steamclient.dll. +cd "%OLD_DIR%\build\experimental\release\x86\" +IF EXIST %CDS_DIR%\RELEASE_STEAMCLIENT_NON_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_STEAMCLIENT_NON_X86.LKS ) +echo /link /OUT:%OLD_DIR%\release\experimental\steamclient.dll > %CDS_DIR%\RELEASE_STEAMCLIENT_NON_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\experimental\steamclient.pdb >> %CDS_DIR%\RELEASE_STEAMCLIENT_NON_X86.LKS ) +cl /LD @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\STEAMCLIENT.BLD @%CDS_DIR%\RELEASE_STEAMCLIENT_NON_X86.LKS + +:LK_STEAMCLIENT_LOADER_X86 + +IF DEFINED SKIP_STEAMCLIENT_LOADER GOTO LK_X64 + +REM Build steamclient_loader release x86. +cd "%OLD_DIR%\build\experimental_steamclient\steamclient_loader\release\x86" +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\STEAMCLIENT_LOADER.BLD +IF EXIST %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X86.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X86.LKS +echo /link /OUT:%OLD_DIR%\release\experimental_steamclient\steamclient_loader_x32.exe >> %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X86.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\experimental_steamclient\steamclient_loader_x32.pdb >> %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X86.LKS ) +cl @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\STEAMCLIENT_LOADER.LKS @%CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X86.LKS +cd %OLD_DIR% + +:LK_X64 + +endlocal + +setlocal + +IF DEFINED SKIP_X64 GOTO LK_END + "%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto -cl steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient_loader.exe -copy steamclient_loader\ColdClientLoader.ini release\experimental_steamclient\ call build_env_x64.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /IImGui /DNDEBUG /I%PROTOBUF_X64_DIRECTORY%\include\ /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient64.dll + +REM Non-STEAMCLIENT_DLL release sc_deps. +cd "%OLD_DIR%\build\experimental_steamclient\release\x64\sc_deps" +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\SC_DEPS.BLD +IF EXIST %CDS_DIR%\RELEASE_SC_DEPS_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_SC_DEPS_X64.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_SC_DEPS_X64.LKS + +IF DEFINED SKIP_EXPERIMENTAL_BUILD GOTO LK_EXP_STEAMCLIENT_DLL_X64 + +REM Link Non-STEAMCLIENT_DLL release steam_api64.dll. +cd "%OLD_DIR%\build\experimental\release\x64\" +IF EXIST %CDS_DIR%\RELEASE_STEAMAPI_NON_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_STEAMAPI_NON_X64.LKS ) +echo /link /OUT:%OLD_DIR%\release\experimental\steam_api64.dll > %CDS_DIR%\RELEASE_STEAMAPI_NON_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\experimental\steam_api64.pdb >> %CDS_DIR%\RELEASE_STEAMAPI_NON_X64.LKS ) +cl /LD @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\PROTOBUF_X64.LKS @%CDS_DIR%\EXPERIMENTAL.BLD @%CDS_DIR%\EXPERIMENTAL.LKS @%CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS @%CDS_DIR%\RELEASE_SC_DEPS_X64.LKS @%CDS_DIR%\RELEASE_STEAMAPI_NON_X64.LKS + +:LK_EXP_STEAMCLIENT_DLL_X64 + +IF DEFINED SKIP_EXPERIMENTAL_STEAMCLIENT_BUILD GOTO LK_STEAMCLIENT_DLL_X64 + +REM Link STEAMCLIENT_DLL release steamclient64.dll +cd "%OLD_DIR%\build\experimental_steamclient\release\x64" +IF EXIST %CDS_DIR%\RELEASE_STEAMCLIENT_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_STEAMCLIENT_X64.LKS ) +echo /link /OUT:%OLD_DIR%\release\experimental_steamclient\steamclient64.dll > %CDS_DIR%\RELEASE_STEAMCLIENT_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\experimental_steamclient\steamclient64.pdb >> %CDS_DIR%\RELEASE_STEAMCLIENT_X64.LKS ) +cl /LD @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\PROTOBUF_X64.LKS @%CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS @%CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS @%CDS_DIR%\RELEASE_SC_DEPS_X64.LKS @%CDS_DIR%\RELEASE_STEAMCLIENT_X64.LKS + +:LK_STEAMCLIENT_DLL_X64 + +IF DEFINED SKIP_EXPERIMENTAL_BUILD GOTO LK_STEAMCLIENT_LOADER_X64 + +REM Link Non-STEAMCLIENT_DLL release steamclient64.dll. +cd "%OLD_DIR%\build\experimental\release\x64\" +IF EXIST %CDS_DIR%\RELEASE_STEAMCLIENT_NON_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_STEAMCLIENT_NON_X64.LKS ) +echo /link /OUT:%OLD_DIR%\release\experimental\steamclient64.dll > %CDS_DIR%\RELEASE_STEAMCLIENT_NON_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\experimental\steamclient64.pdb >> %CDS_DIR%\RELEASE_STEAMCLIENT_NON_X64.LKS ) +cl /LD @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\STEAMCLIENT.BLD @%CDS_DIR%\RELEASE_STEAMCLIENT_NON_X64.LKS + +:LK_STEAMCLIENT_LOADER_X64 + +IF DEFINED SKIP_STEAMCLIENT_LOADER GOTO LK_END + +REM Build steamclient_loader release x64. +cd "%OLD_DIR%\build\experimental_steamclient\steamclient_loader\release\x64" +cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\STEAMCLIENT_LOADER.BLD +IF EXIST %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X64.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X64.LKS +echo /link /OUT:%OLD_DIR%\release\experimental_steamclient\steamclient_loader_x64.exe >> %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X64.LKS +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /PDB:%OLD_DIR%\release\experimental_steamclient\steamclient_loader_x64.pdb >> %CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X64.LKS ) +cl @%CDS_DIR%\RELEASE.LKS @%CDS_DIR%\STEAMCLIENT_LOADER.LKS @%CDS_DIR%\RELEASE_STEAMCLIENT_LOADER_X64.LKS +cd %OLD_DIR% + +:LK_END + +endlocal + +copy Readme_experimental.txt release\experimental\Readme.txt +copy steamclient_loader\ColdClientLoader.ini release\experimental_steamclient\ copy Readme_experimental_steamclient.txt release\experimental_steamclient\Readme.txt diff --git a/dll/common_includes.h b/dll/common_includes.h index 5de14c4..3b43545 100644 --- a/dll/common_includes.h +++ b/dll/common_includes.h @@ -112,7 +112,6 @@ inline void reset_LastError() #include #include #include - #include #include #include @@ -205,4 +204,4 @@ inline std::string ascii_to_lowercase(std::string data) { #define LOBBY_CONNECT_APPID ((uint32)-2) -#endif//__INCLUDED_COMMON_INCLUDES__ \ No newline at end of file +#endif//__INCLUDED_COMMON_INCLUDES__ diff --git a/dll/settings.h b/dll/settings.h index a7b2aa9..aeb8b49 100644 --- a/dll/settings.h +++ b/dll/settings.h @@ -132,6 +132,9 @@ public: //custom broadcasts std::set custom_broadcasts; + //custom master server + std::set custom_master_server; + //stats std::map getStats() { return stats; } void setStatDefiniton(std::string name, struct Stat_config stat_config) {stats[ascii_to_lowercase(name)] = stat_config; } diff --git a/dll/settings_parser.cpp b/dll/settings_parser.cpp index 22dad2e..ef34316 100644 --- a/dll/settings_parser.cpp +++ b/dll/settings_parser.cpp @@ -211,6 +211,11 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s load_custom_broadcasts(local_storage->get_global_settings_path() + "custom_broadcasts.txt", custom_broadcasts); load_custom_broadcasts(Local_Storage::get_game_settings_path() + "custom_broadcasts.txt", custom_broadcasts); + // Custom master server + std::set custom_master_server; + load_custom_broadcasts(local_storage->get_global_settings_path() + "custom_master_server.txt", custom_master_server); + load_custom_broadcasts(Local_Storage::get_game_settings_path() + "custom_master_server.txt", custom_master_server); + // Acount name char name[32] = {}; if (local_storage->get_data_settings("account_name.txt", name, sizeof(name) - 1) <= 0) { @@ -359,6 +364,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s settings_server->set_port(port); settings_client->custom_broadcasts = custom_broadcasts; settings_server->custom_broadcasts = custom_broadcasts; + settings_client->custom_master_server = custom_master_server; + settings_server->custom_master_server = custom_master_server; settings_client->disable_networking = disable_networking; settings_server->disable_networking = disable_networking; settings_client->disable_overlay = disable_overlay; diff --git a/dll/steam_client.cpp b/dll/steam_client.cpp index 17af33e..101d089 100644 --- a/dll/steam_client.cpp +++ b/dll/steam_client.cpp @@ -81,6 +81,7 @@ Steam_Client::Steam_Client() steam_remote_storage = new Steam_Remote_Storage(settings_client, local_storage, callback_results_client); steam_screenshots = new Steam_Screenshots(local_storage, callbacks_client); steam_http = new Steam_HTTP(settings_client, network, callback_results_client, callbacks_client); + steam_unified_messages = new Steam_Unified_Messages(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); steam_controller = new Steam_Controller(settings_client, callback_results_client, callbacks_client, run_every_runcb); steam_ugc = new Steam_UGC(settings_client, callback_results_client, callbacks_client); steam_applist = new Steam_Applist(); @@ -95,7 +96,6 @@ Steam_Client::Steam_Client() steam_networking_messages = new Steam_Networking_Messages(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); steam_game_coordinator = new Steam_Game_Coordinator(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); steam_networking_utils = new Steam_Networking_Utils(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); - steam_unified_messages = new Steam_Unified_Messages(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); steam_game_search = new Steam_Game_Search(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); steam_parties = new Steam_Parties(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); steam_remoteplay = new Steam_RemotePlay(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); diff --git a/dll/steam_client.h b/dll/steam_client.h index d00cb6a..37c4a85 100644 --- a/dll/steam_client.h +++ b/dll/steam_client.h @@ -75,6 +75,7 @@ public ISteamClient018, public ISteamClient019, public ISteamClient { +// Some games (SAO:FB) use pointer math to access the class so member order is important. public: Networking *network; SteamCallResults *callback_results_server, *callback_results_client; @@ -94,6 +95,7 @@ public: Steam_Remote_Storage *steam_remote_storage; Steam_Screenshots *steam_screenshots; Steam_HTTP *steam_http; + Steam_Unified_Messages *steam_unified_messages; Steam_Controller *steam_controller; Steam_UGC *steam_ugc; Steam_Applist *steam_applist; @@ -108,7 +110,6 @@ public: Steam_Networking_Messages *steam_networking_messages; Steam_Game_Coordinator *steam_game_coordinator; Steam_Networking_Utils *steam_networking_utils; - Steam_Unified_Messages *steam_unified_messages; Steam_Game_Search *steam_game_search; Steam_Parties *steam_parties; Steam_RemotePlay *steam_remoteplay; diff --git a/dll/steam_masterserver_updater.h b/dll/steam_masterserver_updater.h index d55e63e..d17ccd8 100644 --- a/dll/steam_masterserver_updater.h +++ b/dll/steam_masterserver_updater.h @@ -173,12 +173,64 @@ void ForceHeartbeat() bool AddMasterServer( const char *pServerAddress ) { PRINT_DEBUG("Steam_Masterserver_Updater::AddMasterServer\n"); + + IP_PORT addr; + + if (pServerAddress) + { + addr.ip = (uint32)*pServerAddress; + if (pServerAddress[(sizeof(uint32))] != 0) + { + addr.port = (uint16)*(pServerAddress + sizeof(uint32)); + } + else + { + addr.port = 27016; + } + PRINT_DEBUG("Steam_Masterserver_Updater::AddMasterServer pServerAddress IP: %d, PORT: %d", addr.ip, addr.port); + this->settings->custom_master_server.insert(addr); + } + return true; } bool RemoveMasterServer( const char *pServerAddress ) { PRINT_DEBUG("Steam_Masterserver_Updater::RemoveMasterServer\n"); + + std::set::iterator iter; + IP_PORT addr; + IP_PORT list; + + if (pServerAddress) + { + addr.ip = (uint32)*pServerAddress; + if (pServerAddress[(sizeof(uint32))] != 0) + { + addr.port = (uint16)*(pServerAddress + sizeof(uint32)); + } + else + { + addr.port = 27016; + } + PRINT_DEBUG("Steam_Masterserver_Updater::RemoveMasterServer pServerAddress IP: %d, PORT: %d", addr.ip, addr.port); + + iter = this->settings->custom_master_server.begin(); + while (iter != this->settings->custom_master_server.end()) + { + list = (*iter); + if (addr.ip == list.ip && + (addr.port == list.port || (list.port == 0 && addr.port == 27016))) + { + iter = this->settings->custom_master_server.erase(iter); + } + else + { + iter++; + } + } + } + return true; } @@ -186,7 +238,7 @@ bool RemoveMasterServer( const char *pServerAddress ) int GetNumMasterServers() { PRINT_DEBUG("Steam_Masterserver_Updater::GetNumMasterServers\n"); - return 0; + return this->settings->custom_master_server.size(); } @@ -194,7 +246,38 @@ int GetNumMasterServers() int GetMasterServerAddress( int iServer, char *pOut, int outBufferSize ) { PRINT_DEBUG("Steam_Masterserver_Updater::GetMasterServerAddress\n"); - return 0; + + size_t written_bytes = 0; + char * byte_cpy = NULL; + std::set::iterator iter; + IP_PORT addr; + + if (pOut && outBufferSize >= sizeof(uint32) && this->settings->custom_master_server.size() > 0) + { + iter = this->settings->custom_master_server.begin(); + while (written_bytes < outBufferSize && iter != this->settings->custom_master_server.end()) + { + addr = (*iter); + byte_cpy = (char*)&(addr.ip); + for (size_t x = 0; x < sizeof(addr.ip) && written_bytes < outBufferSize; x++) + { + memcpy(pOut + x, byte_cpy + x, 1); + written_bytes++; + } + if (addr.port != 0 && addr.port != 27016) // Default updater port. + { + byte_cpy = (char*)&(addr.port); + for (size_t x = 0; x < sizeof(addr.port) && written_bytes < outBufferSize; x++) + { + memcpy(pOut + x, byte_cpy + x, 1); + written_bytes++; + } + } + iter++; + } + } + + return written_bytes; } diff --git a/dll/steam_remoteplay.cpp b/dll/steam_remoteplay.cpp new file mode 100644 index 0000000..c182b76 --- /dev/null +++ b/dll/steam_remoteplay.cpp @@ -0,0 +1,202 @@ +/* Copyright (C) 2019 Mr Goldberg + This file is part of the Goldberg Emulator + + The Goldberg Emulator is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The Goldberg Emulator is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the Goldberg Emulator; if not, see + . */ + +#include "steam_remoteplay.h" +#include +#include + +typedef struct remote_play_session_info_T { + RemotePlaySessionID_t session_id; + CSteamID connected_user; + const char * client_name; + ESteamDeviceFormFactor client_form_factor; + int client_resolution_x; + int client_resolution_y; +} remote_play_session_info; +//TODO: NOT thread safe!!! +static std::vector remote_play_sessions; + +int create_remote_play_session_info( RemotePlaySessionID_t session_id, CSteamID connected_user, const char * client_name, ESteamDeviceFormFactor client_form_factor, int client_resolution_x, int client_resolution_y ) { + remote_play_session_info session_info; + size_t buffer_length = 0; + char * buffer = NULL; + + if ((remote_play_sessions.size() < UINT_MAX) && (client_name != NULL)) { + session_info.session_id = session_id; + session_info.connected_user = connected_user; + session_info.client_form_factor = client_form_factor; + session_info.client_resolution_x = client_resolution_x; + session_info.client_resolution_y = client_resolution_y; + + buffer_length = strlen( client_name ); + if (buffer_length > 0) { + buffer = new char[buffer_length + 1]; + if (buffer != NULL) { + memcpy(buffer, client_name, buffer_length); + session_info.client_name = buffer; + remote_play_sessions.push_back( (const remote_play_session_info)session_info ); + return 0; + } + } + } + return -1; +} + +int destroy_remote_play_session_info( size_t index ) { + if (remote_play_sessions.size() < index) { + delete remote_play_sessions[index].client_name; + remote_play_sessions.erase(remote_play_sessions.begin() + index); + return 0; + } + return -1; +} + +uint32 get_number_of_remote_play_sessions() { + return (uint32)remote_play_sessions.size(); +} + +int get_remote_play_session_id( size_t index, RemotePlaySessionID_t * session_id ) { + if ((session_id != NULL) && (index >= 0) && (remote_play_sessions.size() < index)) { + *session_id = remote_play_sessions[index].session_id; + return 0; + } + return -1; +} + +int get_remote_play_session_index( RemotePlaySessionID_t session_id, size_t * index ) { + size_t count = 0; + + if ((index != NULL) && (remote_play_sessions.size() > 0)) { + for (std::vector::iterator iter = remote_play_sessions.begin(); iter != remote_play_sessions.end(); iter++) { + if (iter->session_id == session_id) { + *index = count; + return 0; + } + count++; + } + } + return -1; +} + +int get_remote_play_session_connected_user( size_t index, CSteamID * connected_user ) { + if ((connected_user != NULL) && (index >= 0) && (remote_play_sessions.size() < index)) { + *connected_user = remote_play_sessions[index].connected_user; + return 0; + } + return -1; +} + +int get_remote_play_session_client_name( size_t index, const char ** client_name ) { + if ((client_name != NULL) && (index >= 0) && (remote_play_sessions.size() < index)) { + *client_name = remote_play_sessions[index].client_name; + return 0; + } + return -1; +} + +int get_remote_play_session_client_form_factor( size_t index, ESteamDeviceFormFactor * client_form_factor ) { + if ((client_form_factor != NULL) && (index >= 0) && (remote_play_sessions.size() < index)) { + *client_form_factor = remote_play_sessions[index].client_form_factor; + return 0; + } + return -1; +} + +int get_remote_play_session_client_resolutions( size_t index, int * client_resolution_x, int * client_resolution_y ) { + if ((client_resolution_x != NULL) && (client_resolution_y != NULL) && (index >= 0) && (remote_play_sessions.size() < index)) { + *client_resolution_x = remote_play_sessions[index].client_resolution_x; + *client_resolution_y = remote_play_sessions[index].client_resolution_y; + return 0; + } + return -1; +} + +uint32 Steam_RemotePlay::GetSessionCount() +{ + PRINT_DEBUG("Steam_RemotePlay::GetSessionCount\n"); + return get_number_of_remote_play_sessions(); +} + +uint32 Steam_RemotePlay::GetSessionID( int iSessionIndex ) +{ + RemotePlaySessionID_t session_id; + + PRINT_DEBUG("Steam_RemotePlay::GetSessionID\n"); + return ((get_remote_play_session_id( iSessionIndex, &session_id ) == 0) ? (session_id) : (0)); +} + +CSteamID Steam_RemotePlay::GetSessionSteamID( uint32 unSessionID ) +{ + CSteamID steam_id = k_steamIDNil; + size_t index = 0; + + PRINT_DEBUG("Steam_RemotePlay::GetSessionSteamID\n"); + if (get_remote_play_session_index( unSessionID, &index ) == 0) { + if (get_remote_play_session_connected_user( index, &steam_id ) == 0) { + return steam_id; + } + } + return k_steamIDNil; +} + +const char * Steam_RemotePlay::GetSessionClientName( uint32 unSessionID ) +{ + const char * client_name = NULL; + size_t index = 0; + + PRINT_DEBUG("Steam_RemotePlay::GetSessionClientName\n"); + if (get_remote_play_session_index( unSessionID, &index ) == 0) { + if (get_remote_play_session_client_name( index, &client_name ) == 0) { + return client_name; + } + } + return NULL; +} + +ESteamDeviceFormFactor Steam_RemotePlay::GetSessionClientFormFactor( uint32 unSessionID ) +{ + ESteamDeviceFormFactor form_factor = k_ESteamDeviceFormFactorUnknown; + size_t index = 0; + + PRINT_DEBUG("Steam_RemotePlay::GetSessionClientFormFactor\n"); + if (get_remote_play_session_index( unSessionID, &index ) == 0) { + if (get_remote_play_session_client_form_factor( index, &form_factor ) == 0) { + return form_factor; + } + } + return k_ESteamDeviceFormFactorUnknown; +} + +bool Steam_RemotePlay::BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *pnResolutionY ) +{ + int x = 0; + int y = 0; + size_t index = 0; + + PRINT_DEBUG("Steam_RemotePlay::BGetSessionClientResolution\n"); + if ((pnResolutionX != NULL) && (pnResolutionY != NULL)) { + if (get_remote_play_session_index( unSessionID, &index ) == 0) { + if (get_remote_play_session_client_resolutions( index, &x, &y ) == 0) { + *pnResolutionX = x; + *pnResolutionY = y; + return true; + } + } + } + return false; +} + diff --git a/dll/steam_remoteplay.h b/dll/steam_remoteplay.h index 7bd97ff..56e2965 100644 --- a/dll/steam_remoteplay.h +++ b/dll/steam_remoteplay.h @@ -62,48 +62,24 @@ Steam_RemotePlay(class Settings *settings, class Networking *network, class Stea } // Get the number of currently connected Steam Remote Play sessions -uint32 GetSessionCount() -{ - PRINT_DEBUG("Steam_RemotePlay::GetSessionCount\n"); - return 0; -} +uint32 GetSessionCount(); // Get the currently connected Steam Remote Play session ID at the specified index. Returns zero if index is out of bounds. -uint32 GetSessionID( int iSessionIndex ) -{ - PRINT_DEBUG("Steam_RemotePlay::GetSessionID\n"); - return 0; -} +uint32 GetSessionID( int iSessionIndex ); // Get the SteamID of the connected user -CSteamID GetSessionSteamID( uint32 unSessionID ) -{ - PRINT_DEBUG("Steam_RemotePlay::GetSessionSteamID\n"); - return k_steamIDNil; -} +CSteamID GetSessionSteamID( uint32 unSessionID ); // Get the name of the session client device // This returns NULL if the sessionID is not valid -const char *GetSessionClientName( uint32 unSessionID ) -{ - PRINT_DEBUG("Steam_RemotePlay::GetSessionClientName\n"); - return NULL; -} +const char *GetSessionClientName( uint32 unSessionID ); // Get the form factor of the session client device -ESteamDeviceFormFactor GetSessionClientFormFactor( uint32 unSessionID ) -{ - PRINT_DEBUG("Steam_RemotePlay::GetSessionClientFormFactor\n"); - return k_ESteamDeviceFormFactorUnknown; -} +ESteamDeviceFormFactor GetSessionClientFormFactor( uint32 unSessionID ); // Get the resolution, in pixels, of the session client device // This is set to 0x0 if the resolution is not available -bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *pnResolutionY ) -{ - PRINT_DEBUG("Steam_RemotePlay::BGetSessionClientResolution\n"); - return false; -} +bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *pnResolutionY ); // Invite a friend to Remote Play Together // This returns false if the invite can't be sent diff --git a/dll/steam_ugc.h b/dll/steam_ugc.h index b1ada44..77658b2 100644 --- a/dll/steam_ugc.h +++ b/dll/steam_ugc.h @@ -600,13 +600,13 @@ bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) bool AddContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ) { - PRINT_DEBUG("Steam_UGC::AddContentDescriptor %llu %u\n", handle, index); + PRINT_DEBUG("Steam_UGC::AddContentDescriptor %llu %u\n", handle, descid); return false; } bool RemoveContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ) { - PRINT_DEBUG("Steam_UGC::RemoveContentDescriptor %llu %u\n", handle, index); + PRINT_DEBUG("Steam_UGC::RemoveContentDescriptor %llu %u\n", handle, descid); return false; } diff --git a/dll/wrap.cpp b/dll/wrap.cpp index 50defc7..7cabf7c 100644 --- a/dll/wrap.cpp +++ b/dll/wrap.cpp @@ -25,6 +25,7 @@ // Nothing to be done here #else #define STEAM_API_FUNCTIONS_IMPL + #include "base.h" #include "dll.h" @@ -34,6 +35,26 @@ const char *STEAM_PATH; size_t STEAM_PATH_SIZE; +#ifndef __x86_64__ +# define _STAT_VER_LINUX_OLD 1 +# define _STAT_VER_KERNEL 1 +# define _STAT_VER_SVR4 2 +# define _STAT_VER_LINUX 3 +# define _MKNOD_VER_LINUX 1 +# define _MKNOD_VER_SVR4 2 +#else +# define _STAT_VER_KERNEL 0 +# define _STAT_VER_LINUX 1 +# define _MKNOD_VER_LINUX 0 +#endif +#define _STAT_VER _STAT_VER_LINUX +#define _MKNOD_VER _MKNOD_VER_LINUX + +/* From kernel_stat.h It help me save some condition */ +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 __STATFS_MATCHES_STATFS64 +#define STAT_IS_KERNEL_STAT 1 + // Returns a '/' terminated absolute path to the steam folder in user's home, // root is returned if env home is not set const char *get_steam_path() @@ -290,7 +311,16 @@ STEAMAPI_API int __wrap_access(const char *path, int mode) STEAMAPI_API int __wrap___xstat(int ver, const char * path, struct stat * stat_buf) { const char *path_lowercased = lowercase_path(path, false, false); - int result = __xstat(ver, path_lowercased, stat_buf); + int result; + + switch (ver) { + case _STAT_VER_KERNEL: + result = stat(path_lowercased, stat_buf); + break; + default: + result = EINVAL; + } + if (path_lowercased != path) { free((void *)path_lowercased); } @@ -305,7 +335,16 @@ STEAMAPI_API int __wrap_stat(const char * path, struct stat * stat_buf) STEAMAPI_API int __wrap___lxstat(int ver, const char * path, struct stat * stat_buf) { const char *path_lowercased = lowercase_path(path, false, false); - int result = __lxstat(ver, path_lowercased, stat_buf); + int result; + + switch (ver) { + case _STAT_VER_KERNEL: + result = lstat(path_lowercased, stat_buf); + break; + default: + result = EINVAL; + } + if (path_lowercased != path) { free((void *)path_lowercased); } @@ -350,7 +389,16 @@ STEAMAPI_API DIR *__wrap_opendir(const char *path) STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat_buf) { const char *path_lowercased = lowercase_path(path, false, false); - int result = __xstat64(ver, path_lowercased, stat_buf); + int result; + + switch (ver) { + case _STAT_VER_KERNEL: + result = stat64(path_lowercased, stat_buf); + break; + default: + result = EINVAL; + } + if (path_lowercased != path) { free((void *)path_lowercased); } @@ -360,7 +408,16 @@ STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat STEAMAPI_API int __wrap___lxstat64(int ver, const char *path, struct stat64 *stat_buf) { const char *path_lowercased = lowercase_path(path, false, false); - int result = __lxstat64(ver, path_lowercased, stat_buf); + int result; + + switch (ver) { + case _STAT_VER_KERNEL: + result = lstat64(path_lowercased, stat_buf); + break; + default: + result = EINVAL; + } + if (path_lowercased != path) { free((void *)path_lowercased); } @@ -448,7 +505,7 @@ STEAMAPI_API int __wrap_link(const char *path1, const char *path2) STEAMAPI_API int __wrap_mknod(const char *path, mode_t mode, dev_t dev) { const char *path_lowercased = lowercase_path(path, true, true); - int result = __xmknod(1, path_lowercased, mode, &dev); + int result = mknod(path_lowercased, mode, dev); if (path_lowercased != path) { free((void *)path_lowercased); } diff --git a/files_example/steam_settings.EXAMPLE/custom_master_server.EXAMPLE.txt b/files_example/steam_settings.EXAMPLE/custom_master_server.EXAMPLE.txt new file mode 100644 index 0000000..2837580 --- /dev/null +++ b/files_example/steam_settings.EXAMPLE/custom_master_server.EXAMPLE.txt @@ -0,0 +1,2 @@ +192.168.7.99 +removethis.test.domain.com diff --git a/generate_all_deps.bat b/generate_all_deps.bat new file mode 100644 index 0000000..621808e --- /dev/null +++ b/generate_all_deps.bat @@ -0,0 +1,61 @@ +@echo off +cd /d "%~dp0" + +call generate_build_win.bat + +IF EXIST build\all_deps\debug\x86\*.* ( DEL /F /S /Q build\all_deps\debug\x86\*.* ) +IF EXIST build\all_deps\debug\x64\*.* ( DEL /F /S /Q build\all_deps\debug\x64\*.* ) +IF EXIST build\all_deps\release\x86\*.* ( DEL /F /S /Q build\all_deps\release\x86\*.* ) +IF EXIST build\all_deps\release\x64\*.* ( DEL /F /S /Q build\all_deps\release\x64\*.* ) + +call build_set_protobuf_directories.bat + +setlocal +"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto +call build_env_x86.bat +SET OLD_DIR=%cd% +cd "build\all_deps\debug\x86" +cl @%CDS_DIR%/RTLGENRANDOM.BLD +cl /c @%CDS_DIR%/DEBUG.BLD @%CDS_DIR%/PROTOBUF_X86.BLD @%CDS_DIR%\ALL_DEPS.BLD +IF EXIST %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS ) +where "*.obj" > %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS +cd %OLD_DIR% +endlocal + +setlocal +"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto +call build_env_x64.bat +SET OLD_DIR=%cd% +cd "build\all_deps\debug\x64" +cl @%CDS_DIR%/RTLGENRANDOM.BLD +cl /c @%CDS_DIR%/DEBUG.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%\ALL_DEPS.BLD +IF EXIST %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS ) +where "*.obj" > %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS +cd %OLD_DIR% +endlocal + +setlocal +"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto +call build_env_x86.bat +SET OLD_DIR=%cd% +cd "build\all_deps\release\x86" +cl @%CDS_DIR%/RTLGENRANDOM.BLD +cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X86.BLD @%CDS_DIR%\ALL_DEPS.BLD +IF EXIST %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS +cd %OLD_DIR% +endlocal + +setlocal +"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto +call build_env_x64.bat +SET OLD_DIR=%cd% +cd "build\all_deps\release\x64" +cl @%CDS_DIR%/RTLGENRANDOM.BLD +cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%\ALL_DEPS.BLD +IF EXIST %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS ) +where "*.obj" > %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS +cd %OLD_DIR% +endlocal + +SET BUILT_ALL_DEPS=1 diff --git a/generate_build_win.bat b/generate_build_win.bat new file mode 100644 index 0000000..e3c7451 --- /dev/null +++ b/generate_build_win.bat @@ -0,0 +1,414 @@ +@echo off +REM Should be called from the root of the repo. + +REM Make build and output dirs. +IF NOT EXIST build ( mkdir build ) +IF NOT EXIST build\cmds ( mkdir build\cmds ) +IF NOT EXIST build\debug ( mkdir build\debug ) +IF NOT EXIST build\release ( mkdir build\release ) +IF NOT EXIST build\all_deps ( mkdir build\all_deps ) +IF NOT EXIST build\all_deps\debug ( mkdir build\all_deps\debug ) +IF NOT EXIST build\all_deps\release ( mkdir build\all_deps\release ) +IF NOT EXIST build\experimental ( mkdir build\experimental ) +IF NOT EXIST build\experimental\debug ( mkdir build\experimental\debug ) +IF NOT EXIST build\experimental\release ( mkdir build\experimental\release ) +IF NOT EXIST build\experimental_steamclient ( mkdir build\experimental_steamclient ) +IF NOT EXIST build\experimental_steamclient\debug ( mkdir build\experimental_steamclient\debug ) +IF NOT EXIST build\experimental_steamclient\release ( mkdir build\experimental_steamclient\release ) +IF NOT EXIST build\experimental_steamclient\steamclient_loader ( mkdir build\experimental_steamclient\steamclient_loader ) +IF NOT EXIST build\experimental_steamclient\steamclient_loader\debug ( mkdir build\experimental_steamclient\steamclient_loader\debug ) +IF NOT EXIST build\experimental_steamclient\steamclient_loader\release ( mkdir build\experimental_steamclient\steamclient_loader\release ) +IF NOT EXIST build\lobby_connect\debug ( mkdir build\lobby_connect\debug ) +IF NOT EXIST build\lobby_connect\release ( mkdir build\lobby_connect\release ) +IF NOT EXIST build\release\tools ( mkdir build\release\tools ) +IF NOT EXIST build\release\tools\debug ( mkdir build\release\tools\debug ) +IF NOT EXIST build\release\tools\release ( mkdir build\release\tools\release ) + +IF NOT EXIST build\debug\x86 ( mkdir build\debug\x86 ) +IF NOT EXIST build\debug\x64 ( mkdir build\debug\x64 ) +IF NOT EXIST build\release\x86 ( mkdir build\release\x86 ) +IF NOT EXIST build\release\x64 ( mkdir build\release\x64 ) + +IF NOT EXIST build\all_deps\debug\x86 ( mkdir build\all_deps\debug\x86 ) +IF NOT EXIST build\all_deps\debug\x64 ( mkdir build\all_deps\debug\x64 ) +IF NOT EXIST build\all_deps\release\x86 ( mkdir build\all_deps\release\x86 ) +IF NOT EXIST build\all_deps\release\x64 ( mkdir build\all_deps\release\x64 ) + +IF NOT EXIST build\experimental\debug\x86 ( mkdir build\experimental\debug\x86 ) +IF NOT EXIST build\experimental\debug\x64 ( mkdir build\experimental\debug\x64 ) +IF NOT EXIST build\experimental\release\x86 ( mkdir build\experimental\release\x86 ) +IF NOT EXIST build\experimental\release\x64 ( mkdir build\experimental\release\x64 ) + +IF NOT EXIST build\experimental_steamclient\debug\x86 ( mkdir build\experimental_steamclient\debug\x86 ) +IF NOT EXIST build\experimental_steamclient\debug\x64 ( mkdir build\experimental_steamclient\debug\x64 ) +IF NOT EXIST build\experimental_steamclient\release\x86 ( mkdir build\experimental_steamclient\release\x86 ) +IF NOT EXIST build\experimental_steamclient\release\x64 ( mkdir build\experimental_steamclient\release\x64 ) +IF NOT EXIST build\experimental_steamclient\debug\x86\deps ( mkdir build\experimental_steamclient\debug\x86\deps ) +IF NOT EXIST build\experimental_steamclient\debug\x64\deps ( mkdir build\experimental_steamclient\debug\x64\deps ) +IF NOT EXIST build\experimental_steamclient\release\x86\deps ( mkdir build\experimental_steamclient\release\x86\deps ) +IF NOT EXIST build\experimental_steamclient\release\x64\deps ( mkdir build\experimental_steamclient\release\x64\deps ) +IF NOT EXIST build\experimental_steamclient\debug\x86\sc_deps ( mkdir build\experimental_steamclient\debug\x86\sc_deps ) +IF NOT EXIST build\experimental_steamclient\debug\x64\sc_deps ( mkdir build\experimental_steamclient\debug\x64\sc_deps ) +IF NOT EXIST build\experimental_steamclient\release\x86\sc_deps ( mkdir build\experimental_steamclient\release\x86\sc_deps ) +IF NOT EXIST build\experimental_steamclient\release\x64\sc_deps ( mkdir build\experimental_steamclient\release\x64\sc_deps ) + +IF NOT EXIST build\experimental_steamclient\steamclient_loader\debug\x86 ( mkdir build\experimental_steamclient\steamclient_loader\debug\x86 ) +IF NOT EXIST build\experimental_steamclient\steamclient_loader\debug\x64 ( mkdir build\experimental_steamclient\steamclient_loader\debug\x64 ) +IF NOT EXIST build\experimental_steamclient\steamclient_loader\release\x86 ( mkdir build\experimental_steamclient\steamclient_loader\release\x86 ) +IF NOT EXIST build\experimental_steamclient\steamclient_loader\release\x64 ( mkdir build\experimental_steamclient\steamclient_loader\release\x64 ) + +IF NOT EXIST build\lobby_connect\debug\x86 ( mkdir build\lobby_connect\debug\x86 ) +IF NOT EXIST build\lobby_connect\debug\x64 ( mkdir build\lobby_connect\debug\x64 ) +IF NOT EXIST build\lobby_connect\release\x86 ( mkdir build\lobby_connect\release\x86 ) +IF NOT EXIST build\lobby_connect\release\x64 ( mkdir build\lobby_connect\release\x64 ) +IF NOT EXIST build\release\tools\debug\x86 ( mkdir build\release\tools\debug\x86 ) +IF NOT EXIST build\release\tools\debug\x64 ( mkdir build\release\tools\debug\x64 ) +IF NOT EXIST build\release\tools\release\x86 ( mkdir build\release\tools\release\x86 ) +IF NOT EXIST build\release\tools\release\x64 ( mkdir build\release\tools\release\x64 ) + +IF NOT EXIST debug ( mkdir debug ) +IF NOT EXIST debug\experimental ( mkdir debug\experimental ) +IF NOT EXIST debug\experimental_steamclient ( mkdir debug\experimental_steamclient ) +IF NOT EXIST debug\lobby_connect ( mkdir debug\lobby_connect ) +IF NOT EXIST debug\tools ( mkdir debug\tools ) + +IF NOT EXIST release ( mkdir release ) +IF NOT EXIST release\experimental ( mkdir release\experimental ) +IF NOT EXIST release\experimental_steamclient ( mkdir release\experimental_steamclient ) +IF NOT EXIST release\lobby_connect ( mkdir release\lobby_connect ) +IF NOT EXIST release\tools ( mkdir release\tools ) + +SET CDS_DIR=%cd%\build\cmds + +REM +REM Arguments. +REM + +REM normal_args. +IF EXIST %CDS_DIR%\NORMAL_ARGS.ARG ( DEL /F /S /Q %CDS_DIR%\NORMAL_ARGS.ARG ) +echo /EHsc > %CDS_DIR%\NORMAL_ARGS.ARG +echo /Ox >> %CDS_DIR%\NORMAL_ARGS.ARG + +REM JOB ARGS. +IF "%JOB_COUNT%" == "" ( echo /MP1 >> %CDS_DIR%\NORMAL_ARGS.ARG ) +IF NOT "%JOB_COUNT%" == "" ( echo /MP%JOB_COUNT% >> %CDS_DIR%\NORMAL_ARGS.ARG ) + +REM Debug args. +IF EXIST %CDS_DIR%\DEBUG.BLD ( DEL /F /S /Q %CDS_DIR%\DEBUG.BLD ) +IF EXIST %CDS_DIR%\DEBUG.LKS ( DEL /F /S /Q %CDS_DIR%\DEBUG.LKS ) + +REM Create empty file. (No BUILD time args currently.) +type NUL >> %CDS_DIR%\DEBUG.BLD + +REM DISABLE the PDB builds if we are running on the CI. (It can't build them currently.) +IF EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /DEBUG:NONE > %CDS_DIR%\DEBUG.LKS ) +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /DEBUG:FULL /OPT:REF /OPT:ICF > %CDS_DIR%\DEBUG.LKS ) + +REM Release args. +IF EXIST %CDS_DIR%\RELEASE.ARG ( DEL /F /S /Q %CDS_DIR%\RELEASE.ARG ) +IF EXIST %CDS_DIR%\RELEASE.LKS ( DEL /F /S /Q %CDS_DIR%\RELEASE.LKS ) +REM Release mode Flags. +echo /DEMU_RELEASE_BUILD > %CDS_DIR%\RELEASE.ARG +echo /DNDEBUG >> %CDS_DIR%\RELEASE.ARG +copy %CDS_DIR%\RELEASE.ARG %CDS_DIR%\RELEASE.BLD +type %CDS_DIR%\RELEASE.ARG > %CDS_DIR%\RELEASE.LKS + +REM DISABLE the PDB builds if we are running on the CI. (It can't build them currently.) +IF EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /DEBUG:NONE > %CDS_DIR%\RELEASE.LKS ) +IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /DEBUG:FULL /OPT:REF /OPT:ICF > %CDS_DIR%\RELEASE.LKS ) + +REM BASE DLL Flags. +IF EXIST %CDS_DIR%\DLL_MAIN_CPP.ARG ( DEL /F /S /Q %CDS_DIR%\DLL_MAIN_CPP.ARG ) + +REM EXPERIMENTAL Flags. +IF EXIST %CDS_DIR%\EXPERIMENTAL.ARG ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL.ARG ) +echo /DEMU_EXPERIMENTAL_BUILD > %CDS_DIR%\EXPERIMENTAL.ARG +echo /DCONTROLLER_SUPPORT >> %CDS_DIR%\EXPERIMENTAL.ARG +echo /DEMU_OVERLAY >> %CDS_DIR%\EXPERIMENTAL.ARG + +REM EXPERIMENTAL_STEAMCLIENT Flags. +IF EXIST %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.ARG ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.ARG ) +echo /DSTEAMCLIENT_DLL > %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.ARG + +REM lobby_connect Flags. +IF EXIST %CDS_DIR%\LOBBY_CONNECT.ARG ( DEL /F /S /Q %CDS_DIR%\LOBBY_CONNECT.ARG ) +echo /DNO_DISK_WRITES > %CDS_DIR%\LOBBY_CONNECT.ARG +echo /DLOBBY_CONNECT >> %CDS_DIR%\LOBBY_CONNECT.ARG + +REM +REM Includes. +REM + +REM protobuf. +call build_set_protobuf_directories.bat +IF EXIST %CDS_DIR%\PROTOBUF_X86.ICD ( DEL /F /S /Q %CDS_DIR%\PROTOBUF_X86.ICD ) +IF EXIST %CDS_DIR%\PROTOBUF_X64.ICD ( DEL /F /S /Q %CDS_DIR%\PROTOBUF_X64.ICD ) +setlocal +SET TEST_A=%cd% +cd %PROTOBUF_X86_DIRECTORY% +SET TEST_B=%cd%\include +cd %TEST_A% +echo /I%TEST_B% > %CDS_DIR%\PROTOBUF_X86.ICD +endlocal +setlocal +SET TEST_A=%cd% +cd %PROTOBUF_X64_DIRECTORY% +SET TEST_B=%cd%\include +cd %TEST_A% +echo /I%TEST_B% > %CDS_DIR%\PROTOBUF_X64.ICD +endlocal + +REM OVERLAY_EXPERIMENTAL. +IF EXIST %CDS_DIR%\OVERLAY_EXPERIMENTAL.ICD ( DEL /F /S /Q %CDS_DIR%\OVERLAY_EXPERIMENTAL.ICD ) +echo /I%cd%\overlay_experimental > %CDS_DIR%\OVERLAY_EXPERIMENTAL.ICD + +REM IMGUI. +IF EXIST %CDS_DIR%\IMGUI.ICD ( DEL /F /S /Q %CDS_DIR%\IMGUI.ICD ) +echo /I%cd%\ImGui > %CDS_DIR%\IMGUI.ICD + +REM +REM Link Libraries. +REM + +REM protobuf. +IF EXIST %CDS_DIR%\PROTOBUF_X86.OS ( DEL /F /S /Q %CDS_DIR%\PROTOBUF_X86.OS ) +IF EXIST %CDS_DIR%\PROTOBUF_X64.OS ( DEL /F /S /Q %CDS_DIR%\PROTOBUF_X64.OS ) +dir /b /s %PROTOBUF_X86_LIBRARY% > %CDS_DIR%\PROTOBUF_X86.OS +dir /b /s %PROTOBUF_X64_LIBRARY% > %CDS_DIR%\PROTOBUF_X64.OS + +REM BASE DLL. +IF EXIST %CDS_DIR%\DLL_MAIN_CPP.OS ( DEL /F /S /Q %CDS_DIR%\DLL_MAIN_CPP.OS ) +echo Iphlpapi.lib > %CDS_DIR%\DLL_MAIN_CPP.OS +echo Ws2_32.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS +echo Shell32.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS + +REM EXPERIMENTAL. +IF EXIST %CDS_DIR%\EXPERIMENTAL.OS ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL.OS ) +echo dbghelp.lib >> %CDS_DIR%\EXPERIMENTAL.OS +echo Faultrep.lib >> %CDS_DIR%\EXPERIMENTAL.OS +echo opengl32.lib >> %CDS_DIR%\EXPERIMENTAL.OS +echo Winmm.lib >> %CDS_DIR%\EXPERIMENTAL.OS + +REM steamclient_loader. +IF EXIST %CDS_DIR%\STEAMCLIENT_LOADER.OS ( DEL /F /S /Q %CDS_DIR%\STEAMCLIENT_LOADER.OS ) +echo advapi32.lib > %CDS_DIR%\STEAMCLIENT_LOADER.OS +echo user32.lib >> %CDS_DIR%\STEAMCLIENT_LOADER.OS + +REM lobby_connect. +IF EXIST %CDS_DIR%\LOBBY_CONNECT.OS ( DEL /F /S /Q %CDS_DIR%\LOBBY_CONNECT.OS ) +echo Comdlg32.lib > %CDS_DIR%\LOBBY_CONNECT.OS + +REM +REM Files. +REM + +REM Protobuf. +REM Needs to be compiled here (really just needs to exist), as we include it below. +"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto + +REM OVERLAY_EXPERIMENTAL. +IF EXIST %CDS_DIR%\OVERLAY_EXPERIMENTAL.FLS ( DEL /F /S /Q %CDS_DIR%\OVERLAY_EXPERIMENTAL.FLS ) +IF EXIST %CDS_DIR%\OVERLAY_EXPERIMENTAL_SYSTEM.FLS ( DEL /F /S /Q %CDS_DIR%\OVERLAY_EXPERIMENTAL_SYSTEM.FLS ) +where "%cd%\overlay_experimental\:*.cpp" > %CDS_DIR%\OVERLAY_EXPERIMENTAL.FLS +where "%cd%\overlay_experimental\windows\:*.cpp" >> %CDS_DIR%\OVERLAY_EXPERIMENTAL.FLS +where "%cd%\overlay_experimental\System\:*.cpp" >> %CDS_DIR%\OVERLAY_EXPERIMENTAL_SYSTEM.FLS + +REM IMGUI. +IF EXIST %CDS_DIR%\IMGUI.FLS ( DEL /F /S /Q %CDS_DIR%\IMGUI.FLS ) +where "%cd%\ImGui\:*.cpp" > %CDS_DIR%\IMGUI.FLS +where "%cd%\ImGui\backends\:imgui_impl_dx*.cpp" >> %CDS_DIR%\IMGUI.FLS +where "%cd%\ImGui\backends\:imgui_impl_win32.cpp" >> %CDS_DIR%\IMGUI.FLS +where "%cd%\ImGui\backends\:imgui_impl_vulkan.cpp" >> %CDS_DIR%\IMGUI.FLS +where "%cd%\ImGui\backends\:imgui_impl_opengl3.cpp" >> %CDS_DIR%\IMGUI.FLS +where "%cd%\ImGui\backends\:imgui_win_shader_blobs.cpp" >> %CDS_DIR%\IMGUI.FLS + +REM DETOURS. +IF EXIST %CDS_DIR%\DETOURS.FLS ( DEL /F /S /Q %CDS_DIR%\DETOURS.FLS ) +where "%cd%\detours\:*.cpp" > %CDS_DIR%\DETOURS.FLS + +REM rtlgenrandom. +IF EXIST %CDS_DIR%\RTLGENRANDOM.FLS ( DEL /F /S /Q %CDS_DIR%\RTLGENRANDOM.FLS ) +where "%cd%\dll\:rtlgenrandom.c" > %CDS_DIR%\RTLGENRANDOM.FLS +where "%cd%\dll\:rtlgenrandom.def" >> %CDS_DIR%\RTLGENRANDOM.FLS + +REM CONTROLLER. +IF EXIST %CDS_DIR%\CONTROLLER.FLS ( DEL /F /S /Q CONTROLLER.FLS ) +where "%cd%\controller\:gamepad.c" > %CDS_DIR%\CONTROLLER.FLS + +REM sc_different_deps. +IF EXIST %CDS_DIR%\SC_DIFFERENT_DEPS.FLS ( DEL /F /S /Q %CDS_DIR%\SC_DIFFERENT_DEPS.FLS ) +where "%cd%\dll\:flat.cpp" > %CDS_DIR%\SC_DIFFERENT_DEPS.FLS +where "%cd%\dll\:dll.cpp" >> %CDS_DIR%\SC_DIFFERENT_DEPS.FLS + +REM BASE DLL. +IF EXIST %CDS_DIR%\DLL_MAIN_CPP.FLS ( DEL /F /S /Q %CDS_DIR%\DLL_MAIN_CPP.FLS ) +move %cd%\dll\flat.cpp %cd%\dll\flat.cpp.tmp +move %cd%\dll\dll.cpp %cd%\dll\dll.cpp.tmp +where "%cd%\dll\:*.cpp" > %CDS_DIR%\DLL_MAIN_CPP.FLS +move %cd%\dll\flat.cpp.tmp %cd%\dll\flat.cpp +move %cd%\dll\dll.cpp.tmp %cd%\dll\dll.cpp +where "%cd%\dll\:*.cc" >> %CDS_DIR%\DLL_MAIN_CPP.FLS + +REM SteamClient. +IF EXIST %CDS_DIR%\STEAMCLIENT.FLS ( DEL /F /S /Q %CDS_DIR%\STEAMCLIENT.FLS ) +where "%cd%\:steamclient.cpp" > %CDS_DIR%\STEAMCLIENT.FLS + +REM steamclient_loader. +IF EXIST %CDS_DIR%\STEAMCLIENT_LOADER.FLS ( DEL /F /S /Q %CDS_DIR%\STEAMCLIENT_LOADER.FLS ) +where "%cd%\steamclient_loader\:*.cpp" > %CDS_DIR%\STEAMCLIENT_LOADER.FLS + +REM lobby_connect. +IF EXIST %CDS_DIR%\LOBBY_CONNECT.FLS ( DEL /F /S /Q %CDS_DIR%\LOBBY_CONNECT.FLS ) +where "%cd%\:lobby_connect.cpp" > %CDS_DIR%\LOBBY_CONNECT.FLS + +REM generate_interfaces_file. +IF EXIST %CDS_DIR%\GENERATE_INTERFACES_FILE.FLS ( DEL /F /S /Q %CDS_DIR%\GENERATE_INTERFACES_FILE.FLS ) +where "%cd%\:generate_interfaces_file.cpp" > %CDS_DIR%\GENERATE_INTERFACES_FILE.FLS + +REM +REM Build and link cmd script files. +REM + +REM protobuf. +IF EXIST %CDS_DIR%\PROTOBUF_X86.BLD ( DEL /F /S /Q %CDS_DIR%\PROTOBUF_X86.BLD ) +IF EXIST %CDS_DIR%\PROTOBUF_X86.LKS ( DEL /F /S /Q %CDS_DIR%\PROTOBUF_X86.LKS ) +type %CDS_DIR%\PROTOBUF_X86.ICD > %CDS_DIR%\PROTOBUF_X86.BLD +type %CDS_DIR%\PROTOBUF_X86.BLD > %CDS_DIR%\PROTOBUF_X86.LKS +type %CDS_DIR%\PROTOBUF_X86.OS >> %CDS_DIR%\PROTOBUF_X86.LKS + +IF EXIST %CDS_DIR%\PROTOBUF_X64.BLD ( DEL /F /S /Q %CDS_DIR%\PROTOBUF_X64.BLD ) +IF EXIST %CDS_DIR%\PROTOBUF_X64.LKS ( DEL /F /S /Q %CDS_DIR%\PROTOBUF_X64.LKS ) +type %CDS_DIR%\PROTOBUF_X64.ICD > %CDS_DIR%\PROTOBUF_X64.BLD +type %CDS_DIR%\PROTOBUF_X64.BLD > %CDS_DIR%\PROTOBUF_X64.LKS +type %CDS_DIR%\PROTOBUF_X64.OS >> %CDS_DIR%\PROTOBUF_X64.LKS + +REM rtlgenrandom. +IF EXIST %CDS_DIR%\RTLGENRANDOM.BLD ( DEL /F /S /Q %CDS_DIR%\RTLGENRANDOM.BLD ) +type %CDS_DIR%\RTLGENRANDOM.FLS > %CDS_DIR%\RTLGENRANDOM.BLD + +REM SC_DEPS +IF EXIST %CDS_DIR%\SC_DEPS.BLD ( DEL /F /S /Q %CDS_DIR%\SC_DEPS.BLD ) +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\SC_DEPS.BLD +type %CDS_DIR%\EXPERIMENTAL.ARG >> %CDS_DIR%\SC_DEPS.BLD +type %CDS_DIR%\OVERLAY_EXPERIMENTAL.ICD >> %CDS_DIR%\SC_DEPS.BLD +type %CDS_DIR%\IMGUI.ICD >> %CDS_DIR%\SC_DEPS.BLD +type %CDS_DIR%\DLL_MAIN_CPP.FLS >> %CDS_DIR%\SC_DEPS.BLD +type %CDS_DIR%\OVERLAY_EXPERIMENTAL.FLS >> %CDS_DIR%\SC_DEPS.BLD + +REM DEPS +IF EXIST %CDS_DIR%\DEPS.BLD ( DEL /F /S /Q %CDS_DIR%\DEPS.BLD ) +type %CDS_DIR%\DETOURS.FLS >> %CDS_DIR%\DEPS.BLD +type %CDS_DIR%\CONTROLLER.FLS >> %CDS_DIR%\DEPS.BLD +type %CDS_DIR%\IMGUI.FLS >> %CDS_DIR%\DEPS.BLD +type %CDS_DIR%\OVERLAY_EXPERIMENTAL_SYSTEM.FLS >> %CDS_DIR%\DEPS.BLD + +REM all_deps. +IF EXIST %CDS_DIR%\ALL_DEPS.BLD ( DEL /F /S /Q %CDS_DIR%\ALL_DEPS.BLD ) +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\ALL_DEPS.BLD +type %CDS_DIR%\OVERLAY_EXPERIMENTAL.ICD >> %CDS_DIR%\ALL_DEPS.BLD +type %CDS_DIR%\IMGUI.ICD >> %CDS_DIR%\ALL_DEPS.BLD +type %CDS_DIR%\DETOURS.FLS >> %CDS_DIR%\ALL_DEPS.BLD +type %CDS_DIR%\CONTROLLER.FLS >> %CDS_DIR%\ALL_DEPS.BLD +type %CDS_DIR%\IMGUI.FLS >> %CDS_DIR%\ALL_DEPS.BLD +type %CDS_DIR%\OVERLAY_EXPERIMENTAL_SYSTEM.FLS >> %CDS_DIR%\ALL_DEPS.BLD + +REM BASE DLL. +IF EXIST %CDS_DIR%\DLL_MAIN_CPP.BLD ( DEL /F /S /Q %CDS_DIR%\DLL_MAIN_CPP.BLD ) +IF EXIST %CDS_DIR%\DLL_MAIN_CPP.LKS ( DEL /F /S /Q %CDS_DIR%\DLL_MAIN_CPP.LKS ) +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\DLL_MAIN_CPP.BLD +type %CDS_DIR%\DLL_MAIN_CPP.FLS >> %CDS_DIR%\DLL_MAIN_CPP.BLD +type %CDS_DIR%\SC_DIFFERENT_DEPS.FLS >> %CDS_DIR%\DLL_MAIN_CPP.BLD +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\DLL_MAIN_CPP.LKS +type %CDS_DIR%\DLL_MAIN_CPP.OS >> %CDS_DIR%\DLL_MAIN_CPP.LKS + +REM EXPERIMENTAL. +IF EXIST %CDS_DIR%\EXPERIMENTAL.BLD ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL.BLD ) +IF EXIST %CDS_DIR%\EXPERIMENTAL.LKS ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL.LKS ) + +REM Note the order and repeats. cl will complain if this gets messed up. +REM OLD SCRIPT. +REM type NORMAL_ARGS.ARG > EXPERIMENTAL.BLD +REM type EXPERIMENTAL.ARG >> EXPERIMENTAL.BLD +REM type EXPERIMENTAL.ICD >> EXPERIMENTAL.BLD +REM type DLL_MAIN_CPP.FLS >> EXPERIMENTAL.BLD +REM type SC_DIFFERENT_DEPS.FLS >> EXPERIMENTAL.BLD +REM type OVERLAY_EXPERIMENTAL.FLS >> EXPERIMENTAL.BLD +REM type OVERLAY_EXPERIMENTAL_SYSTEM.FLS >> EXPERIMENTAL.BLD +REM type DETOURS.FLS >> EXPERIMENTAL.BLD +REM type CONTROLLER.FLS >> EXPERIMENTAL.BLD +REM type IMGUI.FLS >> EXPERIMENTAL.BLD +REM type NORMAL_ARGS.ARG > EXPERIMENTAL.LKS +REM type EXPERIMENTAL.ARG >> EXPERIMENTAL.LKS +REM type EXPERIMENTAL.ICD >> EXPERIMENTAL.LKS +REM type DLL_MAIN_CPP.OS >> EXPERIMENTAL.LKS +REM type EXPERIMENTAL.OS >> EXPERIMENTAL.LKS +REM NEW Combined experimental && experimental_steamclient SCRIPT. +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\EXPERIMENTAL.BLD +type %CDS_DIR%\EXPERIMENTAL.ARG >> %CDS_DIR%\EXPERIMENTAL.BLD +type %CDS_DIR%\OVERLAY_EXPERIMENTAL.ICD >> %CDS_DIR%\EXPERIMENTAL.BLD +type %CDS_DIR%\IMGUI.ICD >> %CDS_DIR%\EXPERIMENTAL.BLD +type %CDS_DIR%\SC_DIFFERENT_DEPS.FLS >> %CDS_DIR%\EXPERIMENTAL.BLD + +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\EXPERIMENTAL.LKS +type %CDS_DIR%\EXPERIMENTAL.ARG >> %CDS_DIR%\EXPERIMENTAL.LKS +type %CDS_DIR%\OVERLAY_EXPERIMENTAL.ICD >> %CDS_DIR%\EXPERIMENTAL.LKS +type %CDS_DIR%\IMGUI.ICD >> %CDS_DIR%\EXPERIMENTAL.LKS +type %CDS_DIR%\DLL_MAIN_CPP.OS >> %CDS_DIR%\EXPERIMENTAL.LKS +type %CDS_DIR%\EXPERIMENTAL.OS >> %CDS_DIR%\EXPERIMENTAL.LKS + +REM SteamClient. +IF EXIST %CDS_DIR%\STEAMCLIENT.BLD ( DEL /F /S /Q %CDS_DIR%\STEAMCLIENT.BLD ) +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\STEAMCLIENT.BLD +type %CDS_DIR%\EXPERIMENTAL.ARG >> %CDS_DIR%\STEAMCLIENT.BLD +type %CDS_DIR%\OVERLAY_EXPERIMENTAL.ICD >> %CDS_DIR%\STEAMCLIENT.BLD +type %CDS_DIR%\IMGUI.ICD >> %CDS_DIR%\STEAMCLIENT.BLD +type %CDS_DIR%\STEAMCLIENT.FLS >> %CDS_DIR%\STEAMCLIENT.BLD + +REM EXPERIMENTAL_STEAMCLIENT. +IF EXIST %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.BLD ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.BLD ) +IF EXIST %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS ) + +REM Note the order and repeats. cl will complain if this gets messed up. + + + + +REM FULL +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS +type %CDS_DIR%\EXPERIMENTAL.ARG >> %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS +type %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.ARG >> %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS +type %CDS_DIR%\SC_DIFFERENT_DEPS.FLS >> %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS +type %CDS_DIR%\DLL_MAIN_CPP.OS >> %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS +type %CDS_DIR%\EXPERIMENTAL.OS >> %CDS_DIR%\EXPERIMENTAL_STEAMCLIENT.LKS + +REM steamclient_loader. +IF EXIST %CDS_DIR%\STEAMCLIENT_LOADER.BLD ( DEL /F /S /Q %CDS_DIR%\STEAMCLIENT_LOADER.BLD ) +IF EXIST %CDS_DIR%\STEAMCLIENT_LOADER.LKS ( DEL /F /S /Q %CDS_DIR%\STEAMCLIENT_LOADER.LKS ) + +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\STEAMCLIENT_LOADER.BLD +type %CDS_DIR%\STEAMCLIENT_LOADER.FLS >> %CDS_DIR%\STEAMCLIENT_LOADER.BLD + +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\STEAMCLIENT_LOADER.LKS +type %CDS_DIR%\STEAMCLIENT_LOADER.OS >> %CDS_DIR%\STEAMCLIENT_LOADER.LKS + +REM lobby_connect. +IF EXIST %CDS_DIR%\LOBBY_CONNECT.BLD ( DEL /F /S /Q %CDS_DIR%\LOBBY_CONNECT.BLD ) +IF EXIST %CDS_DIR%\LOBBY_CONNECT.LKS ( DEL /F /S /Q %CDS_DIR%\LOBBY_CONNECT.LKS ) +type %CDS_DIR%\LOBBY_CONNECT.ARG > %CDS_DIR%\LOBBY_CONNECT.BLD +type %CDS_DIR%\NORMAL_ARGS.ARG >> %CDS_DIR%\LOBBY_CONNECT.BLD +type %CDS_DIR%\LOBBY_CONNECT.FLS >> %CDS_DIR%\LOBBY_CONNECT.BLD +type %CDS_DIR%\DLL_MAIN_CPP.FLS >> %CDS_DIR%\LOBBY_CONNECT.BLD +type %CDS_DIR%\SC_DIFFERENT_DEPS.FLS >> %CDS_DIR%\LOBBY_CONNECT.BLD + +type %CDS_DIR%\LOBBY_CONNECT.ARG > %CDS_DIR%\LOBBY_CONNECT.LKS +type %CDS_DIR%\NORMAL_ARGS.ARG >> %CDS_DIR%\LOBBY_CONNECT.LKS +type %CDS_DIR%\DLL_MAIN_CPP.OS >> %CDS_DIR%\LOBBY_CONNECT.LKS +type %CDS_DIR%\LOBBY_CONNECT.OS >> %CDS_DIR%\LOBBY_CONNECT.LKS + +REM GENERATE_INTERFACES_FILE +IF EXIST %CDS_DIR%\GENERATE_INTERFACES_FILE.BLD ( DEL /F /S /Q %CDS_DIR%\GENERATE_INTERFACES_FILE.BLD ) +IF EXIST %CDS_DIR%\GENERATE_INTERFACES_FILE.LKS ( DEL /F /S /Q %CDS_DIR%\GENERATE_INTERFACES_FILE.LKS ) +type %CDS_DIR%\NORMAL_ARGS.ARG >> %CDS_DIR%\GENERATE_INTERFACES_FILE.BLD +type %CDS_DIR%\GENERATE_INTERFACES_FILE.FLS >> %CDS_DIR%\GENERATE_INTERFACES_FILE.BLD + +type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\GENERATE_INTERFACES_FILE.LKS diff --git a/generate_build_win_bat.py b/generate_build_win_bat.py deleted file mode 100644 index f24b6bc..0000000 --- a/generate_build_win_bat.py +++ /dev/null @@ -1,127 +0,0 @@ -import os - -def files_from_dir(dir, extension, filter=[]): - out = [] - for f in os.listdir(dir): - if f.endswith(extension) and f not in filter: - out.append(os.path.join(dir, f)) - return out - -def convert_to_obj(files, obj_dir): - out = [] - for f in files: - out.append(os.path.join(obj_dir, os.path.splitext(os.path.basename(f))[0] + ".obj")) - return out - -def cl_line_obj(arguments, out_dir): - return "rmdir /S /Q {0}\nmkdir {0}\ncl /Fo:{0}/ /c {1}\n".format(out_dir, ' '.join(arguments)) - -def cl_line_link(arguments, linker_arguments): - return "cl /LD {} /link {}\n".format(' '.join(arguments), ' '.join(linker_arguments)) - -def cl_line_exe(arguments, linker_arguments): - return "cl {} /link {}\n".format(' '.join(arguments), ' '.join(linker_arguments)) - -jobs = 4 -normal_build_args = ["/EHsc", "/Ox", "/MP{}".format(jobs)] - -includes = ["ImGui", "overlay_experimental"] -includes_32 = list(map(lambda a: '/I{}'.format(a), ["%PROTOBUF_X86_DIRECTORY%\\include\\"] + includes)) -includes_64 = list(map(lambda a: '/I{}'.format(a), ["%PROTOBUF_X64_DIRECTORY%\\include\\"] + includes)) - -debug_build_args = [] -release_build_args = ["/DEMU_RELEASE_BUILD", "/DNDEBUG"] -steamclient_build_args = ["/DSTEAMCLIENT_DLL"] - -experimental_build_args = ["/DEMU_EXPERIMENTAL_BUILD", "/DCONTROLLER_SUPPORT", "/DEMU_OVERLAY"] -steamclient_experimental_build_args = experimental_build_args + steamclient_build_args - -normal_linker_libs = ["Iphlpapi.lib", "Ws2_32.lib", "rtlgenrandom.lib", "Shell32.lib"] -experimental_linker_libs = ["opengl32.lib", "Winmm.lib"] + normal_linker_libs -linker_32 = ['"%PROTOBUF_X86_LIBRARY%"'] -linker_64 = ['"%PROTOBUF_X64_LIBRARY%"'] - -controller_deps = ["controller/gamepad.c"] -imgui_deps = files_from_dir("ImGui", ".cpp") + ["ImGui/backends/imgui_impl_dx9.cpp", "ImGui/backends/imgui_impl_dx10.cpp", "ImGui/backends/imgui_impl_dx11.cpp", "ImGui/backends/imgui_impl_dx12.cpp", "ImGui/backends/imgui_impl_win32.cpp", "ImGui/backends/imgui_impl_vulkan.cpp", "ImGui/backends/imgui_impl_opengl3.cpp", "ImGui/backends/imgui_win_shader_blobs.cpp"] -proto_deps = list(map(lambda a: a.replace(".proto", ".pb.cc"), files_from_dir("dll", ".proto"))) -all_deps = proto_deps + files_from_dir("detours", ".cpp") + controller_deps + imgui_deps + files_from_dir("overlay_experimental/System", ".cpp") - -sc_different_deps = ["flat.cpp", "dll.cpp"] -steam_deps = files_from_dir("dll", ".cpp", sc_different_deps) -overlay_deps = files_from_dir("overlay_experimental", ".cpp") + files_from_dir("overlay_experimental/windows", ".cpp") -experimental_steam_deps = steam_deps + overlay_deps -sc_different_deps = list(map(lambda a: "dll/" + a, sc_different_deps)) - -regular_files = [] - -head = """@echo off -cd /d "%~dp0" -rmdir /S /Q release -mkdir release -mkdir release\experimental -mkdir release\experimental_steamclient -mkdir release\debug_experimental -mkdir release\debug_experimental_steamclient -call build_set_protobuf_directories.bat -""" - -head_32bit = """"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\\net.proto -call build_env_x86.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -""" - -head_64bit = """"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\\net.proto -call build_env_x64.bat -cl dll/rtlgenrandom.c dll/rtlgenrandom.def -""" - -footer = """ -copy Readme_release.txt release\Readme.txt -xcopy /s files_example\* release\\ -copy Readme_experimental.txt release\experimental\Readme.txt -copy Readme_debug.txt release\debug_experimental\Readme.txt -copy steamclient_loader\ColdClientLoader.ini release\experimental_steamclient\\ -call build_win_lobby_connect.bat -call build_win_find_interfaces.bat -""" - -out = head -out += head_32bit - -deps_folder = "deps" -sc_deps_folder = "deps_sc" - -def generate_common(include_arch, linker_arch, steam_api_name, steamclient_name): - out = "" - out += cl_line_obj(normal_build_args + release_build_args + include_arch + all_deps, deps_folder) - out += cl_line_link(normal_build_args + release_build_args + include_arch + steam_deps + sc_different_deps + ["deps/net.pb.obj"] + linker_arch + normal_linker_libs, ["/debug:none", "/OUT:release\\{}".format(steam_api_name)]) - - debug_full_args = normal_build_args + debug_build_args + experimental_build_args + include_arch - out += cl_line_obj(debug_full_args + experimental_steam_deps, sc_deps_folder) - - debug_full_dll_args = debug_full_args + sc_different_deps + convert_to_obj(all_deps, deps_folder) + convert_to_obj(experimental_steam_deps, sc_deps_folder) + linker_arch + experimental_linker_libs - out += cl_line_link(debug_full_dll_args, ["/OUT:release\debug_experimental\\{}".format(steam_api_name)]) - out += cl_line_link(steamclient_build_args + debug_full_dll_args, ["/OUT:release\debug_experimental_steamclient\\{}".format(steamclient_name)]) - - release_full_args = normal_build_args + release_build_args + experimental_build_args + include_arch - out += cl_line_obj(release_full_args + experimental_steam_deps, sc_deps_folder) - - release_full_dll_args = release_full_args + sc_different_deps + convert_to_obj(all_deps, deps_folder) + convert_to_obj(experimental_steam_deps, sc_deps_folder) + linker_arch + experimental_linker_libs - out += cl_line_link(release_full_dll_args, ["/debug:none", "/OUT:release\experimental\\{}".format(steam_api_name)]) - out += cl_line_link(steamclient_build_args + release_full_dll_args, ["/debug:none", "/OUT:release\experimental_steamclient\\{}".format(steamclient_name)]) - out += cl_line_link(release_build_args + experimental_build_args + ["steamclient.cpp"] + normal_build_args, ["/debug:none", "/OUT:release\experimental\\{}".format(steamclient_name)]) - return out - -out += generate_common(includes_32, linker_32, "steam_api.dll", "steamclient.dll") - -out += cl_line_exe(files_from_dir("steamclient_loader", ".cpp") + ["advapi32.lib", "user32.lib"] + normal_build_args, ["/debug:none", "/OUT:release\experimental_steamclient\steamclient_loader.exe"]) - -out += head_64bit -out += generate_common(includes_64, linker_64, "steam_api64.dll", "steamclient64.dll") - - -out += footer - - -with open("build_win_release_test.bat", "w") as f: - f.write(out) diff --git a/lobby_connect.cpp b/lobby_connect.cpp index 36f3327..3af6dad 100644 --- a/lobby_connect.cpp +++ b/lobby_connect.cpp @@ -32,93 +32,113 @@ #else #endif -int main() { +int main(int argc, char ** argv) { + bool broadcast_relay_daemon = false; + + if (argc > 1) { + for (int x = 1; x < argc; x++) { + if (strcmp(argv[x], "-d") == 0) { + broadcast_relay_daemon = true; + } + } + } + if (SteamAPI_Init()) { //Set appid to: LOBBY_CONNECT_APPID SteamAPI_RestartAppIfNecessary(LOBBY_CONNECT_APPID); - std::cout << "This is a program to find lobbies and run the game with lobby connect parameters" << std::endl; - std::cout << "Api initialized, "; + if (broadcast_relay_daemon) { + std::cout << "Running in relay daemon mode. Press Ctrl+C to exit...." << std::endl; + std::cout.flush(); + + while (1) { + SteamAPI_RunCallbacks(); + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + } + } else { + std::cout << "This is a program to find lobbies and run the game with lobby connect parameters" << std::endl; + std::cout << "Api initialized, "; top: - std::cout << "waiting a few seconds for connections:" << std::endl; - for (int i = 0; i < 10; ++i) { - SteamAPI_RunCallbacks(); - std::this_thread::sleep_for(std::chrono::milliseconds(200)); - } + std::cout << "waiting a few seconds for connections:" << std::endl; + for (int i = 0; i < 10; ++i) { + SteamAPI_RunCallbacks(); + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + } - int friend_count = SteamFriends()->GetFriendCount(k_EFriendFlagAll); - std::cout << "People on the network: " << friend_count << std::endl; - for (int i = 0; i < friend_count; ++i) { - CSteamID id = SteamFriends()->GetFriendByIndex(i, k_EFriendFlagAll); - const char *name = SteamFriends()->GetFriendPersonaName(id); + int friend_count = SteamFriends()->GetFriendCount(k_EFriendFlagAll); + std::cout << "People on the network: " << friend_count << std::endl; + for (int i = 0; i < friend_count; ++i) { + CSteamID id = SteamFriends()->GetFriendByIndex(i, k_EFriendFlagAll); + const char *name = SteamFriends()->GetFriendPersonaName(id); - FriendGameInfo_t friend_info = {}; - SteamFriends()->GetFriendGamePlayed(id, &friend_info); - std::cout << name << " is playing: " << friend_info.m_gameID.AppID() << std::endl; - } + FriendGameInfo_t friend_info = {}; + SteamFriends()->GetFriendGamePlayed(id, &friend_info); + std::cout << name << " is playing: " << friend_info.m_gameID.AppID() << std::endl; + } - std::cout << std::endl << "--------------Menu-------------" << std::endl << "\tappid\tname\tcommand line" << std::endl; + std::cout << std::endl << "--------------Menu-------------" << std::endl << "\tappid\tname\tcommand line" << std::endl; - std::vector arguments; - for (int i = 0; i < friend_count; ++i) { - CSteamID id = SteamFriends()->GetFriendByIndex(i, k_EFriendFlagAll); - const char *name = SteamFriends()->GetFriendPersonaName(id); - const char *connect = SteamFriends()->GetFriendRichPresence( id, "connect"); - FriendGameInfo_t friend_info = {}; - SteamFriends()->GetFriendGamePlayed(id, &friend_info); + std::vector arguments; + for (int i = 0; i < friend_count; ++i) { + CSteamID id = SteamFriends()->GetFriendByIndex(i, k_EFriendFlagAll); + const char *name = SteamFriends()->GetFriendPersonaName(id); + const char *connect = SteamFriends()->GetFriendRichPresence( id, "connect"); + FriendGameInfo_t friend_info = {}; + SteamFriends()->GetFriendGamePlayed(id, &friend_info); - if (strlen(connect) > 0) { - std::cout << arguments.size() << "\t" << friend_info.m_gameID.AppID() << "\t" << name << "\t" << connect << std::endl; - arguments.push_back(connect); - } else { - if (friend_info.m_steamIDLobby != k_steamIDNil) { - std::string connect = "+connect_lobby " + std::to_string(friend_info.m_steamIDLobby.ConvertToUint64()); + if (strlen(connect) > 0) { std::cout << arguments.size() << "\t" << friend_info.m_gameID.AppID() << "\t" << name << "\t" << connect << std::endl; arguments.push_back(connect); + } else { + if (friend_info.m_steamIDLobby != k_steamIDNil) { + std::string connect = "+connect_lobby " + std::to_string(friend_info.m_steamIDLobby.ConvertToUint64()); + std::cout << arguments.size() << "\t" << friend_info.m_gameID.AppID() << "\t" << name << "\t" << connect << std::endl; + arguments.push_back(connect); + } } } - } - std::cout << arguments.size() << ": Retry." << std::endl; - std::cout << std::endl << "Enter the number corresponding to your choice then press Enter." << std::endl; - unsigned int choice; - std::cin >> choice; + std::cout << arguments.size() << ": Retry." << std::endl; + std::cout << std::endl << "Enter the number corresponding to your choice then press Enter." << std::endl; + unsigned int choice; + std::cin >> choice; - if (choice >= arguments.size()) goto top; + if (choice >= arguments.size()) goto top; #ifdef _WIN32 - std::cout << "starting the game with: " << arguments[choice] << std::endl << "Please select the game exe" << std::endl; + std::cout << "starting the game with: " << arguments[choice] << std::endl << "Please select the game exe" << std::endl; - OPENFILENAMEA ofn; - char szFileName[MAX_PATH] = ""; - ZeroMemory(&ofn, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = 0; - ofn.lpstrFilter = "Exe Files (*.exe)\0*.exe\0All Files (*.*)\0*.*\0"; - ofn.lpstrFile = szFileName; - ofn.nMaxFile = MAX_PATH; - ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.lpstrDefExt = "txt"; - if(GetOpenFileNameA(&ofn)) - { - std::string filename = szFileName; - filename = "\"" + filename + "\" " + arguments[choice]; - std::cout << filename << std::endl; - STARTUPINFOA lpStartupInfo; - PROCESS_INFORMATION lpProcessInfo; + OPENFILENAMEA ofn; + char szFileName[MAX_PATH] = ""; + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = 0; + ofn.lpstrFilter = "Exe Files (*.exe)\0*.exe\0All Files (*.*)\0*.*\0"; + ofn.lpstrFile = szFileName; + ofn.nMaxFile = MAX_PATH; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.lpstrDefExt = "txt"; + if(GetOpenFileNameA(&ofn)) + { + std::string filename = szFileName; + filename = "\"" + filename + "\" " + arguments[choice]; + std::cout << filename << std::endl; + STARTUPINFOA lpStartupInfo; + PROCESS_INFORMATION lpProcessInfo; - ZeroMemory( &lpStartupInfo, sizeof( lpStartupInfo ) ); - lpStartupInfo.cb = sizeof( lpStartupInfo ); - ZeroMemory( &lpProcessInfo, sizeof( lpProcessInfo ) ); + ZeroMemory( &lpStartupInfo, sizeof( lpStartupInfo ) ); + lpStartupInfo.cb = sizeof( lpStartupInfo ); + ZeroMemory( &lpProcessInfo, sizeof( lpProcessInfo ) ); - CreateProcessA( NULL, - const_cast(filename.c_str()), NULL, NULL, - NULL, NULL, NULL, NULL, - &lpStartupInfo, - &lpProcessInfo - ); - } + CreateProcessA( NULL, + const_cast(filename.c_str()), NULL, NULL, + NULL, NULL, NULL, NULL, + &lpStartupInfo, + &lpProcessInfo + ); + } #else - std::cout << "Please launch the game with these arguments: " << arguments[choice] << std::endl; + std::cout << "Please launch the game with these arguments: " << arguments[choice] << std::endl; #endif + } } } diff --git a/steamclient_loader/ColdClientLoader.cpp b/steamclient_loader/ColdClientLoader.cpp index 6e790ab..ed59f24 100644 --- a/steamclient_loader/ColdClientLoader.cpp +++ b/steamclient_loader/ColdClientLoader.cpp @@ -32,6 +32,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance WCHAR ExeRunDir[MAX_PATH] = { 0 }; WCHAR ExeCommandLine[4096] = { 0 }; WCHAR AppId[128] = { 0 }; + HANDLE SharedMemFileMap = 0; + HANDLE SharedMemFileView = 0; + HANDLE SharedMemFileLock = 0; STARTUPINFOW info = { sizeof(info) }; PROCESS_INFORMATION processInfo; @@ -100,11 +103,38 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance return 0; } + // Create shared mem map. + SharedMemFileMap = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 1024, L"Local\\SteamStart_SharedMemFile"); + if (!SharedMemFileMap) + { + MessageBoxA(NULL, "Unable to create shared memory mapping.", "ColdClientLoader", MB_ICONERROR); + return 0; + } + SharedMemFileView = MapViewOfFile(SharedMemFileMap, SECTION_ALL_ACCESS, 0, 0, 0); + if (!SharedMemFileView) + { + MessageBoxA(NULL, "Unable to create view of shared memory mapping.", "ColdClientLoader", MB_ICONERROR); + CloseHandle(SharedMemFileMap); + return 0; + } + SharedMemFileLock = CreateEventW(NULL, FALSE, FALSE, L"Local\\SteamStart_SharedMemLock"); + if (!SharedMemFileLock) + { + MessageBoxA(NULL, "Unable to create lock for shared memory mapping.", "ColdClientLoader", MB_ICONERROR); + CloseHandle(SharedMemFileView); + CloseHandle(SharedMemFileMap); + return 0; + } + SetEvent(SharedMemFileLock); + WCHAR CommandLine[8192]; _snwprintf(CommandLine, _countof(CommandLine), L"\"%ls\" %ls", ExeFile, ExeCommandLine); if (!ExeFile[0] || !CreateProcessW(ExeFile, CommandLine, NULL, NULL, TRUE, CREATE_SUSPENDED, NULL, ExeRunDir, &info, &processInfo)) { MessageBoxA(NULL, "Unable to load the requested EXE file.", "ColdClientLoader", MB_ICONERROR); + CloseHandle(SharedMemFileLock); + CloseHandle(SharedMemFileView); + CloseHandle(SharedMemFileMap); return 0; } HKEY Registrykey; @@ -130,6 +160,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance { MessageBoxA(NULL, "Unable to patch Steam process informations on the Windows registry.", "ColdClientLoader", MB_ICONERROR); TerminateProcess(processInfo.hProcess, NULL); + CloseHandle(SharedMemFileLock); + CloseHandle(SharedMemFileView); + CloseHandle(SharedMemFileMap); return 0; } } @@ -175,5 +208,10 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance } } + // Close the SharedMem handles. + CloseHandle(SharedMemFileLock); + CloseHandle(SharedMemFileView); + CloseHandle(SharedMemFileMap); + return 0; }