diff options
Diffstat (limited to 'src/emu/mconfig.h')
-rw-r--r-- | src/emu/mconfig.h | 149 |
1 files changed, 87 insertions, 62 deletions
diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index 7d57dd14ae4..5fb37662f35 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -4,8 +4,36 @@ Machine configuration macros and functions. - Copyright Nicola Salmoria and the MAME Team. - Visit http://mamedev.org for licensing and usage restrictions. +**************************************************************************** + + Copyright Aaron Giles + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name 'MAME' nor the names of its contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ @@ -64,7 +92,7 @@ #define VIDEO_UPDATE_CALL(name) VIDEO_UPDATE_NAME(name)(screen, bitmap, cliprect) -/* NULL versions */ +// NULL versions #define nvram_handler_0 NULL #define memcard_handler_0 NULL #define machine_start_0 NULL @@ -97,12 +125,12 @@ typedef void * (*driver_data_alloc_func)(running_machine &machine); CONSTANTS ***************************************************************************/ -/* by convention, tags should all lowercase and between 2-15 characters */ +// by convention, tags should all lowercase and between 2-15 characters #define MIN_TAG_LENGTH 2 #define MAX_TAG_LENGTH 15 -/* token types */ +// token types enum { MCONFIG_TOKEN_INVALID, @@ -176,28 +204,28 @@ enum }; -/* ----- flags for video_attributes ----- */ +// ----- flags for video_attributes ----- -/* should VIDEO_UPDATE by called at the start of VBLANK or at the end? */ +// should VIDEO_UPDATE by called at the start of VBLANK or at the end? #define VIDEO_UPDATE_BEFORE_VBLANK 0x0000 #define VIDEO_UPDATE_AFTER_VBLANK 0x0004 -/* indicates VIDEO_UPDATE will add container bits its */ +// indicates VIDEO_UPDATE will add container bits its #define VIDEO_SELF_RENDER 0x0008 -/* automatically extend the palette creating a darker copy for shadows */ +// automatically extend the palette creating a darker copy for shadows #define VIDEO_HAS_SHADOWS 0x0010 -/* automatically extend the palette creating a brighter copy for highlights */ +// automatically extend the palette creating a brighter copy for highlights #define VIDEO_HAS_HIGHLIGHTS 0x0020 -/* Mish 181099: See comments in video/generic.c for details */ +// Mish 181099: See comments in video/generic.c for details #define VIDEO_BUFFERS_SPRITERAM 0x0040 -/* force VIDEO_UPDATE to be called even for skipped frames */ +// force VIDEO_UPDATE to be called even for skipped frames #define VIDEO_ALWAYS_UPDATE 0x0080 -/* calls VIDEO_UPDATE for every visible scanline, even for skipped frames */ +// calls VIDEO_UPDATE for every visible scanline, even for skipped frames #define VIDEO_UPDATE_SCANLINE 0x0100 @@ -212,35 +240,47 @@ struct gfx_decode_entry; class machine_config { + DISABLE_COPYING(machine_config); + + friend class running_machine; + public: - driver_data_alloc_func driver_data_alloc; /* allocator for driver data */ + machine_config(const machine_config_token *tokens); + ~machine_config(); + + void detokenize(const machine_config_token *tokens, const device_config *owner = NULL); + + driver_data_alloc_func m_driver_data_alloc; // allocator for driver data + + attotime m_minimum_quantum; // minimum scheduling quantum + const char * m_perfect_cpu_quantum; // tag of CPU to use for "perfect" scheduling + INT32 m_watchdog_vblank_count; // number of VBLANKs until the watchdog kills us + attotime m_watchdog_time; // length of time until the watchdog kills us - attotime minimum_quantum; /* minimum scheduling quantum */ - const char * perfect_cpu_quantum; /* tag of CPU to use for "perfect" scheduling */ - INT32 watchdog_vblank_count; /* number of VBLANKs until the watchdog kills us */ - attotime watchdog_time; /* length of time until the watchdog kills us */ + machine_start_func m_machine_start; // one-time machine start callback + machine_reset_func m_machine_reset; // machine reset callback - machine_start_func machine_start; /* one-time machine start callback */ - machine_reset_func machine_reset; /* machine reset callback */ + nvram_handler_func m_nvram_handler; // NVRAM save/load callback + memcard_handler_func m_memcard_handler; // memory card save/load callback - nvram_handler_func nvram_handler; /* NVRAM save/load callback */ - memcard_handler_func memcard_handler; /* memory card save/load callback */ + UINT32 m_video_attributes; // flags describing the video system + const gfx_decode_entry *m_gfxdecodeinfo; // pointer to array of graphics decoding information + UINT32 m_total_colors; // total number of colors in the palette + const char * m_default_layout; // default layout for this machine - UINT32 video_attributes; /* flags describing the video system */ - const gfx_decode_entry *gfxdecodeinfo; /* pointer to array of graphics decoding information */ - UINT32 total_colors; /* total number of colors in the palette */ - const char * default_layout; /* default layout for this machine */ + palette_init_func m_init_palette; // one-time palette init callback + video_start_func m_video_start; // one-time video start callback + video_reset_func m_video_reset; // video reset callback + video_eof_func m_video_eof; // end-of-frame video callback + video_update_func m_video_update; // video update callback - palette_init_func init_palette; /* one-time palette init callback */ - video_start_func video_start; /* one-time video start callback */ - video_reset_func video_reset; /* video reset callback */ - video_eof_func video_eof; /* end-of-frame video callback */ - video_update_func video_update; /* video update callback */ + sound_start_func m_sound_start; // one-time sound start callback + sound_reset_func m_sound_reset; // sound reset callback - sound_start_func sound_start; /* one-time sound start callback */ - sound_reset_func sound_reset; /* sound reset callback */ + device_config_list m_devicelist; // list of device configs - device_config_list devicelist; /* list of device configs */ +private: + int m_parse_level; // nested parsing level }; @@ -249,7 +289,7 @@ public: MACROS FOR BUILDING MACHINE DRIVERS ***************************************************************************/ -/* this type is used to encode machine configuration definitions */ +// this type is used to encode machine configuration definitions union machine_config_token { TOKEN_COMMON_FIELDS @@ -274,7 +314,7 @@ union machine_config_token }; -/* helper macro for returning the size of a field within a struct; similar to offsetof() */ +// helper macro for returning the size of a field within a struct; similar to offsetof() #define structsizeof(_struct, _field) sizeof(((_struct *)NULL)->_field) #define DEVCONFIG_OFFSETOF(_class, _member) \ @@ -284,7 +324,7 @@ union machine_config_token sizeof(reinterpret_cast<_class *>(NULL)->_member) -/* start/end tags for the machine driver */ +// start/end tags for the machine driver #define MACHINE_DRIVER_NAME(_name) \ machine_config_##_name @@ -294,21 +334,21 @@ union machine_config_token #define MACHINE_DRIVER_END \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_END, 8) }; -/* use this to declare external references to a machine driver */ +// use this to declare external references to a machine driver #define MACHINE_DRIVER_EXTERN(_name) \ extern const machine_config_token MACHINE_DRIVER_NAME(_name)[] -/* importing data from other machine drivers */ +// importing data from other machine drivers #define MDRV_IMPORT_FROM(_name) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_INCLUDE, 8), \ TOKEN_PTR(tokenptr, MACHINE_DRIVER_NAME(_name)), -/* core parameters */ +// core parameters #define MDRV_DRIVER_DATA(_class) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DRIVER_DATA, 8), \ - TOKEN_PTR(driver_data_alloc, _class::alloc), + TOKEN_PTR(m_driver_data_alloc, _class::alloc), #define MDRV_QUANTUM_TIME(_time) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_QUANTUM_TIME, 8), \ @@ -326,7 +366,7 @@ union machine_config_token TOKEN_UINT64(UINT64_ATTOTIME_IN_##_time), -/* core functions */ +// core functions #define MDRV_MACHINE_START(_func) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_START, 8), \ TOKEN_PTR(machine_start, MACHINE_START_NAME(_func)), @@ -344,7 +384,7 @@ union machine_config_token TOKEN_PTR(memcard_handler, MEMCARD_HANDLER_NAME(_func)), -/* core video parameters */ +// core video parameters #define MDRV_VIDEO_ATTRIBUTES(_flags) \ TOKEN_UINT32_PACK2(MCONFIG_TOKEN_VIDEO_ATTRIBUTES, 8, _flags, 24), @@ -360,7 +400,7 @@ union machine_config_token TOKEN_STRING(&(_layout)[0]), -/* core video functions */ +// core video functions #define MDRV_PALETTE_INIT(_func) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_PALETTE_INIT, 8), \ TOKEN_PTR(palette_init, PALETTE_INIT_NAME(_func)), @@ -382,17 +422,17 @@ union machine_config_token TOKEN_PTR(video_update, VIDEO_UPDATE_NAME(_func)), -/* core sound functions */ +// core sound functions #define MDRV_SOUND_START(_func) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_START, 8), \ TOKEN_PTR(sound_start, SOUND_START_NAME(_func)), #define MDRV_SOUND_RESET(_func) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_RESET, 8), \ - TOKEN_PTR(sound_start, SOUND_RESET_NAME(_func)), + TOKEN_PTR(sound_reset, SOUND_RESET_NAME(_func)), -/* add/remove devices */ +// add/remove devices #define MDRV_DEVICE_ADD(_tag, _type, _clock) \ TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_ADD, 8, _clock, 32), \ TOKEN_PTR(devtype, _type), \ @@ -412,19 +452,4 @@ union machine_config_token TOKEN_STRING(_tag), - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - - -/* ----- machine configurations ----- */ - -/* allocate a new machine configuration and populate it using the supplied constructor */ -machine_config *machine_config_alloc(const machine_config_token *tokens); - -/* release memory allocated for a machine configuration */ -void machine_config_free(machine_config *config); - - #endif /* __MCONFIG_H__ */ |