src/emu/ioport.c
| r15132 | r15133 | |
| 992 | 992 | m_timer(NULL), |
| 993 | 993 | m_current_rate(attotime::zero) |
| 994 | 994 | { |
| 995 | m_queue_chars = ioport_queue_chars_delegate(); |
| 996 | m_accept_char = ioport_accept_char_delegate(); |
| 997 | m_charqueue_empty = ioport_charqueue_empty_delegate(); |
| 998 | |
| 995 | 999 | // reigster debugger commands |
| 996 | 1000 | if (machine.debug_flags & DEBUG_FLAG_ENABLED) |
| 997 | 1001 | { |
| r15132 | r15133 | |
| 1423 | 1427 | |
| 1424 | 1428 | const natural_keyboard::keycode_map_entry *natural_keyboard::find_code(unicode_char ch) const |
| 1425 | 1429 | { |
| 1426 | | for (int code = 0; m_keycode_map[code].ch != 0; code++) |
| 1427 | | if (m_keycode_map[code].ch == ch) |
| 1428 | | return &m_keycode_map[code]; |
| 1430 | for (int index = 0; index < m_keycode_map.count(); index++) |
| 1431 | { |
| 1432 | if (m_keycode_map[index].ch == ch) |
| 1433 | return &m_keycode_map[index]; |
| 1434 | } |
| 1429 | 1435 | return NULL; |
| 1430 | 1436 | } |
| 1431 | 1437 | |
| r15132 | r15133 | |
| 2599 | 2605 | ioport_manager::ioport_manager(running_machine &machine) |
| 2600 | 2606 | : m_machine(machine), |
| 2601 | 2607 | m_safe_to_read(false), |
| 2602 | | m_natkeyboard(machine), |
| 2608 | m_natkeyboard(NULL), |
| 2603 | 2609 | m_last_frame_time(attotime::zero), |
| 2604 | 2610 | m_last_delta_nsec(0), |
| 2605 | 2611 | m_record_file(machine.options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS), |
| r15132 | r15133 | |
| 2660 | 2666 | break; |
| 2661 | 2667 | } |
| 2662 | 2668 | |
| 2669 | m_natkeyboard = global_alloc(natural_keyboard(machine())); |
| 2663 | 2670 | // register callbacks for when we load configurations |
| 2664 | 2671 | config_register(machine(), "input", config_saveload_delegate(FUNC(ioport_manager::load_config), this), config_saveload_delegate(FUNC(ioport_manager::save_config), this)); |
| 2665 | 2672 | |
| r15132 | r15133 | |
| 2757 | 2764 | |
| 2758 | 2765 | void ioport_manager::exit() |
| 2759 | 2766 | { |
| 2767 | global_free(m_natkeyboard); |
| 2760 | 2768 | // close any playback or recording files |
| 2761 | 2769 | playback_end(); |
| 2762 | 2770 | record_end(); |
src/emu/ioport.h
| r15132 | r15133 | |
| 836 | 836 | running_machine &machine() const { return m_machine; } |
| 837 | 837 | bool empty() const { return (m_bufbegin == m_bufend); } |
| 838 | 838 | bool full() const { return ((m_bufend + 1) % m_buffer.count()) == m_bufbegin; } |
| 839 | | bool can_post() const { return (!m_queue_chars.isnull() || m_keycode_map.count() == 0); } |
| 839 | bool can_post() const { return (!m_queue_chars.isnull() || m_keycode_map.count() != 0); } |
| 840 | 840 | bool is_posting() const { return (!empty() || (!m_charqueue_empty.isnull() && !m_charqueue_empty())); } |
| 841 | 841 | |
| 842 | 842 | // configuration |
| r15132 | r15133 | |
| 1239 | 1239 | running_machine &machine() const { return m_machine; } |
| 1240 | 1240 | ioport_port *first_port() const { return m_portlist.first(); } |
| 1241 | 1241 | bool safe_to_read() const { return m_safe_to_read; } |
| 1242 | | natural_keyboard &natkeyboard() { return m_natkeyboard; } |
| 1242 | natural_keyboard &natkeyboard() { return *m_natkeyboard; } |
| 1243 | 1243 | |
| 1244 | 1244 | // type helpers |
| 1245 | 1245 | input_type_entry *first_type() const { return m_typelist.first(); } |
| r15132 | r15133 | |
| 1308 | 1308 | |
| 1309 | 1309 | // specific special global input states |
| 1310 | 1310 | simple_list<digital_joystick> m_joystick_list; // list of digital joysticks |
| 1311 | | natural_keyboard m_natkeyboard; // natural keyboard support |
| 1311 | natural_keyboard *m_natkeyboard; // natural keyboard support |
| 1312 | 1312 | |
| 1313 | 1313 | // frame time tracking |
| 1314 | 1314 | attotime m_last_frame_time; // time of the last frame callback |