aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/concommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/concommand.cpp')
-rw-r--r--NorthstarDedicatedTest/concommand.cpp50
1 files changed, 30 insertions, 20 deletions
diff --git a/NorthstarDedicatedTest/concommand.cpp b/NorthstarDedicatedTest/concommand.cpp
index 5f86ba32..b5da2118 100644
--- a/NorthstarDedicatedTest/concommand.cpp
+++ b/NorthstarDedicatedTest/concommand.cpp
@@ -1,29 +1,9 @@
#include "pch.h"
#include "hooks.h"
#include "concommand.h"
-#include "gameutils.h"
#include "misccommands.h"
#include <iostream>
-typedef void (*ConCommandConstructorType)(
- ConCommand* newCommand, const char* name, void (*callback)(const CCommand&), const char* helpString, int flags, void* parent);
-ConCommandConstructorType conCommandConstructor;
-
-void RegisterConCommand(const char* name, void (*callback)(const CCommand&), const char* helpString, int flags)
-{
- spdlog::info("Registering ConCommand {}", name);
-
- // no need to free this ever really, it should exist as long as game does
- ConCommand* newCommand = new ConCommand;
- conCommandConstructor(newCommand, name, callback, helpString, flags, nullptr);
-}
-
-ON_DLL_LOAD("engine.dll", ConCommand, [](HMODULE baseAddress)
-{
- conCommandConstructor = (ConCommandConstructorType)((char*)baseAddress + 0x415F60);
- AddMiscConCommands();
-})
-
//-----------------------------------------------------------------------------
// Purpose: Returns true if this is a command
// Output : bool
@@ -139,3 +119,33 @@ char* ConCommandBase::CopyString(const char* szFrom) const
}
return szTo;
}
+
+typedef void (*ConCommandConstructorType)(
+ ConCommand* newCommand, const char* name, FnCommandCallback_t callback, const char* helpString, int flags, void* parent);
+ConCommandConstructorType ConCommandConstructor;
+
+void RegisterConCommand(const char* name, FnCommandCallback_t callback, const char* helpString, int flags)
+{
+ spdlog::info("Registering ConCommand {}", name);
+
+ // no need to free this ever really, it should exist as long as game does
+ ConCommand* newCommand = new ConCommand;
+ ConCommandConstructor(newCommand, name, callback, helpString, flags, nullptr);
+}
+
+void RegisterConCommand(
+ const char* name, FnCommandCallback_t callback, const char* helpString, int flags, FnCommandCompletionCallback completionCallback)
+{
+ spdlog::info("Registering ConCommand {}", name);
+
+ // no need to free this ever really, it should exist as long as game does
+ ConCommand* newCommand = new ConCommand;
+ ConCommandConstructor(newCommand, name, callback, helpString, flags, nullptr);
+ newCommand->m_pCompletionCallback = completionCallback;
+}
+
+ON_DLL_LOAD("engine.dll", ConCommand, [](HMODULE baseAddress)
+{
+ ConCommandConstructor = (ConCommandConstructorType)((char*)baseAddress + 0x415F60);
+ AddMiscConCommands();
+}) \ No newline at end of file