File size: 11,800 Bytes
e93c9cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# RE notes — EU4 1.37.5 loading tip / screen cycle mechanism

> Static-analysis findings on `eu4.exe` 1.37.5 (build 2024-10-03,
> SHA-256 `9ad3efe1af169f40ee577f9dae5debbc87af6fb8b5450fb345ebf110dc4d771a`).
> The goal of this file is to give the next maintainer enough breadcrumbs
> to skip the dead-ends and jump straight to the cycle function once
> Ghidra analysis finishes.

## Target binary

```
C:\Program Files (x86)\Steam\steamapps\common\Europa Universalis IV\eu4.exe
```

| Property               | Value                                                  |
|------------------------|--------------------------------------------------------|
| Size                   | 38,462,504 bytes (36.7 MiB)                            |
| SHA-256                | `9ad3efe1af169f40ee577f9dae5debbc87af6fb8b5450fb345ebf110dc4d771a` |
| Version                | `release_1.37.5` (rev `835bfdf8ca24c291a1b3f1b5bc72d47e7df1ae18`) |
| PE timestamp           | 2024-10-03 17:58:17                                    |
| Format                 | PE32+ x86-64, 7 sections, no UPX                       |
| Linker                 | MSVC 14.29 (VS 2019 16.9–16.10)                        |
| ImageBase              | `0x140000000`                                          |
| PDB                    | none shipped (path string `eu4\eu4\outputdir_windows\eu4.pdb` only) |
| .text VMA / file       | `0x140001000` / `0x00000400` size `0x1B64D78`          |
| .rdata VMA / file      | `0x141B66000` / `0x01B65200` size `0x44999A`           |
| .data VMA / file       | `0x141FB0000` / `0x01FAEC00` size `0x384400`           |

## Loading-screen string table

A single string block in `.rdata` (file offset `0x1D62B4B``0x1D62B9C`)
contains every name the loading-screen code looks up by string:

| File offset | VMA            | Bytes / purpose                                                |
|-------------|----------------|----------------------------------------------------------------|
| `0x1D62B4B` | `0x141D62B4B`  | `"load_screen2\0"` — sprite name `bg_load_screen2` (status bg)  |
| `0x1D62B6C` | `0x141D62B6C`  | `"tip\0"` — the loading-tip windowType                          |
| `0x1D62B70` | `0x141D62B70`  | `"load_screen\0"` — the root load_screen windowType             |
| `0x1D62B80` | `0x141D62B80`  | `"LOADING_TIP_\0"` — localization key namespace (no xref; built dynamically via `format` + integer) |
| `0x1D62B88` | `0x141D62B88`  | `"status\0"` — the loading-status windowType                    |

> None of `loading_tip`, `LOADING_TIP`, `loading_screen`, `LoadingScreen`,
> `getLocalization`, `getLocalisation`, `resolveKey`, `Timer`, `tick`,
> `interval`, `next_tip`, `setTextFromKey`, `set_loading_tip` appear
> as strings anywhere in the binary. The localization keys are built
> with `format("LOADING_TIP_{}", i)` at runtime, which is why
> `grep "LOADING_TIP_"` finds only the namespace literal and zero
> references.

## Loading-screen construction (`sub_141174F50`)

**Entry**: `0x141174F50` (image-base + offset, file offset = VMA −
`0x140000000` = `0x1D74F50`).

Called from two places, both inside the same TU:
- `0x1411749E9` — first call site
- `0x141174EE2` — second call site

The function:
1. Allocates a 32-byte string buffer (`call 0x1400950B0` is `operator new`).
2. Copies a 16-byte structure from `.rdata` into it, then a 2-byte and
   1-byte tail.
3. Calls `vtable[0x120](rdi, &local)` (string-keyed registration or
   `addChildByName`).
4. After allocation, sets `[rbx+0x100] = 1` (or `0`) based on
   `[rip+0x12b6d79] + 0x28b` — almost certainly an
   `is_loading_synchronous` / `is_replay` flag.
5. Calls `lea rdx, [rip+0xbedadd]``"load_screen"` and
   `call [rax+0x98]` (a `findChildByName` virtual).
