From 9cee5004d774dff2091bc9e2db331d60e8185ba5 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Sun, 20 Mar 2022 16:00:30 -0400 Subject: [PATCH 01/17] Fix ISteamClient class member ordering for Steam_Unified_Messages. Some games, like SAO:FB, require a specific class member order. --- dll/steam_client.cpp | 2 +- dll/steam_client.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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; From d29103bf79538d9116f757c634058ad1e6ae7e37 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Thu, 24 Mar 2022 02:57:55 -0400 Subject: [PATCH 02/17] Create shared mem mapping in steamclient_loader. The mapping and it's event object are needed by some games. --- steamclient_loader/ColdClientLoader.cpp | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) 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; } From 0d0ec28ecb5dd89054b7b51d0ba96c3dba9259f0 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Tue, 29 Mar 2022 12:27:14 -0400 Subject: [PATCH 03/17] Make a better stub for Steam_RemotePlay functionality. Note for googler's, this doesn't mean RemotePlay works / is being implemented. Put the main stuff into its own .cpp. Set up storage for holding descriptions. (*NOT* thread safe!) Clears up a crash on init in SAO:FB. --- dll/steam_remoteplay.cpp | 202 +++++++++++++++++++++++++++++++++++++++ dll/steam_remoteplay.h | 36 ++----- 2 files changed, 208 insertions(+), 30 deletions(-) create mode 100644 dll/steam_remoteplay.cpp 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 From 40429741002978199fdc3155abf8549377339f9b Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 04:17:51 -0500 Subject: [PATCH 04/17] Add gitattributes file so shell scripts don't get mangled and break builds. Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- .gitattributes | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .gitattributes 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 + From b0796076349b25dbfa14d7605f59835c53b124ce Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 04:19:06 -0500 Subject: [PATCH 05/17] Fix linux build script, and add lobby_connect to it. Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- build_linux.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build_linux.sh b/build_linux.sh index 1d29569..74c0a49 100755 --- a/build_linux.sh +++ b/build_linux.sh @@ -1,2 +1,4 @@ -protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto -clang++ -shared -fPIC -o libsteam_api.so dll/*.cpp dll/*.cc -g3 -Wno-return-type -fsanitize=address -lasan -lprotobuf-lite -std=c++14 && echo built +#!/bin/bash +protoc -I"${PWD}/dll/" --cpp_out="${PWD}/dll/" "${PWD}"/dll/*.proto +clang++ -shared -fPIC -o libsteam_api.so dll/*.cpp dll/*.cc -g3 -Wno-return-type -fsanitize=address -lasan -lprotobuf-lite -std=c++14 && echo built libsteam_api.so +clang++ -fPIC -o lobby_connect lobby_connect.cpp dll/*.cpp dll/*.cc -g3 -Wno-return-type -fsanitize=address -lasan -lprotobuf-lite -std=c++14 && echo built lobby_connect \ No newline at end of file From 2e3f14e7bdb00ed260716b6424174a723fd0cf2a Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 04:20:11 -0500 Subject: [PATCH 06/17] Fix copy-paste syntax error in steam_ugc.h. Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- dll/steam_ugc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } From 92623f586d954a3f201d123e863f9cec8f2b5a08 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 04:27:41 -0500 Subject: [PATCH 07/17] Fix too many env vars causing build failures, and put debug builds in their own folder like release builds. Cannot call the vc vars batch too many times. Fix it by calling set/end local. See also: https://developercommunity.visualstudio.com/t/vcvarsallbat-reports-the-input-line-is-too-long-if/257260 Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- build_win_debug_experimental.bat | 16 ++++++++++++---- build_win_debug_experimental_steamclient.bat | 12 ++++++++++-- build_win_find_interfaces.bat | 2 ++ build_win_lobby_connect.bat | 2 ++ build_win_release.bat | 4 ++++ build_win_release_experimental.bat | 4 ++++ build_win_release_experimental_steamclient.bat | 4 ++++ 7 files changed, 38 insertions(+), 6 deletions(-) diff --git a/build_win_debug_experimental.bat b/build_win_debug_experimental.bat index 7f3a080..f92957b 100755 --- a/build_win_debug_experimental.bat +++ b/build_win_debug_experimental.bat @@ -1,14 +1,22 @@ @echo off cd /d "%~dp0" call build_set_protobuf_directories.bat + +mkdir debug +mkdir debug\experimental + +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 /Z7 /LD /IImGui /I%PROTOBUF_X86_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /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_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api.dll -cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:steamclient.dll +cl /Z7 /LD /IImGui /I%PROTOBUF_X86_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /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_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:debug\experimental\steam_api.dll +cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:debug\experimental\steamclient.dll +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 /Z7 /LD /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /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:steam_api64.dll -cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:steamclient64.dll +cl /Z7 /LD /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /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:debug\experimental\steam_api64.dll +cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:debug\experimental\steamclient64.dll +endlocal \ No newline at end of file diff --git a/build_win_debug_experimental_steamclient.bat b/build_win_debug_experimental_steamclient.bat index 1eec4aa..4e7517b 100644 --- a/build_win_debug_experimental_steamclient.bat +++ b/build_win_debug_experimental_steamclient.bat @@ -1,9 +1,17 @@ cd /d "%~dp0" + +mkdir debug +mkdir debug\experimental_steamclient + call build_set_protobuf_directories.bat +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 /IImGui /I%PROTOBUF_X86_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_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steamclient.dll +cl /LD /IImGui /I%PROTOBUF_X86_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_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:debug\experimental_steamclient\steamclient.dll +endlocal +setlocal 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 +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:debug\experimental_steamclient\steamclient64.dll +endlocal diff --git a/build_win_find_interfaces.bat b/build_win_find_interfaces.bat index cb1cb48..db3b46a 100755 --- a/build_win_find_interfaces.bat +++ b/build_win_find_interfaces.bat @@ -2,8 +2,10 @@ cd /d "%~dp0" mkdir release\tools del /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 copy Readme_generate_interfaces.txt release\tools\Readme_generate_interfaces.txt +endlocal diff --git a/build_win_lobby_connect.bat b/build_win_lobby_connect.bat index 27c83e5..ddfe447 100755 --- a/build_win_lobby_connect.bat +++ b/build_win_lobby_connect.bat @@ -3,6 +3,7 @@ cd /d "%~dp0" mkdir release\lobby_connect del /Q release\lobby_connect\* call build_set_protobuf_directories.bat +setlocal "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x86.bat cl dll/rtlgenrandom.c dll/rtlgenrandom.def @@ -10,3 +11,4 @@ cl /DNO_DISK_WRITES /DLOBBY_CONNECT /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X86 del /Q /S release\lobby_connect\*.lib del /Q /S release\lobby_connect\*.exp copy Readme_lobby_connect.txt release\lobby_connect\Readme.txt +endlocal diff --git a/build_win_release.bat b/build_win_release.bat index 79e7804..4470544 100755 --- a/build_win_release.bat +++ b/build_win_release.bat @@ -7,15 +7,19 @@ rmdir /S /Q release\lobby_connect rmdir /S /Q release mkdir release call build_set_protobuf_directories.bat +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 +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 +endlocal copy Readme_release.txt release\Readme.txt xcopy /s files_example\* release\ call build_win_release_experimental.bat diff --git a/build_win_release_experimental.bat b/build_win_release_experimental.bat index 5c3ff84..b03d8a7 100755 --- a/build_win_release_experimental.bat +++ b/build_win_release_experimental.bat @@ -3,15 +3,19 @@ cd /d "%~dp0" mkdir release\experimental del /Q release\experimental\* call build_set_protobuf_directories.bat +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 /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 +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 /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 +endlocal diff --git a/build_win_release_experimental_steamclient.bat b/build_win_release_experimental_steamclient.bat index cd55557..95c8381 100644 --- a/build_win_release_experimental_steamclient.bat +++ b/build_win_release_experimental_steamclient.bat @@ -3,10 +3,13 @@ cd /d "%~dp0" mkdir release\experimental_steamclient del /Q release\experimental_steamclient\* call build_set_protobuf_directories.bat +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 /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 +endlocal +setlocal "%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\ @@ -14,3 +17,4 @@ 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 copy Readme_experimental_steamclient.txt release\experimental_steamclient\Readme.txt +endlocal \ No newline at end of file From 98488d657058306ce31008748beba6621c89e0a2 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 04:29:06 -0500 Subject: [PATCH 08/17] Create windows lobby_connect debug build script. Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- build_win_debug_lobby_connect.bat | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 build_win_debug_lobby_connect.bat diff --git a/build_win_debug_lobby_connect.bat b/build_win_debug_lobby_connect.bat new file mode 100644 index 0000000..b87707a --- /dev/null +++ b/build_win_debug_lobby_connect.bat @@ -0,0 +1,12 @@ +@echo off +cd /d "%~dp0" +mkdir debug\lobby_connect +del /Q debug\lobby_connect\* +call build_set_protobuf_directories.bat +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 /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 /OUT:debug\lobby_connect\lobby_connect.exe +copy Readme_lobby_connect.txt debug\lobby_connect\Readme.txt +endlocal From d1a0a68d4f724d4793e1acbe7bbff8c910b8cb07 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 04:30:17 -0500 Subject: [PATCH 09/17] Add relay daemon mode to lobby_connect. This (along with the existing custom_broadcasts support) allows for users on different read: _routed_ subnets to see and connect to each other's games. To use this mode: Build lobby_connect and run it with the "-d" argument. Create the custom_broadcasts.txt file in the steam_settings folder next to steam_api.dll / steam_api64.dll and put the IP address of the host running lobby_connect in it. Run games. Note: This should even work with existing installations, _provided_ that at least one of them creates the custom_broadcasts.txt file as described above. (This is because existing installations use broadcast packets to establish new connections, forwarding all of their knowledge to each other. Thus having at least one host on the current subnet configured in this new way turns it into a "proxy" for the other hosts.) Caveat: This will _NOT_ work if NAT is involved. This is due to the lack of NAT traversal support in the emu. (I.e. The lobby_connect daemon will get the info from the NAT'ed hosts and forward it to the others, but hosts outside the NAT won't be able to connect.) Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- lobby_connect.cpp | 152 ++++++++++++++++++++++++++-------------------- 1 file changed, 86 insertions(+), 66 deletions(-) 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 + } } } From d78ab8e8a55b9f7d0a003756e58b2febc6795602 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 04:45:37 -0500 Subject: [PATCH 10/17] Add missing echo off to build_win_debug_experimental_steamclient.bat. Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- build_win_debug_experimental_steamclient.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/build_win_debug_experimental_steamclient.bat b/build_win_debug_experimental_steamclient.bat index 4e7517b..8555e69 100644 --- a/build_win_debug_experimental_steamclient.bat +++ b/build_win_debug_experimental_steamclient.bat @@ -1,3 +1,4 @@ +@echo off cd /d "%~dp0" mkdir debug From 8f212b82cadce80e9c7ba9b0411ab2daa1401ead Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 05:00:43 -0500 Subject: [PATCH 11/17] Generate PDB files for the debug builds. Allows for better debugging with Windows debuggers. Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- build_win_debug_experimental.bat | 10 +++++----- build_win_debug_experimental_steamclient.bat | 4 ++-- build_win_debug_lobby_connect.bat | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build_win_debug_experimental.bat b/build_win_debug_experimental.bat index f92957b..ba56b41 100755 --- a/build_win_debug_experimental.bat +++ b/build_win_debug_experimental.bat @@ -9,14 +9,14 @@ 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 /Z7 /LD /IImGui /I%PROTOBUF_X86_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /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_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:debug\experimental\steam_api.dll -cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:debug\experimental\steamclient.dll +cl /LD /IImGui /I%PROTOBUF_X86_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /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_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:.\debug\experimental\steam_api.pdb /link /OUT:debug\experimental\steam_api.dll +cl /LD steamclient.cpp /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:.\debug\experimental\steamclient.pdb /link /OUT:debug\experimental\steamclient.dll 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 /Z7 /LD /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /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:debug\experimental\steam_api64.dll -cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:debug\experimental\steamclient64.dll -endlocal \ No newline at end of file +cl /LD /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /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 /DDEBUG:FULL /Zi /Fd:.\debug\experimental\steam_api64.pdb /link /OUT:debug\experimental\steam_api64.dll +cl /LD steamclient.cpp /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:.\debug\experimental\steamclient64.pdb /link /OUT:debug\experimental\steamclient64.dll +endlocal diff --git a/build_win_debug_experimental_steamclient.bat b/build_win_debug_experimental_steamclient.bat index 8555e69..2bca8e2 100644 --- a/build_win_debug_experimental_steamclient.bat +++ b/build_win_debug_experimental_steamclient.bat @@ -9,10 +9,10 @@ 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 /IImGui /I%PROTOBUF_X86_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_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:debug\experimental_steamclient\steamclient.dll +cl /LD /IImGui /I%PROTOBUF_X86_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_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:.\debug\experimental_steamclient\steamclient.pdb /link /OUT:debug\experimental_steamclient\steamclient.dll endlocal setlocal 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:debug\experimental_steamclient\steamclient64.dll +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 /DDEBUG:FULL /Zi /Fd:.\debug\experimental_steamclient\steamclient64.pdb /link /OUT:debug\experimental_steamclient\steamclient64.dll endlocal diff --git a/build_win_debug_lobby_connect.bat b/build_win_debug_lobby_connect.bat index b87707a..cdea074 100644 --- a/build_win_debug_lobby_connect.bat +++ b/build_win_debug_lobby_connect.bat @@ -7,6 +7,6 @@ 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 /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 /OUT:debug\lobby_connect\lobby_connect.exe +cl /DNO_DISK_WRITES /DLOBBY_CONNECT /DEMU_RELEASE_BUILD /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 /DDEBUG:FULL /Zi /Fd:.\debug\lobby_connect\lobby_connect.pdb /link /OUT:debug\lobby_connect\lobby_connect.exe copy Readme_lobby_connect.txt debug\lobby_connect\Readme.txt endlocal From a2c9f9230f220c6c99b93c34d9e1311bae0e004e Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 10 Jan 2024 05:04:28 -0500 Subject: [PATCH 12/17] Improve steam_masterserver_updater stub. This creates a new "custom_master_server.txt" file that can be used to pre-seed a master server list. This also allows for steam apps to manipulate the master server list in memory. I.e. This implements: Steam_Masterserver_Updater::AddMasterServer() Steam_Masterserver_Updater::RemoveMasterServer() Steam_Masterserver_Updater::GetNumMasterServers() Steam_Masterserver_Updater::GetMasterServerAddress() Signed-off-by: redpolline <11156324-redpolline@users.noreply.gitlab.com> --- dll/settings.h | 3 + dll/settings_parser.cpp | 7 ++ dll/steam_masterserver_updater.h | 87 ++++++++++++++++++- .../custom_master_server.EXAMPLE.txt | 2 + 4 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 files_example/steam_settings.EXAMPLE/custom_master_server.EXAMPLE.txt 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_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/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 From ef5c4731b4a58a41dfc5b677d1cc41631b055cb8 Mon Sep 17 00:00:00 2001 From: ayaka Date: Sun, 29 Aug 2021 16:05:17 +0800 Subject: [PATCH 13/17] dll/wrap: fix build for glibc 2.33 I don't think I need the step that converting to legacy struct. Signed-off-by: ayaka --- dll/common_includes.h | 3 +- dll/wrap.cpp | 67 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 7 deletions(-) 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/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); } From b75f3241007e33e00fe28328f0803ad5f3978abf Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Thu, 6 Jun 2024 08:30:59 -0400 Subject: [PATCH 14/17] Fix build scripts. Fix list: - Make cmd not choke on recursive calls to build_env_x*.bat. - Create build directories and move build output there instead of polluting the root of the source tree. - Make proper debug builds with pdb output. - Make proper x64 builds of lobby_connect, and steamclient_loader. (lobby_connect_x64.exe, and steamclient_loader_x64.exe) - Rename x86 build of lobby_connect.exe to lobby_connect_x86.exe. - Rename x86 build of steamclient_loader.exe to steamclient_loader_x86.exe. - Make proper distrib directories. (I.e. ///.) --- .gitignore | 35 ++++++++++--------- build_env_x64.bat | 12 +++++++ build_env_x86.bat | 13 ++++++- build_win_debug_experimental.bat | 34 +++++++++++++----- build_win_debug_experimental_steamclient.bat | 30 ++++++++++++---- build_win_debug_lobby_connect.bat | 21 ++++++++--- build_win_find_interfaces.bat | 19 +++++++--- build_win_lobby_connect.bat | 21 +++++++---- build_win_release.bat | 34 ++++++++++++------ build_win_release_experimental.bat | 32 ++++++++++++----- ...d_win_release_experimental_steamclient.bat | 34 +++++++++++++----- 11 files changed, 211 insertions(+), 74 deletions(-) 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/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= Date: Fri, 31 Jan 2025 02:06:41 +0000 Subject: [PATCH 15/17] Update .gitlab-ci.yml file to skip building the PDBs. (CI throws errors and skips building the PE files.) --- .gitlab-ci.yml | 10 ++++++++-- generate_build_win_bat.py | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c158841..98989b5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,15 +69,21 @@ build_windows: - 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 + - DLL_FILES="$(ls dll/*.cpp | tr "\n" " " | tr "/" "\\\\")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat + - DLL_FILES="$(ls dll/*.proto | tr "\n" " " | tr "/" "\\\\" | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat - sed "s| /MP12 | /MP4 |g" -i *.bat + # CI can't produce PDBs. Throws a bunch of errors, and skips building the PEs. + - sed "s| /DDEBUG\:FULL | |g" -i *.bat + # Turn on echo. + - sed "s|echo off|echo on|g" -i *.bat - python generate_build_win_bat.py - export WINEDEBUG=-all - wine cmd /c build_win_release_test.bat + - cp build_win_release_test.bat release/build_win_release_test.bat artifacts: paths: - release/ + - debug/ expire_in: 1 day build_cmake_linux: diff --git a/generate_build_win_bat.py b/generate_build_win_bat.py index f24b6bc..9e3ef47 100644 --- a/generate_build_win_bat.py +++ b/generate_build_win_bat.py @@ -32,6 +32,7 @@ includes_64 = list(map(lambda a: '/I{}'.format(a), ["%PROTOBUF_X64_DIRECTORY%\\i debug_build_args = [] release_build_args = ["/DEMU_RELEASE_BUILD", "/DNDEBUG"] steamclient_build_args = ["/DSTEAMCLIENT_DLL"] +lobby_connect_args = ["/DNO_DISK_WRITES", "/DLOBBY_CONNECT"] experimental_build_args = ["/DEMU_EXPERIMENTAL_BUILD", "/DCONTROLLER_SUPPORT", "/DEMU_OVERLAY"] steamclient_experimental_build_args = experimental_build_args + steamclient_build_args @@ -62,6 +63,7 @@ mkdir release\experimental mkdir release\experimental_steamclient mkdir release\debug_experimental mkdir release\debug_experimental_steamclient +mkdir release\lobby_connect call build_set_protobuf_directories.bat """ @@ -81,7 +83,8 @@ 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 +REM call build_win_lobby_connect.bat +copy Readme_lobby_connect.txt release\lobby_connect\Readme.txt call build_win_find_interfaces.bat """ @@ -114,6 +117,8 @@ def generate_common(include_arch, linker_arch, steam_api_name, steamclient_name) out += generate_common(includes_32, linker_32, "steam_api.dll", "steamclient.dll") +out += cl_line_exe(files_from_dir("./", "lobby_connect.cpp") + files_from_dir("dll", "flat.cpp") + files_from_dir("dll", "dll.cpp") + lobby_connect_args + normal_build_args + release_build_args + includes_32 + proto_deps + steam_deps + normal_linker_libs + ["Comdlg32.lib", "user32.lib"], linker_32 + ["/debug:none", "/OUT:release\lobby_connect\lobby_connect.exe"]) + 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 From 74d22df42e6055becd39f8773cfdf9e3cd509dda Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Tue, 4 Feb 2025 18:28:11 -0500 Subject: [PATCH 16/17] Fix CI to use BAT files only for win build. For consistency have the CI use the same build path as the end-user builds. Use where.exe from wine-10.0. CI's version is a stub. Use one that actually works, until the CI gets updated. Also, fix broken RtlGenRandom by importing ADVAPI32's GetUserNameW(), and calling GetModuleHandleW() / GetProcAddress() for SystemFunction032(). Instead of trying to use a fake import lib. Bonus: Can now use the host system's username as the default for the steam user name instead of "Noob". ("Noob" is still used as the fallback if this call fails, or the host system's username is invalid.) --- .gitlab-ci.yml | 26 +- build_set_protobuf_directories.bat | 11 +- build_win_debug_experimental.bat | 37 +- build_win_debug_experimental_steamclient.bat | 147 ++++++- build_win_debug_lobby_connect.bat | 47 +- build_win_find_interfaces.bat | 39 +- build_win_lobby_connect.bat | 47 +- build_win_release.bat | 41 +- build_win_release_experimental.bat | 36 +- ...d_win_release_experimental_steamclient.bat | 145 ++++++- dll/base.cpp | 31 +- dll/rtlgenrandom.c | 4 - dll/rtlgenrandom.def | 3 - dll/settings_parser.cpp | 34 +- generate_all_deps.bat | 57 +++ generate_build_win.bat | 406 ++++++++++++++++++ generate_build_win_bat.py | 132 ------ 17 files changed, 926 insertions(+), 317 deletions(-) delete mode 100644 dll/rtlgenrandom.c delete mode 100644 dll/rtlgenrandom.def create mode 100644 generate_all_deps.bat create mode 100644 generate_build_win.bat delete mode 100644 generate_build_win_bat.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98989b5..1a7612e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,27 +59,29 @@ 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" " " | tr "/" "\\\\")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat - - DLL_FILES="$(ls dll/*.proto | tr "\n" " " | tr "/" "\\\\" | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat - sed "s| /MP12 | /MP4 |g" -i *.bat # CI can't produce PDBs. Throws a bunch of errors, and skips building the PEs. - - sed "s| /DDEBUG\:FULL | |g" -i *.bat - # Turn on echo. - - sed "s|echo off|echo on|g" -i *.bat - - python generate_build_win_bat.py + - touch CI_BUILD.TAG - export WINEDEBUG=-all - - wine cmd /c build_win_release_test.bat - - cp build_win_release_test.bat release/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/ @@ -162,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_set_protobuf_directories.bat b/build_set_protobuf_directories.bat index fb3e63b..8bd16a6 100755 --- a/build_set_protobuf_directories.bat +++ b/build_set_protobuf_directories.bat @@ -1,7 +1,14 @@ @echo off cd /d "%~dp0" -SET PROTOBUF_X86_DIRECTORY=..\vcpkg\installed\x86-windows-static -SET PROTOBUF_X64_DIRECTORY=..\vcpkg\installed\x64-windows-static + +SET TEST_A=%cd% +REM CI doesn't like this var expansion of "%cd%\". +cd ..\vcpkg\installed\x86-windows-static +SET PROTOBUF_X86_DIRECTORY=%cd% +cd %TEST_A% +cd ..\vcpkg\installed\x64-windows-static +SET PROTOBUF_X64_DIRECTORY=%cd% +cd %TEST_A% rem location of protoc in protobuf directories: SET PROTOC_X86_EXE=%PROTOBUF_X86_DIRECTORY%\tools\protobuf\protoc.exe diff --git a/build_win_debug_experimental.bat b/build_win_debug_experimental.bat index 10ebb89..7cbc3c8 100755 --- a/build_win_debug_experimental.bat +++ b/build_win_debug_experimental.bat @@ -1,38 +1,9 @@ @echo off cd /d "%~dp0" -IF NOT EXIST build ( mkdir build ) -IF NOT EXIST build\experimental ( mkdir build\experimental ) -IF NOT EXIST build\experimental\debug ( mkdir build\experimental\debug ) -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 EXIST build\experimental\debug\x86\*.* ( DEL /F /S /Q build\experimental\debug\x86\*.* ) -IF EXIST build\experimental\debug\x64\*.* ( DEL /F /S /Q build\experimental\debug\x64\*.* ) +IF NOT "%1" == "" ( SET JOB_COUNT=%~1 ) -IF NOT EXIST debug ( mkdir debug ) -IF NOT EXIST debug\experimental ( mkdir debug\experimental ) -IF EXIST debug\experimental\*.* ( DEL /F /S /Q debug\experimental\*.* ) +SET SKIP_EXPERIMENTAL_STEAMCLIENT_BUILD=1 +SET SKIP_STEAMCLIENT_LOADER=1 -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\experimental\debug\x86 -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /I%OLD_DIR%/ImGui /I%OLD_DIR%/%PROTOBUF_X86_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /I%OLD_DIR%/overlay_experimental %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc %OLD_DIR%/detours/*.cpp %OLD_DIR%/controller/gamepad.c %OLD_DIR%/ImGui/*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_dx*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_win32.cpp %OLD_DIR%/ImGui/backends/imgui_impl_vulkan.cpp %OLD_DIR%/ImGui/backends/imgui_impl_opengl3.cpp %OLD_DIR%/ImGui/backends/imgui_win_shader_blobs.cpp %OLD_DIR%/overlay_experimental/*.cpp %OLD_DIR%/overlay_experimental/windows/*.cpp %OLD_DIR%/overlay_experimental/System/*.cpp "%OLD_DIR%/%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\experimental\steam_api.pdb /link /OUT:%OLD_DIR%\debug\experimental\steam_api.dll -cl /LD %OLD_DIR%/steamclient.cpp /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\experimental\steamclient.pdb /link /OUT:%OLD_DIR%\debug\experimental\steamclient.dll -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\experimental\debug\x64 -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /I%OLD_DIR%/ImGui /I%OLD_DIR%/%PROTOBUF_X64_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /I%OLD_DIR%/overlay_experimental %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc %OLD_DIR%/detours/*.cpp %OLD_DIR%/controller/gamepad.c %OLD_DIR%/ImGui/*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_dx*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_win32.cpp %OLD_DIR%/ImGui/backends/imgui_impl_vulkan.cpp %OLD_DIR%/ImGui/backends/imgui_impl_opengl3.cpp %OLD_DIR%/ImGui/backends/imgui_win_shader_blobs.cpp %OLD_DIR%/overlay_experimental/*.cpp %OLD_DIR%/overlay_experimental/windows/*.cpp %OLD_DIR%/overlay_experimental/System/*.cpp "%OLD_DIR%/%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\experimental\steam_api64.pdb /link /OUT:%OLD_DIR%\debug\experimental\steam_api64.dll -cl /LD %OLD_DIR%/steamclient.cpp /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\experimental\steamclient64.pdb /link /OUT:%OLD_DIR%\debug\experimental\steamclient64.dll -cd %OLD_DIR% -endlocal +call build_win_debug_experimental_steamclient.bat diff --git a/build_win_debug_experimental_steamclient.bat b/build_win_debug_experimental_steamclient.bat index 32da89a..85d7f8d 100644 --- a/build_win_debug_experimental_steamclient.bat +++ b/build_win_debug_experimental_steamclient.bat @@ -1,36 +1,141 @@ @echo off cd /d "%~dp0" -IF NOT EXIST build ( mkdir build ) -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\debug\x86 ( mkdir build\experimental_steamclient\debug\x86 ) -IF NOT EXIST build\experimental_steamclient\debug\x64 ( mkdir build\experimental_steamclient\debug\x64 ) -IF EXIST build\experimental_steamclient\debug\x86\*.* ( DEL /F /S /Q build\experimental_steamclient\debug\x86\*.* ) -IF EXIST build\experimental_steamclient\debug\x64\*.* ( DEL /F /S /Q build\experimental_steamclient\debug\x64\*.* ) +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\debug\x86\*.* ( DEL /F /S /Q build\experimental\steamclient\debug\x86\*.* ) +IF EXIST build\experimental\steamclient\debug\x64\*.* ( DEL /F /S /Q build\experimental\steamclient\debug\x64\*.* ) -IF NOT EXIST debug ( mkdir debug ) -IF NOT EXIST debug\experimental_steamclient ( mkdir debug\experimental_steamclient ) IF EXIST debug\experimental_steamclient\*.* ( DEL /F /S /Q debug\experimental_steamclient\*.* ) -call build_set_protobuf_directories.bat - setlocal + +IF DEFINED SKIP_X86 GOTO LK_X64 + "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x86.bat -SET OLD_DIR=%cd% -cd build\experimental_steamclient\debug\x86 -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /I%OLD_DIR%/ImGui /I%OLD_DIR%/%PROTOBUF_X86_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD /DEMU_OVERLAY /I%OLD_DIR%/overlay_experimental %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc %OLD_DIR%/detours/*.cpp %OLD_DIR%/controller/gamepad.c %OLD_DIR%/ImGui/*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_dx*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_win32.cpp %OLD_DIR%/ImGui/backends/imgui_impl_vulkan.cpp %OLD_DIR%/ImGui/backends/imgui_impl_opengl3.cpp %OLD_DIR%/ImGui/backends/imgui_win_shader_blobs.cpp %OLD_DIR%/overlay_experimental/*.cpp %OLD_DIR%/overlay_experimental/windows/*.cpp %OLD_DIR%/overlay_experimental/System/*.cpp "%OLD_DIR%/%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\experimental_steamclient\steamclient.pdb /link /OUT:%OLD_DIR%\debug\experimental_steamclient\steamclient.dll -cl %OLD_DIR%/steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Ox /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\experimental_steamclient\steamclient_loader_x32.pdb /link /OUT:%OLD_DIR%\debug\experimental_steamclient\steamclient_loader_x32.exe + +REM Non-STEAMCLIENT_DLL debug sc_deps. +cd "%OLD_DIR%\build\experimental_steamclient\debug\x86\sc_deps" +cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\SC_DEPS.BLD +IF EXIST %CDS_DIR%\DEBUG_SC_DEPS_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_SC_DEPS_X86.LKS ) +where "*.obj" > %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 -SET OLD_DIR=%cd% -cd build\experimental_steamclient\debug\x64 -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /I%OLD_DIR%/ImGui /I%OLD_DIR%/%PROTOBUF_X64_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD /DEMU_OVERLAY /I%OLD_DIR%/overlay_experimental %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc %OLD_DIR%/detours/*.cpp %OLD_DIR%/controller/gamepad.c %OLD_DIR%/ImGui/*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_dx*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_win32.cpp %OLD_DIR%/ImGui/backends/imgui_impl_vulkan.cpp %OLD_DIR%/ImGui/backends/imgui_impl_opengl3.cpp %OLD_DIR%/ImGui/backends/imgui_win_shader_blobs.cpp %OLD_DIR%/overlay_experimental/*.cpp %OLD_DIR%/overlay_experimental/windows/*.cpp %OLD_DIR%/overlay_experimental/System/*.cpp "%OLD_DIR%/%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\experimental_steamclient\steamclient64.pdb /link /OUT:%OLD_DIR%\debug\experimental_steamclient\steamclient64.dll -cl %OLD_DIR%/steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Ox /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\experimental_steamclient\steamclient_loader_x64.pdb /link /OUT:%OLD_DIR%\debug\experimental_steamclient\steamclient_loader_x64.exe + +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 index 0ae8792..7ad250e 100644 --- a/build_win_debug_lobby_connect.bat +++ b/build_win_debug_lobby_connect.bat @@ -1,25 +1,46 @@ @echo off cd /d "%~dp0" -IF NOT EXIST build ( mkdir build ) -IF NOT EXIST build\debug ( mkdir build\debug ) -IF NOT EXIST build\debug\lobby_connect ( mkdir build\debug\lobby_connect ) -IF NOT EXIST build\debug\lobby_connect\x86 ( mkdir build\debug\lobby_connect\x86 ) +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 NOT EXIST debug ( mkdir debug ) -IF NOT EXIST debug\lobby_connect ( mkdir debug\lobby_connect ) IF EXIST debug\lobby_connect\*.* ( DEL /F /S /Q debug\lobby_connect\*.* ) -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\debug\lobby_connect\x86 -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /DNO_DISK_WRITES /DLOBBY_CONNECT /DEMU_RELEASE_BUILD /I%OLD_DIR%/%PROTOBUF_X86_DIRECTORY%\include\ %OLD_DIR%/lobby_connect.cpp %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc "%OLD_DIR%/%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Comdlg32.lib /EHsc /MP12 /Ox /DDEBUG:FULL /Zi /Fd:%OLD_DIR%\debug\lobby_connect\lobby_connect.pdb /link /OUT:%OLD_DIR%\debug\lobby_connect\lobby_connect.exe +cd %OLD_DIR%\build\lobby_connect\debug\x86 + +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% -copy Readme_lobby_connect.txt debug\lobby_connect\Readme.txt 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 /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 ca77c84..36f834e 100755 --- a/build_win_find_interfaces.bat +++ b/build_win_find_interfaces.bat @@ -1,20 +1,39 @@ @echo off cd /d "%~dp0" -IF NOT EXIST build ( mkdir build ) -IF NOT EXIST build\release ( mkdir build\release ) -IF NOT EXIST build\release\tools ( mkdir build\release\tools ) -IF NOT EXIST build\release\tools\x86 ( mkdir build\release\tools\x86 ) -IF EXIST build\release\tools\x86\*.* ( DEL /F /S /Q build\release\tools\x86\*.* ) +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 NOT EXIST release\tools ( mkdir release\tools ) IF EXIST release\tools\*.* ( DEL /F /S /Q release\tools\*.* ) setlocal call build_env_x86.bat -SET OLD_DIR=%cd% -cd build\release\tools\x86 -cl %OLD_DIR%/generate_interfaces_file.cpp /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\tools\generate_interfaces_file.exe +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% -copy Readme_generate_interfaces.txt release\tools\Readme_generate_interfaces.txt 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 046f957..09f194b 100755 --- a/build_win_lobby_connect.bat +++ b/build_win_lobby_connect.bat @@ -1,23 +1,46 @@ @echo off cd /d "%~dp0" -IF NOT EXIST build ( mkdir build ) -IF NOT EXIST build\release ( mkdir build\release ) -IF NOT EXIST build\release\lobby_connect ( mkdir build\release\lobby_connect ) -IF NOT EXIST build\release\lobby_connect\x86 ( mkdir build\release\lobby_connect\x86 ) -IF EXIST build\release\lobby_connect\x86\*.* ( DEL /F /S /Q build\release\lobby_connect\x86\*.* ) +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 NOT EXIST release\lobby_connect ( mkdir release\lobby_connect ) IF EXIST release\lobby_connect\*.* ( DEL /F /S /Q release\lobby_connect\*.* ) -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\release\lobby_connect\x86 -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /DNO_DISK_WRITES /DLOBBY_CONNECT /DEMU_RELEASE_BUILD /DNDEBUG /I%OLD_DIR%/%PROTOBUF_X86_DIRECTORY%\include\ %OLD_DIR%/lobby_connect.cpp %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc "%OLD_DIR%/%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Comdlg32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\lobby_connect\lobby_connect.exe +cd %OLD_DIR%\build\lobby_connect\release\x86 + +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% -copy Readme_lobby_connect.txt release\lobby_connect\Readme.txt 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 /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 a89eae0..31e3854 100755 --- a/build_win_release.bat +++ b/build_win_release.bat @@ -1,42 +1,51 @@ @echo off cd /d "%~dp0" -IF NOT EXIST build ( mkdir build ) -IF NOT EXIST build\release ( mkdir build\release ) -IF NOT EXIST build\release\x86 ( mkdir build\release\x86 ) -IF NOT EXIST build\release\x64 ( mkdir build\release\x64 ) +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 NOT EXIST release ( mkdir release ) 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 ) -call build_set_protobuf_directories.bat - -SET OLD_DIR=%cd% - setlocal "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x86.bat -cd build\release\x86 -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DNDEBUG /I%OLD_DIR%/%PROTOBUF_X86_DIRECTORY%\include\ %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc "%OLD_DIR%/%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\steam_api.dll +cd %OLD_DIR%\build\release\x86 + +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 -cd build\release\x64 -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DNDEBUG /I%OLD_DIR%/%PROTOBUF_X64_DIRECTORY%\include\ %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc "%OLD_DIR%/%PROTOBUF_X64_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\steam_api64.dll +cd %OLD_DIR%\build\release\x64 + +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 0e7d6ad..faa8230 100755 --- a/build_win_release_experimental.bat +++ b/build_win_release_experimental.bat @@ -1,37 +1,9 @@ @echo off cd /d "%~dp0" -IF NOT EXIST build ( mkdir build ) -IF NOT EXIST build\experimental ( mkdir build\experimental ) -IF NOT EXIST build\experimental\release ( mkdir build\experimental\release ) -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 EXIST build\experimental\release\x86\*.* ( DEL /F /S /Q build\experimental\release\x86\*.* ) -IF EXIST build\experimental\release\x64\*.* ( DEL /F /S /Q build\experimental\release\x64\*.* ) -IF NOT EXIST release\experimental ( mkdir release\experimental ) -IF EXIST release\experimental\*.* ( DEL /F /S /Q release\experimental\*.* ) +IF NOT "%1" == "" ( SET JOB_COUNT=%~1 ) -call build_set_protobuf_directories.bat +SET SKIP_EXPERIMENTAL_STEAMCLIENT_BUILD=1 +SET SKIP_STEAMCLIENT_LOADER=1 -setlocal -"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto -call build_env_x86.bat -SET OLD_DIR=%cd% -cd "build\experimental\release\x86" -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /I%OLD_DIR%/ImGui /I%OLD_DIR%/%PROTOBUF_X86_DIRECTORY%\include\ /I%OLD_DIR%/overlay_experimental %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc %OLD_DIR%/detours/*.cpp %OLD_DIR%/controller/gamepad.c %OLD_DIR%/ImGui/*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_dx*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_win32.cpp %OLD_DIR%/ImGui/backends/imgui_impl_vulkan.cpp %OLD_DIR%/ImGui/backends/imgui_impl_opengl3.cpp %OLD_DIR%/ImGui/backends/imgui_win_shader_blobs.cpp %OLD_DIR%/overlay_experimental/*.cpp %OLD_DIR%/overlay_experimental/windows/*.cpp %OLD_DIR%/overlay_experimental/System/*.cpp "%OLD_DIR%/%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\experimental\steam_api.dll -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG %OLD_DIR%/steamclient.cpp /EHsc /MP4 /Ox /link /OUT:%OLD_DIR%\release\experimental\steamclient.dll -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 "%OLD_DIR%\build\experimental\release\x64" -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /I%OLD_DIR%/ImGui /I%OLD_DIR%/%PROTOBUF_X64_DIRECTORY%\include\ /I%OLD_DIR%/overlay_experimental %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc %OLD_DIR%/detours/*.cpp %OLD_DIR%/controller/gamepad.c %OLD_DIR%/ImGui/*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_dx*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_win32.cpp %OLD_DIR%/ImGui/backends/imgui_impl_vulkan.cpp %OLD_DIR%/ImGui/backends/imgui_impl_opengl3.cpp %OLD_DIR%/ImGui/backends/imgui_win_shader_blobs.cpp %OLD_DIR%/overlay_experimental/*.cpp %OLD_DIR%/overlay_experimental/windows/*.cpp %OLD_DIR%/overlay_experimental/System/*.cpp "%OLD_DIR%/%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\experimental\steam_api64.dll -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG %OLD_DIR%/steamclient.cpp /EHsc /MP4 /Ox /link /OUT:%OLD_DIR%\release\experimental\steamclient64.dll -cd %OLD_DIR% -copy Readme_experimental.txt release\experimental\Readme.txt -endlocal +call build_win_release_experimental_steamclient.bat diff --git a/build_win_release_experimental_steamclient.bat b/build_win_release_experimental_steamclient.bat index 5ff6d23..800c195 100644 --- a/build_win_release_experimental_steamclient.bat +++ b/build_win_release_experimental_steamclient.bat @@ -1,38 +1,141 @@ @echo off cd /d "%~dp0" -IF NOT EXIST build ( mkdir build ) -IF NOT EXIST build\experimental ( mkdir build\experimental ) -IF NOT EXIST build\experimental\steamclient ( mkdir build\experimental\steamclient ) -IF NOT EXIST build\experimental\steamclient\release ( mkdir build\experimental\steamclient\release ) -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 ) + +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 NOT EXIST release\experimental_steamclient ( mkdir release\experimental_steamclient ) IF EXIST release\experimental_steamclient\*.* ( DEL /F /S /Q release\experimental_steamclient\*.* ) -call build_set_protobuf_directories.bat - setlocal + +IF DEFINED SKIP_X86 GOTO LK_X64 + "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x86.bat -SET OLD_DIR=%cd% -cd "build\experimental\steamclient\release\x86" -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /I%OLD_DIR%/ImGui /DNDEBUG /I%OLD_DIR%/%PROTOBUF_X86_DIRECTORY%\include\ /I%OLD_DIR%/overlay_experimental %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc %OLD_DIR%/detours/*.cpp %OLD_DIR%/controller/gamepad.c %OLD_DIR%/ImGui/*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_dx*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_win32.cpp %OLD_DIR%/ImGui/backends/imgui_impl_vulkan.cpp %OLD_DIR%/ImGui/backends/imgui_impl_opengl3.cpp %OLD_DIR%/ImGui/backends/imgui_win_shader_blobs.cpp %OLD_DIR%/overlay_experimental/*.cpp %OLD_DIR%/overlay_experimental/windows/*.cpp %OLD_DIR%/overlay_experimental/System/*.cpp "%OLD_DIR%/%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\experimental_steamclient\steamclient.dll -cl %OLD_DIR%/steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\experimental_steamclient\steamclient_loader_x32.exe + +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% -copy steamclient_loader\ColdClientLoader.ini release\experimental_steamclient\ + +: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 -SET OLD_DIR=%cd% -cd "build\experimental\steamclient\release\x64" -cl %OLD_DIR%/dll/rtlgenrandom.c %OLD_DIR%/dll/rtlgenrandom.def -cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /I%OLD_DIR%/ImGui /DNDEBUG /I%OLD_DIR%/%PROTOBUF_X64_DIRECTORY%\include\ /I%OLD_DIR%/overlay_experimental %OLD_DIR%/dll/*.cpp %OLD_DIR%/dll/*.cc %OLD_DIR%/detours/*.cpp %OLD_DIR%/controller/gamepad.c %OLD_DIR%/ImGui/*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_dx*.cpp %OLD_DIR%/ImGui/backends/imgui_impl_win32.cpp %OLD_DIR%/ImGui/backends/imgui_impl_vulkan.cpp %OLD_DIR%/ImGui/backends/imgui_impl_opengl3.cpp %OLD_DIR%/ImGui/backends/imgui_win_shader_blobs.cpp %OLD_DIR%/overlay_experimental/*.cpp %OLD_DIR%/overlay_experimental/windows/*.cpp %OLD_DIR%/overlay_experimental/System/*.cpp "%OLD_DIR%/%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\experimental_steamclient\steamclient64.dll -cl %OLD_DIR%/steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:%OLD_DIR%\release\experimental_steamclient\steamclient_loader_x64.exe + +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 -endlocal \ No newline at end of file diff --git a/dll/base.cpp b/dll/base.cpp index 507e034..10d3622 100644 --- a/dll/base.cpp +++ b/dll/base.cpp @@ -19,14 +19,37 @@ #ifdef __WINDOWS__ +HMODULE hadvapi32 = NULL; +BOOLEAN (NTAPI *real_RtlGenRandom)(PVOID,ULONG) = NULL; + static void randombytes(char * const buf, const size_t size) { - while (!RtlGenRandom((PVOID) buf, (ULONG) size)) { - PRINT_DEBUG("RtlGenRandom ERROR\n"); - Sleep(100); + PRINT_DEBUG("%s %p %zu.\n", "mine_RtlGenRandom() called.", buf, size); + if (hadvapi32 == NULL) { + hadvapi32 = GetModuleHandleW(L"advapi32.dll"); + if (hadvapi32 == NULL) { + PRINT_DEBUG("%s.\n", "GetModuleHandle() failed for advapi32.dll"); + } + PRINT_DEBUG("advapi32.dll handle: 0x%x.\n", hadvapi32); } - + if (hadvapi32 != NULL && + real_RtlGenRandom == NULL) { + real_RtlGenRandom = (BOOLEAN(NTAPI *)(PVOID,ULONG))GetProcAddress(hadvapi32, "SystemFunction036"); + if (real_RtlGenRandom == NULL) { + PRINT_DEBUG("%s.\n", "GetProcAddress() failed for RtlGenRandom()"); + } + PRINT_DEBUG("real_RtlGenRandom address: 0x%p.\n", real_RtlGenRandom); + } + if (real_RtlGenRandom != NULL) { + PRINT_DEBUG("%s.\n", "Calling real_RtlGenRandom"); + while (!real_RtlGenRandom((PVOID) buf, (ULONG) size)) { + PRINT_DEBUG("RtlGenRandom ERROR\n"); + Sleep(100); + } + PRINT_DEBUG("%s.\n", "real_RtlGenRandom returned"); + } + return; } std::string get_env_variable(std::string name) diff --git a/dll/rtlgenrandom.c b/dll/rtlgenrandom.c deleted file mode 100644 index e160da4..0000000 --- a/dll/rtlgenrandom.c +++ /dev/null @@ -1,4 +0,0 @@ -#include -#define RtlGenRandom SystemFunction036 -#define DLLEXPORT __declspec(dllexport) -DLLEXPORT BOOLEAN WINAPI RtlGenRandom(PVOID in, ULONG len) {} \ No newline at end of file diff --git a/dll/rtlgenrandom.def b/dll/rtlgenrandom.def deleted file mode 100644 index 3f23d20..0000000 --- a/dll/rtlgenrandom.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY advapi32.dll -EXPORTS -SystemFunction036 \ No newline at end of file diff --git a/dll/settings_parser.cpp b/dll/settings_parser.cpp index ef34316..af56f73 100644 --- a/dll/settings_parser.cpp +++ b/dll/settings_parser.cpp @@ -217,9 +217,39 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s load_custom_broadcasts(Local_Storage::get_game_settings_path() + "custom_master_server.txt", custom_master_server); // Acount name - char name[32] = {}; + char name[32] = { '\0' }; if (local_storage->get_data_settings("account_name.txt", name, sizeof(name) - 1) <= 0) { - strcpy(name, DEFAULT_NAME); + PRINT_DEBUG("%s.\n", "Attempting to set steam user name from system user name"); +#if defined(STEAM_WIN32) + DWORD username_dword = 32; + wchar_t username[32] = { '\0' }; + if (GetUserNameW((wchar_t*)&username, &username_dword) == TRUE) { + std::wstring username_wstr(username); + std::string username_str = utf8_encode(username_wstr); + size_t username_len = username_str.length(); + if (username_len > 0 && + username_len < 31) { + memcpy(&name, username_str.c_str(), username_len); + name[31] = '\0'; + } + } +#else + char * env_username = getenv("USER"); + if (env_username != NULL) { + size_t username_len = strlen(env_username); + if (username_len > 0 && + username_len < 31) { + memcpy(&name, env_username, username_len); + name[31] = '\0'; + } + } +#endif + char empty_name[32] = { '\0' }; + if (memcmp(name, empty_name, 32) == 0) { + PRINT_DEBUG("%s %s.\n", "Setting steam user name to", DEFAULT_NAME); + strcpy(name, DEFAULT_NAME); + } + PRINT_DEBUG("Username: %s.\n", name); local_storage->store_data_settings("account_name.txt", name, strlen(name)); } diff --git a/generate_all_deps.bat b/generate_all_deps.bat new file mode 100644 index 0000000..974ec06 --- /dev/null +++ b/generate_all_deps.bat @@ -0,0 +1,57 @@ +@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 /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 /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 /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 /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..0372b1a --- /dev/null +++ b/generate_build_win.bat @@ -0,0 +1,406 @@ +@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 +echo advapi32.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 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 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 9e3ef47..0000000 --- a/generate_build_win_bat.py +++ /dev/null @@ -1,132 +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"] -lobby_connect_args = ["/DNO_DISK_WRITES", "/DLOBBY_CONNECT"] - -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 -mkdir release\lobby_connect -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\\ -REM call build_win_lobby_connect.bat -copy Readme_lobby_connect.txt release\lobby_connect\Readme.txt -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("./", "lobby_connect.cpp") + files_from_dir("dll", "flat.cpp") + files_from_dir("dll", "dll.cpp") + lobby_connect_args + normal_build_args + release_build_args + includes_32 + proto_deps + steam_deps + normal_linker_libs + ["Comdlg32.lib", "user32.lib"], linker_32 + ["/debug:none", "/OUT:release\lobby_connect\lobby_connect.exe"]) - -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) From ae6e1829dd222b92c5d293d41bf6df9b8ac625eb Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Wed, 12 Feb 2025 09:32:46 -0500 Subject: [PATCH 17/17] CI: Use winehq.org's rpm until fedora 40 goes EOL. Otherwise, we'll be constantly changing the URL in the CI yml everytime Wine makes a new point release. --- .gitlab-ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1a7612e..e054e77 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,11 +66,16 @@ build_windows: - 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/ + # Ancient CI version of wine doesn't support the where.exe cmd. (It's a stub.) Use the version from wine-10.1. + # Note: This can use the fedora archive once f40 goes eol (~ 5/28/2025) and wine 10.x gets locked into their archive server. + # (Can't use it before then due to newer wine point releases changing the URL....) + #- wget 'https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/39/Everything/x86_64/os/Packages/w/wine-core-10.0-1.fc41.i686.rpm' + #- 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/ + - wget 'https://dl.winehq.org/wine-builds/fedora/41/x86_64/wine-devel-10.0.0-1.1.x86_64.rpm' + - echo './opt/wine-devel/lib64/wine/i386-windows/where.exe' > extract.txt; rpm2cpio wine-devel-10.0.0-1.1.x86_64.rpm | cpio -ivdE extract.txt; rm -f extract.txt + - /usr/bin/mv -f ./opt/wine-devel/lib64/wine/i386-windows/where.exe wine/; rm -rf ./opt/ - /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