diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-07-07 21:31:41 +0100 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-07-07 21:31:41 +0100 |
commit | 2ae34b67e36b8ba05132d481876eb4ed7a826283 (patch) | |
tree | 63f44c8e2dcdc959d7a5317a3a7b36efedbd7d38 /NorthstarDLL/sourceconsole.h | |
parent | 3406de7aaaf52cbef20b1549f2d7da0255d30f51 (diff) | |
download | NorthstarLauncher-2ae34b67e36b8ba05132d481876eb4ed7a826283.tar.gz NorthstarLauncher-2ae34b67e36b8ba05132d481876eb4ed7a826283.zip |
almost fully replaced hooking lib
Diffstat (limited to 'NorthstarDLL/sourceconsole.h')
-rw-r--r-- | NorthstarDLL/sourceconsole.h | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/NorthstarDLL/sourceconsole.h b/NorthstarDLL/sourceconsole.h index 9f6c2bf8..3bb31d9c 100644 --- a/NorthstarDLL/sourceconsole.h +++ b/NorthstarDLL/sourceconsole.h @@ -1,110 +1,110 @@ -#pragma once -#include "pch.h" -#include "sourceinterface.h" -#include "spdlog/sinks/base_sink.h" -#include <map> - -class EditablePanel -{ - public: - virtual ~EditablePanel() = 0; - unsigned char unknown[0x2B0]; -}; - -struct SourceColor -{ - unsigned char R; - unsigned char G; - unsigned char B; - unsigned char A; - - SourceColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) - { - R = r; - G = g; - B = b; - A = a; - } - - SourceColor() - { - R = 0; - G = 0; - B = 0; - A = 0; - } -}; - -class IConsoleDisplayFunc -{ - public: - virtual void ColorPrint(const SourceColor& clr, const char* pMessage) = 0; - virtual void Print(const char* pMessage) = 0; - virtual void DPrint(const char* pMessage) = 0; -}; - -class CConsolePanel : public EditablePanel, public IConsoleDisplayFunc -{ -}; - -class CConsoleDialog -{ - public: - struct VTable - { - void* unknown[298]; - void (*OnCommandSubmitted)(CConsoleDialog* consoleDialog, const char* pCommand); - }; - - VTable* m_vtable; - unsigned char unknown[0x398]; - CConsolePanel* m_pConsolePanel; -}; - -class CGameConsole -{ - public: - virtual ~CGameConsole() = 0; - - // activates the console, makes it visible and brings it to the foreground - virtual void Activate() = 0; - - virtual void Initialize() = 0; - - // hides the console - virtual void Hide() = 0; - - // clears the console - virtual void Clear() = 0; - - // return true if the console has focus - virtual bool IsConsoleVisible() = 0; - - virtual void SetParent(int parent) = 0; - - bool m_bInitialized; - CConsoleDialog* m_pConsole; -}; - -extern SourceInterface<CGameConsole>* g_pSourceGameConsole; - -// spdlog logger -class SourceConsoleSink : public spdlog::sinks::base_sink<std::mutex> -{ - private: - std::map<spdlog::level::level_enum, SourceColor> m_LogColours = { - {spdlog::level::trace, SourceColor(0, 255, 255, 255)}, - {spdlog::level::debug, SourceColor(0, 255, 255, 255)}, - {spdlog::level::info, SourceColor(255, 255, 255, 255)}, - {spdlog::level::warn, SourceColor(255, 255, 0, 255)}, - {spdlog::level::err, SourceColor(255, 0, 0, 255)}, - {spdlog::level::critical, SourceColor(255, 0, 0, 255)}, - {spdlog::level::off, SourceColor(0, 0, 0, 0)} - }; - - protected: - void sink_it_(const spdlog::details::log_msg& msg) override; - void flush_() override; -}; - -void InitialiseConsoleOnInterfaceCreation(); +#pragma once
+#include "pch.h"
+#include "sourceinterface.h"
+#include "spdlog/sinks/base_sink.h"
+#include <map>
+
+class EditablePanel
+{
+ public:
+ virtual ~EditablePanel() = 0;
+ unsigned char unknown[0x2B0];
+};
+
+struct SourceColor
+{
+ unsigned char R;
+ unsigned char G;
+ unsigned char B;
+ unsigned char A;
+
+ SourceColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
+ {
+ R = r;
+ G = g;
+ B = b;
+ A = a;
+ }
+
+ SourceColor()
+ {
+ R = 0;
+ G = 0;
+ B = 0;
+ A = 0;
+ }
+};
+
+class IConsoleDisplayFunc
+{
+ public:
+ virtual void ColorPrint(const SourceColor& clr, const char* pMessage) = 0;
+ virtual void Print(const char* pMessage) = 0;
+ virtual void DPrint(const char* pMessage) = 0;
+};
+
+class CConsolePanel : public EditablePanel, public IConsoleDisplayFunc
+{
+};
+
+class CConsoleDialog
+{
+ public:
+ struct VTable
+ {
+ void* unknown[298];
+ void (*OnCommandSubmitted)(CConsoleDialog* consoleDialog, const char* pCommand);
+ };
+
+ VTable* m_vtable;
+ unsigned char unknown[0x398];
+ CConsolePanel* m_pConsolePanel;
+};
+
+class CGameConsole
+{
+ public:
+ virtual ~CGameConsole() = 0;
+
+ // activates the console, makes it visible and brings it to the foreground
+ virtual void Activate() = 0;
+
+ virtual void Initialize() = 0;
+
+ // hides the console
+ virtual void Hide() = 0;
+
+ // clears the console
+ virtual void Clear() = 0;
+
+ // return true if the console has focus
+ virtual bool IsConsoleVisible() = 0;
+
+ virtual void SetParent(int parent) = 0;
+
+ bool m_bInitialized;
+ CConsoleDialog* m_pConsole;
+};
+
+extern SourceInterface<CGameConsole>* g_pSourceGameConsole;
+
+// spdlog logger
+class SourceConsoleSink : public spdlog::sinks::base_sink<std::mutex>
+{
+ private:
+ std::map<spdlog::level::level_enum, SourceColor> m_LogColours = {
+ {spdlog::level::trace, SourceColor(0, 255, 255, 255)},
+ {spdlog::level::debug, SourceColor(0, 255, 255, 255)},
+ {spdlog::level::info, SourceColor(255, 255, 255, 255)},
+ {spdlog::level::warn, SourceColor(255, 255, 0, 255)},
+ {spdlog::level::err, SourceColor(255, 0, 0, 255)},
+ {spdlog::level::critical, SourceColor(255, 0, 0, 255)},
+ {spdlog::level::off, SourceColor(0, 0, 0, 0)}
+ };
+
+ protected:
+ void sink_it_(const spdlog::details::log_msg& msg) override;
+ void flush_() override;
+};
+
+void InitialiseConsoleOnInterfaceCreation();
|