comparison io.c @ 1610:c206a422d466

Added J-Cart support
author Michael Pavone <pavone@retrodev.com>
date Tue, 14 Aug 2018 00:07:21 -0700
parents 360d5bab199f
children d6c403135e64
comparison
equal deleted inserted replaced
1609:9c8f58740450 1610:c206a422d466
112 } 112 }
113 } 113 }
114 return NULL; 114 return NULL;
115 } 115 }
116 116
117 void io_port_gamepad_down(io_port *port, uint8_t button)
118 {
119 gp_button_def *def = button_defs + button;
120 port->input[def->states[0]] |= def->value;
121 if (def->states[1] != GAMEPAD_NONE) {
122 port->input[def->states[1]] |= def->value;
123 }
124 }
125
126 void io_port_gamepad_up(io_port *port, uint8_t button)
127 {
128 gp_button_def *def = button_defs + button;
129 port->input[def->states[0]] &= ~def->value;
130 if (def->states[1] != GAMEPAD_NONE) {
131 port->input[def->states[1]] &= ~def->value;
132 }
133 }
134
117 void io_gamepad_down(sega_io *io, uint8_t gamepad_num, uint8_t button) 135 void io_gamepad_down(sega_io *io, uint8_t gamepad_num, uint8_t button)
118 { 136 {
119 io_port *port = find_gamepad(io, gamepad_num); 137 io_port *port = find_gamepad(io, gamepad_num);
120 if (port) { 138 if (port) {
121 gp_button_def *def = button_defs + button; 139 io_port_gamepad_down(port, button);
122 port->input[def->states[0]] |= def->value;
123 if (def->states[1] != GAMEPAD_NONE) {
124 port->input[def->states[1]] |= def->value;
125 }
126 } 140 }
127 } 141 }
128 142
129 void io_gamepad_up(sega_io *io, uint8_t gamepad_num, uint8_t button) 143 void io_gamepad_up(sega_io *io, uint8_t gamepad_num, uint8_t button)
130 { 144 {
131 io_port *port = find_gamepad(io, gamepad_num); 145 io_port *port = find_gamepad(io, gamepad_num);
132 if (port) { 146 if (port) {
133 gp_button_def *def = button_defs + button; 147 io_port_gamepad_up(port, button);
134 port->input[def->states[0]] &= ~def->value;
135 if (def->states[1] != GAMEPAD_NONE) {
136 port->input[def->states[1]] &= ~def->value;
137 }
138 } 148 }
139 } 149 }
140 150
141 void io_mouse_down(sega_io *io, uint8_t mouse_num, uint8_t button) 151 void io_mouse_down(sega_io *io, uint8_t mouse_num, uint8_t button)
142 { 152 {