Skip to content

Latest commit

 

History

History
149 lines (120 loc) · 10.2 KB

emudev_resources_general.md

File metadata and controls

149 lines (120 loc) · 10.2 KB

General Resources

Most people start with a CHIP-8 emulator. As with any system, see <#482208284032499713> to get started. Note: A great guide that still keeps it challenging is https://tobiasvl.github.io/blog/write-a-chip-8-emulator/.

After that, you can pretty much move to whatever system you want to. You don't have to "work your way up" to it as many seem to think (relevant opinionated thread here: https://goo.gl/CAvrd4). Just make sure you have the basics down first, study the source code of existing emulators (super important) and if you get stuck, ask questions here or in the subreddit. If you contribute to a project that has its own community/resources, you should probably prioritize that.

Emulation Terms

Explanations for some terms you might come across. (for more info, look at source code of existing emulators, or ask others)

HLE vs LLE

High Level Emulation vs Low Level Emulation

CPU emulation, cached interpeters

Dynarecs/JITs and AOTs

Just-In-Time and Ahead-of-Time compilers.

fastmem

Fast memory accesses using host MMU.

Software Rasterization

For emulating 3D systems.

Audio

FPGAs

Integrated Circuits

Save States

Emulator Update Loop

Useful libraries

  • Multimedia libraries (For Audio/Video output, keyboard/controller input, etc)

    • SDL2: C library for graphics, audio, input, threading, and more. Has bindings for several languages
    • SFML: C++ library for video and input. Mostly aimed at gamedevs, but can be used for emudev too. Audio API generally considered unfit for emudev.
    • Miniaudio: Single-header C audio library, supports all major desktop OSs + Android/iOS.
  • UI frameworks:

    • Qt: C++ GUI framework with bindings in several languages.
    • Dear ImGui: Immediate-mode GUI framework, focusing on ease-of-use
      • ImGui Club: Collection of useful ImGui widgets, including a memory editor
    • Avalonia: Portable .NET GUI framework
    • GTK
    • Nuklear: Single header C immediate mode GUI library
    • WxWidgets
  • Runtime code generation (emitter) libraries for use in JITs and assemblers:

    • Xbyak: Single header C++ x86-32 and x86-64 emitter
    • Oaknut: Single header C++ arm64 emitter
    • Dynasm: x86-32/x86-64/arm32/arm64/PowerPC/MIPS emitter written in C
    • Luma: Single header C++ 32-bit PowerPC emitter, with support for the Paired Singles ISA in the Gamecube/Wii/Wii U CPUs
    • Vixl: C++ arm32 and arm64 emitter for x86-32, x86-64 and arm64.
    • asmjit: C++ emitter
    • Dynasm-rs: A dynasm-like library for Rust, using proc-macros
  • Libraries for handling configuration files, game databases, etc:

    • nlohmann/json: JSON for modern C++
    • toml11: TOML for modern C++
    • mINI: Single header C++ library for manipulating INI files
  • Cryptography libraries for systems with crypto hardware:

  • elfio: C++ library for reading and creating ELF files, useful for emulators that need to load ELFs or create ELFs for debugging purposes.

  • Capstone: C disassembler library with support for too many architectures to enumerate

  • Keystone: C assembler framework

  • glm: C++ library for faciliating vector, matrix and quaternion math. Particularly useful for graphics emulation.

  • Hips: Single header C++ library for applying IPS, BPS and UPS patches

  • Discord-RPC: C++ library for adding discord RPC to your emulator, because we all love free advertisements.


Reverse Engineering

In emulation, RE-ing is often needed for system BIOSes, operating systems, drivers, OS modules and games to aid in understanding of what the hardware does & emulate it properly when the documentation is insufficient or incomplete (ie. always). It's a huge area of expertise & there is no be-all end-all resource, but a decent starting point might be https://beginners.re (older but free mirror: https://mirrors.ocf.berkeley.edu/parrot/misc/openbooks/programming/ReverseEngineeringForBeginners.en.pdf)

Static analysis

The industry standard tools are:

  • Ghidra: There are loaders/extensions for pretty much all consoles/processors, search for them.
  • IDA Pro: Proprietary, paid, closed-source. Industry-standard for professionals - especially before Ghidra it was the only viable option. I don't personally recommend it, especially for architectures other than x86. Also if you want to get it legally, it costs multiple thousands of dollars vs. Ghidra being free & open source.

Dynamic analysis / Debugging

The standard tool that's cross-platform and supports many architectures is gdb.


Contributing

Have something to add to this list? Submit a pull request here.

Note: If you're new here, scroll up to the top!