Skip to content

Commit

Permalink
Merge branch 'temp-merge'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgamerz committed Mar 26, 2023
2 parents 2b08f8c + bb552d4 commit 377f5fe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions LE1DebugLogger/DebugLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ UObject* CreateImport_hook(ULinkerLoad* Context, int i)
return object;
}


UObject* CreateExport_hook(ULinkerLoad* Context, int i)
{
logger.writeToLog(wstring_format(L"Creating UExport %i in %s\n", i + 1, Context->Filename.Data), true);
UObject* object = CreateExport_orig(Context, i);
if (object != nullptr) {
logger.writeToLog(wstring_format(L"Loaded UExport %i (%hs)\n", i + 1, object->GetName()), true);
}
else {
logger.writeToLog(wstring_format(L"FAILED TO LOAD UEXPORT %i!\n", i + 1), true);
}
logger.flush();

/*if (object == nullptr)
{
FObjectImport importEntry = Context->ImportMap(i);
logger.writeToLog(wstring_format(L"Could not resolve #%d: %hs (%hs) in file: %s\n", -i - 1, importEntry.ObjectName.GetName(), importEntry.ClassName.GetName(), Context->Filename.Data), true);
logger.flush();
}*/
return object;
}

// Logs a message from a source
void logMessage(const wchar_t* logSource, wchar_t* formatStr, void* param1, void* param2)
{
Expand Down Expand Up @@ -267,6 +289,13 @@ SPI_IMPLEMENT_ATTACH
INIT_FIND_PATTERN_POSTHOOK(CreateImport, /*48 8b c4 55 41*/ "54 41 55 41 56 41 57 48 8b ec 48 83 ec 70 48 c7 45 d0 fe ff ff ff 48 89 58 10 48 89 70 18 48 89 78 20 4c 63 e2");
INIT_HOOK_PATTERN(CreateImport);

if (nullptr != std::wcsstr(GetCommandLineW(), L" -debugexportcreation")) {
// Hook CreateExport - this will print a ton of logs!
// This is game specific since pattern has to extend into memory addressing
INIT_FIND_PATTERN_POSTHOOK(CreateExport, /*89 54 24 10 55*/ "56 57 41 54 41 55 41 56 41 57 48 8b ec 48 83 ec 70 48 c7 45 d0 fe ff ff ff 48 89 9c 24 c0 00 00 00 4c 63 e2 48 8b f1 48 89 0d b5 12 58 01 44 89 25 0e 49 51 01 49 6b dc 64 48 03 99 2c 01 00 00");
INIT_HOOK_PATTERN(CreateExport);
}

// FIX ADDR
// OBJECT PRELOAD (called on every object in a package file, can be used for seekfree)
//INIT_FIND_PATTERN_POSTHOOK(LinkerLoadPreload, /*"40 55 56 57 41*/ "54 41 55 41 56 41 57 48 8d 6c 24 d9 48 81 ec 90 00 00 00 48 c7 45 e7 fe ff ff ff");
Expand Down
4 changes: 4 additions & 0 deletions LE1DebugLogger/HookPrototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ typedef UPackage* (*tLoadPackage)(void* param1, wchar_t* packageName, ELoadFlags
tLoadPackage LoadPackage = nullptr;
tLoadPackage LoadPackage_orig = nullptr;

typedef UObject* (*tCreateExport)(ULinkerLoad* Context, int UIndex);
tCreateExport CreateExport = nullptr;
tCreateExport CreateExport_orig = nullptr;

typedef uint32(*tAsyncLoadMethod)(UnLinker* linker, int a2, float a3);
tAsyncLoadMethod LoadPackageAsyncTick = nullptr;
tAsyncLoadMethod LoadPackageAsyncTick_orig = nullptr;
Expand Down

0 comments on commit 377f5fe

Please sign in to comment.