--- hatari/src/gui-sdl/dlgRom.c 2019/04/01 07:11:58 1.1 +++ hatari/src/gui-sdl/dlgRom.c 2019/04/01 07:13:51 1.1.1.4 @@ -4,7 +4,7 @@ This file is distributed under the GNU Public License, version 2 or at your option any later version. Read the file gpl.txt for details. */ -char DlgRom_rcsid[] = "Hatari $Id: dlgRom.c,v 1.1 2019/04/01 07:11:58 root Exp $"; +const char DlgRom_rcsid[] = "Hatari $Id: dlgRom.c,v 1.1.1.4 2019/04/01 07:13:51 root Exp $"; #include "main.h" #include "configuration.h" @@ -37,7 +37,7 @@ static SGOBJ romdlg[] = { SGBUTTON, 0, 0, 42,14, 8,1, "Browse" }, { SGTEXT, 0, 0, 2,16, 46,1, NULL }, { SGTEXT, 0, 0, 2,19, 25,1, "A reset is needed after changing these options." }, - { SGBUTTON, 0, 0, 16,21, 20,1, "Back to main menu" }, + { SGBUTTON, SG_DEFAULT, 0, 16,21, 20,1, "Back to main menu" }, { -1, 0, 0, 0,0, 0,0, NULL } }; @@ -48,15 +48,10 @@ static SGOBJ romdlg[] = */ void DlgRom_Main(void) { - char *tmpname; char szDlgTosName[47]; char szDlgCartName[47]; int but; - tmpname = malloc(FILENAME_MAX); - if (tmpname == NULL) - return; - SDLGui_CenterDlg(romdlg); File_ShrinkName(szDlgTosName, DialogParams.Rom.szTosImageFileName, sizeof(szDlgTosName)-1); @@ -67,17 +62,15 @@ void DlgRom_Main(void) do { - but = SDLGui_DoDialog(romdlg); + but = SDLGui_DoDialog(romdlg, NULL); switch (but) { case DLGROM_TOSBROWSE: - strcpy(tmpname, DialogParams.Rom.szTosImageFileName); - File_MakeAbsoluteName(tmpname); - if (SDLGui_FileSelect(tmpname, NULL, FALSE)) /* Show and process the file selection dlg */ - { - strcpy(DialogParams.Rom.szTosImageFileName, tmpname); - File_ShrinkName(szDlgTosName, DialogParams.Rom.szTosImageFileName, sizeof(szDlgTosName)-1); - } + /* Show and process the file selection dlg */ + SDLGui_FileConfSelect(szDlgTosName, + DialogParams.Rom.szTosImageFileName, + sizeof(szDlgTosName)-1, + FALSE); break; case DLGROM_CARTEJECT: @@ -86,17 +79,14 @@ void DlgRom_Main(void) break; case DLGROM_CARTBROWSE: - strcpy(tmpname, DialogParams.Rom.szCartridgeImageFileName); - File_MakeAbsoluteName(tmpname); - if (SDLGui_FileSelect(tmpname, NULL, FALSE)) /* Show and process the file selection dlg */ - { - strcpy(DialogParams.Rom.szCartridgeImageFileName, tmpname); - File_ShrinkName(szDlgCartName, DialogParams.Rom.szCartridgeImageFileName, sizeof(szDlgCartName)-1); - } + /* Show and process the file selection dlg */ + SDLGui_FileConfSelect(szDlgCartName, + DialogParams.Rom.szCartridgeImageFileName, + sizeof(szDlgCartName)-1, + FALSE); break; } } - while (but!=DLGROM_EXIT && !bQuitProgram); - - free(tmpname); + while (but != DLGROM_EXIT && but != SDLGUI_QUIT + && but != SDLGUI_ERROR && !bQuitProgram); }