@@ -66,23 +66,24 @@ bool CP2SMPlusPlusPlugin::Load(CreateInterfaceFn interfaceFactory, const CreateI
6666 );
6767
6868 Log (INFO, false , " Loading plugin..." );
69-
70- Log (INFO, true , " Grabbing game window handle..." );
71- if (!WindowsGUI::GetWindowHandle ())
72- Log (WARNING, false , " Failed to find game window!" );
73-
74- Log (INFO, true , " Connecting tier libraries..." );
69+
70+ Log (INFO, true , " Connecting tier libraries and registering plugin ConVars and ConCommands..." );
71+ ConVar_Register (0 );
7572 MathLib_Init (2 .2f , 2 .2f , 0 .0f , 2 .0f );
7673 ConnectTier1Libraries (&interfaceFactory, 1 );
7774 ConnectTier2Libraries (&interfaceFactory, 1 );
7875
79- Log (INFO, true , " Registering plugin ConVars and ConCommands..." );
80- ConVar_Register (0 );
81-
76+ Log (INFO, true , " Initializing plugin GUI systems..." );
77+ if (!GeneralGUI::InitializeGUISystems ())
78+ {
79+ assert (0 && " Failed to initialize plugin GUI systems!" );
80+ Log (WARNING, false , " Failed to initialize plugin GUI systems!" );
81+ }
82+
8283 // Make sure that all the interfaces needed are loaded and usable.
8384 Log (INFO, true , " Loading interfaces..." );
8485 Log (INFO, true , " Loading engineServer..." );
85- engineServer = static_cast <IVEngineServer*>(interfaceFactory (INTERFACEVERSION_VENGINESERVER, 0 ));
86+ engineServer = static_cast <IVEngineServer*>(interfaceFactory (INTERFACEVERSION_VENGINESERVER, nullptr ));
8687 if (!engineServer)
8788 {
8889 assert (false && " Unable to load engineServer!" );
@@ -92,7 +93,7 @@ bool CP2SMPlusPlusPlugin::Load(CreateInterfaceFn interfaceFactory, const CreateI
9293 }
9394
9495 Log (INFO, true , " Loading engineClient..." );
95- engineClient = static_cast <IVEngineClient*>(interfaceFactory (VENGINE_CLIENT_INTERFACE_VERSION, 0 ));
96+ engineClient = static_cast <IVEngineClient*>(interfaceFactory (VENGINE_CLIENT_INTERFACE_VERSION, nullptr ));
9697 if (!engineClient)
9798 {
9899 assert (false && " Unable to load engineClient!" );
@@ -102,7 +103,7 @@ bool CP2SMPlusPlusPlugin::Load(CreateInterfaceFn interfaceFactory, const CreateI
102103 }
103104
104105 Log (INFO, true , " Loading g_pPlayerInfoManager..." );
105- g_pPlayerInfoManager = static_cast <IPlayerInfoManager*>(gameServerFactory (INTERFACEVERSION_PLAYERINFOMANAGER, 0 ));
106+ g_pPlayerInfoManager = static_cast <IPlayerInfoManager*>(gameServerFactory (INTERFACEVERSION_PLAYERINFOMANAGER, nullptr ));
106107 if (!g_pPlayerInfoManager)
107108 {
108109 assert (false && " Unable to load g_pPlayerInfoManager!" );
@@ -188,19 +189,6 @@ bool CP2SMPlusPlusPlugin::Load(CreateInterfaceFn interfaceFactory, const CreateI
188189 &CUGCFileRequestManager__Update_hook, reinterpret_cast <void **>(&CUGCFileRequestManager__Update_orig)
189190 );
190191
191- // MH_CreateHook(
192- // Memory::Scanner::Scan(CLIENT, "55 8B EC 51 56 6A 20 8B F1"),
193- // &CUGCFileRequestManager__Update_hook, reinterpret_cast<void**>(&CUGCFileRequestManager__Update_orig)
194- // );
195-
196- //
197- // Stop workshop map downloads by not returning false on the download request.
198- // Log(INFO, true, "Hooking CWorkshopManager::CreateFileDownloadRequest...");
199- // MH_CreateHook( //55 8B EC 8B 45 ?? 83 EC 14 53 57
200- // Memory::Scanner::Scan(CLIENT, "55 8B EC 8B 45 ?? 83 EC 14 53 57"),
201- // &CUGCFileRequestManager__CreateFileDownloadRequest_hook, reinterpret_cast<void**>(&CUGCFileRequestManager__CreateFileDownloadRequest_orig)
202- // );
203-
204192 // Log(INFO, true, "Hooking CEnvProjectedTexture::EnforceSingleProjectionRules...");
205193 // MH_CreateHook(
206194 // Memory::Scan<void*>(CLIENT, "55 8B EC 8B 45 ? 8B 55 ? 50 8B 45 ? 52 8B 55 ? 50 8B 45 ? 52 8B 55 ? 50 8B 45"),
@@ -241,13 +229,6 @@ bool CP2SMPlusPlusPlugin::Load(CreateInterfaceFn interfaceFactory, const CreateI
241229 if (ConVar* ifuCVar = g_pCVar->FindVar (" in_forceuser" ))
242230 ifuCVar->RemoveFlags (FCVAR_CHEAT);
243231
244- Log (INFO, true , " Starting ImGUI..." );
245- if (!ImGui::Init ())
246- {
247- assert (false && " Failed to initialize ImGui!" );
248- Log (INFO, false , " Failed to initialize ImGui!" );
249- }
250-
251232 Log (INFO, false , " Loaded plugin! Yay! :D" );
252233 m_bPluginLoaded = true ;
253234
@@ -264,7 +245,7 @@ void CP2SMPlusPlusPlugin::Unload(void)
264245 {
265246 m_bNoUnload = false ;
266247 Log (WARNING, true , " Failed to load plugin!" );
267- MessageBox (WindowsGUI ::GetWindowHandle (), " P2SM++ ran into a error when starting!\n Please check the console for more info!" , " P2SM++ Startup Error" , MB_OK | MB_ICONERROR);
248+ MessageBox (GeneralGUI ::GetWindowHandle (), " P2SM++ ran into a error when starting!\n Please check the console for more info!" , " P2SM++ Startup Error" , MB_OK | MB_ICONERROR);
268249 return ;
269250 }
270251
0 commit comments