Skip to main content

Per-Game Save/Load Snapshot Support for Xemu Emulator

❗Problem

The Xemu emulator currently supports only global save states, meaning snapshots aren’t tied to individual games. This makes managing save states across a large Xbox library difficult and error-prone—especially when using LaunchBox and Big Box as the frontend. Users must manually manage snapshot slots or risk overwriting saves from other games. Additionally, Big Box navigation can interfere with snapshot inputs due to overlapping hotkeys.


💡Proposal

Introduce enhanced per-game save/load snapshot functionality for Xemu using integrated AHK (AutoHotKey) scripts. These scripts read the emulator’s log file to identify the currently running game and dynamically assign a save or load state based on its filename—effectively simulating per-game snapshots.

Requested Features:

  • Automatically assign game-specific snapshot names using the running game’s ISO path in the log file

  • Allow save/load state actions from the pause menu

  • Display the currently selected snapshot for clarity

  • Include a resume override to close Xemu’s monitor window when using the Xbox Guide button (to avoid interference)

  • Optional: Add support for clipboard-based AHK scripts for more robust and faster input


✅Benefits

  • Adds functionality missing from Xemu’s native implementation

  • Allows seamless per-game snapshot support without manually managing slots

  • Avoids accidental overwrites of global save states

  • Enhances Big Box’s usability as a full Xbox frontend

  • Improves input compatibility with Guide button and gamepad navigation

This approach mirrors what’s already done in other LaunchBox-integrated AHK enhancements and helps fill a key feature gap for original Xbox emulation.

4 comments

Log in to comment and vote

Comments4

  • AstroBob changed status to Open To Community
    Team•

    May 18, 2025

    Pinned

    Hi there!

    Thanks so much for submitting this request and for taking the time to explain your use case — that context is always super helpful.

    I’ve gone ahead and fleshed out the main idea using the info you provided, and I’m opening it up to the community for further discussion and feedback. I’ve also added your original request as a comment to maintain full history. Please let me know if this fleshed-out version doesn’t match your original intended request.

    Feel free to let me know if you have any extra thoughts, examples, or edge cases you think might be relevant!

    Cheers,
    The LaunchBox team

    • jevcleem

      •

      May 18, 2025

      hey, what i submitted wasn’t really a feature request, it was already a working AHK script for xemu for save/load state, it could just be set as the default so that other users can use it as well. No changes to the launchbox software are needed.

  • jevcleem

    •

    May 18, 2025

    add xemu save/load snapshot per game

    I made generic ahk scripts (using relative paths, expects xemu to be in the emulators folder), so we have load/save state in xemu + can use the guide button to open the pause menu. Please add them.

    Save state script: Will go to your xemu log file to see what game has been started and then use the monitor window to set a game-specific snapshot. This is necessary because using hotkeys make system wide snapshots (not tied to the running game).

    ; Define the path to the log file
    logFilePath := ".\Emulators\xemu\xemu.log"

    ; Read the contents of the log file into a string variable
    FileRead, logContents, %logFilePath%

    ; Check if the file was successfully read
    if (ErrorLevel)
    {
    MsgBox, Failed to get the filename! Check the install directory of xemu in the ahk script 'save state script'.
    ExitApp
    }

    ; Use regular expression to extract the string between the two delimiters
    RegExMatch(logContents, "LaunchBox\\Games\\Microsoft Xbox\\(.*?).iso", extractedString)

    ; If a match is found, the result will be in extractedString1
    if (extractedString)
    {
    filename := extractedString1 ; The captured match will be in extractedString1
    ;MsgBox, Extracted filename: %filename%
    }
    else
    {
    MsgBox, Could not obtain the filename, check the regex expression in the ahk script 'save state script'.
    ExitApp
    }

    ; Send ~ key (tilde key)
    Send, {~ 1} ; this adds characters in monitor
    Send, {Backspace 2} ;an extra one is sometimes needed..

    ; Wait a little to ensure the focus is ready
    Sleep, 500

    ; Send the savevm command with the filename
    Send, savevm "%filename%"" ; double quote can only be added twice or is not added at all..
    Send, {Backspace 1} ;remove the extra double quote

    ; Send Enter key to execute the command
    Send, {Enter}
    Send, {~ 1}

    Load state script: The same as above but using 'loadvm' instead of 'savevm'

    Resume script: I (and many others) use the xbox guide button as pause menu, this will however open the xemu menu. So after resuming, esc is sent to close it. You can still open the xemu menu by pressing select+start. If you use a different way, not using the guide button, to open the pause menu, this hotkey will have not have an impact, it will not close the emulator.

    ; Send esc key to close the menu
    Send, {esc}

  • jevcleem

    •

    Mar 22, 2025

    There should be an additional “Sleep, 500“ before the “Send, {~ 1} “ in the save/load scripts because otherwise the resume script interferes and closes the monitor window

    Edit1:

    It wasn’t necessary to add the additional sleep, it was because the ‘keyboard automation‘ was interfering with the script during bigbox, i just set all interfering keys to null

    Edit2: I updated the load/save state script to the following, it uses clipboard, so its faster and no interference with keyboard hotkeys during bigbox

    ; Define the path to the log file

    logFilePath := ".\Emulators\xemu\xemu.log"

    ; Read the contents of the log file into a string variable

    FileRead, logContents, %logFilePath%

    ; Check if the file was successfully read

    if (ErrorLevel) {

    MsgBox, Failed to get the filename! Check the install directory of xemu in the ahk script 'save state script'.

    ExitApp

    }

    ; Use regular expression to extract the string between the two delimiters

    RegExMatch(logContents, "LaunchBox\Games\Microsoft Xbox\(.*?).iso", extractedString)

    ; If a match is found, the result will be in extractedString1

    if (extractedString) {

    filename := extractedString1 ; The captured match will be in extractedString1

    ;MsgBox, Extracted filename: %filename%

    }

    else {

    MsgBox, Could not obtain the filename, check the regex expression in the ahk script 'save state script'.

    ExitApp

    }

    Send, {~ 1} ; Send to open monitor

    Sleep, 250 ; Wait a little to ensure the focus is ready

    ; Send the command with the filename between double quotes

    commandToSend := "loadvm " . Chr(34) . filename . Chr(34)

    Clipboard := commandToSend

    ; Set the clipboard content

    SendInput, ^a ; select any text already present

    SendInput, ^v ; Paste the text instantly

    Send, {Enter}; Send Enter key to execute the command

    Send, {~ 1}; Send to close monitor

    Clipboard := "" ; Clear clipboard to avoid accidental pastes