Skip to content

Commit 39b467f

Browse files
committed
Fix loading issues with dll proxy method
1 parent cb11b59 commit 39b467f

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

UnityInspector/src/dllmain.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "pch.h"
1+
#include "pch.h"
22

33
#include "game/core/core.h"
44
#include "gui/window/window.h"
@@ -13,14 +13,20 @@ static void Init(HMODULE hMod)
1313
{dx_hook::Hk11::Mode::Discord, X("Discord")},
1414
{dx_hook::Hk11::Mode::Steam, X("Steam")},
1515
{dx_hook::Hk11::Mode::Kiero, X("Kiero")},
16-
//{dx_hook::Hk11::Mode::SteamLegacy, "Steam Legacy"},
1716
};
1817

1918
bool hookSuccess = false;
2019
const auto config = Core::config.get();
2120
uint8_t try_count = 0;
2221

23-
console::StartConsole(X("Debug Console"), true);
22+
while (!WindowFinder::FindGameWindow())
23+
{
24+
std::this_thread::sleep_for(2s);
25+
try_count++;
26+
if (constexpr uint8_t max_try = 15; try_count >= max_try) goto exit;
27+
}
28+
29+
try_count = 0;
2430

2531
do {
2632
if (config->gameAssembly = GetModuleHandleA(X("mono-2.0-bdwgc.dll")); config->gameAssembly)
@@ -40,7 +46,9 @@ static void Init(HMODULE hMod)
4046
if (constexpr uint8_t max_try = 5; try_count >= max_try) goto exit;
4147
} while (true);
4248

43-
LOG_INFO(X("Game Loaded, Initializing..."));
49+
console::StartConsole(X("Debug Console"), true);
50+
LOG_INFO(X("Game Assemblies Loaded"));
51+
LOG_INFO(X("Initializing..."));
4452
UR::Init(config->gameAssembly, config->gameMode);
4553

4654
LOG_INFO(X("initializing Overlay Hook."));
@@ -101,7 +109,7 @@ static void Init(HMODULE hMod)
101109
LOG_INFO(X("Exiting..."));
102110
std::this_thread::sleep_for(3s);
103111
console::EndConsole();
104-
FreeLibraryAndExitThread(hMod, 1);
112+
ExitThread(1);
105113
}
106114

107115
BOOL APIENTRY DllMain(HMODULE hMod, DWORD reason, LPVOID lpReserved)

0 commit comments

Comments
 (0)