SDL: some groundwork for implementation of now-dummy functions

This commit is contained in:
shinydoofy 2009-04-11 15:51:13 +00:00
parent dd643f96e0
commit c18c460e8d
1 changed files with 9 additions and 8 deletions

View File

@ -228,7 +228,8 @@ void setHotKeys()
config->addOption(prefix + "SelectState6", SDLK_6); config->addOption(prefix + "SelectState6", SDLK_6);
config->addOption(prefix + "SelectState7", SDLK_7); config->addOption(prefix + "SelectState7", SDLK_7);
config->addOption(prefix + "SelectState8", SDLK_8); config->addOption(prefix + "SelectState8", SDLK_8);
config->addOption(prefix + "SelectState9", SDLK_9);*/ config->addOption(prefix + "SelectState9", SDLK_9);
*/
return; return;
} }
@ -236,13 +237,13 @@ void setHotKeys()
* This function opens a file chooser dialog and returns the filename the * This function opens a file chooser dialog and returns the filename the
* user selected. * user selected.
* */ * */
std::string GetFilename(const char* title) std::string GetFilename(const char* title, bool save)
{ {
if (FCEUI_EmulationPaused() == 0) if (FCEUI_EmulationPaused() == 0)
FCEUI_ToggleEmulationPause(); FCEUI_ToggleEmulationPause();
std::string fname = ""; std::string fname = "";
#ifdef WIN32 #ifdef WIN32 // seriously?
OPENFILENAME ofn; // common dialog box structure OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name char szFile[260]; // buffer for file name
HWND hwnd; // owner window HWND hwnd; // owner window
@ -276,6 +277,8 @@ std::string GetFilename(const char* title)
std::string command = "zenity --file-selection --title=\""; std::string command = "zenity --file-selection --title=\"";
command.append(title); command.append(title);
command.append("\""); command.append("\"");
if (save) // Do we want to save a file or load one?
command.append(" --save --confirm-overwrite");
if ( !(fpipe = (FILE*)popen(command.c_str(),"r")) ) if ( !(fpipe = (FILE*)popen(command.c_str(),"r")) )
{ // If fpipe is NULL { // If fpipe is NULL
FCEUD_PrintError("Pipe error on opening zenity"); FCEUD_PrintError("Pipe error on opening zenity");
@ -284,9 +287,7 @@ std::string GetFilename(const char* title)
int c; int c;
while( (c = fgetc(fpipe)) ) while( (c = fgetc(fpipe)) )
{ {
if (c == EOF) if (c == EOF || c == '\n')
break;
if (c == '\n')
break; break;
fname += c; fname += c;
} }
@ -387,7 +388,7 @@ KeyboardCommands()
if(is_shift) { if(is_shift) {
FCEUI_StopMovie(); FCEUI_StopMovie();
std::string fname; std::string fname;
fname = GetFilename("Open FM2 movie for playback..."); fname = GetFilename("Open FM2 movie for playback...", false);
if(fname != "") if(fname != "")
{ {
if(fname.find(".fm2") != std::string::npos) if(fname.find(".fm2") != std::string::npos)
@ -471,7 +472,7 @@ KeyboardCommands()
#ifdef _S9XLUA_H #ifdef _S9XLUA_H
if(_keyonly(loadLuaKey)) { if(_keyonly(loadLuaKey)) {
std::string fname; std::string fname;
fname = GetFilename("Open LUA script..."); fname = GetFilename("Open LUA script...", false);
if(fname != "") if(fname != "")
FCEU_LoadLuaCode(fname.c_str()); FCEU_LoadLuaCode(fname.c_str());
} }