DeSmuME - Emulator base class

class desmume.emulator.DeSmuME(dl_name: str = None)[source]

Bases: object

DeSmuME, the Nintendo DS emulator.

close()[source]

Close a previously opened ROM, freeing up memory. You don’t need to call this before opening a new ROM (it is done automatically).

create_sdl_window(auto_pause=False, use_opengl_if_possible=True) DeSmuME_SDL_Window[source]

Create an SDL window for drawing the emulator in and processing inputs.

Parameters:
  • auto_pause – Whether or not “tabbing out” of the window pauses the game.

  • use_opengl_if_possible – Whether or not to use OpenGL for rendering, if available.

cycle(with_joystick=True)[source]

Cycle one game cycle / frame. Set with_joystick to False, if joystick processing was not initialized.

destroy()[source]

Destroy the emulator and free memory. Calling any method after this WILL result in a crash.

display_buffer()[source]

Return the display buffer in the internal format. You probably want to use display_buffer_as_rgbx instead.

display_buffer_as_rgbx(reuse_buffer=True) memoryview[source]

Return the display buffer as RGBX color values, see the screen size constants for how many pixels make up lines.

get_ticks() int[source]

Get the current SDL tick number.

gpu_get_layer_main_enable_state(layer_index: int)[source]

Get the current display status of the specified layer on the main GPU.

gpu_get_layer_sub_enable_state(layer_index: int)[source]

Get the current display status of the specified layer on the sub GPU.

gpu_set_layer_main_enable_state(layer_index: int, state: bool)[source]

Set the current display status of the specified layer on the main GPU.

gpu_set_layer_sub_enable_state(layer_index: int, state: bool)[source]

Set the current display status of the specified layer on the sub GPU.

has_opengl() bool[source]

Returns True, if OpenGL is available for rendering.

property input

Keyboard and joystick configuration.

Type:

DeSmuME_Input

is_running() bool[source]

Returns True, if a game is loaded and the emulator is running (not paused).

property memory

Accessing and manipulating the memory.

Type:

DeSmuME_Memory

property movie

Recording and playing back movies.

Type:

DeSmuME_Movie

open(file_name: str, auto_resume=True)[source]

Open a ROM by file name.

If auto_resume is True, the emulator will automatically begin emulating the game. Otherwise the emulator is paused and you may call resume to unpause it.

pause()[source]

Pause the emulator.

reset()[source]

Resets the emulator / restarts the current game.

resume(keep_keypad=False)[source]

Resume / unpause the emulator. This will reset the keypad (release all keys), except if keep_keypad is provided.

property savestate

Loading and saving savestates.

Type:

DeSmuME_Savestate

screenshot() Image[source]

Convert the current display buffer into a PIL image.

set_language(lang: Language)[source]

Set the current firmware language.

set_savetype(value: int)[source]

Set the type of the SRAM. Please see the DeSmuME documentation for possible values. 0 is auto-detect and set by default.

skip_next_frame()[source]

Tell the emulator to skip the next frame.

volume_get() int[source]

Get the current value (between 0 - 100).

volume_set(volume: int)[source]

Set the current value (to a value between 0 - 100).