6. The branch at `0x14117509C`:
   ```
   cmp [rbp+0x28], 1
   je  0x1411750CA            ; ironman/replay branch
   cmp [rip+0x11caea6], 0     ; probably online check
   jne 0x1411750CA
   mov rdx, [rbx]
   mov rcx, rbx
   call [rdx+0x88]            ; vtable[0x88]
   ```
   The `vtable[0x88]` and `vtable[0x90]` are the two `setVisible` /
   `setActive` overloads, depending on `[rbp+0x28] == 1`.

This is the **construction / activation** path, not the cycling path.

## Status-text updater (`sub_141174840`)

**Entry**: `0x141174840`.

1. `call 0x141172B20` — likely the `LoadingScreen::onEnter` initializer.
2. `lea rdx, [rip+0xbee32b]` → `"status"`; `call [rax+0xB8]` =
   `findChildByName("status")`.
3. The found child at `[rax+0xC8]` is the `text` instantTextBox inside
   `status`.
4. Then the function appends a fixed sequence of characters to the
   textbox:
   ```
   0x141174893:  mov dl, 0x5C   '\'
   0x14117489D:  mov dl, 0x2F   '/'
   0x1411748A7:  mov dl, 0x3A   ':'
   0x1411748B1:  mov dl, 0x2A   '*'
   0x1411748BB:  mov dl, 0x3F   '?'
   0x1411748C5:  mov dl, 0x3C   '<'
   0x1411748CF:  mov dl, 0x3E   '>'
   0x1411748D9:  mov dl, 0x7C   '|'
   ```
   These are the **classic ASCII spinner glyphs**. The function
   re-renders them in sequence. This is the *status* progress
   indicator, **not** the tip cycler.
5. Then `lea rdx, [rip+0xbee2a1]` → `0x141D62B94` (some other name,
   the bytes are immediately after `"status\0"` in the string table)
   and `call [rax+0x68]`. The function then tail-calls
   `jmp [rax+0x8]` to a setter.

The status updater is driven by an outer loop — search for callers of
`0x141174840` to find the per-frame tick.

## Tip cycle function (NOT YET LOCATED)

What we know it must do:
1. Find the `"tip"` windowType child of the load_screen GUI
   (`findChildByName("tip")` or via the child at offset 0xC8).
2. Increment an internal `Timer` member every frame.
3. When `elapsed >= interval`, pick a random `i` in `[0, 67)`, build
   the key `"LOADING_TIP_" + i`, and call
   `setText(localizedKey)` on the tip textbox.
4. Reset the timer to 0.

The `"tip\0"` C-string exists at VMA `0x141D62B6C` but **has zero xrefs
in the disassembly** as a literal. The function therefore either:
- Uses a hardcoded offset / index instead of a string lookup
  (e.g. `getNthChild(1)` of the load_screen root), or
- Builds the `"tip"` name dynamically via `format` or string concat.

**Next step (with Ghidra decompiler):** decompile the call graph of
`sub_141174F50` (the load_screen setup) and look for the per-frame
update path. The cycling function is somewhere in that graph.

## Timer constants table

At VMA `0x141DC1750` (file offset `0x1DC0950`) is a 16-entry table of
`double` constants used by the engine for UI timers:

| VMA              | Value       | Likely use                                  |
|------------------|-------------|---------------------------------------------|
| `0x141DC1750`    | `4.0`       | fast spinner tick                            |
| `0x141DC1758`    | `5.0`       |                                              |
| `0x141DC1760`    | `8.0000019` | (FP rounding artifact, paired with next)    |
| `0x141DC1768`    | `8.0`       | **prime suspect for tip cycle interval**    |
| `0x141DC1770`    | `9.6`       | (mid-game tick?)                             |
| `0x141DC1778`    | `10.0`      | slow spinner / pause                          |
| `0x141DC1780`    | (garbage)   | (denormal / uninitialised)                   |
| `0x141DC1788`    | `15.0`      | tooltip dwell                                |
| `0x141DC1790`    | `20.0`      |                                              |
| `0x141DC1798`    | `30.0`      |                                              |
| `0x141DC17A0`    | `40.0`      |                                              |
| `0x141DC17A8`    | (garbage)   |                                              |
| `0x141DC17B0`    | `100.0`     |                                              |
| `0x141DC17B8`    | `180.0`     |                                              |
| `0x141DC17C0`    | `200.0`     |                                              |

