diff options
author | Michael Pavone <pavone@retrodev.com> | 2019-03-11 00:04:48 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2019-03-11 00:04:48 -0700 |
commit | e2281e5a19682d44435b1015c4ce4a64b7e3b586 (patch) | |
tree | f2292fce0eb4690470f73c583047719c691be96f /io.c | |
parent | 3d12dcb00997921347170b7f87b54f787a80c678 (diff) |
Minor cleanup
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -219,8 +219,7 @@ void process_device(char * device_type, io_port * port) } const int gamepad_len = strlen("gamepad"); - const int mouse_len = strlen("mouse"); - if (!strncmp(device_type, "gamepad", gamepad_len)) + if (startswith(device_type, "gamepad")) { if ( (device_type[gamepad_len] != '3' && device_type[gamepad_len] != '6' && device_type[gamepad_len] != '2') @@ -236,10 +235,10 @@ void process_device(char * device_type, io_port * port) port->device_type = IO_GAMEPAD6; } port->device.pad.gamepad_num = device_type[gamepad_len+2] - '0'; - } else if(!strncmp(device_type, "mouse", mouse_len)) { + } else if(startswith(device_type, "mouse")) { if (port->device_type != IO_MOUSE) { port->device_type = IO_MOUSE; - port->device.mouse.mouse_num = device_type[mouse_len+1] - '0'; + port->device.mouse.mouse_num = device_type[strlen("mouse")+1] - '0'; port->device.mouse.last_read_x = 0; port->device.mouse.last_read_y = 0; port->device.mouse.cur_x = 0; |