trunk/src/emu/emuopts.c
| r248616 | r248617 | |
| 202 | 202 | |
| 203 | 203 | emu_options::emu_options() |
| 204 | 204 | : core_options() |
| 205 | , m_coin_impulse(0) |
| 206 | , m_sleep(true) |
| 205 | 207 | { |
| 206 | 208 | add_entries(emu_options::s_option_entries); |
| 207 | 209 | } |
| r248616 | r248617 | |
| 380 | 382 | result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); |
| 381 | 383 | } while (num != options_count()); |
| 382 | 384 | |
| 385 | update_cached_options(); |
| 386 | |
| 383 | 387 | return result; |
| 384 | 388 | } |
| 385 | 389 | |
| r248616 | r248617 | |
| 393 | 397 | { |
| 394 | 398 | // parse as normal |
| 395 | 399 | 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; |
| 397 | 403 | } |
| 398 | 404 | |
| 399 | 405 | |
| r248616 | r248617 | |
| 468 | 474 | |
| 469 | 475 | // Re-evaluate slot options after loading ini files |
| 470 | 476 | update_slot_options(); |
| 477 | |
| 478 | update_cached_options(); |
| 471 | 479 | } |
| 472 | 480 | |
| 473 | 481 | |
| r248616 | r248617 | |
| 570 | 578 | buffer.clear(); |
| 571 | 579 | return buffer.c_str(); |
| 572 | 580 | } |
| 581 | |
| 582 | |
| 583 | //------------------------------------------------- |
| 584 | // update_cached_options - to prevent tagmap |
| 585 | // lookups keep copies of frequently requested |
| 586 | // options in member variables. |
| 587 | //------------------------------------------------- |
| 588 | |
| 589 | void 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
| r248616 | r248617 | |
| 266 | 266 | int frameskip() const { return int_value(OPTION_FRAMESKIP); } |
| 267 | 267 | int seconds_to_run() const { return int_value(OPTION_SECONDS_TO_RUN); } |
| 268 | 268 | bool throttle() const { return bool_value(OPTION_THROTTLE); } |
| 269 | | bool sleep() const { return bool_value(OPTION_SLEEP); } |
| 269 | bool sleep() const { return m_sleep; } |
| 270 | 270 | float speed() const { return float_value(OPTION_SPEED); } |
| 271 | 271 | bool refresh_speed() const { return bool_value(OPTION_REFRESHSPEED); } |
| 272 | 272 | |
| r248616 | r248617 | |
| 328 | 328 | bool offscreen_reload() const { return bool_value(OPTION_OFFSCREEN_RELOAD); } |
| 329 | 329 | bool natural_keyboard() const { return bool_value(OPTION_NATURAL_KEYBOARD); } |
| 330 | 330 | 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; } |
| 332 | 332 | |
| 333 | 333 | // core debugging options |
| 334 | 334 | bool log() const { return bool_value(OPTION_LOG); } |
| r248616 | r248617 | |
| 382 | 382 | // INI parsing helper |
| 383 | 383 | bool parse_one_ini(const char *basename, int priority, std::string *error_string = NULL); |
| 384 | 384 | |
| 385 | // cache frequently used options in members |
| 386 | void update_cached_options(); |
| 387 | |
| 385 | 388 | static const options_entry s_option_entries[]; |
| 389 | |
| 390 | // cached options |
| 391 | int m_coin_impulse; |
| 392 | bool m_sleep; |
| 386 | 393 | }; |
| 387 | 394 | |
| 388 | 395 | |
trunk/src/emu/ioport.c
| r248616 | r248617 | |
| 1917 | 1917 | |
| 1918 | 1918 | // coin impulse option |
| 1919 | 1919 | 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) |
| 1921 | 1922 | { |
| 1922 | | if (m_impulse_option_val < 0) |
| 1923 | if (impulse_option_val < 0) |
| 1923 | 1924 | effective_impulse = 0; |
| 1924 | 1925 | 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; |
| 1926 | 1927 | } |
| 1927 | 1928 | |
| 1928 | 1929 | // if this is a switch-down event, handle impulse and toggle |
| r248616 | r248617 | |
| 2136 | 2137 | |
| 2137 | 2138 | for (ioport_setting *setting = first_setting(); setting != NULL; setting = setting->next()) |
| 2138 | 2139 | setting->condition().initialize(setting->device()); |
| 2139 | | |
| 2140 | | m_impulse_option_val = machine().options().coin_impulse(); |
| 2141 | 2140 | } |
| 2142 | 2141 | |
| 2143 | 2142 | |