> ## 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.

# Cheats & Action Replay

> Use cheat codes and understand Action Replay code types

## Overview

Dolphin supports GameCube and Wii cheat codes using the Action Replay code format. These codes allow you to modify game memory to enable cheats like infinite health, unlock items, or alter gameplay mechanics.

## Enabling Cheats

<Steps>
  <Step title="Open Properties">
    Right-click a game in the game list and select "Properties"
  </Step>

  <Step title="Go to AR Codes Tab">
    Navigate to the "AR Codes" tab
  </Step>

  <Step title="Add Codes">
    Click "Add" or "Edit" to enter cheat codes
  </Step>

  <Step title="Enable Codes">
    Check the box next to codes you want active
  </Step>

  <Step title="Enable System">
    Ensure "Enable Cheats" is checked in Config > General
  </Step>
</Steps>

## Code Format

Action Replay codes consist of two-line pairs in hexadecimal format:

```text theme={null}
AAAAAAAA BBBBBBBB
```

* **AAAAAAAA**: Code type and address
* **BBBBBBBB**: Value to write or compare

### Example Codes

```
04012345 00000063    # Write value 0x63 to address 0x80012345
00023000 00000312    # Fill 3 bytes at 0x80023000 with 0x12
```

## Memory Range

GameCube memory range:

* **Cached**: `0x80000000` - `0x817FFFFF`
* **Uncached**: `0xC0000000` - `0xC17FFFFF`

Action Replay uses simplified offsets `0x00000000` - `0x017FFFFF` with code type prefix.

<Note>
  Most codes write to the cached range (`0x80000000` base).
</Note>

## Data Sizes

* **8-bit (Byte)**: `0x12` (0-255)
* **16-bit (Halfword)**: `0x1234` (0-65535)
* **32-bit (Word)**: `0x12345678` (0-4294967295)

### Alignment Requirements

<Warning>
  * **8-bit**: Any address
  * **16-bit**: Address must be multiple of 2 (ends in 0,2,4,6,8,A,C,E)
  * **32-bit**: Address must be multiple of 4 (ends in 0,4,8,C)

  Misaligned codes may fail or crash.
</Warning>

## Basic Code Types

### RAM Write Codes

Write values directly to memory.

<CodeGroup>
  ```text 8-bit Write (00) theme={null}
  00XXXXXX NNNNNNVV

  Writes byte VV to address 0x80XXXXXX, repeated NNNNNN+1 times

  Example:
  00006500 00000312
  Writes 0x12 to addresses:
    0x80006500, 0x80006501, 0x80006502, 0x80006503
  ```

  ```text 16-bit Write (02) theme={null}
  02XXXXXX NNNNVVVV

  Writes halfword VVVV to address 0x80XXXXXX, repeated NNNN+1 times

  Example:
  02006500 00011234
  Writes 0x1234 to addresses:
    0x80006500, 0x80006502
  ```

  ```text 32-bit Write (04) theme={null}
  04XXXXXX VVVVVVVV

  Writes word VVVVVVVV to address 0x80XXXXXX

  Example:
  04006500 12345678
  Writes 0x12345678 to address 0x80006500
  ```
</CodeGroup>

### Addition Codes

Add values to existing memory.

<CodeGroup>
  ```text 8-bit Add (80) theme={null}
  80XXXXXX 000000VV

  Loads byte at address, adds VV, stores result (masked to 8-bit)

  Example:
  80012340 00000005
  Adds 5 to byte at 0x80012340
  ```

  ```text 16-bit Add (82) theme={null}
  82XXXXXX 0000VVVV

  Loads halfword at address, adds VVVV, stores result

  Example:
  82012340 00000100
  Adds 256 to halfword at 0x80012340
  ```

  ```text 32-bit Add (84) theme={null}
  84XXXXXX VVVVVVVV

  Loads word at address, adds VVVVVVVV, stores result

  Example:
  84012340 00000001
  Adds 1 to word at 0x80012340
  ```
</CodeGroup>

## Conditional Codes

Execute following codes only if conditions are met.

### If Equal

