Fuzion icon indicating copy to clipboard operation
Fuzion copied to clipboard

Vulkan support?

Open FelipeFMA opened this issue 3 years ago • 24 comments

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

FelipeFMA avatar Jul 29 '22 21:07 FelipeFMA

it currently relies on opengl imgui for rendering, but i imagine it wouldn't be too hard to make it work for vulkan https://github.com/LWSS/Fuzion/blob/0a4d775e17aba7a723aadce5b80898705e0bd6ff/src/sdlhook.cpp#L75

acuifex avatar Jul 29 '22 21:07 acuifex

it would be cool to have like an option for vulkan ./load -v for exemple

FelipeFMA avatar Jul 29 '22 21:07 FelipeFMA

I just investigated that today with somebody wanting Vulkan support in his cheat. ImGui wants a struct with a ton of pointers to Vulkan classes. Gathering all the information needed is not impossible, but will be a pain in the ass. Specially because you can't get all of the required data from hooking functions, because stuff like the Vulkan instance is never addressed once created and is (if stored at all) somewhere in the game libraries memory. I think implementing Vulkan is a unnecessary pain, which wouldn't be in the interest of many. Pretty sure that it is not happening (if at all) very soon.

Sumandora avatar Jul 29 '22 22:07 Sumandora

https://github.com/Sumandora/FrameworkExample/tree/vulkan another approach is this one. This uses the games D3D components, but doesn't compile because ImGui can't be linked, because there is no d3d9.h A wrapper is needed or this is a dead end

Sumandora avatar Jul 30 '22 08:07 Sumandora

I just investigated that today with somebody wanting Vulkan support in his cheat. ImGui wants a struct with a ton of pointers to Vulkan classes. Gathering all the information needed is not impossible, but will be a pain in the ass. Specially because you can't get all of the required data from hooking functions, because stuff like the Vulkan instance is never addressed once created and is (if stored at all) somewhere in the game libraries memory. I think implementing Vulkan is a unnecessary pain, which wouldn't be in the interest of many. Pretty sure that it is not happening (if at all) very soon.

It wouldn't be unnecessary, Vulcan gives more performance, on my potato I can play CSGO at 720p with 60 fps using vulkan while on opengl I can just get ~30-45. And I think that at some point valve will make vulkan the default

FelipeFMA avatar Jul 30 '22 12:07 FelipeFMA

I just investigated that today with somebody wanting Vulkan support in his cheat. ImGui wants a struct with a ton of pointers to Vulkan classes. Gathering all the information needed is not impossible, but will be a pain in the ass. Specially because you can't get all of the required data from hooking functions, because stuff like the Vulkan instance is never addressed once created and is (if stored at all) somewhere in the game libraries memory. I think implementing Vulkan is a unnecessary pain, which wouldn't be in the interest of many. Pretty sure that it is not happening (if at all) very soon.

It wouldn't be unnecessary, Vulcan gives more performance, on my potato I can play CSGO at 720p with 60 fps using vulkan while on opengl I can just get ~30-45. And I think that at some point valve will make vulkan the default

That's what I thought, but updates to Vulcan are not really addressing the issues all the players have mainly because valve probably implemented Vulcan as a test. They also did not write any code (well only very little) because dxvk is open source and available to everyone. On top you have to admit that having a potato is definitely not the majority, specially because source engine (even with its really crap code) runs extremely well on new systems (ofc, because it is/ its roots are literally 20+ years old) Vulcan has been in the game for a couple of months and development really hasn't advanced that much. And writing a probably around 300 lines of code and reversing the game for a couple hours at least is just not worth it to make a few cheaters (which probably should invest into a bit better pc, cmon this game really does not need a nasa super computer, a 300/400 Euro used PC is more than enough to play this game) happy

Sumandora avatar Jul 30 '22 14:07 Sumandora

