Previous 199869 Revisions Next

r40105 Saturday 1st August, 2015 at 10:46:21 UTC by Wilbert Pol
Some more tagmap lookup reduction work (nw)
[src/emu]emuopts.c emuopts.h ioport.c ioport.h

trunk/src/emu/emuopts.c
r248616r248617
202202
203203emu_options::emu_options()
204204: core_options()
205, m_coin_impulse(0)
206, m_sleep(true)
205207{
206208   add_entries(emu_options::s_option_entries);
207209}
r248616r248617
380382      result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
381383   } while (num != options_count());
382384
385   update_cached_options();
386
383387   return result;
384388}
385389
r248616r248617
393397{
394398   // parse as normal
395399   core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
396   return parse_slot_devices(argc, argv, error_string, NULL, NULL);
400   bool result = parse_slot_devices(argc, argv, error_string, NULL, NULL);
401   update_cached_options();
402   return result;
397403}
398404
399405
r248616r248617
468474
469475   // Re-evaluate slot options after loading ini files
470476   update_slot_options();
477
478   update_cached_options();
471479}
472480
473481
r248616r248617
570578      buffer.clear();
571579   return buffer.c_str();
572580}
581
582
583//-------------------------------------------------
584//  update_cached_options - to prevent tagmap
585//    lookups keep copies of frequently requested
586//    options in member variables.
587//-------------------------------------------------
588
589void emu_options::update_cached_options()
590{
591   m_coin_impulse = int_value(OPTION_COIN_IMPULSE);
592   m_sleep = bool_value(OPTION_SLEEP);
593
594}
595
trunk/src/emu/emuopts.h
r248616r248617
266266   int frameskip() const { return int_value(OPTION_FRAMESKIP); }
267267   int seconds_to_run() const { return int_value(OPTION_SECONDS_TO_RUN); }
268268   bool throttle() const { return bool_value(OPTION_THROTTLE); }
269   bool sleep() const { return bool_value(OPTION_SLEEP); }
269   bool sleep() const { return m_sleep; }
270270   float speed() const { return float_value(OPTION_SPEED); }
271271   bool refresh_speed() const { return bool_value(OPTION_REFRESHSPEED); }
272272
r248616r248617
328328   bool offscreen_reload() const { return bool_value(OPTION_OFFSCREEN_RELOAD); }
329329   bool natural_keyboard() const { return bool_value(OPTION_NATURAL_KEYBOARD); }
330330   bool joystick_contradictory() const { return bool_value(OPTION_JOYSTICK_CONTRADICTORY); }
331   int coin_impulse() const { return int_value(OPTION_COIN_IMPULSE); }
331   int coin_impulse() const { return m_coin_impulse; }
332332
333333   // core debugging options
334334   bool log() const { return bool_value(OPTION_LOG); }
r248616r248617
382382   // INI parsing helper
383383   bool parse_one_ini(const char *basename, int priority, std::string *error_string = NULL);
384384
385   // cache frequently used options in members
386   void update_cached_options();
387
385388   static const options_entry s_option_entries[];
389
390   // cached options
391   int m_coin_impulse;
392   bool m_sleep;
386393};
387394
388395
trunk/src/emu/ioport.c
r248616r248617
19171917
19181918   // coin impulse option
19191919   int effective_impulse = m_impulse;
1920   if (m_impulse_option_val != 0)
1920   int impulse_option_val = machine().options().coin_impulse();
1921   if (impulse_option_val != 0)
19211922   {
1922      if (m_impulse_option_val < 0)
1923      if (impulse_option_val < 0)
19231924         effective_impulse = 0;
19241925      else if ((m_type >= IPT_COIN1 && m_type <= IPT_COIN12) || m_impulse != 0)
1925         effective_impulse = m_impulse_option_val;
1926         effective_impulse = impulse_option_val;
19261927   }
19271928
19281929   // if this is a switch-down event, handle impulse and toggle
r248616r248617
21362137
21372138   for (ioport_setting *setting = first_setting(); setting != NULL; setting = setting->next())
21382139      setting->condition().initialize(setting->device());
2139
2140   m_impulse_option_val = machine().options().coin_impulse();
21412140}
21422141
21432142
trunk/src/emu/ioport.h
r248616r248617
11171117   void *                      m_read_param;       // parameter for read callback routine
11181118   ioport_field_write_delegate m_write;            // write callback routine
11191119   void *                      m_write_param;      // parameter for write callback routine
1120   int                         m_impulse_option_val; // impulse setting from options
11211120
11221121   // data relevant to digital control types
11231122   bool                        m_digital_value;    // externally set value


Previous 199869 Revisions Next


© 1997-2024 The MAME Team