Skip to content

Add DirectX9Ex support - #260

Open
super-continent wants to merge 2 commits into
veeenu:mainfrom
super-continent:dx9ex
Open

super-continent wants to merge 2 commits into
veeenu:mainfrom
super-continent:dx9ex

Conversation

@super-continent

Copy link
Copy Markdown

This adds support for hooking DirectX9Ex, which is used in a few different programs that I want to work on using the crate (great work btw, thanks for maintaining something like this!) The code itself is mostly a copy of the current D3D9 code, with all the modifications needed to support the Ex variants of the hooked functions

@veeenu

veeenu commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Thank you for your contribution! 🙌

Haven't looked it over in depth yet, but I wonder if there is a lot of code that's copied we might make this PR smaller by sharing common behavior rather than duplicating functions. This would help a lot with maintainability.

@super-continent

Copy link
Copy Markdown
Author

This might be possible, the Present and Reset functions are the same as DX9 in this case. I'm unsure how to cleanly structure a merge like that though. An impl macro could work but that could end up being hard to read depending on how complex we need to make it

@veeenu

veeenu commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Hi, sorry this took a while but I haven't really been able to spend any time working on open source lately 😓

Apparently IDirect3D9Ex implements Deref<Target=IDirect3D9>. Probably at least init_pipeline, render and reset_pipeline could be removed and called something like

use super::dx9::{render, init_pipeline, reset_pipeline);

  // later...
  if let Err(e) = render(&device.deref()) {
      error!("Render error: {e:?}");
  }

Could structure the module like

src/hooks/dx9/mod.rs
src/hooks/dx9/ex.rs

and remove those functions and PIPELINE and `RENDER_LOOP from your module. I'm sure there are other avenues I haven't considered yet.

Possibly also the harness could be deduplicated, but I'm not really worried about that. It's fine for it to stay duplicated.

@super-continent

Copy link
Copy Markdown
Author

This should be a more maintainable version of the change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants