Compare commits

..

2 Commits

Author SHA1 Message Date
Mr_Goldberg 4e6aa809de
Kill background thread on client shutdown. 2020-01-13 13:47:47 -05:00
Mr_Goldberg 71e265f52b
Add env variable to set app path. 2020-01-13 13:47:14 -05:00
3 changed files with 19 additions and 10 deletions

View File

@ -193,6 +193,15 @@ std::string get_lib_path() {
std::string get_full_program_path() std::string get_full_program_path()
{ {
std::string env_program_path = get_env_variable("SteamAppPath");
if (env_program_path.length()) {
if (env_program_path.back() != PATH_SEPARATOR[0]) {
env_program_path = env_program_path.append(PATH_SEPARATOR);
}
return env_program_path;
}
std::string program_path; std::string program_path;
#if defined(STEAM_WIN32) #if defined(STEAM_WIN32)
char DllPath[MAX_PATH] = {0}; char DllPath[MAX_PATH] = {0};

View File

@ -18,16 +18,21 @@
#include "steam_client.h" #include "steam_client.h"
#include "settings_parser.h" #include "settings_parser.h"
static bool kill_background_thread;
static void background_thread(Steam_Client *client) static void background_thread(Steam_Client *client)
{ {
PRINT_DEBUG("background thread starting\n"); PRINT_DEBUG("background thread starting\n");
while (1) { while (1) {
std::this_thread::sleep_for(std::chrono::seconds(1)); std::this_thread::sleep_for(std::chrono::seconds(1));
global_mutex.lock(); global_mutex.lock();
if (!client->network->isAlive()) { bool net_alive = client->network->isAlive();
if (!net_alive || kill_background_thread) {
global_mutex.unlock(); global_mutex.unlock();
if (!net_alive) {
//delete network; //delete network;
}
kill_background_thread = false;
PRINT_DEBUG("background thread exit\n"); PRINT_DEBUG("background thread exit\n");
return; return;
} }
@ -701,6 +706,7 @@ void Steam_Client::SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction
bool Steam_Client::BShutdownIfAllPipesClosed() bool Steam_Client::BShutdownIfAllPipesClosed()
{ {
PRINT_DEBUG("BShutdownIfAllPipesClosed\n"); PRINT_DEBUG("BShutdownIfAllPipesClosed\n");
kill_background_thread = true;
return true; return true;
} }

View File

@ -8,8 +8,6 @@ CUR_DIR=$(pwd)
cd "$CONFIG_PATH" cd "$CONFIG_PATH"
mkdir -p ~/.steam/sdk64 mkdir -p ~/.steam/sdk64
mkdir -p ~/.steam/sdk32 mkdir -p ~/.steam/sdk32
rm -rf ~/.steam/sdk64/steam_settings
rm -rf ~/.steam/sdk32/steam_settings
#make a backup of original files #make a backup of original files
mv ~/.steam/steam.pid ~/.steam/steam.pid.orig || true mv ~/.steam/steam.pid ~/.steam/steam.pid.orig || true
mv ~/.steam/sdk64/steamclient.so ~/.steam/sdk64/steamclient.so.orig || true mv ~/.steam/sdk64/steamclient.so ~/.steam/sdk64/steamclient.so.orig || true
@ -17,18 +15,14 @@ mv ~/.steam/sdk32/steamclient.so ~/.steam/sdk32/steamclient.so.orig || true
#copy our files #copy our files
cp x86/steamclient.so ~/.steam/sdk32/steamclient.so cp x86/steamclient.so ~/.steam/sdk32/steamclient.so
cp x86_64/steamclient.so ~/.steam/sdk64/steamclient.so cp x86_64/steamclient.so ~/.steam/sdk64/steamclient.so
cp -r steam_settings ~/.steam/sdk32/
cp -r steam_settings ~/.steam/sdk64/
echo $BASHPID > ~/.steam/steam.pid echo $BASHPID > ~/.steam/steam.pid
cd "$APP_PATH" cd "$APP_PATH"
SteamAppId=$APP_ID SteamGameId=$APP_ID "$APP_NAME" SteamAppPath="$APP_PATH" SteamAppId=$APP_ID SteamGameId=$APP_ID "$APP_NAME"
cd "$CUR_DIR" cd "$CUR_DIR"
#restore original #restore original
rm -f ~/.steam/steam.pid rm -f ~/.steam/steam.pid
rm -f ~/.steam/sdk64/steamclient.so rm -f ~/.steam/sdk64/steamclient.so
rm -f ~/.steam/sdk32/steamclient.so rm -f ~/.steam/sdk32/steamclient.so
rm -rf ~/.steam/sdk64/steam_settings
rm -rf ~/.steam/sdk32/steam_settings
mv ~/.steam/steam.pid.orig ~/.steam/steam.pid mv ~/.steam/steam.pid.orig ~/.steam/steam.pid
mv ~/.steam/sdk64/steamclient.so.orig ~/.steam/sdk64/steamclient.so || true mv ~/.steam/sdk64/steamclient.so.orig ~/.steam/sdk64/steamclient.so || true
mv ~/.steam/sdk32/steamclient.so.orig ~/.steam/sdk32/steamclient.so || true mv ~/.steam/sdk32/steamclient.so.orig ~/.steam/sdk32/steamclient.so || true