<CodeGroup>
  ```text Single-line If Equal (08/0A/0C) theme={null}
  08XXXXXX 000000VV    # 8-bit
  0AXXXXXX 0000VVVV    # 16-bit
  0CXXXXXX VVVVVVVV    # 32-bit

  If value at address equals VV/VVVV/VVVVVVVV, execute next code

  Example:
  0C012340 00000001    # If word at 0x80012340 equals 1
  04012344 00000063    # Then write 99 to 0x80012344
  ```

  ```text Two-line If Equal (48/4A/4C) theme={null}
  48XXXXXX 000000VV    # 8-bit
  4AXXXXXX 0000VVVV    # 16-bit
  4CXXXXXX VVVVVVVV    # 32-bit

  If condition true, execute next TWO codes
  ```

  ```text Multi-line If Equal (88/8A/8C) theme={null}
  88XXXXXX 000000VV    # 8-bit
  8AXXXXXX 0000VVVV    # 16-bit
  8CXXXXXX VVVVVVVV    # 32-bit

  Executes all following codes until terminator:
  00000000 40000000
  ```
</CodeGroup>

### If NOT Equal

<CodeGroup>
  ```text Single-line If NOT Equal (10/12/14) theme={null}
  10XXXXXX 000000VV    # 8-bit
  12XXXXXX 0000VVVV    # 16-bit
  14XXXXXX VVVVVVVV    # 32-bit

  If value does NOT equal, execute next code
  ```

  ```text Two-line If NOT Equal (50/52/54) theme={null}
  50XXXXXX 000000VV    # 8-bit
  52XXXXXX 0000VVVV    # 16-bit
  54XXXXXX VVVVVVVV    # 32-bit

  If condition true, execute next TWO codes
  ```

  ```text Multi-line If NOT Equal (90/92/94) theme={null}
  90XXXXXX 000000VV    # 8-bit
  92XXXXXX 0000VVVV    # 16-bit
  94XXXXXX VVVVVVVV    # 32-bit

  Executes all codes until terminator:
  00000000 40000000
  ```
</CodeGroup>

### Comparison Codes

<AccordionGroup>
  <Accordion title="If Lower (Signed)">
    ```text theme={null}
    18XXXXXX 000000VV    # 8-bit (actually unsigned due to AR bug)
    1AXXXXXX 0000VVVV    # 16-bit signed
    1CXXXXXX VVVVVVVV    # 32-bit signed

    58/5A/5C - Two-line version
    98/9A/9C - Multi-line version
    ```

    <Warning>
      8-bit "signed" comparison is actually unsigned due to AR bug.
    </Warning>
  </Accordion>

  <Accordion title="If Higher (Signed)">
    ```text theme={null}
    20XXXXXX 000000VV    # 8-bit (actually unsigned due to AR bug)
    22XXXXXX 0000VVVV    # 16-bit signed
    24XXXXXX VVVVVVVV    # 32-bit signed

    60/62/64 - Two-line version
    A0/A2/A4 - Multi-line version
    ```
  </Accordion>

  <Accordion title="If Lower (Unsigned)">
    ```text theme={null}
    28XXXXXX 000000VV    # 8-bit: 0-255
    2AXXXXXX 0000VVVV    # 16-bit: 0-65535
    2CXXXXXX VVVVVVVV    # 32-bit: 0-4294967295

    68/6A/6C - Two-line version
    A8/AA/AC - Multi-line version
    ```
  </Accordion>

  <Accordion title="If Higher (Unsigned)">
    ```text theme={null}
    30XXXXXX 000000VV    # 8-bit
    32XXXXXX 0000VVVV    # 16-bit
    34XXXXXX VVVVVVVV    # 32-bit

    70/72/74 - Two-line version
    B0/B2/B4 - Multi-line version
    ```
  </Accordion>

  <Accordion title="If AND (Bitwise)">
    ```text theme={null}
    38XXXXXX VVVVVVVV

    If (value_at_address AND VVVVVVVV) != 0, execute next code

    78XXXXXX - Two-line version
    B8XXXXXX - Multi-line version
    ```
  </Accordion>
</AccordionGroup>

## Advanced Code Types

### Pointer Codes

Write to addresses stored at other addresses.

```text theme={null}
40XXXXXX NNNNNNVV    # 8-bit pointer write
42XXXXXX NNNNVVVV    # 16-bit pointer write
44XXXXXX VVVVVVVV    # 32-bit pointer write

Loads pointer address from 0x80XXXXXX,
then writes to [pointer + offset]

Example:
44012340 12345678
Loads address from 0x80012340,
then writes 0x12345678 to that address
```

### Fill & Slide

Write repeating values with incrementing addresses/values.

