bruhmoment21 / UniversalHookX

Universal graphical hook for Windows apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImGUI window not responding in Vulkan render for Cemu emulator

Estukoo opened this issue · comments

Hey everyone,

I'm having an issue with UniversalHookX and I could really use some help. I'm trying to hook my ImGUI window into the Vulkan render for the Cemu emulator, and I've enabled the Vulkan backend and everything seems to be working properly. When I inject my DLL into Cemu.exe, my window shows up just fine and I can add buttons, sliders, progress bars, etc. But when it comes to actually interacting with the ImGUI window, I'm having trouble - I can't move the window, resize it, or click on any buttons (although hovering seems to work).

I noticed that the callback function WndProc in the hook.cpp file takes a window (HWND) as an argument, but what's being passed into the loop doesn't seem to correspond to the Cemu window - although g_hWindow seems to be working fine.

I've tried printing the name of the window (hWnd in WndProc), but it seems to return an empty string.

I'm not familiar with ImGUI and Vulkan, so I'm not quite sure where to start troubleshooting. I've also tried testing this repo on a DirectX11 game (Black Ops 3), but I'm running into the same problem.

Any help or explanations would be greatly appreciate!

ezgif-4-34d163f9e8

commented

show your wndproc hook

oWndProc = reinterpret_cast<WNDPROC>(SetWindowLongPtr(g_hWindow, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(WndProc)));
static WNDPROC oWndProc;
static LRESULT WINAPI WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    if (uMsg == WM_KEYDOWN) {
        if (wParam == VK_INSERT) {
            Menu_Console::bShowMenu = !Menu_Console::bShowMenu;
            return 0;
        } else if (wParam == VK_HOME) {
            HANDLE hHandle = CreateThread(NULL, 0, ReinitializeGraphicalHooks, NULL, 0, NULL);
            if (hHandle != NULL)
                CloseHandle(hHandle);
            return 0;
        } else if (wParam == VK_END) {
            H::bShuttingDown = true;
            U::UnloadDLL( );
            return 0;
        }
    } else if (uMsg == WM_DESTROY) {
        HANDLE hHandle = CreateThread(NULL, 0, ReinitializeGraphicalHooks, g_hWindow, 0, NULL);
        if (hHandle != NULL)
            CloseHandle(hHandle);
    }

    LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
    if (Menu_Console::bShowMenu) {
        ImGui_ImplWin32_WndProcHandler(g_hWindow, uMsg, wParam, lParam);

        // (Doesn't work for some games like 'Sid Meier's Civilization VI')
        // Window may not maximize from taskbar because 'H::bShowDemoWindow' is set to true by default. ('hooks.hpp')
        //
        // return ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam) == 0;
    }

    // return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam);
    if (!Menu_Console::bShowMenu)
        return CallWindowProc(oWndProc, g_hWindow, uMsg, wParam, lParam);
    return ImGui_ImplWin32_WndProcHandler(g_hWindow, uMsg, wParam, lParam);
}
commented

often times when click do not register/etc you may have a flaw in your code and ImGui_ImplWin32_WndProcHandler is not being called so that being said does it get called?

In my own cpp program that uses OpenGL the function is called and there is no problem, Cemu seems to ignore the inputs...