Win32 - Hooked up remove recent item function to the movie recent menu & load last movie context menu item.

This commit is contained in:
adelikat 2009-05-25 18:17:19 +00:00
parent 15c552902b
commit b7cdece19f
3 changed files with 28 additions and 8 deletions

View File

@ -1320,7 +1320,15 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
char*& fname = recent_movie[wParam - MOVIE_FIRST_RECENT_FILE];
if(fname)
{
FCEUI_LoadMovie(fname, 1, false, false);
if (!FCEUI_LoadMovie(fname, 1, false, false))
{
int result = MessageBox(hWnd,"Remove from list?", "Could Not Open Recent File", MB_YESNO);
if (result == IDYES)
{
RemoveRecentItem((wParam - MOVIE_FIRST_RECENT_FILE), recent_movie, MAX_NUMBER_OF_MOVIE_RECENT_FILES);
UpdateRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
}
}
}
}
@ -1752,7 +1760,17 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case FCEUX_CONTEXT_LOADLASTMOVIE:
if(recent_movie[0])
FCEUI_LoadMovie(recent_movie[0], 1, false, false);
{
if (!FCEUI_LoadMovie(recent_movie[0], 1, false, false))
{
int result = MessageBox(hWnd,"Remove from list?", "Could Not Open Recent File", MB_YESNO);
if (result == IDYES)
{
RemoveRecentItem(0, recent_movie, MAX_NUMBER_OF_MOVIE_RECENT_FILES);
UpdateRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
}
}
}
break;
//View comments and subtitles

View File

@ -726,10 +726,10 @@ void MovieData::dumpSavestateTo(std::vector<char>* buf, int compressionLevel)
}
//begin playing an existing movie
void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe)
bool FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe)
{
if(!tasedit && !FCEU_IsValidUI(FCEUI_PLAYMOVIE))
return;
return true; //adelikat: file did not fail to load, so let's return true here, just do nothing
assert(fname);
@ -744,10 +744,10 @@ void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _paus
strcpy(curMovieFilename, fname);
FCEUFILE *fp = FCEU_fopen(fname,0,"rb",0);
if (!fp) return;
if (!fp) return false;
if(fp->isArchive() && !_read_only) {
FCEU_PrintError("Cannot open a movie in read+write from an archive.");
return;
return true; //adelikat: file did not fail to load, so return true (false is only for file not exist/unable to open errors
}
#ifdef WIN32
@ -768,7 +768,7 @@ void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _paus
if(currMovieData.savestate.size() != 0)
{
bool success = MovieData::loadSavestateFrom(&currMovieData.savestate);
if(!success) return;
if(!success) return true; //adelikat: I guess return true here? False is only for a bad movie filename, if it got this far the file was god?
}
//if there is no savestate, we won't have this crucial piece of information at the start of the movie.
@ -810,6 +810,8 @@ void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _paus
LoggingEnabled = 2;
}
#endif
return true;
}
static void openRecordingMovie(const char* fname)

View File

@ -243,7 +243,7 @@ extern bool autoMovieBackup;
bool CheckFileExists(const char* filename); //Receives a filename (fullpath) and checks to see if that file exists
void FCEUI_MakeBackupMovie(bool dispMessage);
void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author);
void FCEUI_LoadMovie(const char *fname, bool read_only, bool tasedit, int _stopframe);
bool FCEUI_LoadMovie(const char *fname, bool read_only, bool tasedit, int _stopframe);
void FCEUI_MoviePlayFromBeginning(void);
void FCEUI_StopMovie(void);
bool FCEUI_MovieGetInfo(FCEUFILE* fp, MOVIE_INFO& info, bool skipFrameCount = false);