aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/concommand.cpp
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2022-07-07 21:31:41 +0100
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2022-07-07 21:31:41 +0100
commit2ae34b67e36b8ba05132d481876eb4ed7a826283 (patch)
tree63f44c8e2dcdc959d7a5317a3a7b36efedbd7d38 /NorthstarDLL/concommand.cpp
parent3406de7aaaf52cbef20b1549f2d7da0255d30f51 (diff)
downloadNorthstarLauncher-2ae34b67e36b8ba05132d481876eb4ed7a826283.tar.gz
NorthstarLauncher-2ae34b67e36b8ba05132d481876eb4ed7a826283.zip
almost fully replaced hooking lib
Diffstat (limited to 'NorthstarDLL/concommand.cpp')
-rw-r--r--NorthstarDLL/concommand.cpp300
1 files changed, 150 insertions, 150 deletions
diff --git a/NorthstarDLL/concommand.cpp b/NorthstarDLL/concommand.cpp
index fddad088..f9337064 100644
--- a/NorthstarDLL/concommand.cpp
+++ b/NorthstarDLL/concommand.cpp
@@ -1,151 +1,151 @@
-#include "pch.h"
-#include "concommand.h"
-#include "misccommands.h"
-
-#include <iostream>
-
-//-----------------------------------------------------------------------------
-// Purpose: Returns true if this is a command
-// Output : bool
-//-----------------------------------------------------------------------------
-bool ConCommand::IsCommand(void) const
-{
- return true;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Returns true if this is a command
-// Output : bool
-//-----------------------------------------------------------------------------
-bool ConCommandBase::IsCommand(void) const
-{
- return true;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Has this cvar been registered
-// Output : Returns true on success, false on failure.
-//-----------------------------------------------------------------------------
-bool ConCommandBase::IsRegistered(void) const
-{
- return m_bRegistered;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Test each ConCommand query before execution.
-// Input : *pCommandBase - nFlags
-// Output : False if execution is permitted, true if not.
-//-----------------------------------------------------------------------------
-bool ConCommandBase::IsFlagSet(int nFlags) const
-{
- return m_nFlags & nFlags;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Checks if ConCommand has requested flags.
-// Input : nFlags -
-// Output : True if ConCommand has nFlags.
-//-----------------------------------------------------------------------------
-bool ConCommandBase::HasFlags(int nFlags)
-{
- return m_nFlags & nFlags;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Add's flags to ConCommand.
-// Input : nFlags -
-//-----------------------------------------------------------------------------
-void ConCommandBase::AddFlags(int nFlags)
-{
- m_nFlags |= nFlags;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Removes flags from ConCommand.
-// Input : nFlags -
-//-----------------------------------------------------------------------------
-void ConCommandBase::RemoveFlags(int nFlags)
-{
- m_nFlags &= ~nFlags;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Returns current flags.
-// Output : int
-//-----------------------------------------------------------------------------
-int ConCommandBase::GetFlags(void) const
-{
- return m_nFlags;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Output : const ConCommandBase
-//-----------------------------------------------------------------------------
-ConCommandBase* ConCommandBase::GetNext(void) const
-{
- return m_pNext;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Returns the ConCommandBase help text.
-// Output : const char*
-//-----------------------------------------------------------------------------
-const char* ConCommandBase::GetHelpText(void) const
-{
- return m_pszHelpString;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Copies string using local new/delete operators
-// Input : *szFrom -
-// Output : char
-//-----------------------------------------------------------------------------
-char* ConCommandBase::CopyString(const char* szFrom) const
-{
- size_t nLen;
- char* szTo;
-
- nLen = strlen(szFrom);
- if (nLen <= 0)
- {
- szTo = new char[1];
- szTo[0] = 0;
- }
- else
- {
- szTo = new char[nLen + 1];
- memmove(szTo, szFrom, nLen + 1);
- }
- 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();
+#include "pch.h"
+#include "concommand.h"
+#include "misccommands.h"
+
+#include <iostream>
+
+//-----------------------------------------------------------------------------
+// Purpose: Returns true if this is a command
+// Output : bool
+//-----------------------------------------------------------------------------
+bool ConCommand::IsCommand(void) const
+{
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Returns true if this is a command
+// Output : bool
+//-----------------------------------------------------------------------------
+bool ConCommandBase::IsCommand(void) const
+{
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Has this cvar been registered
+// Output : Returns true on success, false on failure.
+//-----------------------------------------------------------------------------
+bool ConCommandBase::IsRegistered(void) const
+{
+ return m_bRegistered;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Test each ConCommand query before execution.
+// Input : *pCommandBase - nFlags
+// Output : False if execution is permitted, true if not.
+//-----------------------------------------------------------------------------
+bool ConCommandBase::IsFlagSet(int nFlags) const
+{
+ return m_nFlags & nFlags;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Checks if ConCommand has requested flags.
+// Input : nFlags -
+// Output : True if ConCommand has nFlags.
+//-----------------------------------------------------------------------------
+bool ConCommandBase::HasFlags(int nFlags)
+{
+ return m_nFlags & nFlags;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Add's flags to ConCommand.
+// Input : nFlags -
+//-----------------------------------------------------------------------------
+void ConCommandBase::AddFlags(int nFlags)
+{
+ m_nFlags |= nFlags;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Removes flags from ConCommand.
+// Input : nFlags -
+//-----------------------------------------------------------------------------
+void ConCommandBase::RemoveFlags(int nFlags)
+{
+ m_nFlags &= ~nFlags;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Returns current flags.
+// Output : int
+//-----------------------------------------------------------------------------
+int ConCommandBase::GetFlags(void) const
+{
+ return m_nFlags;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Output : const ConCommandBase
+//-----------------------------------------------------------------------------
+ConCommandBase* ConCommandBase::GetNext(void) const
+{
+ return m_pNext;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Returns the ConCommandBase help text.
+// Output : const char*
+//-----------------------------------------------------------------------------
+const char* ConCommandBase::GetHelpText(void) const
+{
+ return m_pszHelpString;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Copies string using local new/delete operators
+// Input : *szFrom -
+// Output : char
+//-----------------------------------------------------------------------------
+char* ConCommandBase::CopyString(const char* szFrom) const
+{
+ size_t nLen;
+ char* szTo;
+
+ nLen = strlen(szFrom);
+ if (nLen <= 0)
+ {
+ szTo = new char[1];
+ szTo[0] = 0;
+ }
+ else
+ {
+ szTo = new char[nLen + 1];
+ memmove(szTo, szFrom, nLen + 1);
+ }
+ 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