src/emu/ioport.c
| r15133 | r15134 | |
| 1002 | 1002 | debug_console_register_command(machine, "input", CMDFLAG_NONE, 0, 1, 1, execute_input); |
| 1003 | 1003 | debug_console_register_command(machine, "dumpkbd", CMDFLAG_NONE, 0, 0, 1, execute_dumpkbd); |
| 1004 | 1004 | } |
| 1005 | } |
| 1005 | 1006 | |
| 1007 | //------------------------------------------------- |
| 1008 | // initialize - initialize natural keyboard |
| 1009 | // support |
| 1010 | //------------------------------------------------- |
| 1011 | |
| 1012 | void natural_keyboard::initialize() |
| 1013 | { |
| 1006 | 1014 | // posting keys directly only makes sense for a computer |
| 1007 | | if (machine.ioport().has_keyboard()) |
| 1015 | if (machine().ioport().has_keyboard()) |
| 1008 | 1016 | { |
| 1009 | 1017 | m_buffer.resize(KEY_BUFFER_SIZE); |
| 1010 | | m_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(natural_keyboard::timer), this)); |
| 1011 | | build_codes(machine.ioport()); |
| 1018 | m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(natural_keyboard::timer), this)); |
| 1019 | build_codes(machine().ioport()); |
| 1012 | 1020 | } |
| 1013 | 1021 | } |
| 1014 | | |
| 1015 | | |
| 1016 | 1022 | //------------------------------------------------- |
| 1017 | 1023 | // configure - configure callbacks for full- |
| 1018 | 1024 | // featured keyboard support |
| r15133 | r15134 | |
| 2605 | 2611 | ioport_manager::ioport_manager(running_machine &machine) |
| 2606 | 2612 | : m_machine(machine), |
| 2607 | 2613 | m_safe_to_read(false), |
| 2608 | | m_natkeyboard(NULL), |
| 2614 | m_natkeyboard(machine), |
| 2609 | 2615 | m_last_frame_time(attotime::zero), |
| 2610 | 2616 | m_last_delta_nsec(0), |
| 2611 | 2617 | m_record_file(machine.options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS), |
| r15133 | r15134 | |
| 2666 | 2672 | break; |
| 2667 | 2673 | } |
| 2668 | 2674 | |
| 2669 | | m_natkeyboard = global_alloc(natural_keyboard(machine())); |
| 2675 | m_natkeyboard.initialize(); |
| 2670 | 2676 | // register callbacks for when we load configurations |
| 2671 | 2677 | config_register(machine(), "input", config_saveload_delegate(FUNC(ioport_manager::load_config), this), config_saveload_delegate(FUNC(ioport_manager::save_config), this)); |
| 2672 | 2678 | |
| r15133 | r15134 | |
| 2764 | 2770 | |
| 2765 | 2771 | void ioport_manager::exit() |
| 2766 | 2772 | { |
| 2767 | | global_free(m_natkeyboard); |
| 2768 | 2773 | // close any playback or recording files |
| 2769 | 2774 | playback_end(); |
| 2770 | 2775 | record_end(); |
src/emu/ioport.h
| r15133 | r15134 | |
| 832 | 832 | // construction/destruction |
| 833 | 833 | natural_keyboard(running_machine &machine); |
| 834 | 834 | |
| 835 | void initialize(); |
| 836 | |
| 835 | 837 | // getters and queries |
| 836 | 838 | running_machine &machine() const { return m_machine; } |
| 837 | 839 | bool empty() const { return (m_bufbegin == m_bufend); } |
| r15133 | r15134 | |
| 1239 | 1241 | running_machine &machine() const { return m_machine; } |
| 1240 | 1242 | ioport_port *first_port() const { return m_portlist.first(); } |
| 1241 | 1243 | bool safe_to_read() const { return m_safe_to_read; } |
| 1242 | | natural_keyboard &natkeyboard() { return *m_natkeyboard; } |
| 1244 | natural_keyboard &natkeyboard() { return m_natkeyboard; } |
| 1243 | 1245 | |
| 1244 | 1246 | // type helpers |
| 1245 | 1247 | input_type_entry *first_type() const { return m_typelist.first(); } |
| r15133 | r15134 | |
| 1308 | 1310 | |
| 1309 | 1311 | // specific special global input states |
| 1310 | 1312 | simple_list<digital_joystick> m_joystick_list; // list of digital joysticks |
| 1311 | | natural_keyboard *m_natkeyboard; // natural keyboard support |
| 1313 | natural_keyboard m_natkeyboard; // natural keyboard support |
| 1312 | 1314 | |
| 1313 | 1315 | // frame time tracking |
| 1314 | 1316 | attotime m_last_frame_time; // time of the last frame callback |