desmume.controls module

Some simple ports from sdlcntrl.cpp that are generally useful for dealing with controls.

Some of this only applies if used with GTK (eg. the keyboard configuration), other things apply generally, such as the joystick configuration.

class desmume.controls.Joy[source]

Bases: object

Joystick input types.

JOY_AXIS = 0
JOY_BUTTON = 2
JOY_HAT = 1
class desmume.controls.JoyHats[source]

Bases: object

Jostick hat identifiers.

JOY_HAT_DOWN = 3
JOY_HAT_LEFT = 1
JOY_HAT_RIGHT = 0
JOY_HAT_UP = 2
class desmume.controls.Keys[source]

Bases: object

DS key identifiers. NB_KEYS contains the total number of keys.

KEY_A = 1
KEY_B = 2
KEY_BOOST = 14
KEY_DEBUG = 13
KEY_DOWN = 8
KEY_L = 10
KEY_LEFT = 6
KEY_LID = 15
KEY_NONE = 0
KEY_R = 9
KEY_RIGHT = 5
KEY_SELECT = 3
KEY_START = 4
KEY_UP = 7
KEY_X = 11
KEY_Y = 12
NB_KEYS = 15
NO_KEY_SET = 65535
desmume.controls.add_key(keypad, key)[source]

Add a key to a keypad -> press the key. key is the keymask returned by keymask.

You don’t need to call this manually, see keypad_add_key() instead.

desmume.controls.keymask(k)[source]

Returns the keymask for key k. k is a constant of the Keys class.

desmume.controls.load_configured_config(emu: DeSmuME) Tuple[List[int], List[int]][source]

Load the default for inputs. Also set’s the default config for joystick in emulator.

The keyboard configuration is Gdk key IDs.

Todo:

Support loading/saving from the DesMuME config file.

desmume.controls.load_default_config() Tuple[List[int], List[int]][source]

Returns the default (keyboard configuration),(joystick configuration).

The keyboard configuration is Gdk key IDs.

desmume.controls.rm_key(keypad, key)[source]

Remove a key from a keypad -> release the key. key is the keymask returned by keymask.

You don’t need to call this manually, see keypad_rm_key() instead.