comparison io.h @ 1648:b7ecd0d6a77b mame_interp

Merge from default
author Michael Pavone <pavone@retrodev.com>
date Tue, 25 Dec 2018 11:12:26 -0800
parents c206a422d466
children d6c403135e64
comparison
equal deleted inserted replaced
1509:36732f5c2281 1648:b7ecd0d6a77b
68 uint8_t device_type; 68 uint8_t device_type;
69 } io_port; 69 } io_port;
70 70
71 typedef struct { 71 typedef struct {
72 io_port ports[3]; 72 io_port ports[3];
73 uint8_t mouse_mode;
74 uint8_t mouse_captured;
75 uint8_t keyboard_captured;
76 } sega_io; 73 } sega_io;
77 74
78 #define GAMEPAD_TH0 0 75 //pseudo gamepad for buttons on main console unit
79 #define GAMEPAD_TH1 1 76 #define GAMEPAD_MAIN_UNIT 255
80 #define GAMEPAD_EXTRA 2
81 #define GAMEPAD_NONE 0xF
82
83 #define IO_TH0 0
84 #define IO_TH1 1
85 #define IO_STATE 2
86 77
87 enum { 78 enum {
88 IO_WRITE_PENDING, 79 BUTTON_INVALID,
89 IO_WRITTEN, 80 DPAD_UP,
90 IO_READ_PENDING, 81 DPAD_DOWN,
91 IO_READ 82 DPAD_LEFT,
83 DPAD_RIGHT,
84 BUTTON_A,
85 BUTTON_B,
86 BUTTON_C,
87 BUTTON_START,
88 BUTTON_X,
89 BUTTON_Y,
90 BUTTON_Z,
91 BUTTON_MODE,
92 NUM_GAMEPAD_BUTTONS
92 }; 93 };
93 94
94 typedef struct genesis_context genesis_context; 95 enum {
96 MAIN_UNIT_PAUSE
97 };
95 98
96 void set_keybindings(sega_io *io); 99 enum {
97 void map_all_bindings(sega_io *io); 100 MOUSE_LEFT = 1,
101 MOUSE_RIGHT = 2,
102 MOUSE_MIDDLE = 4,
103 MOUSE_START = 8,
104 PSEUDO_BUTTON_MOTION=0xFF
105 };
106
98 void setup_io_devices(tern_node * config, rom_info *rom, sega_io *io); 107 void setup_io_devices(tern_node * config, rom_info *rom, sega_io *io);
99 void io_adjust_cycles(io_port * pad, uint32_t current_cycle, uint32_t deduction); 108 void io_adjust_cycles(io_port * pad, uint32_t current_cycle, uint32_t deduction);
100 void io_control_write(io_port *port, uint8_t value, uint32_t current_cycle); 109 void io_control_write(io_port *port, uint8_t value, uint32_t current_cycle);
101 void io_data_write(io_port * pad, uint8_t value, uint32_t current_cycle); 110 void io_data_write(io_port * pad, uint8_t value, uint32_t current_cycle);
102 uint8_t io_data_read(io_port * pad, uint32_t current_cycle); 111 uint8_t io_data_read(io_port * pad, uint32_t current_cycle);
103 void handle_keydown(int keycode, uint8_t scancode);
104 void handle_keyup(int keycode, uint8_t scancode);
105 void handle_joydown(int joystick, int button);
106 void handle_joyup(int joystick, int button);
107 void handle_joy_dpad(int joystick, int dpad, uint8_t state);
108 void handle_joy_axis(int joystick, int axis, int16_t value);
109 void handle_joy_added(int joystick);
110 void handle_mouse_moved(int mouse, uint16_t x, uint16_t y, int16_t deltax, int16_t deltay);
111 void handle_mousedown(int mouse, int button);
112 void handle_mouseup(int mouse, int button);
113 void io_serialize(io_port *port, serialize_buffer *buf); 112 void io_serialize(io_port *port, serialize_buffer *buf);
114 void io_deserialize(deserialize_buffer *buf, void *vport); 113 void io_deserialize(deserialize_buffer *buf, void *vport);
115 114
115 void io_port_gamepad_down(io_port *port, uint8_t button);
116 void io_port_gamepad_up(io_port *port, uint8_t button);
117 void io_gamepad_down(sega_io *io, uint8_t gamepad_num, uint8_t button);
118 void io_gamepad_up(sega_io *io, uint8_t gamepad_num, uint8_t button);
119 void io_mouse_down(sega_io *io, uint8_t mouse_num, uint8_t button);
120 void io_mouse_up(sega_io *io, uint8_t mouse_num, uint8_t button);
121 void io_mouse_motion_absolute(sega_io *io, uint8_t mouse_num, uint16_t x, uint16_t y);
122 void io_mouse_motion_relative(sega_io *io, uint8_t mouse_num, int32_t x, int32_t y);
123 void io_keyboard_down(sega_io *io, uint8_t scancode);
124 void io_keyboard_up(sega_io *io, uint8_t scancode);
125 uint8_t io_has_keyboard(sega_io *io);
126
127 extern const char * device_type_names[];
128
116 #endif //IO_H_ 129 #endif //IO_H_
117 130