aboutsummaryrefslogtreecommitdiff
path: root/src/cli
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-01-22 02:56:48 +0100
committerJan200101 <sentrycraft123@gmail.com>2023-08-05 22:15:10 +0200
commitb97db529be365851633a6cc1c9285d930209049d (patch)
tree7a73d6adf71797b9308692a03253d15d3703b5a8 /src/cli
parent045e16665a55e2b7b6dc2e953c91f2125f61e083 (diff)
downloadOFQT-hook.tar.gz
OFQT-hook.zip
hook stash: a1af9ba65d57be898e079a98229845f42069c1e6hook
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/commands.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/cli/commands.c b/src/cli/commands.c
index 08b7ed4..7146eb4 100644
--- a/src/cli/commands.c
+++ b/src/cli/commands.c
@@ -4,15 +4,23 @@
#include "steam.h"
#include "toast.h"
+#include "proc.h"
#include "commands.h"
#include "updater.h"
+#ifdef HAS_HOOKS
+#include "hook.h"
+#endif
+
#define ARRAY_LEN(arr) sizeof(arr) / sizeof(arr[0])
static int install(int, char**);
static int update(int, char**);
static int run(int, char**);
+#ifdef HAS_HOOKS
+static int hook(int, char**);
+#endif
static int version(int, char**);
static int info(int, char**);
@@ -22,6 +30,9 @@ const struct Command commands[] = {
{ .name = "install", .func = install, .description = "Install OpenFortress"},
{ .name = "update", .func = update, .description = "Update an existing install"},
{ .name = "run", .func = run, .description = "Run OpenFortress"},
+#ifdef HAS_HOOKS
+ { .name = "hook", .func = hook, .description = "Hook into OpenFortress to fix things"},
+#endif
{ .name = "version", .func = version, .description = "Display the OFCL version"},
{ .name = "info", .func = info, .description = "Show info about the current setup"},
};
@@ -210,17 +221,17 @@ static int run(int c, char** v)
if (!strcmp(v[arg_index]+2, "direct"))
{
-
+
launch_func = runOpenFortressDirect;
}
else if (!strcmp(v[arg_index]+2, "naive"))
{
-
+
launch_func = runOpenFortressNaive;
}
else if (!strcmp(v[arg_index]+2, "steam"))
{
-
+
launch_func = runOpenFortressSteam;
}
else
@@ -264,6 +275,22 @@ static int run(int c, char** v)
return exit_val;
}
+#ifdef HAS_HOOKS
+static int hook(int c, char** v)
+{
+ if (getPid("hl2_linux") == -1)
+ {
+ //puts("OpenFortress is not running");
+ //return 1;
+ }
+
+ //puts("trying to fix Sys_LoadLibary");
+ fix_SysLoadLibary();
+
+ return 0;
+}
+#endif
+
static int version(int c, char** v)
{
puts(VERSION);