CPUEmu loads Windows executables, interprets their machine code, isolates guest memory, and marshals selected Windows APIs to the host. It is a user-mode compatibility projectβnot a virtual machine, hypervisor, full Windows installation, or transparent native-call forwarder.
Current headline: Undertale loads its PE32 image, parses data.win, creates its GameMaker
window, completes input/display discovery, and reaches Direct3D 9Ex initialization.
Statuses describe the furthest verified milestone, not a promise that every feature works.
| Status | Application | Architecture | Verified milestone | Next blocker |
|---|---|---|---|---|
| π’ Supported | CPUEmu fixtures | x86 / x64 | Load, execute, print, and exit with checked results | Test scope only |
| π’ Smoke test | CPUEmu Paint | x64 | Creates a window and passes headless drawing self-test | Deliberately small fixture |
| π‘ Starts | Classic Windows Notepad | x64 | Editor window, typing, menus, Save/Save As, UTF-8 Unicode, and a 52,138-character round-trip | Edited-content Save As, UTF-16/legacy encodings, and sustained interactive sessions remain unverified |
| π΄ Blocked | Modern packaged Notepad | x64 | Activates a guest-owned WinRT application instance | XAML resource lookup and guest exception unwinding |
| π Graphics bring-up | Undertale | x86 | Parses game data, creates YYGameMakerYY, initializes safe input, reaches Direct3DCreate9Ex |
Direct3D 9Ex device and presentation proxy |
| π΄ Blocked early | Discord / Chromium | x64 | More than 2.6M V8 startup instructions | Guest processes, threads, DLLs, exceptions, SIMD |
PE32 load data.win Native HWND Input/display D3D9Ex First frame
β
βββββββββββ β
ββββββββββββ β
βββββββββββββββ β
ββββββββββββββ π§ βββββββββββ β
313 imports asset parse callbacks run safe COM proxy current target
See the full game and application compatibility database and the Undertale bring-up notebook. Commercial executables and game assets are never stored in this repository.
The map is an auditable catalog view. Every tiny cell maps to one named instruction, grouped
mnemonic, encoding subset, or architectural capability in
docs/instruction-atlas.csv. βBroadβ does not claim that every
historical encoding or edge case is complete, and the 200 tracked entries are not a denominator for
the entire x86 architecture.
The detailed instruction inventory lists implemented mnemonics, partial families, feature-advertising rules, and known gaps. CPUEmu intentionally avoids inflated βthousands of instructionsβ claims: operand size, prefixes, ModRM forms, flags, and memory behavior are all part of an instruction's implementation.
These images were captured from windows owned by cpuemu.exe, not native stand-ins.
| CPUEmu Paint visual probe | Microsoft About Windows (winver.exe) |
|---|---|
![]() |
![]() |
Classic System32\notepad.exe now produces a genuine CPUEmu-owned editor window and accepts basic
keyboard input. Its repository screenshot is still pending; the modern packaged Notepad remains a
separate blocked target. See the capture provenance and exact commands.
- Loads fixed or relocatable PE32 and PE32+ images with checked sections, imports, TLS metadata, stack setup, and low-address x86 thunks.
- Interprets x86 and x86-64 instructions with exact guest register, flag, width, prefix, and address-size behavior where implemented.
- Keeps guest virtual addresses separate from host pointers and validates every mapping through
the guest
Memorymodel. - Provides explicit adapters for console, files, paths, environment, time, heap, TLS/FLS, windows, messages, resources, basic audio, input discovery, and selected COM-like interfaces.
- Re-enters interpreted window procedures safely instead of asking Windows to execute guest code.
- Produces leveled logs, CPU register dumps, and a 64-entry recent-instruction history on failure.
- Windows 10 or 11
- CMake 3.24+
- Ninja
- LLVM/Clang with C++20 support
git clone https://github.com/arcwiser/cpu-emu.git
cd cpu-emu
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build --output-on-failurebuild\cpuemu.exe C:\path\to\program.exePass guest command-line arguments after --:
build\cpuemu.exe build\test-apps\paint.exe -- --selftestLimit interpreted work when probing unknown software:
build\cpuemu.exe program.exe --limit 20000000An instruction limit of 0 disables the limit. This is useful for known guests but is not
recommended for first probes.
CPUEmu logs to stderr; guest stdout remains separate.
| Command | Detail | Best use |
|---|---|---|
cpuemu.exe app.exe |
info |
Normal runs and fast probes |
cpuemu.exe app.exe -v |
api |
Every adapted API call |
cpuemu.exe app.exe -vv |
trace |
Imports, mappings, and window callbacks |
cpuemu.exe app.exe --log-file run.log |
Mirrors logs to a file | Sharing a reproducible failure |
cpuemu.exe --version |
Build version | Bug reports |
cpuemu.exe --help |
Complete CLI usage | Option discovery |
Verbose console output can dominate runtime. Prefer --log-file and the default level until a
probe reaches its blocker, then rerun a narrow reproduction with -v or -vv.
flowchart LR
EXE[PE32 / PE32+ executable] --> PE[PeLoader]
PE --> MEM[Checked guest Memory]
MEM <--> CPU[x86 / x86-64 Cpu interpreter]
CPU <--> RT[Runtime and ABI adapters]
RT <--> WIN[Windows host APIs]
RT --> LOG[Logs and diagnostics]
| Component | Responsibility |
|---|---|
Cpu |
Decode, execute, registers, flags, x87/XMM state, recent instruction history |
Memory |
Checked guest mappings, permissions, page-indexed lookup, virtual-memory bookkeeping |
PeLoader |
PE validation, sections, imports, TLS, image metadata, x86/x64 format handling |
Runtime |
Process setup, ABI thunks, guest-owned interfaces, Win32 marshaling, callback re-entry |
log |
Error/warn/info/API/trace output without contaminating guest stdout |
CPUEmu prefers a correct general mechanism over a patch for one game or instruction address.
- Guest pointers are untrusted. Every range is validated before host access.
- Host pointers stay on the host. Strings, arrays, structures, vtables, and nested pointers are copied or represented in guest memory.
- Callbacks re-enter the interpreter. Guest code is never cast to a host function pointer.
- Unsafe features fail closed. Unsupported asynchronous, process, thread, exception, or COM behavior is refused until it has a lifetime-aware adapter.
- Feature bits are promises.
CPUIDadvertises a family only when software can rely on it. - A compatibility probe is evidence, not a test. General behavior gets a focused regression.
- One interpreted guest thread and one guest process.
- No general guest DLL loader or native 32-bit DLL execution inside the 64-bit host process.
- Direct3D 9Ex device creation/presentation is the current Undertale blocker.
- DirectInput currently exposes safe inert discovery/state behavior, not active keyboard/mouse delivery.
- Steam uses an offline failure path; authenticated integration needs a marshaled 32-bit helper.
- Streaming audio APIs and retained audio callbacks are not implemented.
- x87, MMX, SSE extensions, exception delivery, and many rare encodings remain incomplete.
cpu-emu/
ββ include/winemu/ Public core headers (legacy namespace retained for compatibility)
ββ src/ CPU, memory, PE loader, runtime, logging, CLI
ββ tests/ Machine-code regressions and end-to-end fixtures
ββ tools/ Guest fixture source and test-app generator
ββ docs/ Compatibility, coverage, roadmap, devlog, architecture notes
ββ .github/ Issue forms and pull-request template
ββ AGENTS.md Rules for AI/coding agents
ββ CONTRIBUTING.md Human and AI-assisted contribution requirements
For file ownership and change routing, see Project structure.
Instruction work, ABI fixes, Win32 adapters, tests, documentation, and reproducible compatibility reports are welcome. Every pull request must disclose AI assistance, list exact validation results, include appropriate tests, preserve guest/host isolation, and document limitations honestly.
Read CONTRIBUTING.md before opening a pull request. Coding agents must also follow AGENTS.md.
| Document | Contents |
|---|---|
| Game compatibility | Status tiers, verified applications, audio status |
| Instruction coverage | Detailed mnemonic/family inventory and gaps |
| Windows compatibility | Adapter ownership and supported Win32 areas |
| Undertale roadmap | Current probe, milestones, and subsystem plan |
| Roadmap | Cross-project priorities and completion criteria |
| Development log | Chronological compatibility milestones |
| Project structure | Directory responsibilities and placement rules |

