Skip to content

Commit

Permalink
Interop asi: Fix minhook invocation, and allow communication with Leg…
Browse files Browse the repository at this point in the history
…endary Explorer
  • Loading branch information
SirCxyrtyx committed Jun 24, 2021
1 parent 27c0774 commit b031dc6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Binary file removed Binaries/ME3ExplorerInteropME2.asi
Binary file not shown.
12 changes: 8 additions & 4 deletions ME3ExpInterop/ME3ExpInterop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ void SendMessageToMe3Explorer(USequenceOp* op)
}
msgBuffer[writePos] = 0;
writePos++;
const auto handle = FindWindow(nullptr, L"ME3Explorer");
auto handle = FindWindow(nullptr, L"Legendary Explorer");
if (!handle)
{
handle = FindWindow(nullptr, L"ME3Explorer");
}
if (handle)
{
constexpr unsigned long SENT_FROM_ME2 = 0x02AC00C3;
Expand Down Expand Up @@ -294,7 +298,7 @@ void __fastcall HookedPE(UObject* pObject, void* edx, UFunction* pFunction, void
GetCamPOV(op);
}
}
else if (IsA<ABioPlayerController>(pObject) && isPartOf(pFunction->GetFullName(), "Function SFXGame.BioPlayerController.PlayerTick"))
else if (IsA<ABioPlayerController>(pObject) && strcmp(pFunction->GetName(), "PlayerTick") == 0)
{
const auto playerController = static_cast<ABioPlayerController*>(pObject);
cachedPOV = playerController->PlayerCamera->CameraCache.POV;
Expand All @@ -305,8 +309,8 @@ void __fastcall HookedPE(UObject* pObject, void* edx, UFunction* pFunction, void
void onAttach()
{
MH_Initialize();
MH_CreateHook(reinterpret_cast<LPVOID*>(ProcessEvent_Orig), HookedPE, reinterpret_cast<LPVOID*>(ProcessEvent));
MH_EnableHook(reinterpret_cast<LPVOID*>(ProcessEvent));
MH_CreateHook(reinterpret_cast<LPVOID*>(&ProcessEvent_Orig), HookedPE, ProcessEvent);
MH_EnableHook(ProcessEvent);
}

BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
Expand Down
5 changes: 2 additions & 3 deletions ME3ExpInterop/ME3ExpInterop.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,15 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<IntrinsicFunctions>false</IntrinsicFunctions>
<FunctionLevelLinking>false</FunctionLevelLinking>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ProjectDir)..\detours;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down
1 change: 1 addition & 0 deletions minhook/minhook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
</ClCompile>
<Link>
<SubSystem>
Expand Down

0 comments on commit b031dc6

Please sign in to comment.