From 7d8754469f5d584efafedaaed4bc6f155cf28d69 Mon Sep 17 00:00:00 2001 From: Mgamerz Date: Wed, 1 Nov 2023 08:56:55 -0600 Subject: [PATCH] Add LE1 function logger --- FunctionLogger/FunctionLogger.cpp | 59 ------------------- LE1-ASI-Plugins.sln | 2 +- LE1FunctionLogger/LE1FunctionLogger.cpp | 6 ++ .../LE1FunctionLogger.vcxproj | 8 +-- 4 files changed, 11 insertions(+), 64 deletions(-) delete mode 100644 FunctionLogger/FunctionLogger.cpp create mode 100644 LE1FunctionLogger/LE1FunctionLogger.cpp rename FunctionLogger/FunctionLogger.vcxproj => LE1FunctionLogger/LE1FunctionLogger.vcxproj (95%) diff --git a/FunctionLogger/FunctionLogger.cpp b/FunctionLogger/FunctionLogger.cpp deleted file mode 100644 index f1407f3..0000000 --- a/FunctionLogger/FunctionLogger.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include - -#define GAMELE1 - -#include "../../Shared-ASI/Common.h" -#include "../../Shared-ASI/Interface.h" -#include "../../Shared-ASI/ME3Tweaks/ME3TweaksHeader.h" - -#define MYHOOK "KismetLogger_" - -SPI_PLUGINSIDE_SUPPORT(L"FunctionLogger", L"2.0.0", L"Mgamerz", SPI_GAME_LE1, SPI_VERSION_ANY); -SPI_PLUGINSIDE_POSTLOAD; -SPI_PLUGINSIDE_ASYNCATTACH; - -ME3TweaksASILogger logger("Function Logger v2", "LE1FunctionLog.log"); - - - -// ProcessEvent hook -// ====================================================================== - -typedef void (*tProcessEvent)(UObject* Context, UFunction* Function, void* Parms, void* Result); -tProcessEvent ProcessEvent = nullptr; - -tProcessEvent ProcessEvent_orig = nullptr; -void ProcessEvent_hook(UObject* Context, UFunction* Function, void* Parms, void* Result) -{ - const auto szName = Function->GetFullName(); - logger.writeToLog(string_format("%s\n", szName), true); - logger.flush(); - ProcessEvent_orig(Context, Function, Parms, Result); -} - - -SPI_IMPLEMENT_ATTACH -{ - Common::OpenConsole(); - - INIT_CHECK_SDK() - writeln(L"Crash game as soon as possible in order to keep log size down"); - - INIT_FIND_PATTERN_POSTHOOK(ProcessEvent, /* 40 55 41 56 41 */ "57 48 81 EC 90 00 00 00 48 8D 6C 24 20"); - if (auto rc = InterfacePtr->InstallHook(MYHOOK "ProcessEvent", ProcessEvent, ProcessEvent_hook, (void**)&ProcessEvent_orig); - rc != SPIReturn::Success) - { - writeln(L"Attach - failed to hook ProcessEvent: %d / %s", rc, SPIReturnToString(rc)); - return false; - } - - return true; -} - -SPI_IMPLEMENT_DETACH -{ - Common::CloseConsole(); - return true; -} diff --git a/LE1-ASI-Plugins.sln b/LE1-ASI-Plugins.sln index 3d55e94..141140d 100644 --- a/LE1-ASI-Plugins.sln +++ b/LE1-ASI-Plugins.sln @@ -15,7 +15,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KismetLogger", "KismetLogge EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LE1LEXInterop", "LE1LEXInterop\LE1LEXInterop.vcxproj", "{3E825F49-5D7E-4064-B5B2-03011B408B6F}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FunctionLogger", "FunctionLogger\FunctionLogger.vcxproj", "{F5C37F91-930C-4037-B0A0-C8C352636899}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LE1FunctionLogger", "LE1FunctionLogger\LE1FunctionLogger.vcxproj", "{F5C37F91-930C-4037-B0A0-C8C352636899}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LE1DebugLogger", "LE1DebugLogger\LE1DebugLogger.vcxproj", "{C0B3993D-89FD-43D0-B1E3-B8A108197544}" EndProject diff --git a/LE1FunctionLogger/LE1FunctionLogger.cpp b/LE1FunctionLogger/LE1FunctionLogger.cpp new file mode 100644 index 0000000..c00c565 --- /dev/null +++ b/LE1FunctionLogger/LE1FunctionLogger.cpp @@ -0,0 +1,6 @@ +// Game +#define GAMELE1 + +#include "../../Shared-ASI/FunctionLogger/FunctionLogger.h" + +// ASI code is all defined in FunctionLogger.h in the LEASIMods repo \ No newline at end of file diff --git a/FunctionLogger/FunctionLogger.vcxproj b/LE1FunctionLogger/LE1FunctionLogger.vcxproj similarity index 95% rename from FunctionLogger/FunctionLogger.vcxproj rename to LE1FunctionLogger/LE1FunctionLogger.vcxproj index 4c7ae85..62efa1f 100644 --- a/FunctionLogger/FunctionLogger.vcxproj +++ b/LE1FunctionLogger/LE1FunctionLogger.vcxproj @@ -16,7 +16,7 @@ {F5C37F91-930C-4037-B0A0-C8C352636899} SeqActLog Enabler 10.0 - FunctionLogger + LE1FunctionLogger @@ -47,12 +47,12 @@ true .asi - FunctionLogger + LE1FunctionLogger false .asi - FunctionLogger + LE1FunctionLogger @@ -90,7 +90,7 @@ - +