mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-22 02:35:57 +01:00
csgo-vk-fix: use findFunctionsByName
This commit is contained in:
parent
34ade54e1b
commit
50758aa024
1 changed files with 19 additions and 12 deletions
|
@ -99,14 +99,21 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:csgo-vulkan-fix:res_h", Hyprlang::INT{1050});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:csgo-vulkan-fix:res_h", Hyprlang::INT{1050});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:csgo-vulkan-fix:class", Hyprlang::STRING{"cs2"});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:csgo-vulkan-fix:class", Hyprlang::STRING{"cs2"});
|
||||||
|
|
||||||
g_pMouseMotionHook = HyprlandAPI::createFunctionHook(PHANDLE, (void*)&wlr_seat_pointer_notify_motion, (void*)::hkNotifyMotion);
|
auto FNS = HyprlandAPI::findFunctionsByName(PHANDLE, "wlr_seat_pointer_notify_motion");
|
||||||
g_pSurfaceSizeHook = HyprlandAPI::createFunctionHook(PHANDLE, (void*)&wlr_xwayland_surface_configure, (void*)::hkSetWindowSize);
|
bool success = !FNS.empty();
|
||||||
g_pSurfaceDamageHook = HyprlandAPI::createFunctionHook(PHANDLE, (void*)&wlr_surface_get_effective_damage, (void*)::hkSurfaceDamage);
|
if (success)
|
||||||
|
g_pMouseMotionHook = HyprlandAPI::createFunctionHook(PHANDLE, FNS[0].address, (void*)::hkNotifyMotion);
|
||||||
|
FNS = HyprlandAPI::findFunctionsByName(PHANDLE, "wlr_xwayland_surface_configure");
|
||||||
|
success = success && !FNS.empty();
|
||||||
|
if (success)
|
||||||
|
g_pSurfaceSizeHook = HyprlandAPI::createFunctionHook(PHANDLE, FNS[0].address, (void*)::hkSetWindowSize);
|
||||||
|
FNS = HyprlandAPI::findFunctionsByName(PHANDLE, "wlr_surface_get_effective_damage");
|
||||||
|
success = success && !FNS.empty();
|
||||||
|
if (success)
|
||||||
|
g_pSurfaceDamageHook = HyprlandAPI::createFunctionHook(PHANDLE, FNS[0].address, (void*)::hkSurfaceDamage);
|
||||||
|
|
||||||
bool hkResult = true;
|
FNS = HyprlandAPI::findFunctionsByName(PHANDLE, "logicalDamage");
|
||||||
|
for (auto& r : FNS) {
|
||||||
auto results = HyprlandAPI::findFunctionsByName(PHANDLE, "logicalDamage");
|
|
||||||
for (auto& r : results) {
|
|
||||||
if (!r.demangled.contains("CWLSurface"))
|
if (!r.demangled.contains("CWLSurface"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -114,12 +121,12 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
hkResult = hkResult && g_pWLSurfaceDamageHook->hook();
|
success = success && g_pWLSurfaceDamageHook->hook();
|
||||||
hkResult = hkResult && g_pMouseMotionHook->hook();
|
success = success && g_pMouseMotionHook->hook();
|
||||||
hkResult = hkResult && g_pSurfaceSizeHook->hook();
|
success = success && g_pSurfaceSizeHook->hook();
|
||||||
hkResult = hkResult && g_pSurfaceDamageHook->hook();
|
success = success && g_pSurfaceDamageHook->hook();
|
||||||
|
|
||||||
if (hkResult)
|
if (success)
|
||||||
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Initialized successfully! (Anything version)", CColor{0.2, 1.0, 0.2, 1.0}, 5000);
|
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Initialized successfully! (Anything version)", CColor{0.2, 1.0, 0.2, 1.0}, 5000);
|
||||||
else {
|
else {
|
||||||
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization (hook failed)!", CColor{1.0, 0.2, 0.2, 1.0}, 5000);
|
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization (hook failed)!", CColor{1.0, 0.2, 0.2, 1.0}, 5000);
|
||||||
|
|
Loading…
Reference in a new issue