I'm trying to hook Direct3DCreate9 so I can get a copy of the IDirect3DDevice9 
pointer. I want to make some surfaces with formats that aren't exposed by the 
material system (namely, depth buffers). It looks like the only way to do it 
will be to make a launcher.exe that starts hl2.exe with CREATE_SUSPENDED, hooks 
calls to LoadLibrary to catch when shaderapidx9.dll get's loaded, which is 
static linked to D3D9.DLL. Patch the Import Address Table and voila. Well... in 
theory anyway.

I wonder how hard it would be to make a wrapper interface that takes a DX10.1 
device and exposes a IDirect3DDevice9 to the engine. Rather, I wonder how hard 
it would be to make a program that generates said code. Then I could use 
ID3D10Device::ResolveSubresource to enable anti-aliasing on my deferred shader.

> Date: Sun, 14 Feb 2010 20:10:42 +0100
> From: hlcod...@maxsi.dk
> To: hlcoders@list.valvesoftware.com
> Subject: Re: [hlcoders] Initialization Sequence
> 
> The first function called in client.dll that you should override is
> 
> CHLClient::Init() in cdll_client_int.cpp
> 
> (The actual first function called is CreateInterface but I wouldn't go 
> no-where near that function, it's better to do stuff in CHLClient::Init())
> 
> Sadly, it is not possible to do anything before IDirect3DDevice9 is 
> initialized (Doesn't that happen when the Window opens? It is at least 
> impossible to do anything before the Window opens).
> 
> The CHLClient::Init() is the first function called, but it is not called 
> until a few moments after client.dll is loaded into memory. If you need 
> something to be called early on (note the environment is not entirely 
> safe at this point), you can create a class with a constructor and 
> globally instance one copy of this class; the constructor will then be 
> called when client.dll is loaded into memory.
> 
> The good thing abourt using CHLClient::Init() is that you can return 
> false, if you don't want the game to launch (note this makes hl2.exe 
> quite unstable, it might also be wise to call a function that terminates 
> the process, like PostQuitMessage(0) or something).
> 
> I hook into CHLClient::Init() with my Maxsi Distribution system to 
> initialize it at run-time.
> 
> Like Tom said, _DllMainCRTStartup() is also called, but I wouldn't touch 
> that either - The Windows environment is also very unstable at this time.
> 
> What is it that you are trying to do?
> 
> Brent Lewis skrev:
> > I'd like to know what places in the client.dll are called as part of the 
> > initialization phase. I'd rather not have to set breakpoints at every 
> > function header in every file to see what's going on when the game starts. 
> > Any info available on this?
> >
> > I'd like to know this partly for curiosities sake, but I'd also like to do 
> > some work before the  IDirect3DDevice9 gets created.
> >                                       
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives, 
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >   
> 
> 
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
> 
                                          
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to