Previous 15994 Revisions Next

r1046 Friday 28th September, 2007 at 04:41:35 UTC by Nathan Woods
Changed added_device_options to be an internal option rather than a static var
[src/mess]messopts.c

src/mess/messopts.c
r1045r1046
1313#include "messopts.h"
1414#include "osdmess.h"
1515
16#define OPTION_ADDED_DEVICE_OPTIONS   "added_device_options"
1617
1718
1819/***************************************************************************
1920    LOCAL VARIABLES
2021***************************************************************************/
2122
22static int added_device_options;
23
2423const options_entry mess_core_options[] =
2524{
26   { NULL,                     NULL,   OPTION_HEADER,      "MESS SPECIFIC OPTIONS" },
27    { "ramsize;ram",            NULL,   0,               "size of RAM (if supported by driver)" },
28   { "writeconfig;wc",            "0",   OPTION_BOOLEAN,      "writes configuration to (driver).ini on exit" },
29   { OPTION_SKIP_WARNINGS,         "0",    OPTION_BOOLEAN,      "skip displaying the warnings screen" },
25   { NULL,                     NULL,   OPTION_HEADER,                  "MESS SPECIFIC OPTIONS" },
26    { "ramsize;ram",            NULL,   0,                           "size of RAM (if supported by driver)" },
27   { "writeconfig;wc",            "0",   OPTION_BOOLEAN,                  "writes configuration to (driver).ini on exit" },
28   { OPTION_SKIP_WARNINGS,         "0",    OPTION_BOOLEAN,                  "skip displaying the warnings screen" },
29   { OPTION_ADDED_DEVICE_OPTIONS,   "0",   OPTION_BOOLEAN | OPTION_INTERNAL,   "device-specific options have been added" },
3030   { NULL }
3131};
3232
r1045r1046
4646   const char *result = NULL;
4747   const char *dev_name;
4848
49   if (added_device_options)
49   if (options_get_bool(mame_options(), OPTION_ADDED_DEVICE_OPTIONS))
5050   {
5151      /* identify the option name */
5252      dev_name = device_instancename(devclass, device_index);
r1045r1046
146146
147147void mess_add_device_options(core_options *opts, const game_driver *driver)
148148{
149   /* enumerate our callback for every device */
149150   mess_enumerate_devices(opts, driver, add_device_options_for_device);
151
152   /* record that we've added device options */
153   options_set_bool(opts, OPTION_ADDED_DEVICE_OPTIONS, TRUE, OPTION_PRIORITY_CMDLINE);
150154}
151155
152156
r1045r1046
162166   const game_driver *driver;
163167
164168   /* only add these options if we have not yet added them */
165   if (!added_device_options)
169   if (!options_get_bool(opts, OPTION_ADDED_DEVICE_OPTIONS))
166170   {
167171      driver = driver_get_name(arg);
168172      if (driver != NULL)
169173      {
170174         mess_add_device_options(opts, driver);
171175      }
172      added_device_options = TRUE;
173176   }
174177}
175178
r1045r1046
188191   /* add OSD-MESS specific options (hack!) */
189192   osd_mess_options_init(opts);
190193
191   /* hacky global variable to track whether we have added device options */
192   added_device_options = FALSE;
193
194194   /* we need to dynamically add options when the device name is parsed */
195195   options_set_option_callback(opts, OPTION_GAMENAME, mess_driver_name_callback);
196196}
r1045r1046
211211   const char *dev_name;
212212   const char *filename;
213213
214   assert_always(added_device_options, "extract_device_options_for_device() called without device options");
214   assert_always(options_get_bool(opts, OPTION_ADDED_DEVICE_OPTIONS), "extract_device_options_for_device() called without device options");
215215
216216   /* identify the correct image */
217217   dev_tag = device_get_info_string(devclass, DEVINFO_STR_DEV_TAG);
r1045r1046
278278void mess_options_extract(void)
279279{
280280   /* only extract the device options if we've added them */
281   if (added_device_options)
281   if (options_get_bool(mame_options(), OPTION_ADDED_DEVICE_OPTIONS))
282282      mess_enumerate_devices(mame_options(), Machine->gamedrv, extract_device_options_for_device);
283283
284284   /* write the config, if appropriate */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team