Skip to content

aowlspt_graphics.h

Source: abi/aowlspt_graphics.h — 1157 lines, 37 file-scope functions.

What this header owns

Reproduced verbatim from the header's own banner comment — these notes are frequently the only written record of why the subsystem is shaped the way it is.

text
 aowlspt_graphics.h -- full-frame post-process for post-1.0 EFT (IL2CPP).

## What this is

A ReShade-style, screen-space post-processing stack that runs entirely in the
native host, with no managed C#, no BepInEx, no Unity Material and no
AssetBundle. It hooks `IDXGISwapChain::Present` (the same DXGI vtable the
overlay hooks, captured the same proven way), and just before the real
Present it takes the finished back buffer, runs it through an HLSL pass
compiled at runtime against the game's own D3D11 device, and writes the
graded image back to the same back buffer.

This is a SEPARATE concern from `aowlspt_overlay.h`. The overlay draws a UI
on top of the frame; this regrades the whole frame. The user's "never use the
UI overlay" rule is about UI and does not apply here -- but the two do share
the swap chain, see "Coexistence with the overlay" below.

## Why native D3D11 and not in-engine (the bridge)

The original BepInEx mod attached a `MonoBehaviour` to the FPS Camera and did
the AgX blit in `OnRenderImage`, in linear HDR. That cannot be ported
literally to this build: IL2CPP with managed-code stripping cannot define a
new managed type (no `TonemapBehaviour`), and loading a `Shader` needs an
AssetBundle plus a chain of boxed `il2cpp_runtime_invoke` calls that the
bridge (`abi/aowlspt_bridge.h`, feat-il2cpp-bridge) does not provide -- it
gives "run this closure on the Unity main thread", not a render helper. So
the honest, working path is D3D11 over the back buffer. It is screen-space
only: we see the shipped LDR sRGB image, not the linear HDR scene, so AgX
here is a filmic *look* rather than a literal tonemapper replacement, and
depth effects (SSAO) are out until the in-engine path exists. See Post.hlsl.

## Safe by default

Every entry point is guarded. If the vtable cannot be captured, if the device
cannot be reached, if a shader fails to compile, or if any resource creation
fails, the module latches `broken` and the Present detour becomes a straight
pass-through: the game renders exactly as it would with this module absent.
Nothing here writes to game memory; it only reads and rewrites the back
buffer it is handed. A failure is a missing effect, never a crash.

## Coexistence with the overlay

Both modules detour Present through `aowl_hook_install` (a trampoline detour
on the actual dxgi Present code, not a vtable swap). Installing the graphics
hook AFTER the overlay chains them: graphics runs first (regrades the raw
game frame), then calls the trampoline which reaches the overlay (draws UI on
the graded image), then the real Present. That ordering -- grade the world,
then UI crisp on top -- is what you want, and it is achieved simply by
starting graphics after the overlay in the host boot sequence.

RVAs: none. This module resolves nothing by offset; it is build-independent.

Constants

  • AOWLSPT_GRAPHICS_H
  • AOWL_GFX_SLOT_PRESENT
  • AOWL_GFX_SLOT_RESIZE

Types

  • struct AowlGfxParams
  • struct AowlGfxSaved
  • struct AowlGfxState

Functions

SignatureLine
AowlGfxParams aowl_gfx_defaults(void)114
BOOL CALLBACK aowl_gfx_once_cb(PINIT_ONCE o, PVOID param, PVOID* ctx)254
void aowl_gfx_ensure_init(void)260
void aowl_gfx_note(const char* s)380
void aowl_gfx_fail(const char* why)384
int32_t aowl_gfx_running(void)389
int32_t aowl_gfx_gpu_us(void)393
int32_t aowl_gfx_frames(void)396
int32_t aowl_gfx_status(char* buf, int32_t cap)403
void aowl_gfx_set_params(const AowlGfxParams* p)423
int aowl_gfx_jnum(const char* json, const char* key, float* out)434
void aowl_gfx_set_params_json(const char* json)459
void aowl_gfx_set_in_raid(int32_t on)500
int32_t aowl_gfx_in_raid(void)503
int aowl_gfx_compile_ps(const char* entry, ID3D11PixelShader** out)510
int aowl_gfx_make_pipeline(void)523
void aowl_gfx_release_size(void)604
int aowl_gfx_make_half_rt(UINT w, UINT h, ID3D11Texture2D** tex, ID3D11RenderTargetView** rtv, ID3D11ShaderResourceView** srv)617
int aowl_gfx_make_targets(IDXGISwapChain* sc)631
void aowl_gfx_save(ID3D11DeviceContext* c, AowlGfxSaved* s)680
void aowl_gfx_probe_depth(ID3D11DepthStencilView* dsv, UINT bbW, UINT bbH)715
int32_t aowl_gfx_depth_note(char* buf, int32_t cap)748
void aowl_gfx_restore(ID3D11DeviceContext* c, AowlGfxSaved* s)757
void aowl_gfx_upload_cb(const AowlGfxParams* p, float texW, float texH, float gate, float timeSec)788
void aowl_gfx_fullscreen(ID3D11DeviceContext* c, ID3D11PixelShader* ps, ID3D11RenderTargetView* rtv, ID3D11ShaderResourceView* t0, ID3D11ShaderResourceView* t1, UINT w, UINT h)806
int aowl_gfx_ensure_device(IDXGISwapChain* sc)836
void aowl_gfx_render(IDXGISwapChain* sc)868
HRESULT WINAPI aowl_gfx_present(IDXGISwapChain* sc, UINT sync, UINT flags)985
HRESULT WINAPI aowl_gfx_resize(IDXGISwapChain* sc, UINT count, UINT w, UINT h, DXGI_FORMAT fmt, UINT flags)997
int aowl_gfx_capture_vtable(void** outPresent, void** outResize)1013
void aowl_gfx_grade(IDXGISwapChain* sc)1068
void aowl_gfx_release_size_extern(IDXGISwapChain* sc)1074
void aowl_gfx_grade_ptr(void)1078
void aowl_gfx_release_ptr(void)1079
int32_t aowl_gfx_start_driven(void)1084
int32_t aowl_gfx_start(void)1097
void aowl_gfx_stop(void)1125

aoughwl — self-hosted platform for things n stuff. Contact / Support on Discord for access to the private backends.