From 06325b4a434658edb8996c091f38d529928bd723 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sun, 10 May 2009 08:12:16 +0000 Subject: [PATCH] Allow inserting disks (actually works) --- src/gui-sdl/gui-sdl.c | 45 ++++++++++++++++++++++++++++--------------- src/gui-sdl/menu.c | 3 +-- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/gui-sdl/gui-sdl.c b/src/gui-sdl/gui-sdl.c index dea168b..74603bd 100644 --- a/src/gui-sdl/gui-sdl.c +++ b/src/gui-sdl/gui-sdl.c @@ -11,10 +11,28 @@ #include "options.h" #include "gui.h" +#include "uae.h" #include "menu.h" extern SDL_Surface *screen; +static const char *main_menu_messages[] = { + /*00*/ "Floppy", + /*01*/ "^|df0|df1|df2|df3", + /*02*/ "States", + /*03*/ "^|Load|Save|Delete", + /*04*/ "Keyboard", + /*05*/ "^|Type|Macro|Bind", + /*06*/ "#1-------------------------------------", + /*07*/ "Reset UAE", + /*08*/ "Networking", + /*09*/ "Options", + /*10*/ "Advanced Options", + /*11*/ "Help", + /*12*/ "Quit", + NULL +}; + void gui_init (int argc, char **argv) { @@ -92,23 +110,13 @@ void gui_handle_events (void) { } -static const char *main_menu_messages[] = { - /*00*/ "Floppy", - /*01*/ "^|df0|df1|df2|df3", - /*02*/ "States", - /*03*/ "^|Load|Save|Delete", - /*04*/ "Keyboard", - /*05*/ "^|Type|Macro|Bind", - /*06*/ "#1-------------------------------------", - /*07*/ "Reset UAE", - /*08*/ "Networking", - /*09*/ "Options", - /*10*/ "Advanced Options", - /*11*/ "Help", - /*12*/ "Quit", - NULL -}; +static void insert_floppy(int which) +{ + const char *name = menu_select_file(prefs_get_attr("floppy_path")); + if (name != NULL) + strcpy (changed_prefs.df[which], name); +} void gui_display(int shortcut) { @@ -116,6 +124,7 @@ void gui_display(int shortcut) int submenus[3]; int opt; + memset(submenus, 0, sizeof(submenus)); printf("Initing gui with %d\n", shortcut); printf("Al-mibb: Gui is display!\n"); @@ -127,6 +136,10 @@ void gui_display(int shortcut) opt = menu_select_title("Main menu", main_menu_messages, submenus); switch(opt) { + case 0: + /* Insert floppy */ + insert_floppy(submenus[0]); + break; case 7: uae_reset(1); break; diff --git a/src/gui-sdl/menu.c b/src/gui-sdl/menu.c index 00ff331..26182f5 100644 --- a/src/gui-sdl/menu.c +++ b/src/gui-sdl/menu.c @@ -263,8 +263,7 @@ static const char **get_file_list(const char *base_dir) de = readdir(d)) { char buf[255]; - const char *exts[] = {".d64", ".D64", ".prg", ".PRG", - ".p00", ".P00", ".s00", ".S00", + const char *exts[] = {".adf", ".ADF", ".adz", ".ADZ", ".t64", ".T64", ".sav", ".SAV", NULL}; struct stat st;