From 814544b8c75bc353f21330be2fc8f1044bfcc196 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Thu, 28 May 2009 16:32:10 +0000 Subject: [PATCH] Fix floppy speed setting (and simplify it) --- src/gui-sdl/gui-sdl.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/gui-sdl/gui-sdl.c b/src/gui-sdl/gui-sdl.c index 160be28..012f7fd 100644 --- a/src/gui-sdl/gui-sdl.c +++ b/src/gui-sdl/gui-sdl.c @@ -306,26 +306,17 @@ static void set_cpu_to_chipset_speed(int which) changed_prefs.m68k_speed = cpu_to_chipset_table[which]; } +static int floppy_table[] = {100, 0, 400, 800}; + static int get_floppy_speed(void) { - switch(changed_prefs.floppy_speed) - { - case 200: - return 1; - case 400: - return 2; - case 800: - return 3; - default: break; /* 100 */ - } - return 0; + return find_index_by_val(changed_prefs.floppy_speed, floppy_table, + sizeof(floppy_table) / sizeof(floppy_table[0]), 0); } static void set_floppy_speed(int which) { - int table[] = {100, 0, 400, 800}; - - changed_prefs.floppy_speed = table[which]; + changed_prefs.floppy_speed = floppy_table[which]; } static void set_gfx_framerate(int which)