| 1 |
/*************************************************************************** |
| 2 |
|
| 3 |
mame.h |
| 4 |
|
| 5 |
Controls execution of the core MAME system. |
| 6 |
|
| 7 |
***************************************************************************/ |
| 8 |
|
| 9 |
#ifndef MACHINE_H |
| 10 |
#define MACHINE_H |
| 11 |
|
| 12 |
#include "osdepend.h" |
| 13 |
#include "drawgfx.h" |
| 14 |
#include <stdio.h> |
| 15 |
#include <string.h> |
| 16 |
#include <stdlib.h> |
| 17 |
#include "palette.h" |
| 18 |
|
| 19 |
#ifdef MAME32JP |
| 20 |
#include "ui_font.h" |
| 21 |
#endif |
| 22 |
|
| 23 |
#ifdef MESS |
| 24 |
#include "mess.h" |
| 25 |
#endif |
| 26 |
|
| 27 |
extern char build_version[]; |
| 28 |
|
| 29 |
#define MAX_GFX_ELEMENTS 32 |
| 30 |
#define MAX_MEMORY_REGIONS 32 |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
/*************************************************************************** |
| 35 |
|
| 36 |
Core description of the currently-running machine |
| 37 |
|
| 38 |
***************************************************************************/ |
| 39 |
|
| 40 |
struct RegionInfo |
| 41 |
{ |
| 42 |
UINT8 * base; |
| 43 |
size_t length; |
| 44 |
UINT32 type; |
| 45 |
UINT32 flags; |
| 46 |
}; |
| 47 |
|
| 48 |
struct RunningMachine |
| 49 |
{ |
| 50 |
struct RegionInfo memory_region[MAX_MEMORY_REGIONS]; |
| 51 |
struct GfxElement *gfx[MAX_GFX_ELEMENTS]; /* graphic sets (chars, sprites) */ |
| 52 |
struct mame_bitmap *scrbitmap; /* bitmap to draw into */ |
| 53 |
struct rectangle visible_area; |
| 54 |
pen_t *pens; /* remapped palette pen numbers. When you write */ |
| 55 |
/* directly to a bitmap, never use absolute values, */ |
| 56 |
/* use this array to get the pen number. For example, */ |
| 57 |
/* if you want to use color #6 in the palette, use */ |
| 58 |
/* pens[6] instead of just 6. */ |
| 59 |
rgb_t *palette; |
| 60 |
UINT16 *game_colortable; /* lookup table used to map gfx pen numbers */ |
| 61 |
/* to color numbers */ |
| 62 |
pen_t *remapped_colortable; /* the above, already remapped through */ |
| 63 |
/* Machine->pens */ |
| 64 |
const struct GameDriver *gamedrv; /* contains the definition of the game machine */ |
| 65 |
const struct InternalMachineDriver *drv; /* same as gamedrv->drv */ |
| 66 |
int color_depth; /* video color depth: 8, 16, 15 or 32 */ |
| 67 |
int sample_rate; /* the digital audio sample rate; 0 if sound is disabled. */ |
| 68 |
/* This is set to a default value, or a value specified by */ |
| 69 |
/* the user; osd_init() is allowed to change it to the actual */ |
| 70 |
/* sample rate supported by the audio card. */ |
| 71 |
struct GameSamples *samples; /* samples loaded from disk */ |
| 72 |
struct InputPort *input_ports; /* the input ports definition from the driver */ |
| 73 |
/* is copied here and modified (load settings from disk, */ |
| 74 |
/* remove cheat commands, and so on) */ |
| 75 |
struct InputPort *input_ports_default; /* original input_ports without modifications */ |
| 76 |
int orientation; /* see #defines in driver.h */ |
| 77 |
struct GfxElement *uifont; /* font used by the user interface */ |
| 78 |
int uifontwidth,uifontheight; |
| 79 |
#ifdef JAPANESE |
| 80 |
struct GfxElement *uifont2; /* font used by the user interface */ |
| 81 |
int uifontwidth2,uifontheight2; |
| 82 |
#endif |
| 83 |
int uixmin,uiymin; |
| 84 |
int uiwidth,uiheight; |
| 85 |
int ui_orientation; |
| 86 |
struct rectangle absolute_visible_area; /* as passed to osd_set_visible_area() */ |
| 87 |
|
| 88 |
/* stuff for the debugger */ |
| 89 |
struct mame_bitmap *debug_bitmap; |
| 90 |
pen_t *debug_pens; |
| 91 |
pen_t *debug_remapped_colortable; |
| 92 |
struct GfxElement *debugger_font; |
| 93 |
}; |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
/*************************************************************************** |
| 98 |
|
| 99 |
Options passed from the frontend to the main core |
| 100 |
|
| 101 |
***************************************************************************/ |
| 102 |
|
| 103 |
#ifdef MESS |
| 104 |
#define MAX_IMAGES 32 |
| 105 |
/* |
| 106 |
* This is a filename and it's associated peripheral type |
| 107 |
* The types are defined in mess.h (IO_...) |
| 108 |
*/ |
| 109 |
struct ImageFile |
| 110 |
{ |
| 111 |
const char *name; |
| 112 |
int type; |
| 113 |
}; |
| 114 |
#endif |
| 115 |
|
| 116 |
/* The host platform should fill these fields with the preferences specified in the GUI */ |
| 117 |
/* or on the commandline. */ |
| 118 |
struct GameOptions |
| 119 |
{ |
| 120 |
void *record; |
| 121 |
void *playback; |
| 122 |
void *language_file; /* LBO 042400 */ |
| 123 |
|
| 124 |
int mame_debug; |
| 125 |
int cheat; |
| 126 |
int gui_host; |
| 127 |
|
| 128 |
int samplerate; |
| 129 |
int use_samples; |
| 130 |
int use_filter; |
| 131 |
|
| 132 |
int color_depth; /* 8 or 16, any other value means auto */ |
| 133 |
int vector_width; /* requested width for vector games; 0 means default (640) */ |
| 134 |
int vector_height; /* requested height for vector games; 0 means default (480) */ |
| 135 |
int debug_width; /* initial size of the debug_bitmap */ |
| 136 |
int debug_height; |
| 137 |
int norotate; |
| 138 |
int ror; |
| 139 |
int rol; |
| 140 |
int flipx; |
| 141 |
int flipy; |
| 142 |
int beam; |
| 143 |
float vector_flicker; |
| 144 |
int translucency; |
| 145 |
int antialias; |
| 146 |
int use_artwork; |
| 147 |
char savegame; |
| 148 |
|
| 149 |
#ifdef MAME32JP |
| 150 |
int autofiredelay; |
| 151 |
int game_index; |
| 152 |
int use_joystick; |
| 153 |
#endif |
| 154 |
|
| 155 |
#ifdef MESS |
| 156 |
int append_no_file_extension; |
| 157 |
|
| 158 |
struct ImageFile image_files[MAX_IMAGES]; |
| 159 |
int image_count; |
| 160 |
#endif |
| 161 |
}; |
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
/*************************************************************************** |
| 166 |
|
| 167 |
Globals referencing the current machine and the global options |
| 168 |
|
| 169 |
***************************************************************************/ |
| 170 |
|
| 171 |
extern struct GameOptions options; |
| 172 |
extern struct RunningMachine *Machine; |
| 173 |
extern int partial_update_count; |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
/*************************************************************************** |
| 178 |
|
| 179 |
Function prototypes |
| 180 |
|
| 181 |
***************************************************************************/ |
| 182 |
|
| 183 |
int run_game(int game); |
| 184 |
int updatescreen(void); |
| 185 |
void draw_screen(void); |
| 186 |
|
| 187 |
/* force a partial update of the screen up to and including the |
| 188 |
requested scanline */ |
| 189 |
void force_partial_update(int scanline); |
| 190 |
|
| 191 |
/* called by cpuexec.c to reset updates at the end of VBLANK */ |
| 192 |
void reset_partial_updates(void); |
| 193 |
|
| 194 |
/* next time vh_screenrefresh is called, full_refresh will be true, |
| 195 |
thus requesting a redraw of the entire screen */ |
| 196 |
void schedule_full_refresh(void); |
| 197 |
|
| 198 |
void update_video_and_audio(void); |
| 199 |
/* osd_fopen() must use this to know if high score files can be used */ |
| 200 |
int mame_highscore_enabled(void); |
| 201 |
#ifdef MAME32JP |
| 202 |
#define set_led_status(num, on) |
| 203 |
#else |
| 204 |
void set_led_status(int num,int on); |
| 205 |
#endif |
| 206 |
|
| 207 |
/* expansion of tag/data pairs */ |
| 208 |
struct InternalMachineDriver; |
| 209 |
void expand_machine_driver(void (*constructor)(struct InternalMachineDriver *), struct InternalMachineDriver *output); |
| 210 |
|
| 211 |
#endif |