veeenu / hudhook

A videogame overlay framework written in Rust, supporting DirectX and OpenGL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`DirectComposition` is not implemented on Wine

vars1ty opened this issue Β· comments

Using the latest commit, I can't hook into the OpenGL game "Star Stable Online", tested on both Windows and Linux (via Wine).
image

Commits prior to the RenderEngine works.

Is the error Not implemented on both Windows and Linux? Can you tell me more about the game's architecture?

Could you please post the full backtrace? My hunch there is that DirectX 12 (or some specific API) may not be available.

It's present on both Windows and Linux, tested on native Windows outside of any VMs.
And there is no full backtrace from what I can see, I just compiled the sample DLL in examples and tried to inject it, then it crashed as soon as it got to the render engine.

The game arch is x64, tried the hook on a DX12 game named The Hunter COTW and it crashed there as well, with the same error message. Compiled with MSVC

Yeah backtrace shouldn't show up by itself -- can you set the RUST_BACKTRACE environment variable to 1 from inside the DllMain? That should work.

Peculiar behavior though, the fact that it fails on Windows as well... Which version are you using? And what CPU/GPU? I wonder if the renderer is using a feature that's not available on your hardware πŸ€”

Will do in a few hours, currently sorting out some other things.

My specs are:

  • CPU: Intel Core i7 12700k
  • GPU: AMD Radeon RX 6800 XT
  • RAM: 64GB DDR4
  • OS Tested: Arch Linux, Windows 10 Pro with specs listed below.
  • Runner: wine-ge

Windows specs:

  • CPU: Intel Core i7 12700k
  • GPU: AMD Radeon RX 7700 XT
  • RAM: 32GB DDR4
  • OS: Windows 10 Pro

Both machines have the latest drivers and updates installed, plus tried rebooting, recompiling and whatnot, none which worked.

Yeah your hardware should be fine honestly. I checked and your GPUs all support the DirectX feature level 12_2 while we require 11_1 (and should ideally be able to go even lower than that). Another hypothesis I have is that EnumAdapters could return the onboard GPU, but that one supports level 12_1 afaik.

I will try and stand up a VM today and install that game on it.

Can you try running the tests in hudhook? If those do not work either, then we can be sure that it's related to the game and not the hardware at all.

Yeah I'll try the tests. And regarding onboard GPU, not possible in this case as I disabled it in BIOS and also blacklisted the driver for it on Linux.
On the Windows PC it's also disabled in BIOS.

Mmm, maybe it's something else related to COM. I managed to stand up the VM today but haven't had the time to test the game yet.

I have tried running the game in a VM, but the dll hooked successfully, so I can't reproduce it. When you have time, could you try vendoring the library and finding out which one is the call that produces the error (tracing::debug! statements would be the way to go)?

I still want to address this issue, but I will probably release the library on crates.io soon and get at this in a future semver-patch release.

Hm, weird. Could you try compiling the sample dll on Linux and see if it works for you? If you need MSVC, here's my guide for it.

I'll run the tests and enable backtrace a bit later today or tomorrow, since I haven't used the tracing library before.
Been busy with fixing some issues with my cheat framework, hence the slow responses.

Alright some bad news for myself, it's a Linux issue. I tried to compile it and run tests on Windows; works there.
I then tried to use that same DLL on Linux, no changes made, VKD3D and all installed, instant crash.
I also tried MSVC compilation on Linux, and even tried the Windows GNU toolchain, both crash.

So until this has been resolved, if it does get resolved, I'm stuck on the versions prior to the simplified Render Engine as my cheat framework advertises itself as compatible with Windows and Linux through Wine/Wine forks.

Also some notes regarding the tests; I tried them on Linux, they just dead-lock and no window shows up.

Mmm, this is something I definitely want to address before release. Linux compat is not an explicit goal but would be nice to have as other people also have shown interest in running on Linux.

I traced it back to this:
immagine

Once I added the workaround of using CreateSwapChainForHwnd as per this thread, the computation progressed up until the calls to DirectComposition:
immagine

I have perused the WineHQ bugzilla and general board and ironically Star Stable Online is one of the games that pop up for using DirectComposition and terminating because it's unimplemented.

I want to test this approach: get rid of DirectComposition altogether, and see if I can just use DirectX for the compositing part.

Not at all surprised at this rate. Dealt with this game for years and it does so many weird and hacky things, it's a miracle it even runs. Even the game engine it uses, which is custom, barely even functions anymore.

If you need me to test anything and whatnot, feel free to ping me or add me on Discord if you need faster responses.

Thank you, will do! But there is never any hurry really -- I prefer async communication like this both because we can't necessarily dedicate enough time to the project for timely responses, and because it will also serve as documentation eventually.

Nada, tried various attempts, BitBlt, Direct2D, acquiring a swap chain for the HWND and do another DX12 render pass -- couldn't get anything working at all. 😞

Saving these findings here:

https://gitlab.winehq.org/zhiyi/wine/-/blob/b4ea669754fc0a9d01be048d254a2c29c9fd8647/dlls/dcomp/device.c#L92
https://gitlab.winehq.org/zhiyi/wine/-/compare/master...directcomposition?from_project_id=5&straight=false#3e63fa6bf30e6b1a1d0e80f34cc6250e52c96e77

Chances are following this same approach could work in replacement of DirectComposition.

By the way, that branch is work towards implementation of DirectComposition in Wine. Unfortunately it seems abandoned for now, but not all hope is lost 🀞

RIP, not even slightly surprised that the game crashes with the workaround you listed in the other project, it has to hack around its own game engine because it uses its own super-flawed scripting language.

If you do find a fix or a workaround, let me know πŸ‘πŸ½ Until then, I'll lock my projects hudhook version to the commit prior to the refactor.

I am actually considering switching off of Windows myself to see if this is the Year Of The Linux Desktop finally so I will keep looking into a way of dealing with this.

I wanna say this is not completely flawless, but it's not using DirectComposition. πŸ˜…

2024-02-06_141137.mp4