From a4da54ddf1d41f5bbadf54be7f025a9e7a928eff Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Fri, 2 Sep 2022 19:19:17 +0200 Subject: reverse search vdf's correctly, return on non forks --- src/qt/mainwindow.cpp | 1 + src/steam.c | 11 +++++++---- src/vdf/vdf.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/qt/mainwindow.cpp b/src/qt/mainwindow.cpp index 84d6ee9..12ddf3e 100644 --- a/src/qt/mainwindow.cpp +++ b/src/qt/mainwindow.cpp @@ -142,6 +142,7 @@ void MainWindow::workerResult(const enum Worker::Results_t& result) case Worker::RESULT_UPDATE_COMPLETE: resetProgress(); + ui->mainButton->setText("Play"); ui->statusLabel->setText("Updated"); workerOperate(Worker::TASK_IS_UPTODATE); break; diff --git a/src/steam.c b/src/steam.c index 387c9b9..f28272c 100644 --- a/src/steam.c +++ b/src/steam.c @@ -244,20 +244,23 @@ long getSteamPID(void) int runOpenFortress(char** args, size_t arg_count) { #ifdef STEAM_DIRECT_LAUNCH + int in_fork = 0; #if defined(__linux__) || defined(__FreeBSD__) // fork so we don't have to stay alive for the game - if (fork()) return 0; #endif - char* game = getSourceSDK2013MpDir(); if (!game) - exit(0); + { + if (in_fork) exit(0); + else return 0; + } char* of_dir = getOpenFortressDir(); if (!of_dir) { free(game); - exit(0); + if (in_fork) exit(0); + else return 0; } game = realloc(game, strlen(game) + strlen(OS_PATH_SEP) + strlen(HL2_EXE) + 1); diff --git a/src/vdf/vdf.c b/src/vdf/vdf.c index bb27a55..c678e55 100644 --- a/src/vdf/vdf.c +++ b/src/vdf/vdf.c @@ -326,7 +326,7 @@ struct vdf_object* vdf_object_index_array_str(const struct vdf_object* o, const if (!o || !str || o->type != VDF_TYPE_ARRAY) return NULL; - for (size_t i = o->data.data_array.len; i >= 0; ++i) + for (size_t i = o->data.data_array.len-1; i >= 0; --i) { struct vdf_object* k = o->data.data_array.data_value[i]; if (!strcmp(k->key, str)) -- cgit v1.2.3