I was able to figure out how to enable Anisotropic Filtering natively in Freelancer.
rp8.dll:
01A48C: Int8 2 -> 3. Changes the magnification filtering mode from "linear" to "anisotropic".
01A4C5: Int8 2 -> 3. Changes the minification filtering mode from "linear" to "anisotropic".
01A4FE: Int8 1 -> 3. Changes the mipmap filtering mode from "nearest" to "anisotropic".
01A5B8: Int8 1 -> 2, 4, 8, 16. Changes the maximum anisotropy from 1 to either 2, 4, 8, or 16, respectively.
With these patches we can add Anisotropic Filtering options for the vanilla and Lighting Bug Fix graphics APIs! They can also be used for an additional option to force AF outside dgVoodoo and DxWrapper (might not work) when either has been selected.
Enabling Anti Aliasing the same way is unfortunately a lot more tricky; file offset 8F5F in rp8.dll sets the MultiSampleType as a DWORD. Unfortunately setting this value to anything other than 0 causes the game to throw D3DERR_INVALIDCALL and not launch. Online I found the following clues:
Paired values of render targets or of depth stencil surfaces and D3DMULTISAMPLE_TYPE must match.
To use multisampling, the SwapEffect member of D3DPRESENT_PARAMETER must be set to D3DSWAPEFFECT_DISCARD.
The last step is to enable multisampling antialiasing by calling the IDirect3DDevice9::SetRenderState method and setting the D3DRS_MULTISAMPLEANTIALIAS to TRUE. After setting this value to TRUE, any rendering that you do will have multisampling applied to it. You might want to enable and disable multisampling, depending on what you are rendering.
It'd be nice if we could also utilize the IDirect3DDevice9::GetDeviceCaps method from d3d9.h to check which level of AA and AF the user's system supports. Based on this we can auto select the highest available option and warn the user if they select an option their device (potentially) doesn't support.
I was able to figure out how to enable Anisotropic Filtering natively in Freelancer.
With these patches we can add Anisotropic Filtering options for the vanilla and Lighting Bug Fix graphics APIs! They can also be used for an additional option to force AF outside dgVoodoo and DxWrapper (might not work) when either has been selected.
Enabling Anti Aliasing the same way is unfortunately a lot more tricky; file offset
8F5F
inrp8.dll
sets the MultiSampleType as a DWORD. Unfortunately setting this value to anything other than 0 causes the game to throwD3DERR_INVALIDCALL
and not launch. Online I found the following clues:It'd be nice if we could also utilize the
IDirect3DDevice9::GetDeviceCaps
method fromd3d9.h
to check which level of AA and AF the user's system supports. Based on this we can auto select the highest available option and warn the user if they select an option their device (potentially) doesn't support.