mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-08 12:35:59 +01:00
csgo-vk-fix: avoid crashing on missing fns
This commit is contained in:
parent
03df2bceb9
commit
4c2cef8326
1 changed files with 6 additions and 1 deletions
|
@ -106,7 +106,6 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
|
|
||||||
g_pSurfaceSizeHook = HyprlandAPI::createFunctionHook(PHANDLE, fn.address, (void*)::hkSetWindowSize);
|
g_pSurfaceSizeHook = HyprlandAPI::createFunctionHook(PHANDLE, fn.address, (void*)::hkSetWindowSize);
|
||||||
}
|
}
|
||||||
success = success && g_pSurfaceSizeHook;
|
|
||||||
|
|
||||||
FNS = HyprlandAPI::findFunctionsByName(PHANDLE, "computeDamage");
|
FNS = HyprlandAPI::findFunctionsByName(PHANDLE, "computeDamage");
|
||||||
for (auto& r : FNS) {
|
for (auto& r : FNS) {
|
||||||
|
@ -117,6 +116,12 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
success = success && g_pSurfaceSizeHook && g_pWLSurfaceDamageHook && g_pMouseMotionHook;
|
||||||
|
if (!success) {
|
||||||
|
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization: Failed to find required hook fns", CColor{1.0, 0.2, 0.2, 1.0}, 5000);
|
||||||
|
throw std::runtime_error("[vkfix] Hooks fn init failed");
|
||||||
|
}
|
||||||
|
|
||||||
success = success && g_pWLSurfaceDamageHook->hook();
|
success = success && g_pWLSurfaceDamageHook->hook();
|
||||||
success = success && g_pMouseMotionHook->hook();
|
success = success && g_pMouseMotionHook->hook();
|
||||||
success = success && g_pSurfaceSizeHook->hook();
|
success = success && g_pSurfaceSizeHook->hook();
|
||||||
|
|
Loading…
Reference in a new issue