How Computers "Remember" Things: The 5 Mental Models
If you have never seen a line of code or a hex byte in your life, start here. Reverse engineering is not magicโit is simply exploring an unmarked hotel with a flashlight.
๐จ 1. The Hotel Analogy: What is Memory?
Imagine a gigantic hotel with millions of rooms. Each room has:
- Room Number = The Memory Address (e.g.
#101or0x7FF74E210000). - What's Inside the Room = The Value / Data (e.g. Health:
100, Gold:500). - A Pointer = A room that contains no luggage, just a note saying "Go to Room #304".
๐ 2. The Hotel on Wheels: What is ASLR?
For security, Windows places the entire hotel on wheels. Every time you launch Skyrim, the hotel is parked on a random street in the city (the Base Address).
Formula:
Today's Street Address (Base) + Distance Down Hall (Offset) = The Room (Runtime VA).
๐ 3. The Phone Directory: Address Library
When Bethesda updates Skyrim (from SE 1.5.97 to AE 1.6.1170), they rebuild the hotel and shuffle room numbers. Address Library IDs are permanent resident IDs that let our mods look up the new room number in a table automatically!
๐ต๏ธ 4. Landmarks & Proximity: How to Find Unnamed Functions
Skyrim's developers removed all name tags from their code before releasing the game. You want to find the secret unexported function that calculates stealth, but there is no door sign.
How do we find it? We use Landmark & Cross-Reference (XREF) Analysis:
- Look for the Neon Pizza Sign: We search for a known debug string like
"Stealth Detected"in memory. - Follow Footsteps (XREFs): We check which unexported function calls or reads that string.
- Measure Distance: It is sitting in the text segment right next to known ID
52224!
Don't know which memory number holds the "Sneaking" status?
- Take a photo of all memory while the player is standing.
- Press the crouch button in-game.
- Take a second photo and compare them.
- The single number that flipped from
0to1is your target!
Raw Bytes, Endianness & Dereferencing
In memory, there are no variable namesโonly numbered byte slots. Reverse engineering is learning how to read raw byte layouts and chase pointers through structures.
The Skyrim Address Chain & Dual-Build Engine
Skyrim exports no symbols. Every hook requires mapping an Address Library ID → RVA → Runtime Virtual Address (with ASLR).
๐ก๏ธ What is ASLR? (Address Space Layout Randomization)
Core OS Security๐จ The Plain-English Explanation
โก How Windows ASLR Works
ASLR stands for Address Space Layout Randomization. It is a security feature built into Windows. Every time you launch SkyrimSE.exe, Windows rolls a random dice and loads the entire game into a completely different memory address.
- Why Windows does this: To prevent malware and viruses from predicting where functions live in RAM and exploiting buffer overflows.
- What it means for SKSE mods: You can never hardcode a memory address (e.g.
0x7FF74EAF6140) because next launch, that address will point to junk or crash the game.
While the Base Address moves randomly every launch, the Relative Virtual Address (RVA) โ the distance of a function from the start โ never changes within a game version!
Runtime Address = (Random ASLR Base) + (Fixed RVA Offset)
Interactive Address Resolver
Address Library Dual Mapping Table
Why raw RVAs fail across versions: Steam updates shift text segment offsets, but Address Library IDs remain the canonical cross-version anchor.
| Function / Anchor | SE 1.5.97 | AE 1.6.1170 | RelocationID Pair |
|---|---|---|---|
| PlayerCharacter::GetSingleton | ID 37609 RVA 0x620130 |
ID 38556 RVA 0x654300 |
REL::RelocationID(37609, 38556) |
| Actor::GetCombatTarget | ID 52224 RVA 0x8E6140 |
ID 53106 RVA 0x932F20 |
REL::RelocationID(52224, 53106) |
| TESForm::GetFormID | ID 19365 RVA 0x2213F0 |
ID 19792 RVA 0x2352B0 |
REL::RelocationID(19365, 19792) |
Locating Unexported Code & Struct Members
When a function or struct field has no name in Ghidra, we never guess. We anchor to a known entity and navigate proximity using 4 standard reverse engineering techniques.
Technique 1: Cross-Reference (XREF) Tracing Walkthrough
Skyrim contains thousands of unexported functions, but Bethesda left strings like error prints, console logs, and animation tag names in the .rdata section.
Live Bridge RE & Memory Diffing Simulator
Static decompilation tells you what code could do. Live memory inspection confirms what it actually does at runtime. Stimulate the game and isolate the changing offset.
Live Introspection Bridge: Actor Memory Diff Lab
Test stimulus triggers to discover the hidden field offset
Real-World RE Mission: Hooking Unexported Combat State
Step into the shoes of a Skyrim reverse engineer. Follow the exact workflow used to find, verify, and write an SKSE hook for an unexported engine function.
Objective: Find where Skyrim calculates if an Actor is in Combat
Actor::IsInCombat(), but we need to intercept the internal scoring function that decides combat targets before the state flips. Where do you begin?
Grep finds ID 52224 (Actor::GetCombatTarget) at SE RVA 0x8E6140
0x8E63B0. How do we map this unexported function to Skyrim AE (1.6.1170)?
Verify Live with Introspection Bridge
(Actor* a_this, Actor* a_target) and returns a boolean in the AL register. Before writing hook code, how do we verify?