I just investigated that today with somebody wanting Vulkan support in his cheat. ImGui wants a struct with a ton of pointers to Vulkan classes. Gathering all the information needed is not impossible, but will be a pain in the ass. Specially because you can't get all of the required data from hooking functions, because stuff like the Vulkan instance is never addressed once created and is (if stored at all) somewhere in the game libraries memory. I think implementing Vulkan is a unnecessary pain, which wouldn't be in the interest of many. Pretty sure that it is not happening (if at all) very soon.

It wouldn't be unnecessary, Vulcan gives more performance, on my potato I can play CSGO at 720p with 60 fps using vulkan while on opengl I can just get ~30-45. And I think that at some point valve will make vulkan the default

That's what I thought, but updates to Vulcan are not really addressing the issues all the players have mainly because valve probably implemented Vulcan as a test. They also did not write any code (well only very little) because dxvk is open source and available to everyone. On top you have to admit that having a potato is definitely not the majority, specially because source engine (even with its really crap code) runs extremely well on new systems (ofc, because it is/ its roots are literally 20+ years old) Vulcan has been in the game for a couple of months and development really hasn't advanced that much. And writing a probably around 300 lines of code and reversing the game for a couple hours at least is just not worth it to make a few cheaters (which probably should invest into a bit better pc, cmon this game really does not need a nasa super computer, a 300/400 Euro used PC is more than enough to play this game) happy

