> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/dolphin-emu/dolphin/llms.txt
> Use this file to discover all available pages before exploring further.

# Core emulation

> Deep dive into Dolphin's core emulation engine for GameCube and Wii hardware

The core emulation engine in `Source/Core/Core/` handles the fundamental hardware emulation for both GameCube and Wii systems.

## Console Type Detection

Dolphin supports multiple console types defined in `Core/Core.h`:

```cpp theme={null}
enum class ConsoleType : u32
{
  // GameCube retail
  HW1 = 1,
  HW2 = 2,
  LatestProductionBoard = 3,
  
  // Wii retail  
  RVL_Retail1 = 0x21,
  RVL_Retail2 = 0x22,
  RVL_Retail3 = 0x23,
  
  // Development kits
  FirstDevkit = 0x10000004,
  NDEV2_0 = 0x10000020,
  // ... more devkit types
};
```

The console type affects:

* Boot ROM behavior
* Hardware capabilities
* Memory map layout
* Available peripherals

## Hardware Components

The `Core/HW/` directory contains emulation for all hardware subsystems:

### Memory Interface

**Location**: `Core/HW/MemoryInterface.cpp`

Emulates the memory controller:

* Main RAM access (24 MB GameCube, 64 MB Wii)
* Memory protection and address translation
* Cache control
* Memory refresh timing

### Processor Interface

**Location**: `Core/HW/ProcessorInterface.cpp`

Handles CPU-GPU communication:

* Interrupt controller (32 interrupt sources)
* Reset control
* Console type configuration
* Debug communication

Interrupt types:

```cpp theme={null}
// From ProcessorInterface.h
PE_TOKEN    = 0x01,  // GPU token
PE_FINISH   = 0x02,  // GPU draw done
VI          = 0x04,  // Vertical interrupt
DI          = 0x08,  // Disc interface
AI          = 0x10,  // Audio interface
DSP         = 0x20,  // DSP
MEM         = 0x40,  // Memory
// ... more interrupt types
```

### Video Interface

**Location**: `Core/HW/VideoInterface.cpp`

Emulates the video output controller:

* Display timing generation
* Vertical blank interrupts
* Video mode configuration (NTSC, PAL, progressive)
* XFB (External Framebuffer) management

### Audio Interface

**Location**: `Core/HW/AudioInterface.cpp`

Streams audio from RAM to output:

* DMA from main RAM
* Sample rate control (32 KHz default)
* Audio interrupts
* Streaming mode

### Serial Interface (SI)

**Location**: `Core/HW/SI/`

GameCube controller port emulation:

* 4 controller ports
* Memory card slots (2 per controller)
* GBA link cable support
* Keyboard support

Supported device types:

* Standard controller
* GBA
* Steering wheel
* DK Bongos
* GC Keyboard

### EXI (External Interface)

**Location**: `Core/HW/EXI/`

Expansion port emulation:

* Memory cards (slot A/B)
* Broadband/modem adapter
* Real-time clock
* IPL/BIOS chip
* Gecko code handler

### DVD Interface

**Location**: `Core/HW/DVD/`

Disc drive emulation:

* Disc reading and seeking
* Drive authentication
* Audio streaming from disc
* Read commands and DMA

## Boot Process

**Location**: `Core/Boot/`

The boot process depends on the game type:

<Tabs>
  <Tab title="GameCube Games">
    <Steps>
      <Step title="Load IPL">
        Load GameCube BIOS (IPL.bin) or use HLE replacement
      </Step>

      <Step title="Initialize Hardware">
        Set up memory map, configure video mode
      </Step>

      <Step title="Load Boot ROM">
        Read `boot.bin` from disc image
      </Step>

      <Step title="Load DOL">
        Parse and load main executable (boot.dol or apploader → main.dol)
      </Step>

      <Step title="Start Execution">
        Jump to entry point and begin PowerPC execution
      </Step>
    </Steps>
  </Tab>

  <Tab title="Wii Games">
    <Steps>
      <Step title="Initialize IOS">
        Boot Wii operating system kernel
      </Step>

      <Step title="Load IOS Modules">
        Start system modules (ES, FS, DI, etc.)
      </Step>

      <Step title="Mount Partition">
        Decrypt and mount game partition
      </Step>

      <Step title="Load DOL">
        Load main executable from partition
      </Step>

      <Step title="Start Execution">
        Begin PowerPC execution under IOS
      </Step>
    </Steps>
  </Tab>

  <Tab title="Wii Channels">
    <Steps>
      <Step title="Initialize IOS">
        Boot Wii system menu IOS
      </Step>

      <Step title="Load from NAND">
        Read WAD/channel from NAND filesystem
      </Step>

      <Step title="Verify Signatures">
        Check TMD and ticket signatures
      </Step>

      <Step title="Decrypt Content">
        Decrypt with title key
      </Step>

      <Step title="Start Execution">
        Run channel application
      </Step>
    </Steps>
  </Tab>
</Tabs>

## System Timing

**Location**: `Core/HW/SystemTimers.cpp`

Dolphin uses a cycle-accurate timing system:

| Component | Clock Speed                 | Cycle Time            |
| --------- | --------------------------- | --------------------- |
| CPU       | 486 MHz (GC/Wii)            | \~2.06 ns             |
| GPU       | 162 MHz (GC), 243 MHz (Wii) | \~6.17 ns / \~4.12 ns |
| DSP       | 81 MHz                      | \~12.35 ns            |
| AI        | 32 KHz sample rate          | 31.25 μs              |

Timers synchronize:

* Video interrupts (60 Hz NTSC, 50 Hz PAL)
* Audio DMA
* DSP communication
* Peripheral polling

## Configuration System

**Location**: `Core/Config/`

Hierarchical configuration with layers:

1. **Base layer**: Dolphin.ini defaults
2. **Game layer**: Per-game overrides (GameSettings/\*.ini)
3. **Runtime layer**: Temporary runtime changes

Configuration sections:

```ini theme={null}
[Core]
CPUCore = 1              # 0=Interpreter, 1=JIT, 2=Cached Interpreter
CPUThread = True
SkipIdle = True
EnableDebugging = False

[DSP]
EnableJIT = True
DumpAudio = False
Backend = Cubeb
```

## Save States

Full system state can be serialized:

<Accordion title="Saved Components">
  * All CPU registers (GPR, FPR, SPR, CR, etc.)
  * Main RAM contents (24/64 MB)
  * GPU state (registers, caches, command buffer)
  * DSP state (IRAM, DRAM, registers)
  * All hardware registers
  * Peripheral state (controllers, memory cards)
</Accordion>

<Accordion title="State Format">
  Binary format with version header:

  ```cpp theme={null}
  // Simplified structure
  struct SaveState {
    u32 version;
    u32 cpu_core_count;
    // Serialized component data...
  };
  ```
</Accordion>

<Note>
  Save states are not compatible across Dolphin versions due to internal changes. Use in-game saves for long-term storage.
</Note>

## Debugging Features

**Location**: `Core/Debugger/`

Built-in debugging tools:

* **Code Breakpoints**: Break on PowerPC address execution
* **Memory Breakpoints**: Watch RAM reads/writes
* **Logging**: Per-component log levels
* **Disassembly**: PowerPC instruction viewer
* **Register Inspector**: CPU/GPU register display
* **Memory Viewer**: RAM/cache browser

Enable with `--debugger` flag or in settings.

## See Also

* [CPU Emulation Details](/architecture/cpu-emulation)
* [IOS/HLE Emulation](/architecture/ios-emulation)
* [Video Backend Architecture](/architecture/video-backends)
* [Configuration Guide](/user-guide/configuration)
