# loading_tip_patcher Patches the cycle interval of EU4's loading-tip textbox and (when RE finishes) the loading-screen image cycle. Built because the Clausewitz engine hardcodes the interval in `eu4.exe` and exposes no define or GUI knob for it. ## Status **Skeleton only — not yet functional for end users.** The patch sites in `eu4.exe` have been narrowed down via static RE (see [`RE_notes.md`](RE_notes.md)), but the cycle function itself and the Ironman-bypass functions are still being traced in Ghidra. Once Ghidra analysis finishes, the placeholder VMA/file-offset constants in `src/main.cpp` are filled in and the patcher becomes usable. ## What works today - `config.example.json` shows the config schema (no defaults by design; the patcher errors out if `tip_interval_seconds` is missing or `<=0`). - `src/main.cpp` is a complete Win32 console app skeleton: PID lookup, SHA-256, VirtualProtectEx / WriteProcessMemory plumbing, minimal JSON reader. Currently applies the **single patch site** at VMA `0x141DC1768` (the `8.0` double in the timer-constants table — prime suspect for the tip-cycle interval). ## What is missing (Phase 2 RE work) - The actual cycle function in `eu4.exe` that owns `tip_interval` and the (possibly separate) `image_interval` (one vs two timers is still undecided). - The Ironman integrity-check functions (3 sites): hash compute, server upload, load-time verify. - `--revert`, `--status`, `--rescan` (placeholders in main.cpp). - `state.json` write (currently a TODO). - Path resolution for `eu4.exe` (currently hardcoded to the Steam install path; needs `QueryFullProcessImageNameW`). ## Build Requires MinGW-w64 GCC 15.2.0 (ships with msys2). The patcher is a standalone `.exe` with no MSVC runtime dependency. ```bash cd tools/loading_tip_patcher make ``` Output: `bin/loading_tip_patcher.exe`. ## Run ```bash # 1. Edit config.json next to the .exe: # cp config.example.json config.json # (then set tip_interval_seconds) # 2. Launch EU4 and start a campaign so eu4.exe is running. # 3. Apply the patch: ./bin/loading_tip_patcher.exe --apply ``` ## Risks (please read) This tool rewrites bytes in a running Paradox game executable. - **Ironman / achievements**: Paradox's cloud-save integrity check hashes the exe. With a patched exe, ironman saves may fail to load on the next session, and the cloud server may refuse to grant achievements. The "Ironman + achievements" feature the user requested is **separate RE work** in Phase 2 — see [`RE_notes.md`](RE_notes.md) for the planned patches. - **Game updates**: Every Paradox patch changes the binary, which moves the timer-constants-table offset. The patcher is designed to refuse to run on an unknown SHA-256; run `--rescan` to refresh. - **Anti-cheat**: Paradox's server-side anti-cheat is out of scope. The patcher only touches `eu4.exe`; if Paradox bans the account, that is a user-accepted risk. - **Antivirus false positives**: a tiny standalone .exe that calls `OpenProcess` / `WriteProcessMemory` on a known game process is exactly the signature AV vendors flag. You may need to add an exception. ## Files in this directory | File | Purpose | |-----------------------|----------------------------------------------------------| | `src/main.cpp` | The patcher source (~290 LoC, plain Win32) | | `Makefile` | MinGW-w64 GCC build | | `config.example.json` | Sample config (no defaults; user must set interval) | | `state.json` | Per-version patch record — **auto-generated**, do not edit | | `RE_notes.md` | Static RE findings + breadcrumbs for the cycle function | | `README.md` | This file |