```text theme={null}
00000000 8XXXXXXX
Y1Y2Y3Y4 Z1Z2Z3Z4

Address: 8XXXXXXX (size in bits 25-26)
Value: Y1Y2Y3Y4
Address increment: Z3Z4 (signed)
Value increment: Z1 (signed)
Repeat count: Z2

Example:
00000000 84012340
00000001 02050010

Writes to 0x84012340 with 32-bit size:
  Value 0x01, repeat 5 times,
  incrementing address by 0x10,
  incrementing value by 2 each time
```

### Master Code

Modify how codes are executed (advanced).

```text theme={null}
C4XXXXXX NNNNTTMM

MM = Master Code Number (0x00-0x0F)
TT = Type (0-3)
NN = Codes to execute per cycle

Types:
  0 - Branch to subroutine 1
  1 - Backup 4 ASM lines, branch to main
  2 - Branch to subroutine 1 copy
  3 - Branch to main routine start
```

<Warning>
  Master codes are complex and can crash games if misconfigured. Use with caution.
</Warning>

## Special Codes

### End of Codes

```text theme={null}
00000000 00000000

Terminates code execution, returns control to game
```

### Normal Execution

```text theme={null}
00000000 40000000

Ends multi-line conditional blocks
Resets execution mode to normal
```

### Execute All Codes

```text theme={null}
00000000 60000000

Executes all codes without returning to game
Until another mode change occurs
```

## Practical Examples

<CodeGroup>
  ```text Infinite Health theme={null}
  04123456 000003E7

  Writes 999 to health address at 0x80123456
  ```

  ```text Max Money on Button Press theme={null}
  # If D-Pad Up is pressed (button value check)
  08789ABC 00000010
  # Then set money to 999999
  04456789 000F423F
  ```

  ```text Conditional Unlock theme={null}
  # If progress flag >= 5
  1C012340 00000005
  # Then unlock item (set flag to 1)
  04012344 00000001
  ```

  ```text Level-Up Loop theme={null}
  # Multi-line conditional
  8C012340 00000064    # If XP == 100
  04012344 00000002    # Set level to 2
  04012340 00000000    # Reset XP to 0
  00000000 40000000    # End multi-line
  ```
</CodeGroup>

## Finding Code Addresses

<Steps>
  <Step title="Use Dolphin's Memory Tools">
    Tools > Cheats Manager > "Start New Search"
  </Step>

  <Step title="Narrow Down Values">
    Search for known values (health, money, etc.)
    Perform actions in-game and search again
  </Step>

  <Step title="Identify Address">
    When you find the address, note it down
  </Step>

  <Step title="Create Code">
    Use appropriate code type to modify the value
  </Step>
</Steps>

## Code Databases

Pre-made codes available at:

* **Gecko Codes**: Common cheat code database
* **GCT Files**: Pre-compiled code collections
* **Community Forums**: Game-specific code repositories

<Note>
  Always verify codes are for the correct game region (NTSC-U, PAL, NTSC-J).
</Note>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Codes Not Working">
    * Verify "Enable Cheats" is checked in Config > General
    * Check codes are enabled (checked) in AR Codes tab
    * Ensure code is for correct game region
    * Verify address alignment is correct
  </Accordion>

  <Accordion title="Game Crashes">
    * Disable all codes and re-enable one at a time
    * Check for alignment errors (16/32-bit codes)
    * Verify addresses are valid (0x80000000-0x817FFFFF)
    * Remove master codes if present
  </Accordion>

  <Accordion title="Code Has No Effect">
    * Address may change between game versions
    * Value may be overwritten by game logic
    * Try using pointer codes if direct write fails
    * Search for address again using memory tools
  </Accordion>
</AccordionGroup>

## Best Practices

* **Test codes individually** before combining
* **Back up save files** before using cheats
* **Use minimal codes** to reduce conflicts
* **Disable codes** when not needed
* **Document addresses** for future reference

<Warning>
  Some codes can corrupt save files or cause permanent game glitches. Use with caution and keep backups.
</Warning>

## Related Topics

<CardGroup cols={2}>
  <Card title="TAS Tools" icon="clock" href="/advanced/tas-tools">
    Frame-by-frame control and input recording
  </Card>

  <Card title="Graphics Mods" icon="palette" href="/advanced/graphics-mods">
    Visual modifications and enhancements
  </Card>
</CardGroup>
