11
22#include < BuildInfo.h>
3+ #include < MinHook.h>
34#include < TiltedCore/Initializer.hpp>
45
56#include " Launcher.h"
67#include " TargetConfig.h"
8+
79#include " loader/ExeLoader.h"
10+ #include " loader/PathRerouting.h"
811
12+ #include " Utils/Error.h"
913#include " oobe/InstallCheckFlow.h"
1014#include " oobe/ViabilityChecks.h"
1115#include " steam/SteamLoader.h"
12- #include " Utils/Error.h"
1316
1417static LaunchContext* g_context = nullptr ;
1518
@@ -21,27 +24,11 @@ LaunchContext* GetLaunchContext()
2124 return g_context;
2225}
2326
24- static void InitEnvironment ()
25- {
26- auto & gamePath = g_context->gamePath ;
27- auto appPath = TiltedPhoques::GetPath ();
28-
29- SetDefaultDllDirectories (LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_USER_DIRS );
30- AddDllDirectory (appPath.c_str ());
31- AddDllDirectory (gamePath.c_str ());
32- SetCurrentDirectoryW (gamePath.c_str ());
33-
34- std::wstring pathBuf;
35- pathBuf.resize (32768 );
36- GetEnvironmentVariableW (L" PATH" , pathBuf.data (), static_cast <DWORD >(pathBuf.length ()));
37-
38- // append bin & game directories
39- std::wstring newPath = appPath.native () + L" ;" + gamePath.native () + L" ;" + pathBuf;
40- SetEnvironmentVariableW (L" PATH" , newPath.c_str ());
41- }
42-
4327void Bootstrap ()
4428{
29+ // LdrGetKnownDllSectionHandle = reinterpret_cast<decltype(LdrGetKnownDllSectionHandle)>(
30+ // GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "LdrGetKnownDllSectionHandle"));
31+
4532 auto LC = std::make_unique<LaunchContext>();
4633 g_context = LC .get ();
4734
@@ -57,22 +44,30 @@ void Bootstrap()
5744 }
5845
5946 // Bind path environment.
60- InitEnvironment ( );
61- steam::Load (g_context ->gamePath );
47+ loader::InstallPathRouting ( LC -> gamePath );
48+ steam::Load (LC ->gamePath );
6249
6350 {
6451 ExeLoader loader (CurrentTarget.loadLimit , GetProcAddress);
65- if (!loader.Load (g_context ->exePath ))
52+ if (!loader.Load (LC ->exePath ))
6653 return ;
6754
68- g_context ->gameMain = loader.GetEntryPoint ();
55+ LC ->gameMain = loader.GetEntryPoint ();
6956 }
7057
7158 TiltedPhoques::Initializer::RunAll ();
72- g_context ->gameMain ();
59+ LC ->gameMain ();
7360}
7461
7562void RunClient ()
7663{
77- // LdrLoadDll at fixed address
64+ LoadLibraryA (
65+ R"( C:\Users\vince\Documents\Development\Tilted\TiltedEvolution\build\windows\x64\debug\SkyrimTogether.dll)" );
66+
67+ #if 0
68+ __debugbreak();
69+ LoadLibraryA(
70+ R"(C:\Users\vince\Documents\Development\Tilted\TiltedEvolution\build\windows\x64\debug\SkyrimTogether.dll)");
71+ __debugbreak();
72+ #endif
7873}
0 commit comments