libmame
libmame.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  * libmame.h
00003  *
00004  * Copyright Bryan Ischo and the MAME Team.
00005  * Visit http://mamedev.org for licensing and usage restrictions.
00006  * 
00007  *****************************************************************************/
00008 
00009 
00010 #ifndef __LIBMAME_H__
00011 #define __LIBMAME_H__
00012 
00013 #include <stdarg.h>
00014 #include <stdint.h>
00015 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #if 0 // fix emacs indentation
00019 }
00020 #endif
00021 #endif
00022 
00146 /*****************************************************************************
00147  * Opaque type definitions
00148  *****************************************************************************/
00149 
00150 typedef struct LibMame_RunningGame LibMame_RunningGame;
00151 
00152 
00153 /*****************************************************************************
00154  * Preprocessor definitions - constants
00155  *****************************************************************************/
00156 
00167 #define LIBMAME_WORKINGFLAGS_WRONG_COLORS                       0x001
00168 
00171 #define LIBMAME_WORKINGFLAGS_IMPERFECT_COLORS                   0x002
00172 
00175 #define LIBMAME_WORKINGFLAGS_IMPERFECT_GRAPHICS                 0x004
00176 
00180 #define LIBMAME_WORKINGFLAGS_NO_SOUND                           0x008
00181 
00184 #define LIBMAME_WORKINGFLAGS_IMPERFECT_SOUND                    0x010
00185 
00188 #define LIBMAME_WORKINGFLAGS_NO_COCKTAIL                        0x020
00189 
00192 #define LIBMAME_WORKINGFLAGS_UNEMULATED_PROTECTION              0x040
00193 
00196 #define LIBMAME_WORKINGFLAGS_NO_SAVE_STATE                      0x080
00197 
00200 #define LIBMAME_WORKINGFLAGS_NOTWORKING                         0x100
00201 
00202 
00217 #define LIBMAME_RENDERFLAGS_TEXTURE_ORIENTATION(flags)      ((flags) & 0x000F)
00218 
00222 #define LIBMAME_RENDERFLAGS_TEXTURE_FORMAT(flags)           ((LibMame_TextureFormat) ((flags) & 0x00F0))
00223 
00227 #define LIBMAME_RENDERFLAGS_BLEND_MODE(flags)               ((flags) & 0x0F00)
00228 
00232 #define LIBMAME_RENDERFLAGS_ANTIALIAS(flags)                ((flags) & 0x1000)
00233 
00239 #define LIBMAME_RENDERFLAGS_SCREEN_TEXTURE(flags)           ((flags) & 0x2000)
00240 
00245 #define LIBMAME_RENDERFLAGS_TEXTURE_WRAP(flags)             ((flags) & 0x4000)
00246 
00247 
00248 /*****************************************************************************
00249  * Enumerated types
00250  *****************************************************************************/
00251 
00255 typedef enum
00256 {
00257     LibMame_InitializeStatus_Success = 0,
00258     LibMame_InitializeStatus_OutOfMemory,
00259     LibMame_InitializeStatus_GeneralFailure
00260 } LibMame_InitializeStatus;
00261 
00262 
00266 typedef enum
00267 {
00268     LibMame_ScreenType_Raster,
00269     LibMame_ScreenType_LCD,
00270     LibMame_ScreenType_Vector
00271 } LibMame_ScreenType;
00272 
00273 
00278 typedef enum
00279 {
00283     LibMame_OrientationType_Normal       = 0,
00287     LibMame_OrientationType_90           = 5,
00291     LibMame_OrientationType_180          = 3,
00295     LibMame_OrientationType_270          = 6
00296 } LibMame_OrientationType;
00297 
00298 
00302 typedef enum
00303 {
00304     LibMame_JoystickDirection_Up,
00305     LibMame_JoystickDirection_Right,
00306     LibMame_JoystickDirection_Down,
00307     LibMame_JoystickDirection_Left,
00308     /* This is not a type, it's the number of entries in this enum */
00309     LibMame_JoystickDirectionCount
00310 } LibMame_JoystickDirection;
00311 
00312 
00316 typedef enum
00317 {
00318     LibMame_ControllerType_LeftHorizontalJoystick,
00319     LibMame_ControllerType_LeftVerticalJoystick,
00320     LibMame_ControllerType_Left4WayJoystick,
00321     LibMame_ControllerType_Left8WayJoystick,
00322     LibMame_ControllerType_RightHorizontalJoystick,
00323     LibMame_ControllerType_RightVerticalJoystick,
00324     LibMame_ControllerType_Right4WayJoystick,
00325     LibMame_ControllerType_Right8WayJoystick,
00326     LibMame_ControllerType_AnalogHorizontalJoystick,
00327     LibMame_ControllerType_AnalogVerticalJoystick,
00328     LibMame_ControllerType_Analog8WayJoystick,
00329     LibMame_ControllerType_Spinner,
00330     LibMame_ControllerType_VerticalSpinner,
00331     LibMame_ControllerType_Paddle,
00332     LibMame_ControllerType_VerticalPaddle,
00333     LibMame_ControllerType_Trackball,
00334     LibMame_ControllerType_Lightgun,
00335     LibMame_ControllerType_Pedal,
00336     LibMame_ControllerType_Pedal2,
00337     LibMame_ControllerType_Pedal3,
00338     /* This is not a type, it's the number of entries in this enum */
00339     LibMame_ControllerTypeCount
00340 } LibMame_ControllerType;
00341 
00342 
00346 typedef enum
00347 {
00348     LibMame_NormalButtonType_1,
00349     LibMame_NormalButtonType_2,
00350     LibMame_NormalButtonType_3,
00351     LibMame_NormalButtonType_4,
00352     LibMame_NormalButtonType_5,
00353     LibMame_NormalButtonType_6,
00354     LibMame_NormalButtonType_7,
00355     LibMame_NormalButtonType_8,
00356     LibMame_NormalButtonType_9,
00357     LibMame_NormalButtonType_10,
00358     LibMame_NormalButtonType_11,
00359     LibMame_NormalButtonType_12,
00360     LibMame_NormalButtonType_13,
00361     LibMame_NormalButtonType_14,
00362     LibMame_NormalButtonType_15,
00363     LibMame_NormalButtonType_16,
00364     /* This is not a type, it's the number of entries in this enum */
00365     LibMame_NormalButtonTypeCount
00366 } LibMame_NormalButtonType;
00367 
00368 
00372 typedef enum
00373 {
00374     LibMame_MahjongButtonType_A,
00375     LibMame_MahjongButtonType_B,
00376     LibMame_MahjongButtonType_C,
00377     LibMame_MahjongButtonType_D,
00378     LibMame_MahjongButtonType_E,
00379     LibMame_MahjongButtonType_F,
00380     LibMame_MahjongButtonType_G,
00381     LibMame_MahjongButtonType_H,
00382     LibMame_MahjongButtonType_I,
00383     LibMame_MahjongButtonType_J,
00384     LibMame_MahjongButtonType_K,
00385     LibMame_MahjongButtonType_L,
00386     LibMame_MahjongButtonType_M,
00387     LibMame_MahjongButtonType_N,
00388     LibMame_MahjongButtonType_O,
00389     LibMame_MahjongButtonType_P,
00390     LibMame_MahjongButtonType_Q,
00391     LibMame_MahjongButtonType_Kan,
00392     LibMame_MahjongButtonType_Pon,
00393     LibMame_MahjongButtonType_Chi,
00394     LibMame_MahjongButtonType_Reach,
00395     LibMame_MahjongButtonType_Ron,
00396     LibMame_MahjongButtonType_Bet,
00397     LibMame_MahjongButtonType_Last_Chance,
00398     LibMame_MahjongButtonType_Score,
00399     LibMame_MahjongButtonType_Double_Up,
00400     LibMame_MahjongButtonType_Flip_Flop,
00401     LibMame_MahjongButtonType_Big,
00402     LibMame_MahjongButtonType_Small,
00403     /* This is not a type, it's the number of entries in this enum */
00404     LibMame_MahjongButtonTypeCount
00405 } LibMame_MahjongButtonType;
00406 
00407 
00411 typedef enum
00412 {
00413     LibMame_HanafudaButtonType_A,
00414     LibMame_HanafudaButtonType_B,
00415     LibMame_HanafudaButtonType_C,
00416     LibMame_HanafudaButtonType_D,
00417     LibMame_HanafudaButtonType_E,
00418     LibMame_HanafudaButtonType_F,
00419     LibMame_HanafudaButtonType_G,
00420     LibMame_HanafudaButtonType_H,
00421     LibMame_HanafudaButtonType_Yes,
00422     LibMame_HanafudaButtonType_No,
00423     /* This is not a type, it's the number of entries in this enum */
00424     LibMame_HanafudaButtonTypeCount
00425 } LibMame_HanafudaButtonType;
00426 
00427 
00431 typedef enum
00432 {
00433     LibMame_GamblingButtonType_High,
00434     LibMame_GamblingButtonType_Low,
00435     LibMame_GamblingButtonType_Half,
00436     LibMame_GamblingButtonType_Deal,
00437     LibMame_GamblingButtonType_D_Up,
00438     LibMame_GamblingButtonType_Take,
00439     LibMame_GamblingButtonType_Stand,
00440     LibMame_GamblingButtonType_Bet,
00441     LibMame_GamblingButtonType_Keyin,
00442     LibMame_GamblingButtonType_Keyout,
00443     LibMame_GamblingButtonType_Payout,
00444     LibMame_GamblingButtonType_Door,
00445     LibMame_GamblingButtonType_Service,
00446     LibMame_GamblingButtonType_Book,
00447     LibMame_GamblingButtonType_Hold1,
00448     LibMame_GamblingButtonType_Hold2,
00449     LibMame_GamblingButtonType_Hold3,
00450     LibMame_GamblingButtonType_Hold4,
00451     LibMame_GamblingButtonType_Hold5,
00452     LibMame_GamblingButtonType_Cancel,
00453     LibMame_GamblingButtonType_Stop1,
00454     LibMame_GamblingButtonType_Stop2,
00455     LibMame_GamblingButtonType_Stop3,
00456     LibMame_GamblingButtonType_Stop4,
00457     LibMame_GamblingButtonType_Stop_All,
00458     /* This is not a type, it's the number of entries in this enum */
00459     LibMame_GamblingButtonTypeCount
00460 } LibMame_GamblingButtonType;
00461 
00462 
00466 typedef enum
00467 {
00468     LibMame_SharedButtonType_Coin1,
00469     LibMame_SharedButtonType_Coin2,
00470     LibMame_SharedButtonType_Coin3,
00471     LibMame_SharedButtonType_Coin4,
00472     LibMame_SharedButtonType_Coin5,
00473     LibMame_SharedButtonType_Coin6,
00474     LibMame_SharedButtonType_Coin7,
00475     LibMame_SharedButtonType_Coin8,
00476     LibMame_SharedButtonType_Bill1,
00477     LibMame_SharedButtonType_Start1,
00478     LibMame_SharedButtonType_Start2,
00479     LibMame_SharedButtonType_Start3,
00480     LibMame_SharedButtonType_Start4,
00481     LibMame_SharedButtonType_Start5,
00482     LibMame_SharedButtonType_Start6,
00483     LibMame_SharedButtonType_Start7,
00484     LibMame_SharedButtonType_Start8,
00485     LibMame_SharedButtonType_Service,
00486     LibMame_SharedButtonType_Service1,
00487     LibMame_SharedButtonType_Service2,
00488     LibMame_SharedButtonType_Service3,
00489     LibMame_SharedButtonType_Service4,
00490     LibMame_SharedButtonType_Tilt,
00491     LibMame_SharedButtonType_Interlock,
00492     LibMame_SharedButtonType_Volume_Up,
00493     LibMame_SharedButtonType_Volume_Down,
00494     /* This is not a type, it's the number of entries in this enum */
00495     LibMame_SharedButtonTypeCount
00496 } LibMame_SharedButtonType;
00497 
00498 
00502 typedef enum
00503 {
00504     LibMame_SpecialButtonType_1,
00505     LibMame_SpecialButtonType_2,
00506     LibMame_SpecialButtonType_3,
00507     LibMame_SpecialButtonType_4,
00508     LibMame_SpecialButtonType_5,
00509     LibMame_SpecialButtonType_6,
00510     LibMame_SpecialButtonType_7,
00511     LibMame_SpecialButtonType_8,
00512     LibMame_SpecialButtonType_9,
00513     LibMame_SpecialButtonType_10,
00514     LibMame_SpecialButtonType_11,
00515     LibMame_SpecialButtonType_12,
00516     LibMame_SpecialButtonType_13,
00517     LibMame_SpecialButtonType_14,
00518     LibMame_SpecialButtonType_15,
00519     LibMame_SpecialButtonType_16,
00520     LibMame_SpecialButtonType_17,
00521     LibMame_SpecialButtonType_18,
00522     LibMame_SpecialButtonType_19,
00523     LibMame_SpecialButtonType_20,
00524     LibMame_SpecialButtonType_21,
00525     LibMame_SpecialButtonType_22,
00526     LibMame_SpecialButtonType_23,
00527     LibMame_SpecialButtonType_24,
00528     LibMame_SpecialButtonType_25,
00529     LibMame_SpecialButtonType_26,
00530     LibMame_SpecialButtonType_27,
00531     LibMame_SpecialButtonType_28,
00532     LibMame_SpecialButtonType_29,
00533     LibMame_SpecialButtonType_30,
00534     LibMame_SpecialButtonType_31,
00535     LibMame_SpecialButtonType_32,
00536     /* This is not a type, it's the number of entries in this enum */
00537     LibMame_SpecialButtonTypeCount
00538 } LibMame_SpecialButtonType;
00539 
00540 
00544 typedef enum
00545 {
00546     LibMame_UiButtonType_Configure,
00547     LibMame_UiButtonType_On_Screen_Display,
00548     LibMame_UiButtonType_Debug_Break,
00549     LibMame_UiButtonType_Pause,
00550     LibMame_UiButtonType_Reset_Machine,
00551     LibMame_UiButtonType_Soft_Reset,
00552     LibMame_UiButtonType_Show_Gfx,
00553     LibMame_UiButtonType_Frameskip_Dec,
00554     LibMame_UiButtonType_Frameskip_Inc,
00555     LibMame_UiButtonType_Throttle,
00556     LibMame_UiButtonType_Fast_Forward,
00557     LibMame_UiButtonType_Show_Fps,
00558     LibMame_UiButtonType_Snapshot,
00559     LibMame_UiButtonType_Record_Movie,
00560     LibMame_UiButtonType_Toggle_Cheat,
00561     LibMame_UiButtonType_Up,
00562     LibMame_UiButtonType_Down,
00563     LibMame_UiButtonType_Left,
00564     LibMame_UiButtonType_Right,
00565     LibMame_UiButtonType_Home,
00566     LibMame_UiButtonType_End,
00567     LibMame_UiButtonType_Page_Up,
00568     LibMame_UiButtonType_Page_Down,
00569     LibMame_UiButtonType_Select,
00570     LibMame_UiButtonType_Cancel,
00571     LibMame_UiButtonType_Display_Comment,
00572     LibMame_UiButtonType_Clear,
00573     LibMame_UiButtonType_Zoom_In,
00574     LibMame_UiButtonType_Zoom_Out,
00575     LibMame_UiButtonType_Prev_Group,
00576     LibMame_UiButtonType_Next_Group,
00577     LibMame_UiButtonType_Rotate,
00578     LibMame_UiButtonType_Show_Profiler,
00579     LibMame_UiButtonType_Toggle_Ui,
00580     LibMame_UiButtonType_Toggle_Debug,
00581     LibMame_UiButtonType_Paste,
00582     LibMame_UiButtonType_Save_State,
00583     LibMame_UiButtonType_Load_State,
00584     /* This is not a type, it's the number of entries in this enum */
00585     LibMame_UiButtonTypeCount
00586 } LibMame_UiButtonType;
00587 
00588 
00592 typedef enum LibMame_ImageStatus_Status
00593 {
00597     LibMame_ImageStatus_GoodDump,
00601     LibMame_ImageStatus_BadDump,
00605     LibMame_ImageStatus_NoDump
00606 } LibMame_ImageStatus;
00607 
00608 
00613 typedef enum
00614 {
00615     LibMame_RenderPrimitiveType_Invalid,
00616     LibMame_RenderPrimitiveType_Line,
00617     LibMame_RenderPrimitiveType_Quad
00618 } LibMame_RenderPrimitiveType;
00619 
00620 
00625 typedef enum
00626 {
00630     LibMame_TextureFormat_Undefined     = 0x0000,
00634     LibMame_TextureFormat_Palette16     = 0x0010,
00638     LibMame_TextureFormat_PaletteA16    = 0x0020,
00642     LibMame_TextureFormat_RGB15         = 0x0030,
00646     LibMame_TextureFormat_RGB32         = 0x0040,
00650     LibMame_TextureFormat_ARGB32        = 0x0050,
00654     LibMame_TextureFormat_YUY16         = 0x0060
00655 } LibMame_TextureFormat;
00656 
00657 
00662 typedef enum
00663 {
00667     LibMame_BlendMode_None              = 0x0000,
00671     LibMame_BlendMode_Alpha             = 0x0100,
00675     LibMame_BlendMode_RGB_Multiply      = 0x0200,
00679     LibMame_BlendMode_RGB_Add           = 0x0300
00680 } LibMame_BlendMode;
00681 
00682 
00687 typedef enum
00688 {
00692     LibMame_StartupPhase_Preparing,
00696     LibMame_StartupPhase_LoadingRoms,
00701     LibMame_StartupPhase_InitializingMachine
00702 } LibMame_StartupPhase;
00703 
00704 
00708 typedef enum
00709 {
00710     LibMame_RunGameStatus_Success,
00711     LibMame_RunGameStatus_InvalidGameNum,
00712     LibMame_RunGameStatus_FailedValidityCheck,
00713     LibMame_RunGameStatus_MissingFiles,
00714     LibMame_RunGameStatus_NoSuchGame,
00715     LibMame_RunGameStatus_InvalidConfig,
00716     LibMame_RunGameStatus_GeneralError
00717 } LibMame_RunGameStatus;
00718 
00719 
00720 /*****************************************************************************
00721  * Structured type definitions
00722  *****************************************************************************/
00723 
00727 typedef struct LibMame_ScreenResolution
00728 {
00729     int width, height;
00730 } LibMame_ScreenResolution;
00731 
00732 
00736 typedef struct LibMame_SoundSample
00737 {
00742     const char *name;
00743 
00749     int source_gamenum;
00750 } LibMame_SoundSample;
00751 
00752 
00756 typedef struct LibMame_Chip
00757 {
00761     int is_sound;
00762 
00766     const char *tag;
00767 
00771     const char *name;
00772 
00776     int clock_hz;
00777 } LibMame_Chip;
00778 
00779 
00783 typedef struct LibMame_Dipswitch
00784 {
00789     const char *name;
00790 
00796     const char *tag;
00797 
00803     uint32_t mask;
00804 
00809     int value_count;
00810 
00814     int default_value;
00815 
00820     const char * const *value_names;
00821 } LibMame_Dipswitch;
00822 
00823 
00830 typedef struct LibMame_PerPlayerControllers
00831 {
00836     int controller_flags;
00837 
00842     int normal_button_flags;
00843 
00848     const char *normal_button_names[LibMame_NormalButtonTypeCount];
00849 
00854     int mahjong_button_flags;
00855 
00860     int hanafuda_button_flags;
00861 
00866     int gambling_button_flags;
00867 } LibMame_PerPlayerControllers;
00868 
00869 
00876 typedef struct LibMame_SharedControllers
00877 {
00882     int shared_button_flags;
00883 
00888     int special_button_flags;
00889 
00894     const char *special_button_names[LibMame_SpecialButtonTypeCount];
00895 } LibMame_SharedControllers;
00896 
00897 
00901 typedef struct LibMame_AllControllers
00902 {
00908     LibMame_PerPlayerControllers per_player;
00909 
00913     LibMame_SharedControllers shared;
00914 } LibMame_AllControllers;
00915 
00916 
00923 typedef struct LibMame_BiosSet
00924 {
00928     const char *name;
00929 
00934     const char *description;
00935     
00940     int is_default;
00941 
00945     int rom_count;
00946 
00951     const int *rom_numbers;
00952 } LibMame_BiosSet;
00953 
00954 
00958 typedef struct LibMame_Image
00959 {
00963     const char *name;
00964 
00972     LibMame_ImageStatus status;
00973 
00978     int is_optional;
00979 
00984     int size_if_known;
00985 
00998     const char *clone_of_game;
00999     const char *clone_of_rom;
01000 
01005     const char *crc;
01006 
01011     const char *sha1;
01012 
01017     const char *md5;
01018 } LibMame_Image;
01019 
01020 
01029 typedef struct LibMame_PerPlayerControlsState
01030 {
01038     int left_joystick_state;
01039 
01047     int right_joystick_state;
01048 
01053     int analog_joystick_horizontal_state;
01054 
01059     int analog_joystick_vertical_state;
01060 
01066     int spinner_delta;
01067 
01073     int vertical_spinner_delta;
01074 
01079     int paddle_state;
01080 
01085     int vertical_paddle_state;
01086 
01093     int trackball_horizontal_delta;
01094 
01101     int trackball_vertical_delta;
01102 
01110     int lightgun_horizontal_state;
01111 
01119     int lightgun_vertical_state;
01120 
01125     int pedal_state;
01126 
01131     int pedal2_state;
01132 
01137     int pedal3_state;
01138 
01146     int normal_buttons_state;
01147 
01155     int mahjong_buttons_state;
01156 
01164     int hanafuda_buttons_state;
01165     
01173     int gambling_buttons_state;
01174 } LibMame_PerPlayerControlsState;
01175 
01176 
01182 typedef struct LibMame_SharedControlsState
01183 {
01193     int shared_buttons_state;
01194 
01204     int special_buttons_state;
01205 
01210     int ui_input_state;
01211 } LibMame_SharedControlsState;
01212 
01213 
01218 typedef struct LibMame_AllControlsState
01219 {
01224     LibMame_PerPlayerControlsState per_player[8];
01225 
01229     LibMame_SharedControlsState shared;
01230 } LibMame_AllControlsState;
01231 
01232 
01239 typedef struct LibMame_RunGameOptions
01240 {
01241     /* search paths for files of specific types; of the form DIR1;DIR2;...
01242        These files are only read (not written) by MAME -------------------- */
01243 
01245     char rom_path[1024];
01247     char sample_path[1024];
01249     char art_path[1024];
01251     char ctrl_path[1024];
01253     char ini_path[1024];
01255     char font_path[1024];
01257     char cheat_path[1024];
01259     char crosshair_path[1024];
01260 
01261     /* single directories for files of specific types.  These files are read
01262        and written by MAME ------------------------------------------------ */
01263 
01265     char nvram_directory[256];
01267     char memcard_directory[256];
01269     char input_directory[256];
01271     char state_directory[256];
01273     char snapshot_directory[256];
01275     char diff_directory[256];
01277     char comment_directory[256];
01278 
01279     /* state/playback options --------------------------------------------- */
01280 
01282     char state[1024]; 
01284     int autosave; 
01286     char playback_file[256];
01288     char record_file[256];
01290     char mngwrite_file[256];
01292     char aviwrite_file[256];
01294     char wavwrite_file[256];
01297     char snapsize[16];
01300     char snapview[64];
01302     int burnin;
01303     
01304     /* core performance options ------------------------------------------- */
01305 
01307     int auto_frame_skip;
01309     int frame_skip_level;
01311     int throttle;
01314     int sleep;
01317     float speed_multiplier;
01320     int auto_refresh_speed;
01321 
01322     /* core rotation/flip options ----------------------------------------- */
01323 
01325     int rotate;
01327     int rotate_right;
01329     int rotate_left;
01331     int auto_rotate_right;
01333     int auto_rotate_left;
01335     int flip_x;
01337     int flip_y;
01338 
01339     /* core artwork options ----------------------------------------------- */
01340 
01342     int crop_artwork;
01344     int use_backdrops;
01346     int use_overlays;
01348     int use_bezels;
01349 
01350     /* core screen options ------------------------------------------------ */
01351 
01353     float brightness;
01355     float contrast;
01357     float gamma;
01359     float pause_brightness;
01361     int quiet_startup;
01363     char effect[256];
01364 
01365     /* core vector options ------------------------------------------------ */
01366 
01368     int vector_antialias;
01370     float vector_beam;
01372     float vector_flicker;
01373 
01374     /* core sound options ------------------------------------------------- */
01375 
01377     int sound;
01379     int sample_rate;
01381     int use_samples;
01383     int volume_attenuation;
01384 
01385     /* core input options ------------------------------------------------- */
01386 
01388     int coin_lockout;
01390     char joystick_map[32];
01393     float joystick_deadzone;
01396     float joystick_saturation;
01398     int enable_steadykey;
01400     int enable_natural_keyboard;
01402     int enable_lightgun_offscreen_reload;
01403 
01404     /* core debugging options --------------------------------------------- */
01405 
01407     int verbose_output;
01409     int emit_log;
01411     int debug;
01413     int debug_internal;
01415     int debugscript;
01417     int update_in_pause;
01418 
01419     /* core misc options -------------------------------------------------- */
01420 
01422     char special_bios[64];
01424     int enable_cheats;
01426     int skip_gameinfo_screens;
01427 
01428 } LibMame_RunGameOptions;
01429 
01430 
01437 typedef struct LibMame_RenderPrimitive
01438 {
01442     LibMame_RenderPrimitiveType type;
01443 
01451     struct {
01452         float x0;   /* leftmost X coordinate */
01453         float y0;   /* topmost Y coordinate */
01454         float x1;   /* rightmost X coordinate */
01455         float y1;   /* bottommost Y coordinate */
01456     } bounds;
01457 
01461     struct {
01462         float a;    /* alpha component (0.0 = transparent, 1.0 = opaque) */
01463         float r;    /* red component (0.0 = none, 1.0 = max) */
01464         float g;    /* green component (0.0 = none, 1.0 = max) */
01465         float b;    /* blue component (0.0 = none, 1.0 = max) */
01466     } color;
01467 
01472     uint32_t flags;
01473 
01478     float width;
01479 
01483     struct {
01490         void *base;           /* base of the data */
01491 
01495         uint32_t rowpixels;   /* pixels per row */
01496 
01500         uint32_t width;
01501 
01505         uint32_t height;      /* height of the image */
01506 
01510         const uint32_t *palette;
01511 
01517         uint32_t seqid;
01518     } texture;
01519 
01524     struct 
01525     {
01529         struct {
01530             float u, v;
01531         } top_left;
01532 
01536         struct {
01537             float u, v;
01538         } top_right;
01539 
01543         struct {
01544             float u, v;
01545         } bottom_left;
01546 
01550         struct {
01551             float u, v;
01552         } bottom_right;
01553     } quad_texuv;
01554 
01559     struct LibMame_RenderPrimitive *next;
01560 } LibMame_RenderPrimitive;
01561 
01562 
01570 typedef struct LibMame_RunGameCallbacks
01571 {
01582     void (*StatusText)(const char *format, va_list args, void *callback_data);
01583 
01603     void (*StartingUp)(LibMame_StartupPhase phase, int pct_complete,
01604                        LibMame_RunningGame *running_game,
01605                        void *callback_data);
01606 
01623     void (*PollAllControlsState)(LibMame_AllControlsState *all_states,
01624                                  void *callback_data);
01625 
01636     void (*UpdateVideo)(const LibMame_RenderPrimitive *render_primitive_list,
01637                         void *callback_data);
01638 
01653     void (*UpdateAudio)(int sample_rate, int samples_this_frame, 
01654                         const int16_t *buffer, void *callback_data);
01655 
01670     void (*SetMasterVolume)(int attenuation, void *callback_data);
01671 
01681     void (*MakeRunningGameCalls)(void *callback_data);
01682 
01695     void (*Paused)(void *callback_data);
01696      
01697 } LibMame_RunGameCallbacks;
01698 
01699 
01700 /*****************************************************************************
01701  * Functions comprising the libmame API
01702  *****************************************************************************/
01703 
01704 /*----------------------------------------------------------------------------
01705  * Functions for managing the library.
01706  ----------------------------------------------------------------------------*/
01707 
01717 LibMame_InitializeStatus LibMame_Initialize();
01718 
01719 
01728 void LibMame_Deinitialize();
01729 
01730 
01738 const char *LibMame_Get_Version_String();
01739 
01740 
01741 /*----------------------------------------------------------------------------
01742  * Functions for querying the supported games and their properties
01743  ----------------------------------------------------------------------------*/
01744 
01750 int LibMame_Get_Game_Count(); 
01751 
01752 
01760 int LibMame_Get_Game_Number(const char *short_name);
01761 
01762 
01775 int LibMame_Get_Game_Matches(const char *short_name, int num_matches,
01776                              int *gamenums);
01777 
01784 const char *LibMame_Get_Game_Short_Name(int gamenum);
01785 
01786 
01793 const char *LibMame_Get_Game_Full_Name(int gamenum);
01794 
01795 
01802 int LibMame_Get_Game_Year_Of_Release(int gamenum);
01803 
01804 
01813 int LibMame_Get_Game_CloneOf(int gamenum);
01814 
01815 
01822 const char *LibMame_Get_Game_Manufacturer(int gamenum);
01823 
01824 
01836 int LibMame_Get_Game_WorkingFlags(int gamenum);
01837 
01838 
01846 LibMame_OrientationType LibMame_Get_Game_Orientation(int gamenum);
01847 
01848 
01855 LibMame_ScreenType LibMame_Get_Game_ScreenType(int gamenum);
01856 
01857 
01865 LibMame_ScreenResolution LibMame_Get_Game_ScreenResolution(int gamenum);
01866 
01867 
01874 float LibMame_Get_Game_ScreenRefreshRateHz(int gamenum);
01875 
01876 
01885 int LibMame_Get_Game_SoundChannels(int gamenum);
01886 
01887 
01894 int LibMame_Get_Game_SoundSamples_Count(int gamenum);
01895 
01896 
01906 int LibMame_Get_Game_SoundSamplesSource(int gamenum);
01907 
01908 
01916 const char *LibMame_Get_Game_SoundSampleFileName(int gamenum, int samplenum);
01917 
01918 
01925 int LibMame_Get_Game_Chip_Count(int gamenum);
01926 
01927 
01935 LibMame_Chip LibMame_Get_Game_Chip(int gamenum, int chipnum);
01936 
01937 
01944 int LibMame_Get_Game_Dipswitch_Count(int gamenum);
01945 
01946 
01954 LibMame_Dipswitch LibMame_Get_Game_Dipswitch(int gamenum, int num);
01955 
01956 
01966 int LibMame_Get_Game_MaxSimultaneousPlayers(int gamenum);
01967 
01968 
01975 LibMame_AllControllers LibMame_Get_Game_AllControllers(int gamenum);
01976 
01977 
01986 int LibMame_Get_Game_BiosSet_Count(int gamenum);
01987 
01988 
01996 LibMame_BiosSet LibMame_Get_Game_BiosSet(int gamenum, int biossetnum);
01997 
01998 
02008 int LibMame_Get_Game_Rom_Count(int gamenum);
02009 
02010 
02019 LibMame_Image LibMame_Get_Game_Rom(int gamenum, int romnum);
02020 
02021 
02029 int LibMame_Get_Game_Hdd_Count(int gamenum);
02030 
02031 
02041 LibMame_Image LibMame_Get_Game_Hdd(int gamenum, int hddnum);
02042 
02043 
02050 const char *LibMame_Get_Game_SourceFileName(int gamenum);
02051 
02052 
02053 /*----------------------------------------------------------------------------
02054  * Functions for managing options
02055  ----------------------------------------------------------------------------*/
02056 
02062 void LibMame_Get_Default_RunGameOptions(LibMame_RunGameOptions *options);
02063 
02064 
02065 /*----------------------------------------------------------------------------
02066  * Functions for running a game
02067  ----------------------------------------------------------------------------*/
02068 
02086 LibMame_RunGameStatus LibMame_RunGame(int gamenum, int benchmarking,
02087                                       const LibMame_RunGameOptions *options,
02088                                       const LibMame_RunGameCallbacks *cbs,
02089                                       void *callback_data);
02090 
02091 
02103 const char *LibMame_RunningGame_GetSpeedText(LibMame_RunningGame *game);
02104 
02105 
02106 /*----------------------------------------------------------------------------
02107  * Functions for altering the state of a running game
02108  ----------------------------------------------------------------------------*/
02109 
02120 void LibMame_RunningGame_Schedule_Pause(LibMame_RunningGame *game);
02121 
02122 
02133 void LibMame_RunningGame_Schedule_Exit(LibMame_RunningGame *game);
02134 
02135 
02146 void LibMame_RunningGame_Schedule_Hard_Reset(LibMame_RunningGame *game);
02147 
02148 
02159 void LibMame_RunningGame_Schedule_Soft_Reset(LibMame_RunningGame *game);
02160 
02161 
02172 void LibMame_RunningGame_SaveState(LibMame_RunningGame *game,
02173                                    const char *filename);
02174 
02175 
02187 void LibMame_RunningGame_LoadState(LibMame_RunningGame *game,
02188                                    const char *filename);
02189 
02190 
02204 void LibMame_RunningGame_ChangeDipswitchValue(LibMame_RunningGame *game,
02205                                               const char *tag, uint32_t mask,
02206                                               const char *value);
02207 
02208 
02209 #ifdef __cplusplus
02210 }
02211 #endif
02212 
02213 #endif /* __LIBMAME_H__ */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines