Esempio n. 1
0
int autostart_autodetect_opt_prgname(const char *file_prog_name,
                                     unsigned int alt_prg_number,
                                     unsigned int runmode)
{
    char *tmp;
    int result;

    /* Check for image:prg -format.  */
    tmp = strrchr(file_prog_name, ':');
    if (tmp) {
        char *autostart_prg_name;
        char *autostart_file;

        autostart_file = lib_stralloc(file_prog_name);
        autostart_prg_name = strrchr(autostart_file, ':');
        *autostart_prg_name++ = '\0';
        /* Does the image exist?  */
        if (util_file_exists(autostart_file)) {
            char *name;

            charset_petconvstring((BYTE *)autostart_prg_name, 0);
            name = charset_replace_hexcodes(autostart_prg_name);
            result = autostart_autodetect(autostart_file, name, 0, runmode);
            lib_free(name);
        } else {
            result = autostart_autodetect(file_prog_name, NULL, alt_prg_number, runmode);
        }
        lib_free(autostart_file);
    } else {
        result = autostart_autodetect(file_prog_name, NULL, alt_prg_number, runmode);
    }
    return result;
}
Esempio n. 2
0
static void uiattach_tape_dialog(HWND hwnd)
{
    TCHAR *st_name;
    int autostart_index = -1;

    SuspendFullscreenModeKeep(hwnd);
    if ((st_name = uilib_select_file_autostart(hwnd,
                   translate_text(IDS_ATTACH_TAPE_IMAGE),
                   UILIB_FILTER_TAPE |
#ifdef HAVE_ZLIB
                   UILIB_FILTER_ZIP |
#endif
                   UILIB_FILTER_ALL,
                   UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_TAPE,
                   &autostart_index, NULL)) != NULL) {
        char *name;

        name = system_wcstombs_alloc(st_name);
        if (autostart_index >= 0) {
            if (autostart_autodetect(name, NULL, autostart_index, AUTOSTART_MODE_RUN) < 0) {
                ui_error(translate_text(IDS_CANNOT_AUTOSTART_FILE));
            }
        } else {
            if (tape_image_attach(1, name) < 0) {
                ui_error(translate_text(IDS_CANNOT_ATTACH_FILE));
            }
        }
        system_wcstombs_free(name);
        lib_free(st_name);
    }
    ResumeFullscreenModeKeep(hwnd);
}
Esempio n. 3
0
static void uiattach_autostart_dialog(HWND hwnd)
{
    TCHAR *st_name;
    int autostart_index = 0;
    char *resource;

    resource = lib_msprintf("AttachDevice%dReadonly", 8);
    if ((st_name = uilib_select_file_autostart(hwnd,
                   translate_text(IDS_AUTOSTART_IMAGE),
                   UILIB_FILTER_CBM |
                   UILIB_FILTER_DISK |
                   UILIB_FILTER_TAPE |
#ifdef HAVE_ZLIB
                   UILIB_FILTER_ZIP |
#endif
                   UILIB_FILTER_PRGP00 |
                   UILIB_FILTER_ALL,
                   UILIB_SELECTOR_TYPE_FILE_LOAD,
                   UILIB_SELECTOR_STYLE_DISK_AND_TAPE,
                   &autostart_index, resource)) != NULL) {
        char *name;

        name = system_wcstombs_alloc(st_name);
        if (autostart_autodetect(name, NULL, autostart_index, AUTOSTART_MODE_RUN) < 0) {
            ui_error(translate_text(IDS_CANNOT_AUTOSTART_FILE));
        }
        system_wcstombs_free(name);
        lib_free(st_name);
    }
    lib_free(resource);
}
Esempio n. 4
0
  void checkfilename (char *currentfilename)
  {
  	char *ret = NULL, *fname = NULL;
  	char *ptr;
  	char actualpath [PATH_MAX];
  	struct dirent **namelist;
  	DIR *dir;
  	
  	if ((dir = opendir(currentfilename)))
  	{ 
  	  dirList=currentfilename;
  	  ptr = realpath(currentfilename, actualpath);
  	  strcpy(currentDir, ptr);
  	  closedir(dir);
  	}
  	else 
  	{
  	  if ((menu_load_type == MENU_SELECT_FILE) && confirmselection)
  	  {
		selectedFilePath=currentfilename;
	  if (autostart_autodetect(selectedFilePath.c_str(), NULL, 0, AUTOSTART_MODE_RUN) < 0) {
                //ui_error("could not start auto-image");
            }
#ifdef ANDROID	  
		SDL_ANDROID_SetScreenKeyboardShown(1);
#endif
		running = false;
	  }
	  else if ((menu_load_type == MENU_SELECT_DRIVE8) && confirmselection)
  	  {
		selectedFilePath8=currentfilename;
		int err8 = file_system_attach_disk(8, selectedFilePath8.c_str());
	  }
	  else if ((menu_load_type == MENU_SELECT_DRIVE9) && confirmselection)
  	  {
		selectedFilePath9=currentfilename;
		int err9 = file_system_attach_disk(9, selectedFilePath9.c_str());
	  }
	  else if ((menu_load_type == MENU_SELECT_DRIVE10) && confirmselection)
  	  {
		selectedFilePath10=currentfilename;
		int err10 = file_system_attach_disk(10, selectedFilePath9.c_str());
	  }
	  else if ((menu_load_type == MENU_SELECT_DRIVE11) && confirmselection)
  	  {
		selectedFilePath11=currentfilename;
		int err11 = file_system_attach_disk(11, selectedFilePath10.c_str());
	  }
  	  if (confirmselection)
	    unraise_loadMenu_guichan();
  	}
  }
