| 1 |
/*************************************************************************** |
| 2 |
|
| 3 |
driver.h |
| 4 |
|
| 5 |
Include this with all MAME files. Includes all the core system pieces. |
| 6 |
|
| 7 |
***************************************************************************/ |
| 8 |
|
| 9 |
#ifndef DRIVER_H |
| 10 |
#define DRIVER_H |
| 11 |
|
| 12 |
|
| 13 |
/*************************************************************************** |
| 14 |
|
| 15 |
Macros for declaring common callbacks |
| 16 |
|
| 17 |
***************************************************************************/ |
| 18 |
|
| 19 |
#define DRIVER_INIT(name) void init_##name(void) |
| 20 |
|
| 21 |
#define INTERRUPT_GEN(func) void func(void) |
| 22 |
|
| 23 |
#define MACHINE_INIT(name) void machine_init_##name(void) |
| 24 |
#define MACHINE_STOP(name) void machine_stop_##name(void) |
| 25 |
|
| 26 |
#define NVRAM_HANDLER(name) void nvram_handler_##name(void *file,int read_or_write) |
| 27 |
|
| 28 |
#define PALETTE_INIT(name) void palette_init_##name(UINT16 *colortable, const UINT8 *color_prom) |
| 29 |
|
| 30 |
#define VIDEO_START(name) int video_start_##name(void) |
| 31 |
#define VIDEO_STOP(name) void video_stop_##name(void) |
| 32 |
#define VIDEO_EOF(name) void video_eof_##name(void) |
| 33 |
#define VIDEO_UPDATE(name) void video_update_##name(struct mame_bitmap *bitmap, const struct rectangle *cliprect) |
| 34 |
|
| 35 |
/* NULL versions */ |
| 36 |
#define init_NULL NULL |
| 37 |
#define machine_init_NULL NULL |
| 38 |
#define nvram_handler_NULL NULL |
| 39 |
#define palette_init_NULL NULL |
| 40 |
#define video_start_NULL NULL |
| 41 |
#define video_stop_NULL NULL |
| 42 |
#define video_eof_NULL NULL |
| 43 |
#define video_update_NULL NULL |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
/*************************************************************************** |
| 48 |
|
| 49 |
Core MAME includes |
| 50 |
|
| 51 |
***************************************************************************/ |
| 52 |
|
| 53 |
#include "osd_cpu.h" |
| 54 |
#include "memory.h" |
| 55 |
#include "mamedbg.h" |
| 56 |
#include "osdepend.h" |
| 57 |
#include "mame.h" |
| 58 |
#include "common.h" |
| 59 |
#include "drawgfx.h" |
| 60 |
#include "palette.h" |
| 61 |
#include "cpuintrf.h" |
| 62 |
#include "cpuexec.h" |
| 63 |
#include "cpuint.h" |
| 64 |
#include "sndintrf.h" |
| 65 |
#include "input.h" |
| 66 |
#include "inptport.h" |
| 67 |
#include "usrintrf.h" |
| 68 |
#include "cheat.h" |
| 69 |
#include "tilemap.h" |
| 70 |
#include "profiler.h" |
| 71 |
|
| 72 |
#ifdef MAME_NET |
| 73 |
#include "network.h" |
| 74 |
#endif /* MAME_NET */ |
| 75 |
|
| 76 |
#ifdef MMSND |
| 77 |
#include "mmsnd/mmsnd.h" |
| 78 |
#endif |
| 79 |
|
| 80 |
|
| 81 |
/*************************************************************************** |
| 82 |
|
| 83 |
Macros for building machine drivers |
| 84 |
|
| 85 |
***************************************************************************/ |
| 86 |
|
| 87 |
/* use this to declare external references to a machine driver */ |
| 88 |
#define MACHINE_DRIVER_EXTERN(game) \ |
| 89 |
void construct_##game(struct InternalMachineDriver *machine) \ |
| 90 |
|
| 91 |
|
| 92 |
/* start/end tags for the machine driver */ |
| 93 |
#define MACHINE_DRIVER_START(game) \ |
| 94 |
void construct_##game(struct InternalMachineDriver *machine) \ |
| 95 |
{ \ |
| 96 |
struct MachineCPU *cpu = NULL; \ |
| 97 |
(void)cpu; \ |
| 98 |
|
| 99 |
#define MACHINE_DRIVER_END \ |
| 100 |
} \ |
| 101 |
|
| 102 |
|
| 103 |
/* importing data from other machine drivers */ |
| 104 |
#define MDRV_IMPORT_FROM(game) \ |
| 105 |
construct_##game(machine); \ |
| 106 |
|
| 107 |
|
| 108 |
/* add/modify/remove/replace CPUs */ |
| 109 |
#define MDRV_CPU_ADD_TAG(tag, type, clock) \ |
| 110 |
cpu = machine_add_cpu(machine, (tag), CPU_##type, (clock)); \ |
| 111 |
|
| 112 |
#define MDRV_CPU_ADD(type, clock) \ |
| 113 |
MDRV_CPU_ADD_TAG(NULL, type, clock) \ |
| 114 |
|
| 115 |
#define MDRV_CPU_MODIFY(tag) \ |
| 116 |
cpu = machine_find_cpu(machine, tag); \ |
| 117 |
|
| 118 |
#define MDRV_CPU_REMOVE(tag) \ |
| 119 |
machine_remove_cpu(machine, tag); \ |
| 120 |
cpu = NULL; \ |
| 121 |
|
| 122 |
#define MDRV_CPU_REPLACE(tag, type, clock) \ |
| 123 |
cpu = machine_find_cpu(machine, tag); \ |
| 124 |
if (cpu) \ |
| 125 |
{ \ |
| 126 |
cpu->cpu_type = (CPU_##type) | (cpu->cpu_type & CPU_FLAGS_MASK);\ |
| 127 |
cpu->cpu_clock = (clock); \ |
| 128 |
} \ |
| 129 |
|
| 130 |
|
| 131 |
/* CPU parameters */ |
| 132 |
#define MDRV_CPU_FLAGS(flags) \ |
| 133 |
if (cpu) \ |
| 134 |
cpu->cpu_type = (flags) | (cpu->cpu_type & ~CPU_FLAGS_MASK); \ |
| 135 |
|
| 136 |
#define MDRV_CPU_CONFIG(config) \ |
| 137 |
if (cpu) \ |
| 138 |
cpu->reset_param = &(config); \ |
| 139 |
|
| 140 |
#define MDRV_CPU_MEMORY(readmem, writemem) \ |
| 141 |
if (cpu) \ |
| 142 |
{ \ |
| 143 |
cpu->memory_read = (readmem); \ |
| 144 |
cpu->memory_write = (writemem); \ |
| 145 |
} \ |
| 146 |
|
| 147 |
#define MDRV_CPU_PORTS(readport, writeport) \ |
| 148 |
if (cpu) \ |
| 149 |
{ \ |
| 150 |
cpu->port_read = (readport); \ |
| 151 |
cpu->port_write = (writeport); \ |
| 152 |
} \ |
| 153 |
|
| 154 |
#define MDRV_CPU_VBLANK_INT(func, rate) \ |
| 155 |
if (cpu) \ |
| 156 |
{ \ |
| 157 |
cpu->vblank_interrupt = func; \ |
| 158 |
cpu->vblank_interrupts_per_frame = (rate); \ |
| 159 |
} \ |
| 160 |
|
| 161 |
#define MDRV_CPU_PERIODIC_INT(func, rate) \ |
| 162 |
if (cpu) \ |
| 163 |
{ \ |
| 164 |
cpu->timed_interrupt = func; \ |
| 165 |
cpu->timed_interrupts_per_second = (rate); \ |
| 166 |
} \ |
| 167 |
|
| 168 |
|
| 169 |
/* core parameters */ |
| 170 |
#define MDRV_FRAMES_PER_SECOND(rate) \ |
| 171 |
machine->frames_per_second = (rate); \ |
| 172 |
|
| 173 |
#define MDRV_VBLANK_DURATION(duration) \ |
| 174 |
machine->vblank_duration = (duration); \ |
| 175 |
|
| 176 |
#define MDRV_INTERLEAVE(interleave) \ |
| 177 |
machine->cpu_slices_per_frame = (interleave); \ |
| 178 |
|
| 179 |
|
| 180 |
/* core functions */ |
| 181 |
#define MDRV_MACHINE_INIT(name) \ |
| 182 |
machine->machine_init = machine_init_##name; \ |
| 183 |
|
| 184 |
#define MDRV_MACHINE_STOP(name) \ |
| 185 |
machine->machine_stop = machine_stop_##name; \ |
| 186 |
|
| 187 |
#define MDRV_NVRAM_HANDLER(name) \ |
| 188 |
machine->nvram_handler = nvram_handler_##name; \ |
| 189 |
|
| 190 |
|
| 191 |
/* core video parameters */ |
| 192 |
#define MDRV_VIDEO_ATTRIBUTES(flags) \ |
| 193 |
machine->video_attributes = (flags) | (machine->video_attributes & VIDEO_ASPECT_RATIO_MASK);\ |
| 194 |
|
| 195 |
#define MDRV_ASPECT_RATIO(num, den) \ |
| 196 |
machine->video_attributes = VIDEO_ASPECT_RATIO(num,den) | (machine->video_attributes & ~VIDEO_ASPECT_RATIO_MASK);\ |
| 197 |
|
| 198 |
#define MDRV_SCREEN_SIZE(width, height) \ |
| 199 |
machine->screen_width = (width); \ |
| 200 |
machine->screen_height = (height); \ |
| 201 |
|
| 202 |
#define MDRV_VISIBLE_AREA(minx, maxx, miny, maxy) \ |
| 203 |
machine->default_visible_area.min_x = (minx); \ |
| 204 |
machine->default_visible_area.max_x = (maxx); \ |
| 205 |
machine->default_visible_area.min_y = (miny); \ |
| 206 |
machine->default_visible_area.max_y = (maxy); \ |
| 207 |
|
| 208 |
#define MDRV_GFXDECODE(gfx) \ |
| 209 |
machine->gfxdecodeinfo = (gfx); \ |
| 210 |
|
| 211 |
#define MDRV_PALETTE_LENGTH(length) \ |
| 212 |
machine->total_colors = (length); \ |
| 213 |
|
| 214 |
#define MDRV_COLORTABLE_LENGTH(length) \ |
| 215 |
machine->color_table_len = (length); \ |
| 216 |
|
| 217 |
|
| 218 |
/* core video functions */ |
| 219 |
#define MDRV_PALETTE_INIT(name) \ |
| 220 |
machine->init_palette = palette_init_##name; \ |
| 221 |
|
| 222 |
#define MDRV_VIDEO_START(name) \ |
| 223 |
machine->video_start = video_start_##name; \ |
| 224 |
|
| 225 |
#define MDRV_VIDEO_STOP(name) \ |
| 226 |
machine->video_stop = video_stop_##name; \ |
| 227 |
|
| 228 |
#define MDRV_VIDEO_EOF(name) \ |
| 229 |
machine->video_eof = video_eof_##name; \ |
| 230 |
|
| 231 |
#define MDRV_VIDEO_UPDATE(name) \ |
| 232 |
machine->video_update = video_update_##name; \ |
| 233 |
|
| 234 |
|
| 235 |
/* core sound parameters */ |
| 236 |
#define MDRV_SOUND_ATTRIBUTES(flags) \ |
| 237 |
machine->sound_attributes = (flags); \ |
| 238 |
|
| 239 |
|
| 240 |
/* add/remove/replace sounds */ |
| 241 |
#define MDRV_SOUND_ADD_TAG(tag, type, interface) \ |
| 242 |
machine_add_sound(machine, (tag), SOUND_##type, &(interface)); \ |
| 243 |
|
| 244 |
#define MDRV_SOUND_ADD(type, interface) \ |
| 245 |
MDRV_SOUND_ADD_TAG(NULL, type, interface) \ |
| 246 |
|
| 247 |
#define MDRV_SOUND_REMOVE(tag) \ |
| 248 |
machine_remove_sound(machine, tag); \ |
| 249 |
|
| 250 |
#define MDRV_SOUND_REPLACE(tag, type, interface) \ |
| 251 |
{ \ |
| 252 |
struct MachineSound *sound = machine_find_sound(machine, tag); \ |
| 253 |
if (sound) \ |
| 254 |
{ \ |
| 255 |
sound->sound_type = SOUND_##type; \ |
| 256 |
sound->sound_interface = &(interface); \ |
| 257 |
} \ |
| 258 |
} \ |
| 259 |
|
| 260 |
|
| 261 |
struct MachineCPU *machine_add_cpu(struct InternalMachineDriver *machine, const char *tag, int type, int cpuclock); |
| 262 |
struct MachineCPU *machine_find_cpu(struct InternalMachineDriver *machine, const char *tag); |
| 263 |
void machine_remove_cpu(struct InternalMachineDriver *machine, const char *tag); |
| 264 |
|
| 265 |
struct MachineSound *machine_add_sound(struct InternalMachineDriver *machine, const char *tag, int type, void *sndintf); |
| 266 |
struct MachineSound *machine_find_sound(struct InternalMachineDriver *machine, const char *tag); |
| 267 |
void machine_remove_sound(struct InternalMachineDriver *machine, const char *tag); |
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
/*************************************************************************** |
| 272 |
|
| 273 |
Internal representation of a machine driver, built from the constructor |
| 274 |
|
| 275 |
***************************************************************************/ |
| 276 |
|
| 277 |
#define MAX_CPU 8 /* MAX_CPU is the maximum number of CPUs which cpuintrf.c */ |
| 278 |
/* can run at the same time. Currently, 8 is enough. */ |
| 279 |
|
| 280 |
#define MAX_SOUND 5 /* MAX_SOUND is the maximum number of sound subsystems */ |
| 281 |
/* which can run at the same time. Currently, 5 is enough. */ |
| 282 |
|
| 283 |
struct InternalMachineDriver |
| 284 |
{ |
| 285 |
struct MachineCPU cpu[MAX_CPU]; |
| 286 |
float frames_per_second; |
| 287 |
int vblank_duration; |
| 288 |
UINT32 cpu_slices_per_frame; |
| 289 |
|
| 290 |
void (*machine_init)(void); |
| 291 |
void (*machine_stop)(void); |
| 292 |
void (*nvram_handler)(void *file,int read_or_write); |
| 293 |
|
| 294 |
UINT32 video_attributes; |
| 295 |
int screen_width,screen_height; |
| 296 |
struct rectangle default_visible_area; |
| 297 |
struct GfxDecodeInfo *gfxdecodeinfo; |
| 298 |
UINT32 total_colors; |
| 299 |
UINT32 color_table_len; |
| 300 |
|
| 301 |
void (*init_palette)(unsigned short *colortable,const unsigned char *color_prom); |
| 302 |
int (*video_start)(void); |
| 303 |
void (*video_stop)(void); |
| 304 |
void (*video_eof)(void); |
| 305 |
void (*video_update)(struct mame_bitmap *bitmap,const struct rectangle *cliprect); |
| 306 |
|
| 307 |
UINT32 sound_attributes; |
| 308 |
struct MachineSound sound[MAX_SOUND]; |
| 309 |
}; |
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
/*************************************************************************** |
| 314 |
|
| 315 |
Machine driver constants and flags |
| 316 |
|
| 317 |
***************************************************************************/ |
| 318 |
|
| 319 |
/* VBlank is the period when the video beam is outside of the visible area and */ |
| 320 |
/* returns from the bottom to the top of the screen to prepare for a new video frame. */ |
| 321 |
/* VBlank duration is an important factor in how the game renders itself. MAME */ |
| 322 |
/* generates the vblank_interrupt, lets the game run for vblank_duration microseconds, */ |
| 323 |
/* and then updates the screen. This faithfully reproduces the behaviour of the real */ |
| 324 |
/* hardware. In many cases, the game does video related operations both in its vblank */ |
| 325 |
/* interrupt, and in the normal game code; it is therefore important to set up */ |
| 326 |
/* vblank_duration accurately to have everything properly in sync. An example of this */ |
| 327 |
/* is Commando: if you set vblank_duration to 0, therefore redrawing the screen BEFORE */ |
| 328 |
/* the vblank interrupt is executed, sprites will be misaligned when the screen scrolls. */ |
| 329 |
|
| 330 |
/* Here are some predefined, TOTALLY ARBITRARY values for vblank_duration, which should */ |
| 331 |
/* be OK for most cases. I have NO IDEA how accurate they are compared to the real */ |
| 332 |
/* hardware, they could be completely wrong. */ |
| 333 |
#define DEFAULT_60HZ_VBLANK_DURATION 0 |
| 334 |
#define DEFAULT_30HZ_VBLANK_DURATION 0 |
| 335 |
/* If you use IPT_VBLANK, you need a duration different from 0. */ |
| 336 |
#define DEFAULT_REAL_60HZ_VBLANK_DURATION 2500 |
| 337 |
#define DEFAULT_REAL_30HZ_VBLANK_DURATION 2500 |
| 338 |
|
| 339 |
|
| 340 |
/* ----- flags for video_attributes ----- */ |
| 341 |
|
| 342 |
/* bit 1 of the video attributes indicates whether or not dirty rectangles will work */ |
| 343 |
#define VIDEO_SUPPORTS_DIRTY 0x0002 |
| 344 |
|
| 345 |
/* bit 0 of the video attributes indicates raster or vector video hardware */ |
| 346 |
#define VIDEO_TYPE_RASTER 0x0000 |
| 347 |
#define VIDEO_TYPE_VECTOR 0x0001 |
| 348 |
|
| 349 |
/* bit 3 of the video attributes indicates that the game's palette has 6 or more bits */ |
| 350 |
/* per gun, and would therefore require a 24-bit display. This is entirely up to */ |
| 351 |
/* the OS dependant layer, the bitmap will still be 16-bit. */ |
| 352 |
#define VIDEO_NEEDS_6BITS_PER_GUN 0x0008 |
| 353 |
|
| 354 |
/* ASG 980417 - added: */ |
| 355 |
/* bit 4 of the video attributes indicates that the driver wants its refresh after */ |
| 356 |
/* the VBLANK instead of before. */ |
| 357 |
#define VIDEO_UPDATE_BEFORE_VBLANK 0x0000 |
| 358 |
#define VIDEO_UPDATE_AFTER_VBLANK 0x0010 |
| 359 |
|
| 360 |
/* In most cases we assume pixels are square (1:1 aspect ratio) but some games need */ |
| 361 |
/* different proportions, e.g. 1:2 for Blasteroids */ |
| 362 |
#define VIDEO_PIXEL_ASPECT_RATIO_MASK 0x0060 |
| 363 |
#define VIDEO_PIXEL_ASPECT_RATIO_1_1 0x0000 |
| 364 |
#define VIDEO_PIXEL_ASPECT_RATIO_1_2 0x0020 |
| 365 |
#define VIDEO_PIXEL_ASPECT_RATIO_2_1 0x0040 |
| 366 |
|
| 367 |
#define VIDEO_DUAL_MONITOR 0x0080 |
| 368 |
|
| 369 |
/* Mish 181099: See comments in vidhrdw/generic.c for details */ |
| 370 |
#define VIDEO_BUFFERS_SPRITERAM 0x0100 |
| 371 |
|
| 372 |
/* game wants to use a hicolor or truecolor bitmap (e.g. for alpha blending) */ |
| 373 |
#define VIDEO_RGB_DIRECT 0x0200 |
| 374 |
|
| 375 |
/* automatically extend the palette creating a darker copy for shadows */ |
| 376 |
#define VIDEO_HAS_SHADOWS 0x0400 |
| 377 |
|
| 378 |
/* automatically extend the palette creating a brighter copy for highlights */ |
| 379 |
#define VIDEO_HAS_HIGHLIGHTS 0x0800 |
| 380 |
|
| 381 |
/* generic aspect ratios */ |
| 382 |
#define VIDEO_ASPECT_RATIO_MASK 0xffff0000 |
| 383 |
#define VIDEO_ASPECT_RATIO_NUM(a) (((a) >> 24) & 0xff) |
| 384 |
#define VIDEO_ASPECT_RATIO_DEN(a) (((a) >> 16) & 0xff) |
| 385 |
#define VIDEO_ASPECT_RATIO(n,d) ((((n) & 0xff) << 24) | (((d) & 0xff) << 16)) |
| 386 |
|
| 387 |
|
| 388 |
/* ----- flags for sound_attributes ----- */ |
| 389 |
#define SOUND_SUPPORTS_STEREO 0x0001 |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
/*************************************************************************** |
| 394 |
|
| 395 |
Game driver structure |
| 396 |
|
| 397 |
***************************************************************************/ |
| 398 |
|
| 399 |
struct GameDriver |
| 400 |
{ |
| 401 |
const char *source_file; /* set this to __FILE__ */ |
| 402 |
const struct GameDriver *clone_of; /* if this is a clone, point to */ |
| 403 |
/* the main version of the game */ |
| 404 |
const char *name; |
| 405 |
const char *description; |
| 406 |
const char *year; |
| 407 |
const char *manufacturer; |
| 408 |
void (*drv)(struct InternalMachineDriver *); |
| 409 |
const struct InputPortTiny *input_ports; |
| 410 |
void (*driver_init)(void); /* optional function to be called during initialization */ |
| 411 |
/* This is called ONCE, unlike Machine->init_machine */ |
| 412 |
/* which is called every time the game is reset. */ |
| 413 |
|
| 414 |
const struct RomModule *rom; |
| 415 |
#ifdef MESS |
| 416 |
const struct IODevice *dev; |
| 417 |
#endif |
| 418 |
|
| 419 |
UINT32 flags; /* orientation and other flags; see defines below */ |
| 420 |
}; |
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
/*************************************************************************** |
| 425 |
|
| 426 |
Game driver flags |
| 427 |
|
| 428 |
***************************************************************************/ |
| 429 |
|
| 430 |
/* ----- values for the flags field ----- */ |
| 431 |
|
| 432 |
#define ORIENTATION_MASK 0x0007 |
| 433 |
#define ORIENTATION_FLIP_X 0x0001 /* mirror everything in the X direction */ |
| 434 |
#define ORIENTATION_FLIP_Y 0x0002 /* mirror everything in the Y direction */ |
| 435 |
#define ORIENTATION_SWAP_XY 0x0004 /* mirror along the top-left/bottom-right diagonal */ |
| 436 |
|
| 437 |
#define GAME_NOT_WORKING 0x0008 |
| 438 |
#define GAME_UNEMULATED_PROTECTION 0x0010 /* game's protection not fully emulated */ |
| 439 |
#define GAME_WRONG_COLORS 0x0020 /* colors are totally wrong */ |
| 440 |
#define GAME_IMPERFECT_COLORS 0x0040 /* colors are not 100% accurate, but close */ |
| 441 |
#define GAME_IMPERFECT_GRAPHICS 0x0080 /* graphics are wrong/incomplete */ |
| 442 |
#define GAME_NO_COCKTAIL 0x0100 /* screen flip support is missing */ |
| 443 |
#define GAME_NO_SOUND 0x0200 /* sound is missing */ |
| 444 |
#define GAME_IMPERFECT_SOUND 0x0400 /* sound is known to be wrong */ |
| 445 |
#define NOT_A_DRIVER 0x4000 /* set by the fake "root" driver_0 and by "containers" */ |
| 446 |
/* e.g. driver_neogeo. */ |
| 447 |
#ifdef MESS |
| 448 |
#define GAME_COMPUTER 0x8000 /* Driver is a computer (needs full keyboard) */ |
| 449 |
#define GAME_COMPUTER_MODIFIED 0x0800 /* Official? Hack */ |
| 450 |
#define GAME_ALIAS NOT_A_DRIVER /* Driver is only an alias for an existing model */ |
| 451 |
#endif |
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
/*************************************************************************** |
| 456 |
|
| 457 |
Macros for building game drivers |
| 458 |
|
| 459 |
***************************************************************************/ |
| 460 |
|
| 461 |
#define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME) \ |
| 462 |
extern const struct GameDriver driver_##PARENT; \ |
| 463 |
const struct GameDriver driver_##NAME = \ |
| 464 |
{ \ |
| 465 |
__FILE__, \ |
| 466 |
&driver_##PARENT, \ |
| 467 |
#NAME, \ |
| 468 |
FULLNAME, \ |
| 469 |
#YEAR, \ |
| 470 |
COMPANY, \ |
| 471 |
construct_##MACHINE, \ |
| 472 |
input_ports_##INPUT, \ |
| 473 |
init_##INIT, \ |
| 474 |
rom_##NAME, \ |
| 475 |
MONITOR \ |
| 476 |
}; |
| 477 |
|
| 478 |
#define GAMEX(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \ |
| 479 |
extern const struct GameDriver driver_##PARENT; \ |
| 480 |
const struct GameDriver driver_##NAME = \ |
| 481 |
{ \ |
| 482 |
__FILE__, \ |
| 483 |
&driver_##PARENT, \ |
| 484 |
#NAME, \ |
| 485 |
FULLNAME, \ |
| 486 |
#YEAR, \ |
| 487 |
COMPANY, \ |
| 488 |
construct_##MACHINE, \ |
| 489 |
input_ports_##INPUT, \ |
| 490 |
init_##INIT, \ |
| 491 |
rom_##NAME, \ |
| 492 |
(MONITOR)|(FLAGS) \ |
| 493 |
}; |
| 494 |
|
| 495 |
#ifdef MAME32JP |
| 496 |
#define GAME_HACK(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME) \ |
| 497 |
extern const struct GameDriver driver_##PARENT; \ |
| 498 |
const struct GameDriver driver_##NAME = \ |
| 499 |
{ \ |
| 500 |
__FILE__, \ |
| 501 |
&driver_##PARENT, \ |
| 502 |
#NAME, \ |
| 503 |
FULLNAME, \ |
| 504 |
#YEAR, \ |
| 505 |
COMPANY, \ |
| 506 |
construct_##MACHINE, \ |
| 507 |
input_ports_##INPUT, \ |
| 508 |
init_##INIT, \ |
| 509 |
rom_##PARENT, \ |
| 510 |
MONITOR \ |
| 511 |
}; |
| 512 |
#define GAME_HACKX(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \ |
| 513 |
extern const struct GameDriver driver_##PARENT; \ |
| 514 |
const struct GameDriver driver_##NAME = \ |
| 515 |
{ \ |
| 516 |
__FILE__, \ |
| 517 |
&driver_##PARENT, \ |
| 518 |
#NAME, \ |
| 519 |
FULLNAME, \ |
| 520 |
#YEAR, \ |
| 521 |
COMPANY, \ |
| 522 |
construct_##MACHINE, \ |
| 523 |
input_ports_##INPUT, \ |
| 524 |
init_##INIT, \ |
| 525 |
rom_##PARENT, \ |
| 526 |
(MONITOR)|(FLAGS) \ |
| 527 |
}; |
| 528 |
|
| 529 |
#endif |
| 530 |
|
| 531 |
/* monitor parameters to be used with the GAME() macro */ |
| 532 |
#define ROT0 0 |
| 533 |
#define ROT90 (ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X) /* rotate clockwise 90 degrees */ |
| 534 |
#define ROT180 (ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y) /* rotate 180 degrees */ |
| 535 |
#define ROT270 (ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y) /* rotate counter-clockwise 90 degrees */ |
| 536 |
|
| 537 |
/* this allows to leave the INIT field empty in the GAME() macro call */ |
| 538 |
#define init_0 0 |
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
/*************************************************************************** |
| 543 |
|
| 544 |
Global variables |
| 545 |
|
| 546 |
***************************************************************************/ |
| 547 |
|
| 548 |
extern const struct GameDriver *drivers[]; |
| 549 |
|
| 550 |
#endif |