diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2024-08-26 16:53:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-26 16:53:34 +0200 |
commit | a9d2ce8a692f7890f4e4bfc21458332890605a5f (patch) | |
tree | 74878b833f063f7ffd05d5177380d1e9ab5f9b54 | |
parent | 5472a3630762db2d6880a4dafda9402dbbc872f8 (diff) | |
parent | 932735e0500f6fc4d43ee949754c6a6a7c48d3e2 (diff) | |
download | NorthstarLauncher-a9d2ce8a692f7890f4e4bfc21458332890605a5f.tar.gz NorthstarLauncher-a9d2ce8a692f7890f4e4bfc21458332890605a5f.zip |
Merge branch 'main' into feat/overhaul-mod-loading-locations
-rw-r--r-- | .clang-format | 4 | ||||
-rw-r--r-- | .git-blame-ignore-revs | 3 | ||||
-rw-r--r-- | primedev/client/localchatwriter.cpp | 10 | ||||
-rw-r--r-- | primedev/core/hooks.cpp | 24 | ||||
-rw-r--r-- | primedev/core/hooks.h | 12 | ||||
-rw-r--r-- | primedev/core/math/vector.h | 42 | ||||
-rw-r--r-- | primedev/logging/logging.h | 9 | ||||
-rw-r--r-- | primedev/masterserver/masterserver.cpp | 7 | ||||
-rw-r--r-- | primedev/plugins/interfaces/interface.cpp | 3 | ||||
-rw-r--r-- | primedev/plugins/plugins.cpp | 3 | ||||
-rw-r--r-- | primedev/squirrel/squirrelclasstypes.h | 3 | ||||
-rw-r--r-- | primedev/util/utils.h | 5 |
12 files changed, 92 insertions, 33 deletions
diff --git a/.clang-format b/.clang-format index ecf9fec8..fb7ca9cf 100644 --- a/.clang-format +++ b/.clang-format @@ -35,5 +35,5 @@ IndentExternBlock: Indent PointerAlignment: Left SortIncludes: false NamespaceIndentation: All -PackConstructorInitializers: NextLine -BreakConstructorInitializersBeforeComma: true +PackConstructorInitializers: Never +BreakConstructorInitializers: BeforeComma diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index b622bb57..c104bb38 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -8,3 +8,6 @@ f9bc3c9d1834cb8bd5f872b749b057c33e8b0102 # Clang format change: one-line inline functions 5b2c608b22ba272e4ab1a45adc1f43b60b1aea79 + +# Clang format change: see PR #775 +6e9792f3651d1e0c7045c5d67312c10f91ce6962 diff --git a/primedev/client/localchatwriter.cpp b/primedev/client/localchatwriter.cpp index 35cc065f..042e77d9 100644 --- a/primedev/client/localchatwriter.cpp +++ b/primedev/client/localchatwriter.cpp @@ -102,7 +102,10 @@ Color lightColors[8] = { class AnsiEscapeParser { public: - explicit AnsiEscapeParser(LocalChatWriter* writer) : m_writer(writer) {} + explicit AnsiEscapeParser(LocalChatWriter* writer) + : m_writer(writer) + { + } void HandleVal(unsigned long val) { @@ -257,7 +260,10 @@ private: } }; -LocalChatWriter::LocalChatWriter(Context context) : m_context(context) {} +LocalChatWriter::LocalChatWriter(Context context) + : m_context(context) +{ +} void LocalChatWriter::Write(const char* str) { diff --git a/primedev/core/hooks.cpp b/primedev/core/hooks.cpp index 5026f837..7ce98331 100644 --- a/primedev/core/hooks.cpp +++ b/primedev/core/hooks.cpp @@ -85,18 +85,18 @@ void __fileAutohook::DispatchForModule(const char* pModuleName) hook->Dispatch(); } -ManualHook::ManualHook(const char* funcName, LPVOID func) : pHookFunc(func), ppOrigFunc(nullptr) +ManualHook::ManualHook(const char* funcName, LPVOID func) + : svFuncName(funcName) + , pHookFunc(func) + , ppOrigFunc(nullptr) { - const size_t iFuncNameStrlen = strlen(funcName); - pFuncName = new char[iFuncNameStrlen]; - memcpy(pFuncName, funcName, iFuncNameStrlen); } -ManualHook::ManualHook(const char* funcName, LPVOID* orig, LPVOID func) : pHookFunc(func), ppOrigFunc(orig) +ManualHook::ManualHook(const char* funcName, LPVOID* orig, LPVOID func) + : svFuncName(funcName) + , pHookFunc(func) + , ppOrigFunc(orig) { - const size_t iFuncNameStrlen = strlen(funcName); - pFuncName = new char[iFuncNameStrlen]; - memcpy(pFuncName, funcName, iFuncNameStrlen); } bool ManualHook::Dispatch(LPVOID addr, LPVOID* orig) @@ -105,19 +105,19 @@ bool ManualHook::Dispatch(LPVOID addr, LPVOID* orig) ppOrigFunc = orig; if (!addr) - spdlog::error("Address for hook {} is invalid", pFuncName); + spdlog::error("Address for hook {} is invalid", svFuncName); else if (MH_CreateHook(addr, pHookFunc, ppOrigFunc) == MH_OK) { if (MH_EnableHook(addr) == MH_OK) { - spdlog::info("Enabling hook {}", pFuncName); + spdlog::info("Enabling hook {}", svFuncName); return true; } else - spdlog::error("MH_EnableHook failed for function {}", pFuncName); + spdlog::error("MH_EnableHook failed for function {}", svFuncName); } else - spdlog::error("MH_CreateHook failed for function {}", pFuncName); + spdlog::error("MH_CreateHook failed for function {}", svFuncName); return false; } diff --git a/primedev/core/hooks.h b/primedev/core/hooks.h index 2a2180da..26d9483c 100644 --- a/primedev/core/hooks.h +++ b/primedev/core/hooks.h @@ -140,7 +140,9 @@ public: __autohook() = delete; __autohook(__fileAutohook* autohook, const char* funcName, LPVOID absoluteAddress, LPVOID* orig, LPVOID func) - : pHookFunc(func), ppOrigFunc(orig), iAbsoluteAddress(absoluteAddress) + : pHookFunc(func) + , ppOrigFunc(orig) + , iAbsoluteAddress(absoluteAddress) { iAddressResolutionMode = ABSOLUTE_ADDR; @@ -152,7 +154,8 @@ public: } __autohook(__fileAutohook* autohook, const char* funcName, const char* addrString, LPVOID* orig, LPVOID func) - : pHookFunc(func), ppOrigFunc(orig) + : pHookFunc(func) + , ppOrigFunc(orig) { iAddressResolutionMode = OFFSET_STRING; @@ -168,7 +171,8 @@ public: } __autohook(__fileAutohook* autohook, const char* funcName, const char* moduleName, const char* procName, LPVOID* orig, LPVOID func) - : pHookFunc(func), ppOrigFunc(orig) + : pHookFunc(func) + , ppOrigFunc(orig) { iAddressResolutionMode = PROCADDRESS; @@ -278,7 +282,7 @@ public: class ManualHook { public: - char* pFuncName; + std::string svFuncName; LPVOID pHookFunc; LPVOID* ppOrigFunc; diff --git a/primedev/core/math/vector.h b/primedev/core/math/vector.h index 0face732..ea1de65e 100644 --- a/primedev/core/math/vector.h +++ b/primedev/core/math/vector.h @@ -13,9 +13,24 @@ class Vector3 public: float x, y, z; - Vector3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} - Vector3(float _f) : x(_f), y(_f), z(_f) {} - Vector3() : x(0.0f), y(0.0f), z(0.0f) {} + Vector3(float _x, float _y, float _z) + : x(_x) + , y(_y) + , z(_z) + { + } + Vector3(float _f) + : x(_f) + , y(_f) + , z(_f) + { + } + Vector3() + : x(0.0f) + , y(0.0f) + , z(0.0f) + { + } inline bool IsValid() { return IsFinite(x) && IsFinite(y) && IsFinite(z); } @@ -302,9 +317,24 @@ public: float y; float z; - QAngle(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} - QAngle(float _f) : x(_f), y(_f), z(_f) {} - QAngle() : x(0.0f), y(0.0f), z(0.0f) {} + QAngle(float _x, float _y, float _z) + : x(_x) + , y(_y) + , z(_z) + { + } + QAngle(float _f) + : x(_f) + , y(_f) + , z(_f) + { + } + QAngle() + : x(0.0f) + , y(0.0f) + , z(0.0f) + { + } Vector3 GetNormal() const; diff --git a/primedev/logging/logging.h b/primedev/logging/logging.h index be41cb39..edfa20dc 100644 --- a/primedev/logging/logging.h +++ b/primedev/logging/logging.h @@ -14,7 +14,11 @@ class ColoredLogger; struct custom_log_msg : spdlog::details::log_msg { public: - custom_log_msg(ColoredLogger* origin, spdlog::details::log_msg msg) : origin(origin), spdlog::details::log_msg(msg) {} + custom_log_msg(ColoredLogger* origin, spdlog::details::log_msg msg) + : origin(origin) + , spdlog::details::log_msg(msg) + { + } ColoredLogger* origin; }; @@ -38,7 +42,8 @@ public: std::vector<std::shared_ptr<CustomSink>> custom_sinks_; - ColoredLogger(std::string name, Color color, bool first = false) : spdlog::logger(*spdlog::default_logger()) + ColoredLogger(std::string name, Color color, bool first = false) + : spdlog::logger(*spdlog::default_logger()) { name_ = std::move(name); if (!first) diff --git a/primedev/masterserver/masterserver.cpp b/primedev/masterserver/masterserver.cpp index e7bb1132..56ab608d 100644 --- a/primedev/masterserver/masterserver.cpp +++ b/primedev/masterserver/masterserver.cpp @@ -992,7 +992,12 @@ void ConCommand_ns_fetchservers(const CCommand& args) g_pMasterServerManager->RequestServerList(); } -MasterServerManager::MasterServerManager() : m_pendingConnectionInfo {}, m_sOwnServerId {""}, m_sOwnClientAuthToken {""} {} +MasterServerManager::MasterServerManager() + : m_pendingConnectionInfo {} + , m_sOwnServerId {""} + , m_sOwnClientAuthToken {""} +{ +} ON_DLL_LOAD_RELIESON("engine.dll", MasterServer, (ConCommand, ServerPresence), (CModule module)) { diff --git a/primedev/plugins/interfaces/interface.cpp b/primedev/plugins/interfaces/interface.cpp index 4c006f2c..bc900542 100644 --- a/primedev/plugins/interfaces/interface.cpp +++ b/primedev/plugins/interfaces/interface.cpp @@ -3,7 +3,8 @@ InterfaceReg* s_pInterfaceRegs; -InterfaceReg::InterfaceReg(InstantiateInterfaceFn fn, const char* pName) : m_pName(pName) +InterfaceReg::InterfaceReg(InstantiateInterfaceFn fn, const char* pName) + : m_pName(pName) { m_CreateFn = fn; m_pNext = s_pInterfaceRegs; diff --git a/primedev/plugins/plugins.cpp b/primedev/plugins/plugins.cpp index 03dd2c9e..f0a9c3c5 100644 --- a/primedev/plugins/plugins.cpp +++ b/primedev/plugins/plugins.cpp @@ -22,7 +22,8 @@ bool isValidSquirrelIdentifier(std::string s) return true; } -Plugin::Plugin(std::string path) : m_location(path) +Plugin::Plugin(std::string path) + : m_location(path) { HMODULE pluginModule = GetModuleHandleA(path.c_str()); diff --git a/primedev/squirrel/squirrelclasstypes.h b/primedev/squirrel/squirrelclasstypes.h index 3a39c957..55897b69 100644 --- a/primedev/squirrel/squirrelclasstypes.h +++ b/primedev/squirrel/squirrelclasstypes.h @@ -174,7 +174,8 @@ class SquirrelAsset { public: std::string path; - SquirrelAsset(std::string path) : path(path) {}; + SquirrelAsset(std::string path) + : path(path) {}; }; #pragma region TypeDefs diff --git a/primedev/util/utils.h b/primedev/util/utils.h index 4b7f57c8..c613d16d 100644 --- a/primedev/util/utils.h +++ b/primedev/util/utils.h @@ -8,7 +8,10 @@ public: auto operator=(ScopeGuard&) = delete; ScopeGuard(ScopeGuard&) = delete; - ScopeGuard(T callback) : m_callback(callback) {} + ScopeGuard(T callback) + : m_callback(callback) + { + } ~ScopeGuard() { if (!m_dismissed) |