The `8.0` value at `0x141DC1768` is referenced from 11 disassembly
sites. Most are *not* the tip cycler (verified: 0x14081D83A is part of
a `0x14081D...` per-frame update, 0x14182CC75 is a graphics normalize
function). The true cycle call site is one of the remaining xrefs and
will be identified by the call graph in the Ghidra decompile.

**Patch candidates** (most likely first):
- `0x1DC0968` (VMA `0x141DC1768`) — the `8.0` literal itself.
  Patch: overwrite 8 bytes with the user's `tip_interval_seconds` as
  a `double`. 8-byte write.
- Alternatively, if the cycle function takes the value via `movsd
  xmm1, [rip+offset]` to the constant, we patch the `movsd` to load
  from a writable .data cell the patcher initializes at runtime.
- A third option: NOP the `jbe` / `jge` after the elapsed-time
  comparison in the cycle function to slow the cycle to "never".

## What remains to do (Ghidra pass)

1. Open `eu4.exe` in `C:\tools\ghidra_12.1.2_PUBLIC\ghidraRun.bat`.
2. Search → For Strings → `"load_screen"`, `"tip"`, `"status"`,
   `"LOADING_TIP_"`.
3. For each, jump to the xref and decompile the containing function.
4. The tip cycler will be a function that:
   - Reads `[rdi+0x30]` (vtable), looks up the `"tip"` child via
     vtable[0xB8] (or a sibling lookup).
   - Has a `Timer` member (look for `add`, `sub`, `cmp` with `8.0`
     and a `jb`/`ja` that conditionally calls `setText`).
5. Record the VMA + file offset of the comparison constant, and
   identify the byte pattern that uniquely matches across
   `1.37.5.x` builds. The patcher will use this pattern for
   `--rescan` after game updates.

## Ironman / achievement bypass (Phase 2 task, partially found)

The MD5-based integrity check is at VMA range **`0x1410F78B0` –
`0x1410F8666`**, with the hash init at **`0x1410F80B8`**
(`mov DWORD PTR [rbp+0xb0], 0x67452301` — the standard MD5 init
constant). The function:

1. Sets up the timer / state at `0x1410F8084` (`movsd xmm2, [rip+…]``8.0`, passed as the third arg of a virtual call at
   `0x1410F808E: call QWORD PTR [rax+0x10]`).
2. Computes the MD5 hash of the game state at `0x1410F84B0:
   call 0x1410DD830`.
3. Uploads / records the hash via `0x1410F8573: call 0x1416554B0`
   (with at least 6 string / data arguments, the most likely
   "write to save header + sync to Paradox" call site).
4. Sets a global flag at `0x1410F85FA` (`mov DWORD PTR
   [rip+0x1247877 + 0x747c], 1`) — almost certainly
   `is_saving_ironman = true`.
5. Continues into the "save complete" path (call to
   `0x1410F864E: call r8` for `vtable[0x10]`, which is the
   `onSaveComplete` callback).

### Ironman patch candidates (to verify in next pass)

| VMA             | Action                                                                 |
|-----------------|------------------------------------------------------------------------|
| `0x1410F84B0`   | 5-byte call `0x1410DD830` (MD5 compute). NOP it.                    |
| `0x1410F8573`   | 5-byte call `0x1416554B0` (hash upload). NOP it.                    |
| `0x1410F85FA`   | 10-byte `mov DWORD PTR [...+0x747c], 1`. Patch to `mov [...+0x747c], 0` to defeat "this is ironman" state. |
| `0x1410F80B8``0x1410F80C7` | 16-byte MD5 init constants. Wipe with NOPs. |

Any one of these patches alone is enough to disable a single link
in the chain; for full ironman-bypass, do all three. The
`--revert` path must restore the original bytes.

### Hash-upload destination string

The 6 string arguments to `0x1416554B0` at `0x1410F8500``0x1410F8573`
include:
- `0x141D5C438` — likely a Paradox account ID or session token
  (used at `0x1410F84F3: lea rdx, [rip+0xc63f3e]`).
- A save-header key at `0x141D228B8` (used at `0x1410F799F`).
- A field at `0x141C4238C` (used at `0x1410F86E0` — to be confirmed).

These are good search anchors for the Ghidra xref pass.