View Single Post
Old 08-02-2012, 03:22 PM   #57
flipper
Registered
 
Join Date: Mar 2002

Location: Texas
Posts: 60
I've been busy trying to get a perspectively correct mirrored background image onto the water surface while maintaining the original MA3 projection matrix or I would have responded earlier. Sorry about that.

The techniques used have been around for decades. MS uses them in their app shim and compatibility layer code, for instance. They're also used a lot in game mods and other types of malware.

In a nutshell, but a bit techy, MA3Ex.exe starts MA3.scr but suspended. It then adds MA3Ex.dll into MA3.scr's process address space, tweaks the process' starting point to call MA3Ex.dll's entry point instead, resumes MA3.scr's execution and then quits.

When MA3.scr starts running again it gives control to MA3Ex.dll, which then uses "api hook"ing to cause the creation of D3D devices to be rerouted to its code. That code allows the call to go through to D3D, and upon a successful creation, adds the device to its good devices list and, using "code hook"ing, causes several of the D3D devices methods to be rerouted to its code. Methods such as BeginScene, DrawPrimitive, SetTexture, SetTransform, etc. So at that point MA3Ex.dll essentially has as much control of MA3.scr's interfaces with D3D as it wants. The same technique could be used for other app->OS api interfaces as well.

It also uses a similar but different hooking technique to take control of the keyboard and mouse.

Regarding the different camera viewpoint I use in my own version of this, if you're willing to allow me to make it public, I'll start working on getting that code into this version. As it's proven to be very difficult to get a correct looking mirrored scene onto the water surface while mucking with two different fields of view (I think as you indicated above.)
flipper is offline   Reply With Quote