Esempio n. 5
0
static void uiattach_disk_dialog(HWND hwnd, WPARAM wparam)
{
    TCHAR *st_name;
    char *resource;
    int unit = 8;
    int autostart_index = -1;

    SuspendFullscreenModeKeep(hwnd);
    switch (wparam & 0xffff) {
    case IDM_ATTACH_8:
        unit = 8;
        break;
    case IDM_ATTACH_9:
        unit = 9;
        break;
    case IDM_ATTACH_10:
        unit = 10;
        break;
    case IDM_ATTACH_11:
        unit = 11;
        break;
    }
    resource = lib_msprintf("AttachDevice%dReadonly", unit);
    if ((st_name = uilib_select_file_autostart(hwnd,
                   translate_text(IDS_ATTACH_DISK_IMAGE),
                   UILIB_FILTER_DISK |
#ifdef HAVE_ZLIB
                   UILIB_FILTER_ZIP |
#endif
                   UILIB_FILTER_ALL,
                   UILIB_SELECTOR_TYPE_FILE_LOAD,
                   UILIB_SELECTOR_STYLE_DISK,
                   &autostart_index, resource)) != NULL) {
        char *name;

        name = system_wcstombs_alloc(st_name);
        if (autostart_index >= 0) {
            if (autostart_autodetect(name, NULL, autostart_index, AUTOSTART_MODE_RUN) < 0) {
                ui_error(translate_text(IDS_CANNOT_AUTOSTART_FILE));
            }
        } else {
            if (file_system_attach_disk(unit, name) < 0) {
                ui_error(translate_text(IDS_CANNOT_ATTACH_FILE));
            }
        }
        system_wcstombs_free(name);
        lib_free(st_name);
    }
    ResumeFullscreenModeKeep(hwnd);
    lib_free(resource);
}
Esempio n. 6
0
static void uiattach_autostart_dialog(video_canvas_t *canvas)
{
    char *name;
    int autostart_index = 0;

    if ((name = uilib_select_file_autostart(translate_text(IDS_AUTOSTART_IMAGE),
                                            UILIB_FILTER_DISK | UILIB_FILTER_TAPE | UILIB_FILTER_ZIP | UILIB_FILTER_ALL,
                                            UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DISK_AND_TAPE,
                                            &autostart_index, NULL)) != NULL) {
        if (autostart_autodetect(name, NULL, autostart_index, AUTOSTART_MODE_RUN) < 0) {
            ui_error(translate_text(IDMES_CANNOT_AUTOSTART_FILE));
        }
        lib_free(name);
    }
}
Esempio n. 7
0
static void autostart_diskimage(HWND hwnd)
{
    TCHAR *st_name;

    st_name = uilib_select_file(hwnd, translate_text(IDS_AUTOSTART_DISK_IMAGE), UILIB_FILTER_ALL | UILIB_FILTER_DISK | UILIB_FILTER_ZIP, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DISK);

    if (st_name != NULL) {
        char *name;

        SetDlgItemText(hwnd, IDC_DISKIMAGE, st_name);
        name = system_wcstombs_alloc(st_name);
        if (autostart_autodetect(name, "*", 0, AUTOSTART_MODE_RUN) < 0) {
            ui_error(translate_text(IDS_CANNOT_AUTOSTART_FILE));
        }
        system_wcstombs_free(name);
        lib_free(st_name);
    }
}
Esempio n. 8
0
static void uiattach_disk_dialog(video_canvas_t *canvas, int idm)
{
    char *name;
    char *resource;
    int unit = 8;
    int autostart_index = -1;

    switch (idm) {
        case IDM_ATTACH_8:
            unit = 8;
            break;
        case IDM_ATTACH_9:
            unit = 9;
            break;
        case IDM_ATTACH_10:
            unit = 10;
            break;
        case IDM_ATTACH_11:
            unit = 11;
            break;
    }
    resource = lib_msprintf("AttachDevice%dReadonly", unit);
    if ((name = uilib_select_file_autostart(translate_text(IDMS_ATTACH_DISK_IMAGE),
                                            UILIB_FILTER_DISK | UILIB_FILTER_ZIP | UILIB_FILTER_ALL,
                                            UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DISK,
                                            &autostart_index, resource)) != NULL) {
        if (autostart_index >= 0) {
            if (autostart_autodetect(name, NULL, autostart_index, AUTOSTART_MODE_RUN) < 0) {
                ui_error(translate_text(IDMES_CANNOT_AUTOSTART_FILE));
            }
        } else {
            if (file_system_attach_disk(unit, name) < 0) {
                ui_error(translate_text(IDMES_CANNOT_ATTACH_FILE));
            }
        }
        lib_free(name);
    }
    lib_free(resource);
}
Esempio n. 9
0
MRESULT EXPENTRY ViceFileDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    switch (msg) {
        case WM_INITDLG:
            {
                FILEDLG *fdlg = (FILEDLG*)WinQueryWindowPtr(hwnd, QWL_USER);
                int i;
                char *szpath;
                const int action = fdlg->ulUser;
                const int nact = (action >> 8) & 0xff;
                const int nsact = (action) & 0xff;

                FillABox(hwnd, action ? nact - 1 : 0);
                FillSBox(hwnd, action ? nsact - 1 : 0);
                FillFBox(hwnd);
                NewFilter(hwnd);

                for (i = 0; i < numfonts; i++) {
                    WinDlgLboxInsertItem(hwnd, DID_FONTNAME_LB, fnames[i]);
                }
                WinDlgLboxSelectItem(hwnd, DID_FONTNAME_LB, 0);

                if (action) {
                    WinEnableControl(hwnd, DID_ACTION_CB, FALSE);
                    WinEnableControl(hwnd, DID_SUBACTION_CB, FALSE);
                }

                if (action || fdlg->fl & FDS_SAVEAS_DIALOG) {
                    WinEnableControl(hwnd, DID_AUTOSTART_PB, FALSE);
                }

                szpath = util_concat(fdlg->pszIDrive, fdlg->szFullFile, NULL);
                *(strrchr(szpath, '\\') + 1) = '\0';

                WinSetDlgItemText(hwnd, DID_DIR_SELECTED, szpath);
                lib_free(szpath);

                szpath = util_concat(archdep_boot_path(), "\\vice2.dll", NULL);
                if (!GpiLoadFonts(WinQueryAnchorBlock(hwnd), szpath)) {
                    log_debug("dlg-fileio.c: GpiLoadFonts('%s') failed.", szpath);
                    WinEnableControl(hwnd, DID_FONTNAME_LB, FALSE);
                }
                lib_free(szpath);
            }
            return FALSE;
        case WM_DESTROY:
            {
                char *szpath = util_concat(archdep_boot_path(), "\\vice2.dll", NULL);
                LboxFreeContents(WinWindowFromID(hwnd, DID_CONTENTS_LB));
                if (!GpiUnloadFonts(WinQueryAnchorBlock(hwnd), szpath)) {
                    log_debug("dlg-fileio.c: GpiUnloadFonts('%s') failed.", szpath);
                }
                lib_free (szpath);
            }
            break;
        case WM_CONTROL:
            switch (SHORT1FROMMP(mp1)) {
                case DID_ACTION_CB:
                    if (SHORT2FROMMP(mp1) == CBN_ENTER) {
                        FillSBox(hwnd, 0);
                    }
                case DID_SUBACTION_CB:
                    if (SHORT2FROMMP(mp1) == CBN_ENTER) {
                        FillFBox(hwnd);
                    }
                case DID_FFILTER_CB:
                    if (SHORT2FROMMP(mp1) == CBN_ENTER) {
                        NewFilter(hwnd);
                    }
                    return FALSE;
                case DID_DIRECTORY_LB:
                    WinDefFileDlgProc(hwnd, msg, mp1, mp2);
                    if (SHORT2FROMMP(mp1) == LN_SELECT || SHORT2FROMMP(mp1) == LN_ENTER) {
                        char szpath[CCHMAXPATH];
                        const int nr = WinQueryLboxSelectedItem((HWND)mp2);

                        if (nr < 0) {
                            return FALSE;
                        }

                        if (SHORT2FROMMP(mp1) == LN_SELECT && WinQueryFocus(HWND_DESKTOP) == (HWND)mp2) {
                            return FALSE;
                        }

                        if (!GetLboxPath((HWND)mp2, nr, szpath)) {
                            return FALSE;
                        }

                        WinSetDlgItemText(hwnd, DID_DIR_SELECTED, szpath);
                    }
                    return FALSE;
                case DID_FILENAME_ED:
                    if (WinQueryButtonCheckstate(hwnd, DID_CONTENTS_CB) && SHORT2FROMMP(mp1) == EN_CHANGE) {
                        char szpath[CCHMAXPATH];
                        if (GetFullFile(hwnd, szpath)) {
                            ShowContents(hwnd, szpath);
                        }
                    }
                    break;
                case DID_CONTENTS_CB:
                    {
                        const int state = WinQueryButtonCheckstate(hwnd, DID_CONTENTS_CB);

                        WinEnableControl(hwnd, DID_CONTENTS_LB, state);
                        WinEnableControl(hwnd, DID_FONTNAME_LB, state);
                        if (state) {
                            ContentsUpdate(hwnd);
                        } else {
                            LboxFreeContents(WinWindowFromID(hwnd, DID_CONTENTS_LB));
                        }
                    }
                    return FALSE;
                case DID_FONTNAME_LB:
                    if (SHORT2FROMMP(mp1) != CBN_ENTER) {
                        break;
                    }
                    ContentsUpdate(hwnd);
                    return FALSE;
            }
            break;
        case WM_COMMAND:
            switch (SHORT1FROMMP(mp1)) {
                case DID_DIRUP:
                    {
                        const HWND name = WinWindowFromID(hwnd, DID_FILENAME_ED);
                        const int pos = WinDlgLboxSelectedItem(hwnd, DID_DIRECTORY_LB);
                        char szpath[CCHMAXPATH];
                        char *cpos;
                        int len;

                        if (!pos) {
                            return FALSE;
                        }

                        WinQueryDlgItemText(hwnd, DID_DIR_SELECTED, CCHMAXPATH - 1, szpath);

                        if (strlen(szpath) < 4) {
                            return FALSE;
                        }

                        *strrchr(szpath, '\\') = '\0';
                        cpos = strrchr(szpath,'\\') + 1;

                        len = cpos - szpath + 2;

                        if (len == CCHMAXPATH - 1) {
                            return FALSE;
                        }

                        WinQueryDlgItemText(hwnd, DID_FILENAME_ED, CCHMAXPATH - len - 1, cpos);

                        WinSetWindowText(name, szpath);

                        *cpos = '\0';

                        WinSetDlgItemText(hwnd, DID_DIR_SELECTED, szpath);

                        //
                        // set focus to entry field and simulate an Apply
                        //
                        WinSetFocus(HWND_DESKTOP, name);
                        WinDefFileDlgProc(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPFROM2SHORT(CMDSRC_PUSHBUTTON, TRUE));
                    }
                    return FALSE;
                case DID_AUTOSTART_PB:
                    {
                        const int pos = WinDlgLboxSelectedItem(hwnd, DID_CONTENTS_LB);
                        FILEDLG *fdlg = (FILEDLG*)WinQueryWindowPtr(hwnd, QWL_USER);
                        size_t length;
                        char szpath[CCHMAXPATH];

                        if (!GetFullFile(hwnd, szpath)) {
                            return FALSE;
                        }

                        if (autostart_autodetect(szpath, NULL, pos < 0 ? 0 : pos, AUTOSTART_MODE_RUN)) {
                            return FALSE;
                        }

                        length = strrchr(szpath, '\\') - szpath;

                        fdlg->lReturn = DID_OK;

                        if (length > 0) {
                            fdlg->szFullFile[length] = 0;
                        }
                    }
                    break;
            }
            break;
        case WM_MEASUREITEM:
            if (SHORT1FROMMP(mp1) == DID_CONTENTS_LB) {
                return MRFROM2SHORT(9, 9);
            }
            break;
        case WM_DRAWITEM:
            if (SHORT1FROMMP(mp1) == DID_CONTENTS_LB) {
                OWNERITEM *item = (OWNERITEM*)mp2;
                RECTL *rcl = &(item->rclItem);

                if (rcl->yTop-rcl->yBottom == 9) {
                    image_contents_screencode_t *line = (image_contents_screencode_t *)WinLboxItemHandle(item->hwnd, item->idItem);

                    if (line) {
                        LboxDrawLine(hwnd, item, rcl, line);
                    }
                    item->fsState = item->fsStateOld = 0;
                }
                return (MRESULT)TRUE;
            }
            break;
        case FDM_VALIDATE:
            // mp1 = PSZ pszPathName
            // mp2 = USHORT Field name id
            // mr  = TRUE -> Valid name
            {
                const int sact = WinDlgLboxSelectedItem(hwnd, DID_SUBACTION_CB);
                const int act = WinDlgLboxSelectedItem(hwnd, DID_ACTION_CB);
                const FILEDLG *fdlg = (FILEDLG*)WinQueryWindowPtr(hwnd, QWL_USER);
                char *szpath = (char*)mp1;
                int rc;
                char *slash;

                if (fdlg->fl & FDS_OPEN_DIALOG) {
                    rc = FdmDoLoadAction(hwnd, szpath, act, sact);
                } else {
                    rc = FdmDoSaveAction(hwnd, szpath, act, sact);
                }

                if (rc < 0) {
                    const action_t *action = fdlg->fl & FDS_OPEN_DIALOG ? LoadAction : SaveAction;
                    char *txt = util_concat("The following action couldn't be performed:\n", action[act].type, " ", action[act].subact[sact].action, NULL);
                    HPOINTER hpt = WinLoadPointer(HWND_DESKTOP, NULLHANDLE, 0x101);
#ifdef WATCOM_COMPILE
                    struct _MB2D mbtemp;
                    struct _MB2INFO mb;

                    mb.cb = sizeof(MB2INFO);
                    mb.hIcon = hpt;
                    mb.cButtons = 1;
                    mb.flStyle = MB_CUSTOMICON|WS_VISIBLE;
                    mb.hwndNotify = NULLHANDLE;
                    sprintf(mbtemp.achText,"      OK      ");
                    mbtemp.idButton = 0;
                    mbtemp.flStyle = BS_DEFAULT;
                    mb.mb2d[0] = mbtemp;
#else
                    MB2INFO mb = {
                        sizeof(MB2INFO),
                        hpt,
                        1,
                        MB_CUSTOMICON | WS_VISIBLE,
                        NULLHANDLE,
                        "      OK      ",
                        0,
                        BS_DEFAULT};
#endif
                    WinMessageBox2(HWND_DESKTOP, hwnd, txt, "VICE/2 Error", 0, &mb);
                    lib_free(txt);
                    return FALSE;
                }

                //
                // FIXME! Better solution?
                //
                slash = strrchr(szpath, '\\');
                if (slash) {
                    *slash = '\0';
                }

                chdir(szpath);
            }
            return (MRESULT)TRUE;

    }
    return WinDefFileDlgProc(hwnd, msg, mp1, mp2);
}
Esempio n. 10
0
/**
 * Show and process the floppy disk image dialog.
 */
