aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/sourceconsole.h
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-08-24 00:32:31 +0100
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-08-25 21:32:55 +0200
commit46bed8d09f32360377350d71816a76abdfbf2c7c (patch)
tree7feedae4910dbfe0e53d26ea1e00c4616d2c1850 /NorthstarDLL/sourceconsole.h
parenta97f1f07bb5aa31629cd87023e09669eb4bf1fe9 (diff)
downloadNorthstarLauncher-1.9.5-rc1.tar.gz
NorthstarLauncher-1.9.5-rc1.zip
Adjust folder structure (#242)v1.9.5-rc1v1.9.5
* Adjust folder structure * change launcher directory name
Diffstat (limited to 'NorthstarDLL/sourceconsole.h')
-rw-r--r--NorthstarDLL/sourceconsole.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/NorthstarDLL/sourceconsole.h b/NorthstarDLL/sourceconsole.h
new file mode 100644
index 00000000..cf65cbd3
--- /dev/null
+++ b/NorthstarDLL/sourceconsole.h
@@ -0,0 +1,106 @@
+#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_SourceGameConsole;
+
+// spdlog logger
+class SourceConsoleSink : public spdlog::sinks::base_sink<std::mutex>
+{
+ private:
+ std::map<spdlog::level::level_enum, SourceColor> logColours;
+
+ public:
+ SourceConsoleSink();
+
+ protected:
+ void sink_it_(const spdlog::details::log_msg& msg) override;
+ void flush_() override;
+};
+
+void InitialiseSourceConsole(HMODULE baseAddress);
+void InitialiseConsoleOnInterfaceCreation(); \ No newline at end of file