KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Callbacks

Automatic input notification callbacks More...

Typedefs

typedef void(* mie_btn_callback_t) (uint32_t btns)
 Mapped controller button callback type.
 
typedef void(* mie_jvs_callback_t) (mie_jvs_input_t input, uint32_t mask)
 Native JVS input callback type.
 

Enumerations

enum  mie_jvs_input_t {
  MIE_JVS_IN_SYSTEM , MIE_JVS_IN_P1 , MIE_JVS_IN_P2 , MIE_JVS_IN_PANEL_DIP ,
  MIE_JVS_IN_PANEL_PSW , MIE_JVS_IN_COIN1 , MIE_JVS_IN_COIN2
}
 Native JVS input source for mie_jvs_callback(). More...
 

Functions

int mie_btn_callback (uint32_t btns, mie_btn_callback_t cb)
 Set an automatic mapped button press callback.
 
int mie_jvs_callback (mie_jvs_input_t input, uint32_t mask, mie_jvs_callback_t cb)
 Set an automatic native JVS input callback.
 

Detailed Description

Automatic input notification callbacks

Callbacks are invoked on a dedicated worker thread when the requested input transitions from released to pressed. Pass NULL as the callback pointer to uninstall a registration with the same key.

Typedef Documentation

◆ mie_btn_callback_t

typedef void(* mie_btn_callback_t) (uint32_t btns)

Mapped controller button callback type.

Called when the mapped cont_state_t buttons matching the registered mask become pressed.

Parameters
btnsCurrent mapped button bitmask (Inputs).
See also
mie_btn_callback

◆ mie_jvs_callback_t

typedef void(* mie_jvs_callback_t) (mie_jvs_input_t input, uint32_t mask)

Native JVS input callback type.

Parameters
inputInput source that triggered the callback.
maskActive bits from the matched mask.
See also
mie_jvs_callback, Input Masks

Enumeration Type Documentation

◆ mie_jvs_input_t

Native JVS input source for mie_jvs_callback().

Enumerator
MIE_JVS_IN_SYSTEM 

JVS SWINP system switch byte.

MIE_JVS_IN_P1 

Player 1 switch bank.

MIE_JVS_IN_P2 

Player 2 switch bank.

MIE_JVS_IN_PANEL_DIP 

Cabinet DIP switches.

MIE_JVS_IN_PANEL_PSW 

Cabinet panel service switches.

MIE_JVS_IN_COIN1 

Coin slot 1 (COIN SW 1) meter insert.

MIE_JVS_IN_COIN2 

Coin slot 2 (COIN SW 2) meter insert.

Function Documentation

◆ mie_btn_callback()

int mie_btn_callback ( uint32_t btns,
mie_btn_callback_t cb )

Set an automatic mapped button press callback.

Registers a callback invoked when the mapped controller buttons in btns transition from not-all-pressed to all-pressed. The callback runs on a worker thread, not in the Maple IRQ context.

Parameters
btnsButton mask to match (Inputs).
cbCallback to invoke, or NULL to uninstall callbacks registered for the same btns value.
Return values
0On success.
-1On allocation or thread creation failure.
See also
mie_btn_callback_t, mie_jvs_callback

◆ mie_jvs_callback()

int mie_jvs_callback ( mie_jvs_input_t input,
uint32_t mask,
mie_jvs_callback_t cb )

Set an automatic native JVS input callback.

Registers a callback invoked when the selected native input source has all bits in mask transition from not-all-active to all-active. The callback runs on a worker thread, not in the Maple IRQ context.

For MIE_JVS_IN_P1, MIE_JVS_IN_P2, MIE_JVS_IN_SYSTEM, MIE_JVS_IN_PANEL_DIP, and MIE_JVS_IN_PANEL_PSW, mask uses the matching Input Masks constants. For MIE_JVS_IN_COIN1 and MIE_JVS_IN_COIN2, use MIE_JVS_COIN_INSERT_BIT. These fire when the JVS COININP meter for that slot increases after a physical coin insert on COIN SW 1/2. The I/O board updates the meter automatically; do not call mie_coin_add() again for the same insert.

Parameters
inputNative JVS input source to watch.
maskBit mask within that source.
cbCallback to invoke, or NULL to uninstall callbacks registered for the same input and mask pair.
Return values
0On success.
-1On allocation or thread creation failure.
See also
mie_jvs_callback_t, mie_btn_callback

Referenced by main().