Bypass SGA verification™
A library that scans module memory space and patches assembly instructions to enable loading unsigned .sga files in Age of Empires 4, with a focus on simplistic code!
This allows greater modding possibilities, as you can patch core game features that the in-game modding tools don't let you. Theoretically this allows you to do things such as create entirely new civilizations, modify any game code you desire, modify the game's UI, etc.
Here's an example use case and why I built this in the first place.
You know The Crucible? The roguelite gamemode where you have to fight against waves of enemies to survive?
I thought it was quite fun, but it would be more fun if you could build walls.
Use the in-game content editor.
-
"Create A New Mod" → "Empty Extension" → give it a name like
AmogUs- delete unnecessary
locdb\,mod.png,mod.rdo - add
scar\rogue\rogue_factions.scar
- delete unnecessary
-
File → Open →
steamapps\common\Age of Empires IV\cardinal\archives\Data.sga -
Copy the contents of the actual
rogue_factions.scarfile into our own -
Make the patches you want (for me, commenting out the below)
local removed_types = {
"stone_wall",
"stone_wall_tower",
"stone_gate",
"palisade_wall",
"palisade_gate",
}-
This will overwrite the original
rogue_factions.scar -
Build the mod, take the .sga file from
\archives\AmogUs.sgaunder the mod folder
- Open your sga file in any hex editor
- Edit any signature bytes (ex. byte
0x1AB(the final00before other numbers) from00→43) - Save your modified archive
So now you have an unsigned sga file you want to load; how?
- Go to your game folder
C:\Program Files (x86)\Steam\steamapps\common\Age of Empires IV, then openRelicGame.module - Add the following to the end:
[data:common:12]
required = 1
archiveRoot = cardinal\archives
archive.01 = AmogUs- Place
AmogUs.sgain\cardinal\archives
- Rename
spearman.dlltoversion.dll - Place it in your game folder (the one with
RelicCardinal.exe) - Copy
C:\Windows\System32\version.dll, rename it toversion_orig.dll, move it to the game folder (next toversion.dll)
The game will run version.dll thinking it's a normal DLL.
Whenever the game calls a function that version.dll normally contains, we forward it to version_orig.dll so all the functions work.
If successfully injected, you should see a message box that says "attached".
To uninstall spearman, delete version.dll and version_orig.dll from your game folder.
Use Steam's file integrity check to automatically repair RelicGame.module.
* These side effects are easily fixable, let me know if it's too annoying.
-
After editing
RelicGame.module, Steam may grief you and trigger "game files integrity verification". To bypass this:- Just wait for it to finish repairing
- Then edit
RelicGame.moduleagain and boot the game - It won't bother you until you next edit
RelicGame.module
-
When using unsigned archives, the content editor will not work
- If you check
EssenceEditor.logyou will see why; it doesn't like our archives. - To use the content editor, simply remove the unsigned archive from
RelicGame.moduleand boot the content editor again.
- If you check
You can use this to modify any game files you want.
Check _default.burnproj to see what files the content editor natively supports burning into your .sga.
I haven't experimented with all the possibilities yet, but all scar (official maps, crucible code and boons, ai logic, art of wars, basically all game code) / attrib / data / ui / localization should be easy.
Try opening official archives like Data.sga, UI.sga, Scenario.sga to see what stuff you can change!
For unsupported files, you may have to understand the format and burn it into your sga (which is not as easy).
- out of love for the game
- to give modders more power, because y'all saying "modding is dead"
- i wanted walls in Crucible
compile it yourself
It will probably cause a desync.
That said, if both you and your opponent load the same unsigned archive, it won't desync (this is how official mods work).
make an issue
leave a star if you enjoy.
contact me on discord @acascadian if required