bruhmoment21 / UniversalHookX

Universal graphical hook for Windows apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DirectX 12 not working

Karri966 opened this issue · comments

So i tried this with DirectX 12 64 bit game and nothing shows up in the game when i press insert, game doesn't crash either. Here's what the console window says: https://prnt.sc/zsRN7VXGFsEV. It would be great to get this working.

whats the game name?
btw rehooking is working only for OpenGL at the moment (Pressing home button)

ok i will download it and look on what i can do
btw what is your gpu?

Okay thanks, my gpu is GTX 1080 ti

test it whenever you have time, im waiting for a reply. I hooked a lot more thing and pressing home should work for dx12 right now. you wont have mouse visible but thats just cuz i dont want to get in that area. input handling is left to the user. (i think this game doesn't capture mouse input so mouse clicks won't work in menu you will have to figure that yourself)

image

First of all thank you so much for making it work for this game, if you don't mind me asking what you had to change in code for it to work i would like to know. Also i can continue from here, i think the hardest part is already done now when its actually showing up ingame. im gonna fix the mouse and everything else. Thank you. Also any idea how to make the DLL auto inject to game itself? if that is possible? like Reshade for example does it somehow.

happy to see it worked. To make it "work" i hooked 6 more functions, the first 2 are Present1 and ResizeBuffers1, didn't know there are 2 present functions that can be called and i hooked ResizeBuffers1 to handle window resizing BUT the game doesn't call that when resizing? I noticed that when resizing the swapChain pointer changes. I hooked all 4 functions that create a swapchain so i can safely release the rendertarget (with CleanupRenderTarget() function) without the game crashing.

If you want the DLL to inject to the game as quick as possible you must create your own exe "loader". It should be fairly simple since you create an exe that starts KINGDOM HEARTS HD 1.5+2.5 ReMIX.exe and then get its PID. I ll give you a pseudocode.

int main() {
    DWORD pID = 0;
    StartGame();

    while (pID == 0) {
        GetGamePID(); // You should search on google "CreateToolhelp32Snapshot" or "EnumProcesses"
// i prefer EnumProcesses. compare if a process name matches your process name and break, there you go you have your process pid.
    }

    InjectDLLIntoProcess(); // many ways to do it i recommend loadlibrary because of its simplicity

/* THIS IS SOME OLD CODE FROM 2020 MAYBE
auto* const h_proc = OpenProcess(PROCESS_ALL_ACCESS, 0, pID);
 
	if (h_proc && h_proc != INVALID_HANDLE_VALUE)
	{		
		auto* loc = VirtualAllocEx(h_proc, nullptr, MAX_PATH, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
		WriteProcessMemory(h_proc, loc, dll_path, strlen(dll_path) + 1, nullptr);
		auto* const h_thread = CreateRemoteThread(h_proc, nullptr, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(LoadLibraryA), loc, 0, nullptr);
	
		if (h_thread) CloseHandle(h_thread);
	}
*/
} // make sure u build the loader with the same architecture as the game

EnumProcesses

Thanks for that pseudocode, I think the game uses directinput8 and I would have to hook to it or somehow block mouse input from it but I have never done that so that's going to be a challenge.

i think you should look into GetDeviceData for that