You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#else// Linux Hooking. Due to the way this plugin is structured, it's currently not possible to compile this for Linux. Literally 1984 I know, but I don't have enough time or experience to figure it out by myself. One day.
91
+
#endif
92
+
93
+
#if _WIN32
94
+
// MinHook initialization and hooking.
95
+
Log(INFO, true, "Initializing MinHook and hooking functions...");
96
+
MH_Initialize();
97
+
98
+
// Hook the death think function so players can be spawned immediate when the p2sm_instantrespawn ConVar is on.
#else// Linux Hooking. Due to the way this plugin is structured, it's currently not possible to compile this for Linux. Literally 1984 I know, but I don't have enough time or experience to figure it out by myself. One day.
133
+
#endif// _WIN32
134
+
135
+
MH_EnableHook(MH_ALL_HOOKS);
136
+
} catch (const std::exception& ex) {
137
+
Log(INFO, false, "Failed to load plugin! :( Exception: \"%s\"", ex.what());
#else// Linux Hooking. Due to the way this plugin is structured, it's currently not possible to compile this for Linux. Literally 1984 I know, but I don't have enough time or experience to figure it out by myself.
161
-
#endif// _WIN32
162
-
163
-
MH_EnableHook(MH_ALL_HOOKS);
164
-
165
-
Log(INFO, false, "Loaded plugin! Yay! :D");
166
-
m_bPluginLoaded = true;
167
-
} catch (const std::exception& ex) {
168
-
Log(INFO, false, "Failed to load plugin! :( Exception: \"%s\"", ex.what());
Log(INFO, true, "Disconnecting hooked functions and un-initializing MinHook...");
247
+
MH_DisableHook(MH_ALL_HOOKS);
248
+
MH_Uninitialize();
249
+
#else// Linux Hooking. Due to the way this plugin is structured, it's currently not possible to compile this for Linux. Literally 1984 I know, but I don't have enough time or experience to figure it out by myself. One day.
Log(ERRORR, false, "P2:MM failed to unload!\nGame has to be shutdown as possibly some other patches/hooks are still connected which can cause issues!");
257
+
}
258
+
259
+
// Turn every ConVar/ConCommand back to normal.
260
+
Log(INFO, true, "Reverting changed ConVars and ConCommands...");
261
+
262
+
Log(INFO, true, "cl_localnetworkbackdoor...");
263
+
if (ConVar* lnbCVar = g_pCVar->FindVar("cl_localnetworkbackdoor"))
264
+
lnbCVar->SetValue(0);
265
+
266
+
// Remove the cheat flag on r_drawscreenoverlay and enable it by default to allow maps to easily display screen overlays.
267
+
Log(INFO, true, "r_drawscreenoverlay...");
268
+
if (ConVar* screenCVar = g_pCVar->FindVar("r_drawscreenoverlay"))
269
+
{
270
+
screenCVar->RemoveFlags(FCVAR_CHEAT);
271
+
screenCVar->SetValue(1);
272
+
}
273
+
274
+
// Make switching between players in splitscreen when testing easier by removing
275
+
// the need for cheats to change the current player under control.
276
+
Log(INFO, true, "in_forceuser...");
277
+
if (ConVar* ifuCVar = g_pCVar->FindVar("in_forceuser"))
278
+
ifuCVar->RemoveFlags(FCVAR_CHEAT);
279
+
280
+
Log(INFO, true, "Unregistering ConVars and ConCommands...");
0 commit comments