|
28 | 28 |
|
29 | 29 | #include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp" |
30 | 30 | #include "xrCore/cdecl_cast.hpp" |
| 31 | +#include "xrCore/ModuleLookup.hpp" |
31 | 32 |
|
32 | 33 | LevelCompilerLoggerWindow& Logger = LevelCompilerLoggerWindow(); |
33 | 34 |
|
@@ -198,23 +199,24 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi |
198 | 199 | { |
199 | 200 | xrDebug::Initialize(false); |
200 | 201 | Core.Initialize("xrai", 0); |
201 | | - HMODULE hFactory; |
202 | | - LPCSTR g_name = "xrSE_Factory"; |
203 | | - Log("Loading DLL:", g_name); |
204 | | - hFactory = LoadLibrary(g_name); |
205 | | - if (0 == hFactory) |
| 202 | + |
| 203 | + |
| 204 | + constexpr pcstr g_name = "xrSE_Factory"; |
| 205 | + Log("Loading DLL:", g_name); |
| 206 | + const auto hFactory = std::make_unique<XRay::Module>(g_name); |
| 207 | + |
| 208 | + if (!hFactory->exist()) |
206 | 209 | R_CHK(GetLastError()); |
207 | | - R_ASSERT2(hFactory, "Factory DLL raised exception during loading or there is no factory DLL at all"); |
| 210 | + R_ASSERT2(hFactory->exist(), "Factory DLL raised exception during loading or there is no factory DLL at all"); |
208 | 211 |
|
209 | | - create_entity = (Factory_Create*)GetProcAddress(hFactory, "_create_entity@4"); |
| 212 | + create_entity = (Factory_Create*)hFactory->getProcAddress("_create_entity@4"); |
210 | 213 | R_ASSERT(create_entity); |
211 | | - destroy_entity = (Factory_Destroy*)GetProcAddress(hFactory, "_destroy_entity@4"); |
| 214 | + |
| 215 | + destroy_entity = (Factory_Destroy*)hFactory->getProcAddress("_destroy_entity@4"); |
212 | 216 | R_ASSERT(destroy_entity); |
213 | 217 |
|
214 | 218 | Startup(lpCmdLine); |
215 | 219 |
|
216 | | - FreeLibrary(hFactory); |
217 | | - |
218 | 220 | Core._destroy(); |
219 | 221 |
|
220 | 222 | return (0); |
|
0 commit comments