# HG changeset patch # User Michael Pavone # Date 1462143463 25200 # Node ID 580a806aef6a5cae91545d057f3e471779cfcb5f # Parent fc000f245cc8b09f750ef9156845bdbcb40d8dec Allow overriding speed 0. May be useful for people that want to use vsync diff -r fc000f245cc8 -r 580a806aef6a default.cfg --- a/default.cfg Sun May 01 14:59:40 2016 -0700 +++ b/default.cfg Sun May 01 15:57:43 2016 -0700 @@ -122,6 +122,7 @@ m68k_divider 7 max_cycles 3420 speeds { + 0 100 1 150 2 200 3 300 diff -r fc000f245cc8 -r 580a806aef6a io.c --- a/io.c Sun May 01 14:59:40 2016 -0700 +++ b/io.c Sun May 01 15:57:43 2016 -0700 @@ -602,13 +602,10 @@ if (cur->el) { process_speeds(cur->straight.next, curstr); } else { - int speed_index = atoi(curstr); - if (speed_index < 1) { - if (!strcmp(curstr, "0")) { - warning("Speed index 0 cannot be set to a custom value\n"); - } else { - warning("%s is not a valid speed index", curstr); - } + char *end; + long speed_index = strtol(curstr, &end, 10); + if (speed_index < 0 || end == curstr || *end) { + warning("%s is not a valid speed index", curstr); } else { if (speed_index >= num_speeds) { speeds = realloc(speeds, sizeof(uint32_t) * (speed_index+1)); @@ -617,6 +614,10 @@ } } speeds[speed_index] = atoi(cur->straight.value.ptrval); + if (speeds[speed_index] < 1) { + warning("%s is not a valid speed percentage, setting speed %d to 100", cur->straight.value.ptrval, speed_index); + speeds[speed_index] = 100; + } } } process_speeds(cur->left, prefix); @@ -1059,6 +1060,10 @@ } map_bindings(ports, mice[mouse].buttons, MAX_MOUSE_BUTTONS); } + //not really related to the intention of this function, but the best place to do this currently + if (speeds[0] != 100) { + set_speed_percent(genesis, speeds[0]); + } } #define TH 0x40