From e9513d47337f41e74bab2e041563a102eb57d836 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Wed, 8 Jan 2020 18:43:18 -0500 Subject: [PATCH] Add linux steamclient builds. --- build_steamos.sh | 3 +++ dll/dll.h | 2 +- dll/steam_client.cpp | 1 + scripts/steamclient_loader.sh | 24 ++++++++++++++++++++++++ sdk_includes/steam_api_common.h | 20 +++++++++++++------- 5 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 scripts/steamclient_loader.sh diff --git a/build_steamos.sh b/build_steamos.sh index 11f799d..ef0423e 100755 --- a/build_steamos.sh +++ b/build_steamos.sh @@ -5,9 +5,12 @@ mkdir -p linux/x86_64 mkdir -p linux/lobby_connect mkdir -p linux/tools cp scripts/find_interfaces.sh linux/tools/ +cp scripts/steamclient_loader.sh linux/tools/ ../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 +g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DSTEAMCLIENT_DLL -DNDEBUG -s -o linux/x86/steamclient.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_steamclient ../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 +g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DSTEAMCLIENT_DLL -DNDEBUG -s -o linux/x86_64/steamclient.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -std=c++11 && echo built64_steamclient diff --git a/dll/dll.h b/dll/dll.h index f8f6642..49eefd2 100644 --- a/dll/dll.h +++ b/dll/dll.h @@ -19,7 +19,7 @@ #ifdef STEAMCLIENT_DLL #define STEAMAPI_API static -#define STEAMCLIENT_API S_API +#define STEAMCLIENT_API S_API_EXPORT #else #define STEAMAPI_API S_API #define STEAMCLIENT_API static diff --git a/dll/steam_client.cpp b/dll/steam_client.cpp index e8bbf1c..a06834a 100644 --- a/dll/steam_client.cpp +++ b/dll/steam_client.cpp @@ -162,6 +162,7 @@ HSteamPipe Steam_Client::CreateSteamPipe() bool Steam_Client::BReleaseSteamPipe( HSteamPipe hSteamPipe ) { PRINT_DEBUG("BReleaseSteamPipe\n"); + return true; } // connects to an existing global user, failing if none exists diff --git a/scripts/steamclient_loader.sh b/scripts/steamclient_loader.sh new file mode 100644 index 0000000..4ef3cb6 --- /dev/null +++ b/scripts/steamclient_loader.sh @@ -0,0 +1,24 @@ +#!/bin/bash +APP_PATH=./example_executable +APP_ID=480 + +set -e +mkdir -p ~/.steam/sdk64 +mkdir -p ~/.steam/sdk32 +#make a backup of original files +mv ~/.steam/steam.pid ~/.steam/steam.pid.orig || true +mv ~/.steam/sdk64/steamclient.so ~/.steam/sdk64/steamclient.so.orig || true +mv ~/.steam/sdk32/steamclient.so ~/.steam/sdk32/steamclient.so.orig || true +#copy our files +cp x86/steamclient.so ~/.steam/sdk32/steamclient.so +cp x86_64/steamclient.so ~/.steam/sdk64/steamclient.so +echo $BASHPID > ~/.steam/steam.pid +SteamAppId=$APP_ID SteamGameId=$APP_ID $APP_PATH + +#restore original +rm -f ~/.steam/steam.pid +rm -f ~/.steam/sdk64/steamclient.so +rm -f ~/.steam/sdk32/steamclient.so +mv ~/.steam/steam.pid.orig ~/.steam/steam.pid +mv ~/.steam/sdk64/steamclient.so.orig ~/.steam/sdk64/steamclient.so || true +mv ~/.steam/sdk32/steamclient.so.orig ~/.steam/sdk32/steamclient.so || true diff --git a/sdk_includes/steam_api_common.h b/sdk_includes/steam_api_common.h index e8d0a1d..44c8291 100644 --- a/sdk_includes/steam_api_common.h +++ b/sdk_includes/steam_api_common.h @@ -19,26 +19,32 @@ // S_API defines the linkage and calling conventions for steam_api.dll exports #if defined( STEAM_WIN32 ) && !defined( _X360 ) #if defined( STEAM_API_EXPORTS ) - #define S_API extern "C" __declspec( dllexport ) + #define S_API_EXPORT extern "C" __declspec( dllexport ) #elif defined( STEAM_API_NODLL ) - #define S_API extern "C" + #define S_API_EXPORT extern "C" #else - #define S_API extern "C" __declspec( dllimport ) + #define S_API_EXPORT extern "C" __declspec( dllimport ) #endif // STEAM_API_EXPORTS #elif defined( GNUC ) #if defined( STEAM_API_EXPORTS ) - #define S_API extern "C" __attribute__ ((visibility("default"))) + #define S_API_EXPORT extern "C" __attribute__ ((visibility("default"))) #else - #define S_API extern "C" + #define S_API_EXPORT extern "C" #endif // STEAM_API_EXPORTS #else // !WIN32 #if defined( STEAM_API_EXPORTS ) - #define S_API extern "C" + #define S_API_EXPORT extern "C" #else - #define S_API extern "C" + #define S_API_EXPORT extern "C" #endif // STEAM_API_EXPORTS #endif +#ifdef STEAMCLIENT_DLL +#define S_API static +#else +#define S_API S_API_EXPORT +#endif + #if ( defined(STEAM_API_EXPORTS) || defined(STEAM_API_NODLL) ) && !defined(API_GEN) #define STEAM_PRIVATE_API( ... ) __VA_ARGS__ #elif defined(STEAM_API_EXPORTS) && defined(API_GEN)