Mercurial > repos > blastem
diff io.c @ 1787:0c6d07f91346 mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 14 Mar 2019 23:40:50 -0700 |
parents | eda8df5bc74c |
children | 1843823f1e9b |
line wrap: on
line diff
--- a/io.c Wed Mar 13 22:01:22 2019 -0700 +++ b/io.c Thu Mar 14 23:40:50 2019 -0700 @@ -219,8 +219,7 @@ } 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 @@ 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;