400 Euro is two average salary on my country :(

FelipeFMA avatar Jul 30 '22 14:07 FelipeFMA

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp

if you understand this maybe u can implement it

bruhmoment21 avatar Aug 01 '22 09:08 bruhmoment21

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp

if you understand this maybe u can implement it

But does this also work with dxvk?

Sumandora avatar Aug 01 '22 09:08 Sumandora

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

bruhmoment21 avatar Aug 01 '22 09:08 bruhmoment21

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

OK im going to test it

Sumandora avatar Aug 01 '22 09:08 Sumandora

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

Ok, I ported it and I can't reproduce your stuff. I used breakpoints in GDB and the "vkAcquireNextImageKHR" method is never called Means that the device is never set and the render methods exits if there is no device.

Sumandora avatar Aug 01 '22 11:08 Sumandora

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

Ok, I ported it and I can't reproduce your stuff. I used breakpoints in GDB and the "vkAcquireNextImageKHR" method is never called Means that the device is never set and the render methods exits if there is no device.

mate dxvk has its own thing. if you got "vkAcquireNextImageKHR" by dlsym it won't give you the correct "vkAcquireNextImageKHR" address. you must use "vkGetDeviceProcAddr" with a VkDevice that you will free after getting needed addresses. (if you are familiar with DirectX it would be like that fake device thing where u create a swapchain + device to get the vtable)

proof: https://streamable.com/lx3wne

bruhmoment21 avatar Aug 01 '22 12:08 bruhmoment21

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

Ok, I ported it and I can't reproduce your stuff. I used breakpoints in GDB and the "vkAcquireNextImageKHR" method is never called Means that the device is never set and the render methods exits if there is no device.

mate dxvk has its own thing. if you got "vkAcquireNextImageKHR" by dlsym it won't give you the correct "vkAcquireNextImageKHR" address. you must use "vkGetDeviceProcAddr" with a VkDevice that you will free after getting needed addresses. (if you are familiar with DirectX it would be like that fake device thing where u create a swapchain + device to get the vtable)

proof: https://streamable.com/lx3wne

I tried both, with dlsym and without. What you show in the video is exactly what happend for me. The nextimage function is not called. The present one is always called. The swapchain one is called when video settings change. But even in your video the first one was never called.

Sumandora avatar Aug 01 '22 12:08 Sumandora

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

Ok, I ported it and I can't reproduce your stuff. I used breakpoints in GDB and the "vkAcquireNextImageKHR" method is never called Means that the device is never set and the render methods exits if there is no device.

mate dxvk has its own thing. if you got "vkAcquireNextImageKHR" by dlsym it won't give you the correct "vkAcquireNextImageKHR" address. you must use "vkGetDeviceProcAddr" with a VkDevice that you will free after getting needed addresses. (if you are familiar with DirectX it would be like that fake device thing where u create a swapchain + device to get the vtable) proof: https://streamable.com/lx3wne

I tried both, with dlsym and without. What you show in the video is exactly what happend for me. The nextimage function is not called. The present one is always called. The swapchain one is called when video settings change. But even in your video the first one was never called.

show code

bruhmoment21 avatar Aug 01 '22 13:08 bruhmoment21

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

Ok, I ported it and I can't reproduce your stuff. I used breakpoints in GDB and the "vkAcquireNextImageKHR" method is never called Means that the device is never set and the render methods exits if there is no device.

mate dxvk has its own thing. if you got "vkAcquireNextImageKHR" by dlsym it won't give you the correct "vkAcquireNextImageKHR" address. you must use "vkGetDeviceProcAddr" with a VkDevice that you will free after getting needed addresses. (if you are familiar with DirectX it would be like that fake device thing where u create a swapchain + device to get the vtable) proof: https://streamable.com/lx3wne

I tried both, with dlsym and without. What you show in the video is exactly what happend for me. The nextimage function is not called. The present one is always called. The swapchain one is called when video settings change. But even in your video the first one was never called.

show code

https://github.com/Sumandora/FrameworkExample/blob/vulkan/Source/Hooks/Vulkan/VulkanHook.cpp just imagine that the dlsyms are not there. they were the last thing i tried

Sumandora avatar Aug 01 '22 13:08 Sumandora

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

Ok, I ported it and I can't reproduce your stuff. I used breakpoints in GDB and the "vkAcquireNextImageKHR" method is never called Means that the device is never set and the render methods exits if there is no device.

mate dxvk has its own thing. if you got "vkAcquireNextImageKHR" by dlsym it won't give you the correct "vkAcquireNextImageKHR" address. you must use "vkGetDeviceProcAddr" with a VkDevice that you will free after getting needed addresses. (if you are familiar with DirectX it would be like that fake device thing where u create a swapchain + device to get the vtable) proof: https://streamable.com/lx3wne

I tried both, with dlsym and without. What you show in the video is exactly what happend for me. The nextimage function is not called. The present one is always called. The swapchain one is called when video settings change. But even in your video the first one was never called.

show code

https://github.com/Sumandora/FrameworkExample/blob/vulkan/Source/Hooks/Vulkan/VulkanHook.cpp just imagine that the dlsyms are not there. they were the last thing i tried

ok i will fix your repo in abt 3 hours

bruhmoment21 avatar Aug 01 '22 13:08 bruhmoment21

does fuzion has vulkan support? i can't use the cheat using -vulkan in launch options, it just crash

https://github.com/bruhmoment21/UniversalHookX/blob/main/UniversalHookX/src/hooks/backend/vulkan/hook_vulkan.cpp if you understand this maybe u can implement it

But does this also work with dxvk?

yes this is a image from not too long ago and my cheat works for both opengl and vulkan

Ok, I ported it and I can't reproduce your stuff. I used breakpoints in GDB and the "vkAcquireNextImageKHR" method is never called Means that the device is never set and the render methods exits if there is no device.

mate dxvk has its own thing. if you got "vkAcquireNextImageKHR" by dlsym it won't give you the correct "vkAcquireNextImageKHR" address. you must use "vkGetDeviceProcAddr" with a VkDevice that you will free after getting needed addresses. (if you are familiar with DirectX it would be like that fake device thing where u create a swapchain + device to get the vtable) proof: https://streamable.com/lx3wne

I tried both, with dlsym and without. What you show in the video is exactly what happend for me. The nextimage function is not called. The present one is always called. The swapchain one is called when video settings change. But even in your video the first one was never called.

show code

https://github.com/Sumandora/FrameworkExample/blob/vulkan/Source/Hooks/Vulkan/VulkanHook.cpp just imagine that the dlsyms are not there. they were the last thing i tried

ok i will fix your repo in abt 3 hours

haha ok, just open a pr. I'm going to notice.

Sumandora avatar Aug 01 '22 13:08 Sumandora

haha ok, just open a pr. I'm going to notice.

mate i dont know your base is crashing for me almost everytime. your windowptr is null to get it place this code in your PollEvent hook

static bool once;
	if (!once && event->type == SDL_WINDOWEVENT) {
		SDL_Window* pWindow = SDL_GetWindowFromID(event->window.windowID);
		if (pWindow) {
			once = true;
			windowptr = pWindow;
		}
	}

and use this piece of code in Vulkan::hook instead of what you have

void* fnAcquireNextImageKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkAcquireNextImageKHR"));
			void* fnQueuePresentKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkQueuePresentKHR"));
			void* fnCreateSwapchainKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkCreateSwapchainKHR"));

bruhmoment21 avatar Aug 01 '22 14:08 bruhmoment21

haha ok, just open a pr. I'm going to notice.

mate i dont know your base is crashing for me almost everytime. your windowptr is null to get it place this code in your PollEvent hook

static bool once;
	if (!once && event->type == SDL_WINDOWEVENT) {
		SDL_Window* pWindow = SDL_GetWindowFromID(event->window.windowID);
		if (pWindow) {
			once = true;
			windowptr = pWindow;
		}
	}

and use this piece of code in Vulkan::hook instead of what you have

void* fnAcquireNextImageKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkAcquireNextImageKHR"));
			void* fnQueuePresentKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkQueuePresentKHR"));
			void* fnCreateSwapchainKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkCreateSwapchainKHR"));

So SwapWindow is not called when using Vulkan? It seems that really was the problem image I might port this to Fuzion if I regained some sanity. Also, yes the crashing is one of these things, which I don't understand (I did not encounter this crash on master) It seems to be completely unlinked to my code, so I might have to investigate this a bit more.

Sumandora avatar Aug 01 '22 14:08 Sumandora

haha ok, just open a pr. I'm going to notice.

mate i dont know your base is crashing for me almost everytime. your windowptr is null to get it place this code in your PollEvent hook

static bool once;
	if (!once && event->type == SDL_WINDOWEVENT) {
		SDL_Window* pWindow = SDL_GetWindowFromID(event->window.windowID);
		if (pWindow) {
			once = true;
			windowptr = pWindow;
		}
	}

and use this piece of code in Vulkan::hook instead of what you have

void* fnAcquireNextImageKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkAcquireNextImageKHR"));
			void* fnQueuePresentKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkQueuePresentKHR"));
			void* fnCreateSwapchainKHR = reinterpret_cast<void*>(vkGetDeviceProcAddr(g_FakeDevice, "vkCreateSwapchainKHR"));

So SwapWindow is not called when using Vulkan? It seems that really was the problem image I might port this to Fuzion if I regained some sanity. Also, yes the crashing is one of these things, which I don't understand (I did not encounter this crash on master) It seems to be completely unlinked to my code, so I might have to investigate this a bit more.

yes you are right swapwindow is a GL backend function so it wont be called and i also think that vulkan hook won't work if steam overlay is disabled but i am not sure

bruhmoment21 avatar Aug 01 '22 15:08 bruhmoment21

yes you are right swapwindow is a GL backend function so it wont be called and i also think that vulkan hook won't work if steam overlay is disabled but i am not sure

You are right, it only works with the Steam Overlay enabled. I thought SwapWindow was called all the time, because in GL the function is called SwapBuffers, not SwapWindow Well whatever, good job writing that example. ^^

Sumandora avatar Aug 01 '22 16:08 Sumandora

yes you are right swapwindow is a GL backend function so it wont be called and i also think that vulkan hook won't work if steam overlay is disabled but i am not sure

You are right, it only works with the Steam Overlay enabled. I thought SwapWindow was called all the time, because in GL the function is called SwapBuffers, not SwapWindow Well whatever, good job writing that example. ^^

thank you stay blessed brother :pray:

bruhmoment21 avatar Aug 01 '22 16:08 bruhmoment21