Code Monkey home page Code Monkey logo

Comments (5)

CookiePLMonster avatar CookiePLMonster commented on May 21, 2024

Of course, passing a "real" interface to SetStreamSource instead of a wrapper helped - but is it me just being dumb and forgetting something or something wrappers didn't account for so far?

EDIT:
Looks like your wrapper is aware of that quirk... are there any other methods which behave like that?

from dxwrapper.

elishacloud avatar elishacloud commented on May 21, 2024

I am not exactly sure which quirk you are asking about. I have found several different issues with wrapping DirectX APIs. I was hoping to write up a wiki to discuss each of them in more detail, but never got around to it.

The crash happens at that location, but the issue could have been a ways up the stack. The problem with wrappers is that if you don't wrap everything correctly then it is possible for the process to get the actual d3d9 interface rather than your wrapper interface. This can cause all kinds of issues. In one game I saw a case where the real interface was exposed at the beginning of the game but it did not crash until you left the game or started a new match, which could be hours later.

Actually in d3d9 I believe you have a chance of crashing, depending on what the game does, if you don't wrap every interface. I believe every interface in d3d9 has at least one function where you need to swap the address with the wrapper address.

For the VertexBuffer there is function called GetDevice. For Textures there is a function called GetSurfaceLevel. Etc...

I am not sure if this is useful or not. Let me know if you need any specific data. You are always welcome to use my wrappers. I spent a good amount of time trying to make sure they can fully wrap all interfaces. It is strictly a wrapper with no additional code in it.

from dxwrapper.

CookiePLMonster avatar CookiePLMonster commented on May 21, 2024

What I haven't noticed at the moment of creating this issue is what in any function passing resources to the device (like SetStreamSource) you are passing underlying resources instead of the wrapper itself. On the second thought it makes sense, since D3D has a right to internally assume those resources are "final" and thus refer to them directly and not via virtual methods.

Example:
https://github.com/elishacloud/dxwrapper/blob/master/d3d9/IDirect3DDevice9.cpp#L576

from dxwrapper.

elishacloud avatar elishacloud commented on May 21, 2024

Yes, you need to pass the real resource to D3D and the wrapper interface to the game process. If you check out my DirectX-Wrappers project and look at the d3d9 wrapper you can see which functions I pass either the real or the wrapper interface.

If the function just has a return ProxyInterface->(function_name) then you don't need to do anything to that function. Example: https://github.com/elishacloud/DirectX-Wrappers/blob/master/d3d9/IDirect3D9Ex.cpp#L57

For other functions there will be additional code to either do one of these three things:

  1. Lookup the wrapper address.
  2. Create a new wrapper interface.
  3. Lookup the resource address.

I should also mention that when I lookup the wrapper address if it does not exist then I create a new interface.

from dxwrapper.

CookiePLMonster avatar CookiePLMonster commented on May 21, 2024

Cool! So it was purely an oversight on my part and not some thing everyone forgot about... good to know!

from dxwrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.