- C 60.3%
- Python 19.2%
- Objective-C++ 11.2%
- Objective-C 6.3%
- Shell 1.9%
- Other 1%
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017tZFvvLKAhcQx5JU8Jc54H |
||
|---|---|---|
| .github | ||
| docs | ||
| fonts | ||
| runtime | ||
| third_party | ||
| tools | ||
| .gitattributes | ||
| .gitignore | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| upscaling.md | ||
FE3H Recomp
A static recompilation of Fire Emblem: Three Houses (Nintendo Switch, 2019) into a native Windows application, built on LAS Recomp by Peiikai.
Important
This is a personal project, and I made it mostly for myself. I wanted to play Three Houses on my PC at a steady 60fps and a higher resolution, and so far emulators haven't given me the experience I'm after. So I built this instead, with a significant amount of help from an AI (Anthropic's Claude wrote most of the FE3H-specific code; I directed and tested).
I'm doing this casually, in my spare time, and I'm not planning to pour a ton of time, energy or resources into it. Honestly, I doubt I'll finish a full playthrough before GTA VI comes out, and once that happens this will probably fall by the wayside for a while. It's shared as-is, and I can't promise any ongoing support. Run it at your own discretion.
Note
No game files are included, and no instructions for obtaining them are provided. You need your own legally obtained copy of the game, version 1.2.0, extracted to
exefsandromfsfolders (and optionally your DLC).
What this is
Static recompilation translates the game's original Switch (AArch64) code into C ahead of time, then compiles it into a native program. It is not emulation: no CPU emulator runs the game. The Switch system software the game talks to (graphics, audio, files, controllers and so on) is reimplemented in the runtime, and graphics go through Vulkan.
LAS Recomp did the heavy lifting: its recompiler, runtime and Vulkan renderer were built for The Legend of Zelda: Link's Awakening. This fork adds what Three Houses needs on top.
Status
Playable. Tested on Windows with an AMD Radeon RX 9070 and an RX 6800 XT: the opening chapters, battles (combat arts, gambits and their cut-ins), the monastery, cutscenes, the calendar, and the start of Cindered Shadows. It holds 60 fps through the monastery and battles. Longer playthroughs are ongoing. Linux x86-64 builds and runs natively (Vulkan, no Wine or Proton; community-maintained, no support promised); see docs/linux.md for the AppImage and building from source. macOS may build but hasn't been tried with this game.
Added for Three Houses:
- Audio: splitter routing (music, voices and effects reach the right mixes), 8 / 24 / 32-bit and float PCM, I3DL2 room reverb, and the game's own effect send / return.
- Movies: the nnMedia player the game uses for its cutscenes, decoded with FFmpeg.
- Lighting: clustered lights work: buffer textures in the shader translator, lane IDs and masks, compute barriers that are safe inside branches, 32-lane compute subgroups, and buffer clears.
- System services: an always-offline network service (the calendar crashed without it).
- DLC: the Expansion Pass, Cindered Shadows and the bonus waves, from your own DLC files.
- Shaders: what FE3H's GPU code uses that Link's Awakening never did: address arithmetic (LEA), atomics and reductions on memory, subroutine calls, and image stores (the battle effects write into textures from compute shaders).
- Smooth play: shader translations are kept on disk, and every shader and pipeline met before is rebuilt at launch, so areas and battle effects you've seen draw at once instead of popping in or stuttering.
- Cheats: Atmosphere-format cheat codes from a
cheats.txtof your own, switched on and off in the menu's Game tab, including the ones that patch the game's code (see Cheats below). - Mods: data mods (translations, overhauls) in a
modsfolder, switched on and ordered on the start screen (see Mods below). Code mods (exefs) can't apply.
The start screen and the in-game menu (F1) are FE3H's own: Video, Audio, Controls and Game settings in slate and gold. LAS's Link's Awakening features (its randomizer, cheats, cosmetics, warps) are still in the code, switched off and out of the menus.
The start screen shows your own picture if you put one in the game files folder as extracted/background.png (or
.jpg); it isn't part of this repository, and .gitignore keeps it out.
Known issues
- The first time you see an area or a battle effect on a PC, its shaders are built while it plays: some pop-in or stutter, and once in a while an effect drawn incompletely (a cut-in as outlines). Only the first time.
- On NVIDIA GPUs and the Steam Deck, the very large battle-effect shaders are skipped (their drivers take too long and too much memory over them), so a battle effect can be missing a layer there.
- Experience multiplier cheats can overflow the EXP bar on the results screen for some classes (archers); the game itself is fine.
Installing a release (Windows)
Requirements: Windows 10 or 11 (64-bit), a CPU with AVX2 (most from 2015 on), a GPU with Vulkan 1.3 drivers, and about 15 GB free for the game files and the build.
- Download
FE3H-Recomp-<version>-windows.zipfrom Releases (what changed in each: CHANGELOG.md) and unzip it anywhere you can write to (not Program Files). Everything it makes - saves, settings, caches, the game files - stays in that folder. - Run
fe3hrecomp.exe. On the start screen, open Settings > Game Files, choose the folder holding your own extracted copy of the game (version 1.2.0,exefsandromfs), and click Set up game files. - Wait. The setup copies the game files, then recompiles the game's code on your PC. That's a one-time job and takes a while (about 6 minutes on a Ryzen 7 / 12 threads; longer with fewer cores).
- Click Play.
Updating: from 0.2.1 on, the start screen can check for new versions and install them for you (it asks once; Settings > Game files > Updates changes it). To update by hand, unzip the new release over the old folder: your game files, saves and settings stay.
DLC: if your game files folder has a dlc folder laid out as in DLC, the setup copies it too. To add
DLC later, put it in extracted/dlc in the program's folder the same way.
Cheats: put a cheats.txt next to fe3hrecomp.exe (see Cheats). For cheats that patch the game's
code, use Settings > Game Files > Rebuild game code on the start screen instead of make gen-main, then restart.
The first time you enter an area, its shaders are prepared and things may pop in for a moment; from then on they're
ready from the start of each session. Moving to another PC? Copy the cache folder along: the shaders are then
ready there from the start too.
Building and running (Windows)
Requirements: Windows 10+ x86-64, a CPU with AVX2 and a GPU with Vulkan 1.3.
- One-time setup, in PowerShell from the repo root:
powershell -ExecutionPolicy Bypass -File tools\setup_windows.ps1(installs MSYS2 with clang, SDL3, FFmpeg, Vulkan and shaderc, plus Python for the tools). More detail in docs/BUILD-windows.md, which LAS wrote for Link's Awakening; the steps are the same. - Game files: put your extracted
exefs/andromfs/inextracted/and set them up on the start screen as in LAS. The game readsextracted/romfs/directly (noromfs.binimage any more). - Optional: the upscalers' vendor files (AMD FSR 3 / FSR 4, NVIDIA DLSS). They aren't in the repository or the
releases; each script shows the vendor's licence and downloads only if you accept it:
tools/fetch_ffx_sdk.sh(AMD's DLL) andtools/fetch_dlss_sdk.sh(NVIDIA's DLSS SDK: the build then makesfe3h-dlss.dll; don't share builds made with it). Without them the build has FSR 1 and bilinear. See upscaling.md, and its line-endings note if you build from a Windows checkout. - Build, from an MSYS2 UCRT64 shell:
make gen # once: recompile the game code from extracted/exefs into generated/ make -j$(nproc) # every core: after make gen, hundreds of files compile - Run:
./build/fe3hrecomp.exe extracted --play > run.log 2>&1Add--upscaler-overlayto show a small window in the top-left corner with the output and render resolutions, the upscaler, its quality level, and what it ran on the last frame.
DLC
Extract each DLC's romfs into a folder named by its content id:
extracted/dlc/010055D009F79001/romfs/...
extracted/dlc/010055D009F79002/romfs/...
Each romfs folder holds the DLC's extracted files (the same kind of extraction as the base game's romfs), not the
.nsp itself. The game sees every pack there as installed and reads it straight from its folder. The start screen
shows how many packs it found ("v1.2.0 · 6 DLC packs").
Cheats
Cheats use the Atmosphere format: put them in cheats.txt in the project folder (a [Name] line, then its codes; a
{Name} block is a master code, always on; # lines under the name describe it), and they show up in the menu's Game tab to switch on and off. The
file stays out of git.
Cheats that only change memory work straight away. Cheats that patch the game's code (most multipliers and "max"
cheats) can't be applied to an already-recompiled game at run time, so their patched instructions get compiled in
beside the originals: after adding or changing those, run make gen-main and then make. The menu marks any cheat
still waiting on that. Switching a cheat off puts back any code it changed; values it already wrote stay. Cheats
that patch the same instruction (Exp x2 / x4 / x8, say) exclude each other: switching one on turns the others off.
Mods
Data mods go in a mods folder next to the game files (extracted/mods), one folder per mod, laid out as for Yuzu
or Ryujinx:
extracted/mods/<mod>/romfs/...
extracted/mods/<mod>/dlc/010055D009F79004/romfs/... (a mod's files for a DLC pack, if it has any)
On the start screen, Settings > Mods lists them: left / right turns a mod off or gives its place in the load
order (where two mods change the same thing, the later one wins), Add a mod copies a mod's folder in, and the
page names conflicts between the mods that are on. The choice is kept in extracted/mods/load_order.txt (one
folder name per line) and applies when the game starts. The game files themselves are never changed.
Translation mods replace one English text: the US one (Settings > Game > Language: English (US)) or the European one
(English (UK)); the Mods page offers to switch when a mod needs the other. Mods that change the game's code (an
exefs folder, IPS patches) can't apply to the recompiled game; only their data is used.
Settings and logs
- F1 (or Minus + Plus on a controller) opens the settings overlay. Internal resolution starts at 1x (1080p). On a fast GPU, "Match display" or higher gives a sharper image; on a laptop, a Steam Deck or an older GPU, 75% or Dynamic keeps battles much smoother (the battle lighting's cost grows with the pixel count). 150% or 200% renders above your display and shrinks the image to it: the smoothest edges, if your GPU has room. Sharpening (Default, High, Low or Off) sets how crisp the final image is; Default doesn't sharpen at Match display.
- Upscaler: AMD FSR 3, AMD FSR 4 (Radeon GPUs whose driver offers it; FSR 3 where not) and NVIDIA DLSS (GeForce RTX) are temporal upscalers. While one of them is selected, Upscaler quality sets the render size instead of Internal resolution. Its Native level is anti-aliasing only: DLAA with DLSS, Native AA with FSR. Anti-aliasing (SMAA) is greyed out, because they anti-alias the image themselves. See upscaling.md.
- Getting FSR 3 / 4 and DLSS (Windows, once): they need files from AMD and NVIDIA that we aren't allowed to
include, so the game fetches them for you. In Settings > Video, pick the upscaler; a Get AMD FSR or
Get NVIDIA DLSS row appears under it. Choose it, read the vendor's licence and accept it: the game downloads
the files from the vendor's own GitHub page, checks them, and puts them next to
fe3hrecomp.exe(with a copy of the licence). FSR 3 / 4 work right away (a 36 MB download); DLSS (63 MB, plus a few seconds to build the small bridgefe3h-dlss.dllthat connects the game to it) works after a restart. Until then the game uses AMD FSR 1, and the row says why. An update of the game keeps these files; if a new version needs DLSS set up again, the row comes back. Nothing is downloaded unless you accept the licence. - Keyboard and mouse: WASD moves, E / Q confirm / back, F / R are X / Y, Z / C are L / R, 1 / 3 are ZL / ZR, Tab / M are Plus / Minus, arrows the d-pad, I / J / K / L the camera. Left click is A, the wheel steps up / down through menus (Shift + wheel, or tilting the wheel, steps left / right). Hold the right mouse button to turn the camera with the mouse, or set Controls > Mouse camera to Always (cursor hidden, right click = B). Every key can be changed in the Controls tab.
- Saves are in
save/, settings infe3hrecomp.ini(an olderlarecomp.iniis renamed to it once). fe3hrecomp.login the program folder (orrun.logwhen started from a shell) is the first place to look when something goes wrong; the three before it are kept asfe3hrecomp.1.logto.3.log.LARECOMP_*environment variables turn on extra logging for specific systems (audio, textures, shaders); they're documented where they're read inruntime/.
Making a release package
From the MSYS2 UCRT64 shell, once: make deps-windows (an LGPL build of FFmpeg: releases can't ship MSYS2's GPL one),
tools/fetch_zig.sh (the compiler players' PCs build the game with) and make gen-helper (the game code generator
as a standalone program; needs the python.org Python 3.12 the setup script installs). Then make dist builds
build/dist/FE3H-Recomp-<version>-windows.zip and its .sha256 (the version is FE3H_VERSION in
runtime/ui/launcher.mm). Attach both to the release: the updater checks every download against the .sha256. It holds
no game code: each player's PC recompiles the game from their own files. make dist rebuilds the generator helper
by itself when tools/ changed. If py isn't on the MSYS2 shell's PATH, give the Python for the helper as
GEN_PY=/c/Users/<you>/AppData/Local/Programs/Python/Python312/python.exe.
Making the Linux AppImage
The AppImage is built on Linux (or in WSL2 on Windows, see below) inside Ubuntu 22.04 containers, so it runs on most
distributions from 2022 on. You need git, make and podman; everything else (compilers, SDL3, FFmpeg, shaderc,
Python, Zig) is downloaded and built inside the container. Like the Windows zip, it holds no game code.
sudo apt install git make podman # Ubuntu / Debian; other distributions: the same three packages
git clone https://git.onerag90.de/recomps/fe3h-recomp.git
cd fe3h-recomp
make appimage
The result is build/dist/FE3H-Recomp-<version>-linux-x86_64.AppImage. The first build takes a while (it builds the
container and the libraries once, then caches them); later ones are much quicker. make appimage ARCH=aarch64
cross-compiles the experimental ARM build (it also needs qemu-user-binfmt).
From Windows (WSL2): in PowerShell, wsl --install -d Ubuntu-24.04 (restart if asked, then pick a user name and
password). Open Ubuntu from the Start menu and run the four commands above there. Clone inside Ubuntu's own home
folder (as above), not under /mnt/c: Windows folders are slow from WSL and Windows Git can turn the scripts' line
endings into CRLF, which breaks them. Copy the result to Windows with
cp build/dist/*.AppImage /mnt/c/fe3h/.
make smoketest (the start screen and the game on this machine) needs a real Linux PC with a GPU and your own
extracted/ in the checkout. More detail, running the AppImage and building from source:
docs/linux.md.
Hurdles along the way
Some of what it took to get from Link's Awakening's recompiler to a playable Three Houses, in case it helps anyone doing the same for another game:
- Lighting was missing. FE3H culls its lights in compute shaders that count lights per screen tile with subgroup operations. The translator returned 0 for lane IDs and masks, so no tile had any lights; and a barrier inside the shader's branch state machine ran before every wave had added its own lights. Fixed in the shader translator.
- Audio routing. Music, voices and effects go through the audio renderer's splitters and an I3DL2 reverb that LA never used; until those were implemented, sounds didn't reach the right mixes.
- Stutter. Each new shader was translated, compiled to SPIR-V and built by the driver in the middle of play. Three layers fixed it: translations cached on disk, draws waiting a few milliseconds a frame for a shader still building instead of skipping it, and a prewarm that rebuilds everything seen in earlier sessions at launch.
- Battle effects. Combat art and gambit cut-ins are drawn by compute shaders writing into images, with subroutine calls and memory reductions the translator didn't know yet. Some are enormous (9,000-11,000 instructions); building them stalled the driver for minutes and held up every other shader behind them, so the effects never appeared. Large ones now build on threads of their own, and the largest are skipped.
- Cheats. Many Switch cheats patch the game's code, which a recompiled game no longer runs. Their patched instructions are compiled in beside the originals and picked at run time. One popular "always critical" cheat turned out to zero unit stats (stranding units unable to move); it was replaced with a one-instruction code patch on the crit roll.
- Setup time. A few of the game's functions are huge (one is 4 MB of C). A compiler can't split one function across cores, so the first setup spent 15 minutes compiling a single file. The generator now writes very long functions as parts that compile in parallel: setup went from about 20 minutes to 6.
Rules for this repository
Nothing owned by Nintendo is ever committed: no game files, no extracted or generated code (extracted/,
generated/), no logs or dumps that contain game code, no assets. .gitignore covers the usual folders.
Credits
- LAS Recomp by Peiikai and its contributors: the recompiler, runtime, renderer and almost everything else here (MIT). Its README lists its full credits and third-party components.
- Ryujinx (MIT): the audio renderer's reverb, I3DL2 reverb and auxiliary send / return
are ports of its implementation (
third_party/ryujinx/LICENSE.txt). - EB Garamond by Georg Duffner: the start screen's title (SIL Open Font License
1.1,
third_party/fonts/EBGaramond/OFL.txt). - AMD FidelityFX Super Resolution 1 (MIT) and SMAA (MIT), as used by LAS.
- Temporal upscalers by Jack (ImJacksLackOfBeetus): AMD FSR 3 / FSR 4 and NVIDIA DLSS, the crash guard and the upscaler overlay (upscaling.md).
- AMD FSR 3 and FSR 4: the game uses AMD FidelityFX Super Resolution 3 and 4 through AMD's MIT-licensed FidelityFX
API headers (
third_party/fidelityfx); AMD's DLL is never bundled (each player, or builder, fetches it from AMD's GitHub under AMD's licence: Get AMD FSR). AMD, Radeon and FidelityFX are trademarks of Advanced Micro Devices, Inc. - NVIDIA DLSS: the game uses NVIDIA DLSS Super Resolution, NVIDIA's technology, through
fe3h-dlss.dll, a small bridge of ours (runtime/dlss/, MIT) that each player's PC builds from NVIDIA's DLSS SDK after they accept NVIDIA's licence (Get NVIDIA DLSS). NVIDIA's files are never bundled, and the game itself contains no NVIDIA code. NVIDIA and DLSS are trademarks of NVIDIA Corporation. - Libraries: SDL 3 (zlib), FFmpeg (LGPL), Dear ImGui (MIT), Vulkan Memory Allocator (MIT), shaderc (Apache 2.0); the code generator uses Capstone, Unicorn and python-lz4.
- The Switch homebrew community's documentation (Switchbrew).
Legal
This is a fan project, not affiliated with, endorsed by or sponsored by Nintendo, Intelligent Systems or Koei Tecmo. Fire Emblem and Fire Emblem: Three Houses are trademarks of Nintendo. No game files, game code or assets are included in this repository. You must provide your own legally obtained copy of the game.
License
The code is open source under the MIT License, as LAS Recomp's is. Third-party components keep their own
licenses (see LAS Recomp's README for the full list, including the Link's Awakening randomizer still in
third_party/). The license covers this project's code only; it grants nothing for Nintendo's game.
The Windows release ships some components unmodified under their own licenses (FFmpeg, SDL, shaderc, the GCC runtime,
and the code generator's Python, Unicorn and Capstone). Their license texts and source links are in its licenses
folder (third_party/notices/README.txt here).