From 4b4cf0723d76b876f5283ec92f920e75e4755829 Mon Sep 17 00:00:00 2001 From: ugetab Date: Fri, 7 May 2010 02:37:02 +0000 Subject: [PATCH] Added metadata loading(right-click during playback, 'View comments and subtitles') for recent movies, last played movie, and drag-n-drop movies, and likely managed any others that I didn't try as well. --- src/drivers/win/main.cpp | 6 +++++- src/drivers/win/main.h | 1 + src/drivers/win/replay.cpp | 15 +++++++++++++++ src/drivers/win/replay.h | 1 + src/drivers/win/window.cpp | 9 ++++++++- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 63298250..e934583f 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -61,6 +61,7 @@ #include "cdlogger.h" #include "throttle.h" #include "tasedit.h" +#include "replay.h" #include "palette.h" //For the SetPalette function #include "main.h" #include "args.h" @@ -711,6 +712,7 @@ int main(int argc,char *argv[]) replayReadOnlySetting = true; FCEUI_LoadMovie(MovieToLoad, replayReadOnlySetting, false, replayStopFrameSetting!=0); + FCEUX_LoadMovieExtras(MovieToLoad); free(MovieToLoad); MovieToLoad = NULL; } @@ -784,7 +786,9 @@ doloopy: return(0); } - +void FCEUX_LoadMovieExtras(const char * fname) { + UpdateReplayCommentsSubs(fname); +} //mbg merge 7/19/06 - the function that contains the code that used to just be UpdateFCEUWindow() and FCEUD_UpdateInput() void _updateWindow() diff --git a/src/drivers/win/main.h b/src/drivers/win/main.h index 3eca8d9d..fcd616e9 100644 --- a/src/drivers/win/main.h +++ b/src/drivers/win/main.h @@ -118,6 +118,7 @@ void DoPriority(); void RemoveDirs(); void CreateDirs(); void SetDirs(); +void FCEUX_LoadMovieExtras(const char * fname); //void initDirectories(); //adelikat 03/02/09 - commenting out reference to a directory that I commented out #endif diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index 33821d90..5648beef 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -118,6 +118,21 @@ static char* GetSavePath(HWND hwndDlg) return fn; } +void UpdateReplayCommentsSubs(const char * fname) { + + MOVIE_INFO info; + + FCEUFILE *fp = FCEU_fopen(fname,0,"rb",0); + bool scanok = FCEUI_MovieGetInfo(fp, info, true); + delete fp; + + if(!scanok) + return; + + currComments = info.comments; + currSubtitles = info.subtitles; +} + void UpdateReplayDialog(HWND hwndDlg) { int doClear=1; diff --git a/src/drivers/win/replay.h b/src/drivers/win/replay.h index 17f5d01e..2b5b3e6d 100644 --- a/src/drivers/win/replay.h +++ b/src/drivers/win/replay.h @@ -1 +1,2 @@ void Replay_LoadMovie(bool tasedit); +void UpdateReplayCommentsSubs(const char * fname); \ No newline at end of file diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 8edef832..f98ae9ce 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -1333,6 +1333,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) if (!GameInfo) //If no game is loaded, load the Open Game dialog LoadNewGamey(hWnd, 0); FCEUI_LoadMovie(outname.c_str(), 1, false, false); + FCEUX_LoadMovieExtras(outname.c_str()); } else { std::string msg = "Failure converting " + fileDropped + "\r\n\r\n" + EFCM_CONVERTRESULT_message(result); MessageBox(hWnd,msg.c_str(),"Failure converting fcm", 0); @@ -1354,8 +1355,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { if (!GameInfo) //If no game is loaded, load the Open Game dialog LoadNewGamey(hWnd, 0); - if (GameInfo && !(fileDropped.find(".fm2") == string::npos)) //.fm2 is at the end of the filename so that must be the extension + if (GameInfo && !(fileDropped.find(".fm2") == string::npos)) { //.fm2 is at the end of the filename so that must be the extension FCEUI_LoadMovie(ftmp, 1, false, false); //We are convinced it is a movie file, attempt to load it + FCEUX_LoadMovieExtras(ftmp); + } } //------------------------------------------------------- //Check if Savestate file @@ -1461,6 +1464,8 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) RemoveRecentItem((wParam - MOVIE_FIRST_RECENT_FILE), recent_movie, MAX_NUMBER_OF_MOVIE_RECENT_FILES); UpdateMovieRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE); } + } else { + FCEUX_LoadMovieExtras(fname); } } } @@ -1951,6 +1956,8 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) RemoveRecentItem(0, recent_movie, MAX_NUMBER_OF_MOVIE_RECENT_FILES); UpdateMovieRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE); } + } else { + FCEUX_LoadMovieExtras(recent_movie[0]); } } break;