diff --git a/Readme_lobby_connect.txt b/Readme_lobby_connect.txt index 10626f8..22d5ccf 100644 --- a/Readme_lobby_connect.txt +++ b/Readme_lobby_connect.txt @@ -7,4 +7,3 @@ Most steam games also let you join lobbies in game without having started the ga Just run this tool and follow the instructions then pick the exe of the game. Make sure that you have installed my emu on the game first and that it works or it won't work. -If you want to help me improve it, the source can be found in the source folder. diff --git a/build_steamos.sh b/build_steamos.sh index e89aab5..b5d9f84 100644 --- a/build_steamos.sh +++ b/build_steamos.sh @@ -1,7 +1,11 @@ +set -e rm -rf linux mkdir -p linux/x86 mkdir -p linux/x86_64 +mkdir -p linux/lobby_connect ../protobuf/prefix_x86/bin/protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -s -o linux/x86/libsteam_api.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -std=c++11 && echo built32 +g++ -m32 -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x86 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -std=c++11 && echo built_lobby_connect32 ../protobuf/prefix/bin/protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -s -o linux/x86_64/libsteam_api.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -std=c++11 && echo built64 +g++ -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x64 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -std=c++11 && echo built_lobby_connect64 diff --git a/build_win_lobby_connect.bat b/build_win_lobby_connect.bat index 309bdd3..a2fbd18 100644 --- a/build_win_lobby_connect.bat +++ b/build_win_lobby_connect.bat @@ -4,9 +4,7 @@ call build_set_protobuf_directories.bat %PROTOBUF_X86_DIRECTORY%%PROTOC_DIRECTORY% -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto call build_env_x86.bat cl dll/rtlgenrandom.c dll/rtlgenrandom.def -cl /DNO_DISK_WRITES /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ lobby_connect.cpp dll/*.cpp dll/*.cc %PROTOBUF_X86_DIRECTORY%%PROTOBUF_LIBRARY% Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Comdlg32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\lobby_connect\lobby_connect.exe +cl /DNO_DISK_WRITES /DLOBBY_CONNECT /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ lobby_connect.cpp dll/*.cpp dll/*.cc %PROTOBUF_X86_DIRECTORY%%PROTOBUF_LIBRARY% Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Comdlg32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\lobby_connect\lobby_connect.exe del /Q /S release\lobby_connect\*.lib del /Q /S release\lobby_connect\*.exp copy Readme_lobby_connect.txt release\lobby_connect\Readme.txt -mkdir release\lobby_connect\source\ -copy lobby_connect.cpp release\lobby_connect\source\ diff --git a/dll/settings.h b/dll/settings.h index fbfa195..93447fc 100644 --- a/dll/settings.h +++ b/dll/settings.h @@ -43,6 +43,11 @@ class Settings { std::vector DLCs; std::vector mods; public: +#ifdef LOBBY_CONNECT + static const bool is_lobby_connect = true; +#else + static const bool is_lobby_connect = false; +#endif static std::string sanitize(std::string name); Settings(CSteamID steam_id, CGameID game_id, std::string name, std::string language); CSteamID get_local_steam_id(); diff --git a/dll/steam_friends.h b/dll/steam_friends.h index 5d55b91..1fbc844 100644 --- a/dll/steam_friends.h +++ b/dll/steam_friends.h @@ -75,10 +75,10 @@ void rich_presence_updated(CSteamID id, AppId_t appid) callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); } -bool isSameAppId(Friend *f) +bool isAppIdCompatible(Friend *f) { - //in my emu 0 appid is the same as any appid, it's useful for things like my lobby connect program - if (!settings->get_local_game_id().AppID()) return true; + if (settings->is_lobby_connect) return true; + if (f == &us) return true; return settings->get_local_game_id().AppID() == f->appid(); } diff --git a/lobby_connect.cpp b/lobby_connect.cpp index d44ce6c..8743ecd 100644 --- a/lobby_connect.cpp +++ b/lobby_connect.cpp @@ -1,15 +1,21 @@ +/* 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 + . */ + /* -This is the source code for the lobby_connect.exe program. -If you want to build it, just dl the steam sdk and link it to the steam api dll -Then to execute it just use my emu dll instead of the steam sdk dll. - -If you make any improvements and want to share them post your code in the thread and if it improves it I'll use it. - -You can also use this code to add this functionality to your launchers. - -Note if you use my steam emu dll: When I build my lobby_connect.exe I static link it to a build of my emu that has reading from disk disabled. -This means that it's a good idea for you to use local_save.txt so that your launcher doesn't conflict with running -games by having the same steam user id. There must also be no steam_appid.txt or else you will only see games with that appid. */ #include "sdk_includes/steam_api.h" @@ -20,8 +26,12 @@ games by having the same steam user id. There must also be no steam_appid.txt or #include #include #include -#include +#ifdef _WIN32 +#include +#else + +#endif int main() { if (SteamAPI_Init()) { //Set appid to: LOBBY_CONNECT_APPID @@ -75,6 +85,7 @@ 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; OPENFILENAMEA ofn; @@ -106,5 +117,8 @@ top: &lpProcessInfo ); } +#else + std::cout << "Please launch the game with these arguments: " << arguments[choice] << std::endl; +#endif } }