void DlgFloppy_Main(void)
{
	int but, i;
	char *newdisk;
	char dlgname[MAX_FLOPPYDRIVES][64], dlgdiskdir[64];

	SDLGui_CenterDlg(floppydlg);

	/* Set up dialog to actual values: */
 const char *name;

 floppydlg[FLOPPYDLG_ATTACH2FLIPLIST].state &= ~SG_SELECTED;

 name = file_system_get_disk_name(8); /* Filename */
 if (!name)dlgname[0][0] = '\0';
 else File_ShrinkName(dlgname[0], name,floppydlg[FLOPPYDLG_DISKA].w);
 floppydlg[FLOPPYDLG_DISKA].txt = dlgname[0];

 name = file_system_get_disk_name(9); /* Filename */
 if (!name)dlgname[1][0] = '\0';
 else File_ShrinkName(dlgname[1], name,floppydlg[FLOPPYDLG_DISKB].w);
 floppydlg[FLOPPYDLG_DISKB].txt = dlgname[1];

 name = file_system_get_disk_name(10); /* Filename */
 if (!name)dlgname[2][0] = '\0';
 else File_ShrinkName(dlgname[2], name,floppydlg[FLOPPYDLG_DISK2].w);
 floppydlg[FLOPPYDLG_DISK2].txt = dlgname[2];

 name = file_system_get_disk_name(11); /* Filename */
 if (!name)dlgname[3][0] = '\0';
 else File_ShrinkName(dlgname[3], name,floppydlg[FLOPPYDLG_DISK3].w);
 floppydlg[FLOPPYDLG_DISK3].txt = dlgname[3];

	/* Default image directory: */
	File_ShrinkName(dlgdiskdir,szDiskImageDirectory,
	                floppydlg[FLOPPYDLG_IMGDIR].w);
	floppydlg[FLOPPYDLG_IMGDIR].txt = dlgdiskdir;


	/* Draw and process the dialog */
	do
	{       
		but = SDLGui_DoDialog(floppydlg, NULL);
		switch (but)
		{
		 case FLOPPYDLG_EJECTA:                         /* Eject disk in drive A: */
			Floppy_SetDiskFileNameNone(0);
			dlgname[0][0] = '\0';
			file_system_detach_disk(GET_DRIVE(8));

			break;
		 case FLOPPYDLG_BROWSEA:                        /* Choose a new disk A: */
			DlgDisk_BrowseDisk(dlgname[0], 0, FLOPPYDLG_DISKA);

			if (strlen(szDiskFileName[0]) > 0){

			int drivetype;

			printf("load (%s)-",szDiskFileName[0]);
			resources_get_int_sprintf("Drive%iType", &drivetype, GET_DRIVE(8));
			printf("(Drive%iType)\n",drivetype);

			cartridge_detach_image(-1);
			tape_image_detach(1);
//			file_system_detach_disk(GET_DRIVE(8));

			if(File_DoesFileExtensionMatch(szDiskFileName[0],"CRT"))
				cartridge_attach_image(CARTRIDGE_CRT, szDiskFileName[0]);
			else {
//FIXME
/*
				if(File_DoesFileExtensionMatch(szDiskFileName[0],"D81") && drivetype!=1581)
						resources_set_int_sprintf("Drive%iType", 1581,  GET_DRIVE(8));
				else if (drivetype!=1542 && !File_DoesFileExtensionMatch(szDiskFileName[0],"D81"))
						resources_set_int_sprintf("Drive%iType", 1542,  GET_DRIVE(8));
*/			

				if (floppydlg[FLOPPYDLG_ATTACH2FLIPLIST].state & SG_SELECTED){
					file_system_detach_disk(GET_DRIVE(8));
					printf("Attach to flip list\n");
					file_system_attach_disk(8, szDiskFileName[0]);
					fliplist_add_image(8)	;
				}
				else {
					printf("autostart\n");
					autostart_autodetect(szDiskFileName[0], NULL, 0, AUTOSTART_MODE_RUN);
				}

			}

			}

			break;
		 case FLOPPYDLG_EJECTB:                         /* Eject disk in drive B: */
			Floppy_SetDiskFileNameNone(1);
			dlgname[1][0] = '\0';
			file_system_detach_disk(GET_DRIVE(9));

			break;
		case FLOPPYDLG_BROWSEB:                         /* Choose a new disk B: */
			DlgDisk_BrowseDisk(dlgname[1], 1, FLOPPYDLG_DISKB);

			if (strlen(szDiskFileName[1]) > 0){
				
			file_system_detach_disk(GET_DRIVE(9));
     		file_system_attach_disk(9, szDiskFileName[1]);
	
			}

		 case FLOPPYDLG_EJECT2:                         /* Eject disk in drive A: */
			Floppy_SetDiskFileNameNone(2);
			dlgname[2][0] = '\0';
			file_system_detach_disk(GET_DRIVE(10));
			break;
		 case FLOPPYDLG_BROWSE2:                        /* Choose a new disk A: */
			DlgDisk_BrowseDisk(dlgname[2], 0, FLOPPYDLG_DISK2);

			if (strlen(szDiskFileName[2]) > 0){
					//strcpy(prefs->DrivePath[2], szDiskFileName[2]);
			}

			break;
		 case FLOPPYDLG_EJECT3:                         /* Eject disk in drive B: */
			Floppy_SetDiskFileNameNone(3);
			dlgname[3][0] = '\0';
			file_system_detach_disk(GET_DRIVE(11));
			break;
		case FLOPPYDLG_BROWSE3:                         /* Choose a new disk B: */
			DlgDisk_BrowseDisk(dlgname[3], 1, FLOPPYDLG_DISKB);

			if (strlen(szDiskFileName[3]) > 0){

//					strcpy(prefs->DrivePath[3], szDiskFileName[3]);
			}

			break;
		 case FLOPPYDLG_BROWSEIMG:
			DlgDisk_BrowseDir(dlgdiskdir,szDiskImageDirectory,floppydlg[FLOPPYDLG_IMGDIR].w);
			break;
/*
		 case FLOPPYDLG_CREATEIMG:
			newdisk = DlgNewDisk_Main();
			if (newdisk)
			{
				DlgFloppy_QueryInsert(dlgname[0], FLOPPYDLG_DISKA,
						      dlgname[1], FLOPPYDLG_DISKB,
						      newdisk);
				free(newdisk);
			}
			break;
*/
		}
                gui_poll_events();
	}
	while (but != FLOPPYDLG_EXIT && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram);

/*
	if (floppydlg[FLOPPYDLG_AUTOSTART].state & SG_SELECTED){

			if(!ThePrefs.Emul1541Proc){
					prefs->Emul1541Proc = !prefs->Emul1541Proc;
			}
	}
	else {
			if(ThePrefs.Emul1541Proc){
					prefs->Emul1541Proc = !prefs->Emul1541Proc;
			}	

	}
*/

}