FLHDE / freelancer-hd-edition-installer

Installer for Freelancer: HD Edition.
https://github.com/BC46/freelancer-hd-edition
9 stars 4 forks source link

Add AF options for vanilla graphics APIs #105

Closed BC46 closed 4 months ago

BC46 commented 1 year ago

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:

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.