Source code for the Total War: ATTILA engine performance mod (Attila Engine Performance Fix, called Attila CPU Performance Fix up to 6.2). It patches the engine in memory at startup. No game files are changed.
Download the ready-made files:
- Nexus Mods: https://www.nexusmods.com/totalwarattila/mods/168
- Steam Workshop: https://steamcommunity.com/sharedfiles/filedetails/?id=3824249154 (after subscribing, run
install.batin the mod's folder)
Created with the help of AI (Claude by Anthropic). Tested in game by JGdaCaesar.
From 7.7 both builds are new code, written part by part from the game's own code: every part checks the exact game
bytes it changes (src/*.sites.h: addresses and hashes) and leaves itself out, with a line in the log, when they
differ. Each part was proven on the game's own code before it went in game: a test runs the game's functions next to
the replacement, and every test is run again on deliberately broken copies of the part, each of which it must catch.
Those tests read the game's files, which cannot be published, so they are not in this repository.
| Folder | Builds | For |
|---|---|---|
32bit/ |
dinput8.dll |
the normal 32-bit game, which loads it at startup |
64bit/ |
perffix64.dll |
Sol Invictus's 64-bit Attila, as a plugin |
shared/ |
— | version.h: one version number for both |
modmanager/ |
TotalWarModManager.exe |
Total War Mod Manager 1.01 (unchanged in 7.7): Steam's Play button opens it, for both versions |
Each part is one file in 32bit/src/ or 64bit/src/, with what it changes in the game and why written at its top
(heap.c the memory allocator, sort.c the render-list sorts, passes.c battle draw batching, uicache.c the unit
cards, attrcache.c the missing-file cache, uikeep.c the menu pictures, cull.c the unit detail cull, and so on).
main.c puts them in, in a fixed order, and writes the STATUS block of the log. The 64-bit plugin takes some shaders
and the upscaling add-on's protocol from 32bit/src/ (one copy for both).
The 32-bit DLL carries dlmalloc 2.8.6 (32bit/third_party/dlmalloc/); the 64-bit plugin uses mimalloc 3.5.3, which
its build downloads.
Both builds also contain the game side of the separate Upscaling and Framegen for Attila add-on (NVIDIA DLSS and
AMD FSR upscaling and frame generation). It does nothing unless the add-on's FrameBridge folder, with its 64-bit
helper, is in the game folder. The helper's source is in its own repository:
JSa25/TotalWarUpscalingFramegen.
You need llvm-mingw 20261006 (UCRT, x86_64 host), with its bin folder on
PATH, and a shell (Git Bash on Windows).
sh 32bit/build.sh # -> 32bit/build/dinput8.dll
MI=/path/to/mimalloc-3.5.3 sh 64bit/build.sh # -> 64bit/build/dll/perffix64.dll (mimalloc 3.5.3's source)
sh modmanager/build.sh # -> modmanager/build/TotalWarModManager.exe
The two DLL builds are reproducible: with the same llvm-mingw you get exactly the released files. Compare the SHA-256
with 32bit/dinput8.dll.sha256 and 64bit/perffix64.dll.sha256. (The Mod Manager's exe keeps a few bytes that depend on
the folder it is built in: see modmanager/README.md.)
Every commit is built on GitHub's own machines, with the compiler (and mimalloc) downloaded from their official
releases, checksums pinned: build.yml for the 32-bit DLL and
build64.yml for the 64-bit plugin. Both fail unless the result is byte for byte the
released file. Open the latest run under Actions: its summary shows the SHA-256, and the file itself can be
downloaded there. Builds also carry a signed build attestation
(gh attestation verify dinput8.dll -R JSa25/AttilaCPUPerfFix).
See LICENSE. 32bit/third_party/dlmalloc/ is dlmalloc by Doug Lea, released to the public domain
(CC0 1.0), unchanged. 32bit/third_party/reshade/ holds
ReShade's add-on API headers by Patrick Mours (BSD-3-Clause OR MIT, as stated in each file), unchanged. mimalloc (MIT)
is not in this repository; the 64-bit build downloads it. Sol Invictus's
64-bit Attila is MIT; no file of his is included here. Portions of
modmanager/ come from it and keep its MIT license: see modmanager/SOL_INVICTUS_MIT.txt.