Five-Damned-Dollarz / LithTech-1-Renderer

LT1 renderer interface reverse engineering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

d_ren - A Prototype LithTech 1 Renderer

Screenshot

Note:

  • This is a personal project more about reverse engineering the interfaces than to create a modern renderer itself, you will find only horror and code-gore here.
  • Requires a test_texture.png to load, it's not actually used but needs to exist to be loaded as a dummy during the menus for now (2021/07).

The Interesting Parts

source/renderer_interface.d and source/object/*.d are where the most useful parts are for most people interested in working with LithTech 1.0, it should be trivial for anyone familiar with C-like languages to translate them from D to any preferred language.

Building

Due to LithTech 1 being exclusively 32-bit, the renderer must be built in 32-bit: dub build --arch="x86_mscoff", attempting to build in 64-bit will fail with one of the many static asserts I've placed to ensure correct alignments in shared structures.

Shaders can be compiled with something like the following if you have the Vulkan SDK installed:

glslc.exe shader.vert -o vert.spv
glslc.exe shader.frag -o frag.spv

Why Vulkan?

I'm not familiar/comfortable with DirectX, but have a little experience with Vulkan before this, and because without hex editing the original exe (barring weird possible alternatives which I probably left in a comment somewhere in the code) an OpenGL context can't be created in the window we're given.

Uses ErupteD as the binding.

This Code is Garbage and Runs Terribly!

Yes. See the first note above; there's a lot of text flushing every frame to make sure I get the information I want written when I cause a crash trying to discover new things.

I also did a 5 minute hack change to make textures work right now that obliterated Vulkan's performance, and haven't really given any thought to restructuring everything to support a more modern rendering style.

Observations

  • I suspect LithTech 1 will need a hack to work on resolutions with a width or height above 5000px due to checks at Client.exe:0x0040b09a (file + 0xA492) which will prevent a surface from being created.

About

LT1 renderer interface reverse engineering


Languages

Language:D 99.0%Language:GLSL 1.0%