Classes |
struct | LibMame_ScreenResolution |
struct | LibMame_SoundSample |
struct | LibMame_Chip |
struct | LibMame_Dipswitch |
struct | LibMame_PerPlayerControllers |
struct | LibMame_SharedControllers |
struct | LibMame_AllControllers |
struct | LibMame_BiosSet |
struct | LibMame_Image |
struct | LibMame_PerPlayerControlsState |
struct | LibMame_SharedControlsState |
struct | LibMame_AllControlsState |
struct | LibMame_RunGameOptions |
struct | LibMame_RenderPrimitive |
struct | LibMame_RunGameCallbacks |
Defines |
#define | LIBMAME_WORKINGFLAGS_WRONG_COLORS 0x001 |
#define | LIBMAME_WORKINGFLAGS_IMPERFECT_COLORS 0x002 |
#define | LIBMAME_WORKINGFLAGS_IMPERFECT_GRAPHICS 0x004 |
#define | LIBMAME_WORKINGFLAGS_NO_SOUND 0x008 |
#define | LIBMAME_WORKINGFLAGS_IMPERFECT_SOUND 0x010 |
#define | LIBMAME_WORKINGFLAGS_NO_COCKTAIL 0x020 |
#define | LIBMAME_WORKINGFLAGS_UNEMULATED_PROTECTION 0x040 |
#define | LIBMAME_WORKINGFLAGS_NO_SAVE_STATE 0x080 |
#define | LIBMAME_WORKINGFLAGS_NOTWORKING 0x100 |
#define | LIBMAME_RENDERFLAGS_TEXTURE_ORIENTATION(flags) ((flags) & 0x000F) |
#define | LIBMAME_RENDERFLAGS_TEXTURE_FORMAT(flags) ((LibMame_TextureFormat) ((flags) & 0x00F0)) |
#define | LIBMAME_RENDERFLAGS_BLEND_MODE(flags) ((flags) & 0x0F00) |
#define | LIBMAME_RENDERFLAGS_ANTIALIAS(flags) ((flags) & 0x1000) |
#define | LIBMAME_RENDERFLAGS_SCREEN_TEXTURE(flags) ((flags) & 0x2000) |
#define | LIBMAME_RENDERFLAGS_TEXTURE_WRAP(flags) ((flags) & 0x4000) |
Typedefs |
typedef struct LibMame_RunningGame | LibMame_RunningGame |
typedef enum
LibMame_ImageStatus_Status | LibMame_ImageStatus |
typedef struct
LibMame_ScreenResolution | LibMame_ScreenResolution |
typedef struct LibMame_SoundSample | LibMame_SoundSample |
typedef struct LibMame_Chip | LibMame_Chip |
typedef struct LibMame_Dipswitch | LibMame_Dipswitch |
typedef struct
LibMame_PerPlayerControllers | LibMame_PerPlayerControllers |
typedef struct
LibMame_SharedControllers | LibMame_SharedControllers |
typedef struct
LibMame_AllControllers | LibMame_AllControllers |
typedef struct LibMame_BiosSet | LibMame_BiosSet |
typedef struct LibMame_Image | LibMame_Image |
typedef struct
LibMame_PerPlayerControlsState | LibMame_PerPlayerControlsState |
typedef struct
LibMame_SharedControlsState | LibMame_SharedControlsState |
typedef struct
LibMame_AllControlsState | LibMame_AllControlsState |
typedef struct
LibMame_RunGameOptions | LibMame_RunGameOptions |
typedef struct
LibMame_RenderPrimitive | LibMame_RenderPrimitive |
typedef struct
LibMame_RunGameCallbacks | LibMame_RunGameCallbacks |
Enumerations |
enum | LibMame_InitializeStatus { LibMame_InitializeStatus_Success = 0,
LibMame_InitializeStatus_OutOfMemory,
LibMame_InitializeStatus_GeneralFailure
} |
enum | LibMame_ScreenType { LibMame_ScreenType_Raster,
LibMame_ScreenType_LCD,
LibMame_ScreenType_Vector
} |
enum | LibMame_OrientationType { LibMame_OrientationType_Normal = 0,
LibMame_OrientationType_90 = 5,
LibMame_OrientationType_180 = 3,
LibMame_OrientationType_270 = 6
} |
enum | LibMame_JoystickDirection {
LibMame_JoystickDirection_Up,
LibMame_JoystickDirection_Right,
LibMame_JoystickDirection_Down,
LibMame_JoystickDirection_Left,
LibMame_JoystickDirectionCount
} |
enum | LibMame_ControllerType {
LibMame_ControllerType_LeftHorizontalJoystick,
LibMame_ControllerType_LeftVerticalJoystick,
LibMame_ControllerType_Left4WayJoystick,
LibMame_ControllerType_Left8WayJoystick,
LibMame_ControllerType_RightHorizontalJoystick,
LibMame_ControllerType_RightVerticalJoystick,
LibMame_ControllerType_Right4WayJoystick,
LibMame_ControllerType_Right8WayJoystick,
LibMame_ControllerType_AnalogHorizontalJoystick,
LibMame_ControllerType_AnalogVerticalJoystick,
LibMame_ControllerType_Analog8WayJoystick,
LibMame_ControllerType_Spinner,
LibMame_ControllerType_VerticalSpinner,
LibMame_ControllerType_Paddle,
LibMame_ControllerType_VerticalPaddle,
LibMame_ControllerType_Trackball,
LibMame_ControllerType_Lightgun,
LibMame_ControllerType_Pedal,
LibMame_ControllerType_Pedal2,
LibMame_ControllerType_Pedal3,
LibMame_ControllerTypeCount
} |
enum | LibMame_NormalButtonType {
LibMame_NormalButtonType_1,
LibMame_NormalButtonType_2,
LibMame_NormalButtonType_3,
LibMame_NormalButtonType_4,
LibMame_NormalButtonType_5,
LibMame_NormalButtonType_6,
LibMame_NormalButtonType_7,
LibMame_NormalButtonType_8,
LibMame_NormalButtonType_9,
LibMame_NormalButtonType_10,
LibMame_NormalButtonType_11,
LibMame_NormalButtonType_12,
LibMame_NormalButtonType_13,
LibMame_NormalButtonType_14,
LibMame_NormalButtonType_15,
LibMame_NormalButtonType_16,
LibMame_NormalButtonTypeCount
} |
enum | LibMame_MahjongButtonType {
LibMame_MahjongButtonType_A,
LibMame_MahjongButtonType_B,
LibMame_MahjongButtonType_C,
LibMame_MahjongButtonType_D,
LibMame_MahjongButtonType_E,
LibMame_MahjongButtonType_F,
LibMame_MahjongButtonType_G,
LibMame_MahjongButtonType_H,
LibMame_MahjongButtonType_I,
LibMame_MahjongButtonType_J,
LibMame_MahjongButtonType_K,
LibMame_MahjongButtonType_L,
LibMame_MahjongButtonType_M,
LibMame_MahjongButtonType_N,
LibMame_MahjongButtonType_O,
LibMame_MahjongButtonType_P,
LibMame_MahjongButtonType_Q,
LibMame_MahjongButtonType_Kan,
LibMame_MahjongButtonType_Pon,
LibMame_MahjongButtonType_Chi,
LibMame_MahjongButtonType_Reach,
LibMame_MahjongButtonType_Ron,
LibMame_MahjongButtonType_Bet,
LibMame_MahjongButtonType_Last_Chance,
LibMame_MahjongButtonType_Score,
LibMame_MahjongButtonType_Double_Up,
LibMame_MahjongButtonType_Flip_Flop,
LibMame_MahjongButtonType_Big,
LibMame_MahjongButtonType_Small,
LibMame_MahjongButtonTypeCount
} |
enum | LibMame_HanafudaButtonType {
LibMame_HanafudaButtonType_A,
LibMame_HanafudaButtonType_B,
LibMame_HanafudaButtonType_C,
LibMame_HanafudaButtonType_D,
LibMame_HanafudaButtonType_E,
LibMame_HanafudaButtonType_F,
LibMame_HanafudaButtonType_G,
LibMame_HanafudaButtonType_H,
LibMame_HanafudaButtonType_Yes,
LibMame_HanafudaButtonType_No,
LibMame_HanafudaButtonTypeCount
} |
enum | LibMame_GamblingButtonType {
LibMame_GamblingButtonType_High,
LibMame_GamblingButtonType_Low,
LibMame_GamblingButtonType_Half,
LibMame_GamblingButtonType_Deal,
LibMame_GamblingButtonType_D_Up,
LibMame_GamblingButtonType_Take,
LibMame_GamblingButtonType_Stand,
LibMame_GamblingButtonType_Bet,
LibMame_GamblingButtonType_Keyin,
LibMame_GamblingButtonType_Keyout,
LibMame_GamblingButtonType_Payout,
LibMame_GamblingButtonType_Door,
LibMame_GamblingButtonType_Service,
LibMame_GamblingButtonType_Book,
LibMame_GamblingButtonType_Hold1,
LibMame_GamblingButtonType_Hold2,
LibMame_GamblingButtonType_Hold3,
LibMame_GamblingButtonType_Hold4,
LibMame_GamblingButtonType_Hold5,
LibMame_GamblingButtonType_Cancel,
LibMame_GamblingButtonType_Stop1,
LibMame_GamblingButtonType_Stop2,
LibMame_GamblingButtonType_Stop3,
LibMame_GamblingButtonType_Stop4,
LibMame_GamblingButtonType_Stop_All,
LibMame_GamblingButtonTypeCount
} |
enum | LibMame_SharedButtonType {
LibMame_SharedButtonType_Coin1,
LibMame_SharedButtonType_Coin2,
LibMame_SharedButtonType_Coin3,
LibMame_SharedButtonType_Coin4,
LibMame_SharedButtonType_Coin5,
LibMame_SharedButtonType_Coin6,
LibMame_SharedButtonType_Coin7,
LibMame_SharedButtonType_Coin8,
LibMame_SharedButtonType_Bill1,
LibMame_SharedButtonType_Start1,
LibMame_SharedButtonType_Start2,
LibMame_SharedButtonType_Start3,
LibMame_SharedButtonType_Start4,
LibMame_SharedButtonType_Start5,
LibMame_SharedButtonType_Start6,
LibMame_SharedButtonType_Start7,
LibMame_SharedButtonType_Start8,
LibMame_SharedButtonType_Service,
LibMame_SharedButtonType_Service1,
LibMame_SharedButtonType_Service2,
LibMame_SharedButtonType_Service3,
LibMame_SharedButtonType_Service4,
LibMame_SharedButtonType_Tilt,
LibMame_SharedButtonType_Interlock,
LibMame_SharedButtonType_Volume_Up,
LibMame_SharedButtonType_Volume_Down,
LibMame_SharedButtonTypeCount
} |
enum | LibMame_SpecialButtonType {
LibMame_SpecialButtonType_1,
LibMame_SpecialButtonType_2,
LibMame_SpecialButtonType_3,
LibMame_SpecialButtonType_4,
LibMame_SpecialButtonType_5,
LibMame_SpecialButtonType_6,
LibMame_SpecialButtonType_7,
LibMame_SpecialButtonType_8,
LibMame_SpecialButtonType_9,
LibMame_SpecialButtonType_10,
LibMame_SpecialButtonType_11,
LibMame_SpecialButtonType_12,
LibMame_SpecialButtonType_13,
LibMame_SpecialButtonType_14,
LibMame_SpecialButtonType_15,
LibMame_SpecialButtonType_16,
LibMame_SpecialButtonType_17,
LibMame_SpecialButtonType_18,
LibMame_SpecialButtonType_19,
LibMame_SpecialButtonType_20,
LibMame_SpecialButtonType_21,
LibMame_SpecialButtonType_22,
LibMame_SpecialButtonType_23,
LibMame_SpecialButtonType_24,
LibMame_SpecialButtonType_25,
LibMame_SpecialButtonType_26,
LibMame_SpecialButtonType_27,
LibMame_SpecialButtonType_28,
LibMame_SpecialButtonType_29,
LibMame_SpecialButtonType_30,
LibMame_SpecialButtonType_31,
LibMame_SpecialButtonType_32,
LibMame_SpecialButtonTypeCount
} |
enum | LibMame_UiButtonType {
LibMame_UiButtonType_Configure,
LibMame_UiButtonType_On_Screen_Display,
LibMame_UiButtonType_Debug_Break,
LibMame_UiButtonType_Pause,
LibMame_UiButtonType_Reset_Machine,
LibMame_UiButtonType_Soft_Reset,
LibMame_UiButtonType_Show_Gfx,
LibMame_UiButtonType_Frameskip_Dec,
LibMame_UiButtonType_Frameskip_Inc,
LibMame_UiButtonType_Throttle,
LibMame_UiButtonType_Fast_Forward,
LibMame_UiButtonType_Show_Fps,
LibMame_UiButtonType_Snapshot,
LibMame_UiButtonType_Record_Movie,
LibMame_UiButtonType_Toggle_Cheat,
LibMame_UiButtonType_Up,
LibMame_UiButtonType_Down,
LibMame_UiButtonType_Left,
LibMame_UiButtonType_Right,
LibMame_UiButtonType_Home,
LibMame_UiButtonType_End,
LibMame_UiButtonType_Page_Up,
LibMame_UiButtonType_Page_Down,
LibMame_UiButtonType_Select,
LibMame_UiButtonType_Cancel,
LibMame_UiButtonType_Display_Comment,
LibMame_UiButtonType_Clear,
LibMame_UiButtonType_Zoom_In,
LibMame_UiButtonType_Zoom_Out,
LibMame_UiButtonType_Prev_Group,
LibMame_UiButtonType_Next_Group,
LibMame_UiButtonType_Rotate,
LibMame_UiButtonType_Show_Profiler,
LibMame_UiButtonType_Toggle_Ui,
LibMame_UiButtonType_Toggle_Debug,
LibMame_UiButtonType_Paste,
LibMame_UiButtonType_Save_State,
LibMame_UiButtonType_Load_State,
LibMame_UiButtonTypeCount
} |
enum | LibMame_ImageStatus_Status { LibMame_ImageStatus_GoodDump,
LibMame_ImageStatus_BadDump,
LibMame_ImageStatus_NoDump
} |
enum | LibMame_RenderPrimitiveType { LibMame_RenderPrimitiveType_Invalid,
LibMame_RenderPrimitiveType_Line,
LibMame_RenderPrimitiveType_Quad
} |
enum | LibMame_TextureFormat {
LibMame_TextureFormat_Undefined = 0x0000,
LibMame_TextureFormat_Palette16 = 0x0010,
LibMame_TextureFormat_PaletteA16 = 0x0020,
LibMame_TextureFormat_RGB15 = 0x0030,
LibMame_TextureFormat_RGB32 = 0x0040,
LibMame_TextureFormat_ARGB32 = 0x0050,
LibMame_TextureFormat_YUY16 = 0x0060
} |
enum | LibMame_BlendMode { LibMame_BlendMode_None = 0x0000,
LibMame_BlendMode_Alpha = 0x0100,
LibMame_BlendMode_RGB_Multiply = 0x0200,
LibMame_BlendMode_RGB_Add = 0x0300
} |
enum | LibMame_StartupPhase { LibMame_StartupPhase_Preparing,
LibMame_StartupPhase_LoadingRoms,
LibMame_StartupPhase_InitializingMachine
} |
enum | LibMame_RunGameStatus {
LibMame_RunGameStatus_Success,
LibMame_RunGameStatus_InvalidGameNum,
LibMame_RunGameStatus_FailedValidityCheck,
LibMame_RunGameStatus_MissingFiles,
LibMame_RunGameStatus_NoSuchGame,
LibMame_RunGameStatus_InvalidConfig,
LibMame_RunGameStatus_GeneralError
} |
Functions |
LibMame_InitializeStatus | LibMame_Initialize () |
void | LibMame_Deinitialize () |
const char * | LibMame_Get_Version_String () |
int | LibMame_Get_Game_Count () |
int | LibMame_Get_Game_Number (const char *short_name) |
int | LibMame_Get_Game_Matches (const char *short_name, int num_matches, int *gamenums) |
const char * | LibMame_Get_Game_Short_Name (int gamenum) |
const char * | LibMame_Get_Game_Full_Name (int gamenum) |
int | LibMame_Get_Game_Year_Of_Release (int gamenum) |
int | LibMame_Get_Game_CloneOf (int gamenum) |
const char * | LibMame_Get_Game_Manufacturer (int gamenum) |
int | LibMame_Get_Game_WorkingFlags (int gamenum) |
LibMame_OrientationType | LibMame_Get_Game_Orientation (int gamenum) |
LibMame_ScreenType | LibMame_Get_Game_ScreenType (int gamenum) |
LibMame_ScreenResolution | LibMame_Get_Game_ScreenResolution (int gamenum) |
float | LibMame_Get_Game_ScreenRefreshRateHz (int gamenum) |
int | LibMame_Get_Game_SoundChannels (int gamenum) |
int | LibMame_Get_Game_SoundSamples_Count (int gamenum) |
int | LibMame_Get_Game_SoundSamplesSource (int gamenum) |
const char * | LibMame_Get_Game_SoundSampleFileName (int gamenum, int samplenum) |
int | LibMame_Get_Game_Chip_Count (int gamenum) |
LibMame_Chip | LibMame_Get_Game_Chip (int gamenum, int chipnum) |
int | LibMame_Get_Game_Dipswitch_Count (int gamenum) |
LibMame_Dipswitch | LibMame_Get_Game_Dipswitch (int gamenum, int num) |
int | LibMame_Get_Game_MaxSimultaneousPlayers (int gamenum) |
LibMame_AllControllers | LibMame_Get_Game_AllControllers (int gamenum) |
int | LibMame_Get_Game_BiosSet_Count (int gamenum) |
LibMame_BiosSet | LibMame_Get_Game_BiosSet (int gamenum, int biossetnum) |
int | LibMame_Get_Game_Rom_Count (int gamenum) |
LibMame_Image | LibMame_Get_Game_Rom (int gamenum, int romnum) |
int | LibMame_Get_Game_Hdd_Count (int gamenum) |
LibMame_Image | LibMame_Get_Game_Hdd (int gamenum, int hddnum) |
const char * | LibMame_Get_Game_SourceFileName (int gamenum) |
void | LibMame_Get_Default_RunGameOptions (LibMame_RunGameOptions *options) |
LibMame_RunGameStatus | LibMame_RunGame (int gamenum, int benchmarking, const LibMame_RunGameOptions *options, const LibMame_RunGameCallbacks *cbs, void *callback_data) |
const char * | LibMame_RunningGame_GetSpeedText (LibMame_RunningGame *game) |
void | LibMame_RunningGame_Schedule_Pause (LibMame_RunningGame *game) |
void | LibMame_RunningGame_Schedule_Exit (LibMame_RunningGame *game) |
void | LibMame_RunningGame_Schedule_Hard_Reset (LibMame_RunningGame *game) |
void | LibMame_RunningGame_Schedule_Soft_Reset (LibMame_RunningGame *game) |
void | LibMame_RunningGame_SaveState (LibMame_RunningGame *game, const char *filename) |
void | LibMame_RunningGame_LoadState (LibMame_RunningGame *game, const char *filename) |
void | LibMame_RunningGame_ChangeDipswitchValue (LibMame_RunningGame *game, const char *tag, uint32_t mask, const char *value) |
LibMame provides a single API for (almost) all functionality of the MAME engine. It provides the following types of functions:
1. Functions for querying the set of games supported by this version of LibMame, and many descriptive details about each game:
- LibMame_Get_Version_String
- LibMame_Get_Game_Count
- LibMame_Get_Game_Number
- LibMame_Get_Game_Matches
- LibMame_Get_Game_Short_Name
- LibMame_Get_Game_Full_Name
- LibMame_Get_Game_Year_Of_Release
- LibMame_Get_Game_CloneOf
- LibMame_Get_Game_Manufacturer
- LibMame_Get_Game_WorkingFlags
- LibMame_Get_Game_OrientationFlags
- LibMame_Get_Game_ScreenType
- LibMame_Get_Game_ScreenResolution
- LibMame_Get_Game_ScreenRefreshRateHz
- LibMame_Get_Game_SoundChannels
- LibMame_Get_Game_SoundSamples_Count
- LibMame_Get_Game_SoundSamplesSource
- LibMame_Get_Game_SoundSampleFileName
- LibMame_Get_Game_Chip_Count
- LibMame_Get_Game_Chip
- LibMame_Get_Game_Dipswitch_Count
- LibMame_Get_Game_Dipswitch
- LibMame_Get_Game_MaxSimultaneousPlayers
- LibMame_Get_Game_AllControllers
- LibMame_Get_Game_BiosSet_Count
- LibMame_Get_Game_BiosSet
- LibMame_Get_Game_Rom_Count
- LibMame_Get_Game_Rom
- LibMame_Get_Game_Hdd_Count
- LibMame_Get_Game_Hdd
- LibMame_Get_Game_SourceFileName
2. A function for running a MAME game (only one MAME game may be run concurrently within the same process due to limitations in the MAME engine). MAME will emulate the game and will interact with the rest of the system (for displaying frames of the game, playing sound, and getting controller input) via callbacks.
3. Functions for manipulating a running MAME game, including pausing, resetting, and manipulating configuration values of various kinds.
- LibMame_RunningGame_Pause
- LibMame_RunningGame_Schedule_Exit
- LibMame_RunningGame_Schedule_Hard_Reset
- LibMame_RunningGame_Schedule_Soft_Reset
- LibMame_RunningGame_SaveState
- LibMame_RunningGame_LoadState
- LibMame_RunningGame_ChangeDipswitchValue
4. Miscellaneous functions necessary for supporting the other libmame functionality:
- LibMame_Initialize
- LibMame_Deinitialize
- LibMame_Get_Default_RunGameOptions
In general, applications using libmame will follow this pattern:
1. Call LibMame_Initialize.
2. Collect game information for display using the LibMame_Get_Game_XXX functions.
3. Look up the number of the game that the user wants to play using LibMame_Get_Game_Number.
4. Set options for running the game by first calling LibMame_Get_Default_RunGameOptions, and then customizing the resulting options according to user preference.
5. Set up internal state for managing the display, sound, and controller input for the game about to be run.
The target display frame rate can be found by calling LibMame_Get_Game_ScreenRefreshRateHz, if needed, and the size at which the game was originally redered is known by calling LibMame_Get_Game_ScreenResolution, although this is not necessarily the same resolution as the visible portion of the game's screen; the visible portion of the game's screen can only be discerned by examining the render primitive bounds in the UpdateVideo callback.
The set of controls that the game will require inputs on can be found by calling LibMame_Get_Game_AllControllers (and the maximum number of players for whom controller input is needed is available from LibMame_Get_Game_MaxSimultaneousPlayers). The application will typically use this information to decide how to map whatever controls it knows about to the inputs that the game is expecting, usually via user preference (managed by the application).
6. Call LibMame_RunGame to run the game, passing in pointers to callback functions that will handle the rendering of audio and video and collecting controller input.
7. As the game is running, according to user input, call the LibMame_RunningGame_XXX functions (but only from the MakeRunningGameCallbacks (or in certain cases, Paused) callbacks, which means that user commands must typically be noted and then applied at the next call to MakeRunningGameCallbacks).
8. When the game completes (i.e. the LibMame_RunningGame_Schedule_Exit callback is made by the application), LibMame_RunGame will return, and the application may then repeat steps 5, 6, and 7 if it wishes.
9. When the application is completely finished calling any LibMame functions, before it exits, it must then call LibMame_Deinitialize.
Please keep in mind that although the API is structured as if it were possible to run multiple MAME games simultaneously from the same application, there is a limit in the MAME engine that prevents more than one game from running at a time. This limit may someday be lifted, in which case this API will already be ready to take advantage of that, but until the limit is lifted, remember that LibMame_RunGame may only be called from one thread at a time within a single application.