Mercurial > repos > blastem
comparison io.c @ 1077:1a66d5165ea7
Cleanup the separation of render backend and VDP code in preparation for having extra debug windows. Make determination of H40/H32 based on number of lines in each mode.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 22 Aug 2016 09:46:18 -0700 |
parents | 284d905ca582 |
children | 22e87b739ad6 |
comparison
equal
deleted
inserted
replaced
1076:fa6fe03f218a | 1077:1a66d5165ea7 |
---|---|
19 #include "blastem.h" | 19 #include "blastem.h" |
20 #include "render.h" | 20 #include "render.h" |
21 #include "util.h" | 21 #include "util.h" |
22 | 22 |
23 #define CYCLE_NEVER 0xFFFFFFFF | 23 #define CYCLE_NEVER 0xFFFFFFFF |
24 #define MIN_POLL_INTERVAL 6840 | |
24 | 25 |
25 const char * device_type_names[] = { | 26 const char * device_type_names[] = { |
26 "3-button gamepad", | 27 "3-button gamepad", |
27 "6-button gamepad", | 28 "6-button gamepad", |
28 "Mega Mouse", | 29 "Mega Mouse", |
1144 } | 1145 } |
1145 } | 1146 } |
1146 } | 1147 } |
1147 } | 1148 } |
1148 | 1149 |
1150 uint32_t last_poll_cycle; | |
1149 void io_adjust_cycles(io_port * port, uint32_t current_cycle, uint32_t deduction) | 1151 void io_adjust_cycles(io_port * port, uint32_t current_cycle, uint32_t deduction) |
1150 { | 1152 { |
1151 /*uint8_t control = pad->control | 0x80; | 1153 /*uint8_t control = pad->control | 0x80; |
1152 uint8_t th = control & pad->output; | 1154 uint8_t th = control & pad->output; |
1153 if (pad->input[GAMEPAD_TH0] || pad->input[GAMEPAD_TH1]) { | 1155 if (pad->input[GAMEPAD_TH0] || pad->input[GAMEPAD_TH1]) { |
1164 } else if (port->device_type == IO_MOUSE) { | 1166 } else if (port->device_type == IO_MOUSE) { |
1165 mouse_check_ready(port, current_cycle); | 1167 mouse_check_ready(port, current_cycle); |
1166 if (port->device.mouse.ready_cycle != CYCLE_NEVER) { | 1168 if (port->device.mouse.ready_cycle != CYCLE_NEVER) { |
1167 port->device.mouse.ready_cycle -= deduction; | 1169 port->device.mouse.ready_cycle -= deduction; |
1168 } | 1170 } |
1171 } | |
1172 if (last_poll_cycle >= deduction) { | |
1173 last_poll_cycle -= deduction; | |
1174 } else { | |
1175 last_poll_cycle = 0; | |
1169 } | 1176 } |
1170 } | 1177 } |
1171 | 1178 |
1172 #ifndef _WIN32 | 1179 #ifndef _WIN32 |
1173 static void wait_for_connection(io_port * port) | 1180 static void wait_for_connection(io_port * port) |
1343 { | 1350 { |
1344 uint8_t control = port->control | 0x80; | 1351 uint8_t control = port->control | 0x80; |
1345 uint8_t output = (control & port->output) | (~control & 0xFF); | 1352 uint8_t output = (control & port->output) | (~control & 0xFF); |
1346 uint8_t th = output & 0x40; | 1353 uint8_t th = output & 0x40; |
1347 uint8_t input; | 1354 uint8_t input; |
1355 if (current_cycle - last_poll_cycle > MIN_POLL_INTERVAL) { | |
1356 process_events(); | |
1357 last_poll_cycle = current_cycle; | |
1358 } | |
1348 switch (port->device_type) | 1359 switch (port->device_type) |
1349 { | 1360 { |
1350 case IO_GAMEPAD3: | 1361 case IO_GAMEPAD3: |
1351 { | 1362 { |
1352 input = port->input[th ? GAMEPAD_TH1 : GAMEPAD_TH0]; | 1363 input = port->input[th ? GAMEPAD_TH1 : GAMEPAD_TH0]; |