Sign in to follow this  
eq

Detect debug run-time

Recommended Posts

I'd like to detect if the user uses the debug runtime or not. I'm doing some lowlevel stuff (read assembly) and the two differs. For instance: A SetTexture call using the debug-runtime destroys one extra element of the stack, etc. Is there a "nice" way to detect if it's a debug-runtime? (It's quite simple to detect knowing the above is true, for instance).

Share this post


Link to post
Share on other sites
If I create a device and then switches the debug/release runtime, does it change the device behavior of the running app?

For instance start an application using one device using release runtime, marking my device as release. Then switch to debug runtime. Do I need to test for changes in the registry key or can I assume that once a device is created it uses the same runtime?


Currently I'm using this "hack":


bool
isDebugRuntime(IDirect3DDevice9* const dev)
{
// Warning! Does a SetTexture(0, null)
IDirect3DDevice9* device = dev;
uint callAddress = *((DWORD*)(*((u8**)device) + 0x104));
__asm
{
push 0
push 0
push device
call callAddress
push DWORD PTR [esp - 12]
pop DWORD PTR device
};
return (device != dev);
}


Share this post


Link to post
Share on other sites
Quote:
Original post by eq
Well I tested, it seems that once a device is created in an app, it usese the same runtime.

It has to. Otherwise the device would have to be destroyed and re-created, which is something an application cannot know about (e.g. the device isn't just 'lost' but completely trashed and reset).

Share this post


Link to post
Share on other sites
Regarding your hack: don't do that! You rely on an undocumented behaviour that may change at any time without notice. Use the documented and reliable methods (like the registry key) unless there are no other options.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this