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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] 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/30] Update .gitlab-ci.yml file to skip building the PDBs. (CI throws errors and skips building the PE files.) --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c158841..35113e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,12 +72,15 @@ build_windows: - DLL_FILES="$(ls dll/*.cpp | tr "\n" " ")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat - DLL_FILES="$(ls dll/*.proto | tr "\n" " " | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat - sed "s| /MP12 | /MP4 |g" -i *.bat + # CI can't produce PDBs. Throws a bunch of errors, and skips building the PEs. + - sed "s| /DDEBUG\:FULL | |g" -i *.bat - python generate_build_win_bat.py - export WINEDEBUG=-all - wine cmd /c build_win_release_test.bat artifacts: paths: - release/ + - debug/ expire_in: 1 day build_cmake_linux: From 36adbce8fbe9647eb15f1d87e77b94c01efdc9d3 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 02:40:46 +0000 Subject: [PATCH 16/30] Update .gitlab-ci.yml file Try disabling the DLL_FILES sed commands. (The BATs should handle this anyway....) --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35113e2..29679e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,8 +69,8 @@ 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" " ")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat + #- DLL_FILES="$(ls dll/*.proto | tr "\n" " " | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat - sed "s| /MP12 | /MP4 |g" -i *.bat # CI can't produce PDBs. Throws a bunch of errors, and skips building the PEs. - sed "s| /DDEBUG\:FULL | |g" -i *.bat From 86084d7c6e7fcd8dc13f96446ec3c969f320e651 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 03:12:12 +0000 Subject: [PATCH 17/30] Update .gitlab-ci.yml file Try building lobby_connect win release using the bat file in the repo. --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 29679e7..e7b252c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -77,6 +77,7 @@ build_windows: - python generate_build_win_bat.py - export WINEDEBUG=-all - wine cmd /c build_win_release_test.bat + - wine cmd /c build_win_lobby_connect.bat artifacts: paths: - release/ From 0276fa99da3853c5df886f918a3807b9d3871f15 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 03:13:59 +0000 Subject: [PATCH 18/30] Update .gitlab-ci.yml file Dump the built bat file. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7b252c..9ee6af6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -77,7 +77,7 @@ build_windows: - python generate_build_win_bat.py - export WINEDEBUG=-all - wine cmd /c build_win_release_test.bat - - wine cmd /c build_win_lobby_connect.bat + - cp build_win_release_test.bat release/build_win_release_test.bat artifacts: paths: - release/ From 9f4c48cdc617785cabde2fd5dbff392a500529eb Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 03:32:05 +0000 Subject: [PATCH 19/30] Update .gitlab-ci.yml file Re-enable sed commands. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ee6af6..35c08fe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,8 +69,8 @@ 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" " ")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat + - DLL_FILES="$(ls dll/*.proto | tr "\n" " " | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat - sed "s| /MP12 | /MP4 |g" -i *.bat # CI can't produce PDBs. Throws a bunch of errors, and skips building the PEs. - sed "s| /DDEBUG\:FULL | |g" -i *.bat From 01e9208d883c17805be5293b1656181d591c2331 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 03:35:51 +0000 Subject: [PATCH 20/30] Update .gitlab-ci.yml file Try fixing translate cmds. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35c08fe..1b5029b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,7 +69,7 @@ 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/*.cpp | tr "\n" " " | tr "/" "\\")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat - DLL_FILES="$(ls dll/*.proto | tr "\n" " " | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat - sed "s| /MP12 | /MP4 |g" -i *.bat # CI can't produce PDBs. Throws a bunch of errors, and skips building the PEs. From 60aac21320b4774527640377ac312e0159baeff4 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 03:38:05 +0000 Subject: [PATCH 21/30] Update .gitlab-ci.yml file Try fixing translate cmds. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1b5029b..3911821 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -70,7 +70,7 @@ build_windows: - 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" " " | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$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 From fcf1ea94a420c0ba49dcc45d21a4d84421d8b5c4 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 07:13:09 +0000 Subject: [PATCH 22/30] Update .gitlab-ci.yml file Try fixing translate cmds. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3911821..826a91a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,8 +69,8 @@ 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" " " | 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 + - 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 From 117ad9ec75f5f93dd2ee21cc5cfaff4485e9447b Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 07:15:41 +0000 Subject: [PATCH 23/30] Update .gitlab-ci.yml file Try fixing translate cmds. --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 826a91a..98989b5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,6 +74,8 @@ build_windows: - 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 From 3ff16f75f421ff0518b16f2614f57a039f7fe4ca Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 07:58:04 +0000 Subject: [PATCH 24/30] Edit generate_build_win_bat.py Add lobby_connect.exe --- generate_build_win_bat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generate_build_win_bat.py b/generate_build_win_bat.py index f24b6bc..efbcc52 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 @@ -81,7 +82,7 @@ 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 call build_win_find_interfaces.bat """ @@ -116,6 +117,8 @@ out += generate_common(includes_32, linker_32, "steam_api.dll", "steamclient.dll out += cl_line_exe(files_from_dir("steamclient_loader", ".cpp") + ["advapi32.lib", "user32.lib"] + normal_build_args, ["/debug:none", "/OUT:release\experimental_steamclient\steamclient_loader.exe"]) +out += cl_line_exe(files_from_dir("./", "lobby_connect.cpp") + lobby_connect_args + normal_build_args + release_build_args + includes_32 + proto_deps + steam_deps + normal_linker_libs + ["Comdlg32.lib", "user32.lib"], ["/debug:none", "/OUT:release\lobby_connect\lobby_connect.exe"] + linker_32) + out += head_64bit out += generate_common(includes_64, linker_64, "steam_api64.dll", "steamclient64.dll") From fec0391a7e5103d1da3898a300eb63c83e3c45f9 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 08:21:16 +0000 Subject: [PATCH 25/30] Edit generate_build_win_bat.py Fix up lobby_connect. --- generate_build_win_bat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generate_build_win_bat.py b/generate_build_win_bat.py index efbcc52..cefd286 100644 --- a/generate_build_win_bat.py +++ b/generate_build_win_bat.py @@ -63,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 """ @@ -83,6 +84,7 @@ 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 """ From 0bf68ab25f300ca3f63b90b202bd0b52423a97b1 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 08:41:12 +0000 Subject: [PATCH 26/30] Edit generate_build_win_bat.py --- generate_build_win_bat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate_build_win_bat.py b/generate_build_win_bat.py index cefd286..404b910 100644 --- a/generate_build_win_bat.py +++ b/generate_build_win_bat.py @@ -117,9 +117,9 @@ 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("steamclient_loader", ".cpp") + ["advapi32.lib", "user32.lib"] + normal_build_args, ["/debug:none", "/OUT:release\experimental_steamclient\steamclient_loader.exe"]) +out += cl_line_exe(files_from_dir("./", "lobby_connect.cpp") + lobby_connect_args + normal_build_args + release_build_args + includes_32 + proto_deps + steam_deps + sc_different_deps + normal_linker_libs + ["Comdlg32.lib", "user32.lib"], ["/debug:none", "/OUT:release\lobby_connect\lobby_connect.exe"] + linker_32) -out += cl_line_exe(files_from_dir("./", "lobby_connect.cpp") + lobby_connect_args + normal_build_args + release_build_args + includes_32 + proto_deps + steam_deps + normal_linker_libs + ["Comdlg32.lib", "user32.lib"], ["/debug:none", "/OUT:release\lobby_connect\lobby_connect.exe"] + linker_32) +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") From 005c22440887169685f713cdfb1c4a683d822d37 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 04:10:45 -0500 Subject: [PATCH 27/30] More fixes. --- generate_build_win_bat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate_build_win_bat.py b/generate_build_win_bat.py index 404b910..2a01944 100644 --- a/generate_build_win_bat.py +++ b/generate_build_win_bat.py @@ -32,7 +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"] +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 @@ -117,7 +117,7 @@ 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") + lobby_connect_args + normal_build_args + release_build_args + includes_32 + proto_deps + steam_deps + sc_different_deps + normal_linker_libs + ["Comdlg32.lib", "user32.lib"], ["/debug:none", "/OUT:release\lobby_connect\lobby_connect.exe"] + linker_32) +out += cl_line_exe(files_from_dir("./", "lobby_connect.cpp") + lobby_connect_args + normal_build_args + release_build_args + includes_32 + proto_deps + steam_deps + files_from_dir("dll", ["flat.cpp", "dll.cpp"]) + 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"]) From a0215595e3d2fe24b15d97d8f35ab004d3095209 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 04:39:35 -0500 Subject: [PATCH 28/30] Just include them manually.... --- generate_build_win_bat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_build_win_bat.py b/generate_build_win_bat.py index 2a01944..9e3ef47 100644 --- a/generate_build_win_bat.py +++ b/generate_build_win_bat.py @@ -117,7 +117,7 @@ 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") + lobby_connect_args + normal_build_args + release_build_args + includes_32 + proto_deps + steam_deps + files_from_dir("dll", ["flat.cpp", "dll.cpp"]) + 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("./", "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"]) From 127fddeae8562ab907a1656c1c2eacbe9912de71 Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 02:40:46 +0000 Subject: [PATCH 29/30] Update .gitlab-ci.yml file Try disabling the DLL_FILES sed commands. (The BATs should handle this anyway....) --- .gitlab-ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35113e2..98989b5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,14 +69,17 @@ 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/ From 80819bd559c742fda48dc88cceed7f5675015d1b Mon Sep 17 00:00:00 2001 From: redpolline <11156324-redpolline@users.noreply.gitlab.com> Date: Fri, 31 Jan 2025 07:58:04 +0000 Subject: [PATCH 30/30] Edit generate_build_win_bat.py Add lobby_connect.exe --- generate_build_win_bat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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