Win32 - Drag & Drop for .fcm, it converts and then loads the converted movie automatically

This commit is contained in:
adelikat 2009-06-24 23:11:43 +00:00
parent e0028f6b17
commit 7574788b23
2 changed files with 25 additions and 6 deletions

View File

@ -1,3 +1,4 @@
24-jun-2009 - adelikat - win32 - Drag & Drop for .fcm, it converts and then loads the converted movie automatically
24-jun-2009 - adelikat - win32 - Drag & Drop support for palette files
23-jun-2009 - adelikat - win32 - Drag & Drop support for savestates
22-jun-2009 - qeed - Revert IRQ inhibit fix, since this seems to break Dragon

View File

@ -1250,16 +1250,34 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
//-------------------------------------------------------
//Check if .fcm file, if so, convert it
//-------------------------------------------------------
//if (!(fileDropped.find(".fcm") == string::npos) && (fileDropped.find(".fcm") == fileDropped.length()-4))
//{
//adelikat: TODO: set this one up, it will be tricky because convert fcm is tied in with the OPENFILE dialog
//I'm thinking it converts it to the original directory of the .fcm then loads the resulting .fm2 automatically
//}
if (!(fileDropped.find(".fcm") == string::npos) && (fileDropped.find(".fcm") == fileDropped.length()-4))
{
//produce output filename
std::string outname;
size_t dot = fileDropped.find_last_of(".");
if(dot == std::string::npos)
outname = fileDropped + ".fm2";
else
outname = fileDropped.substr(0,dot) + ".fm2";
MovieData md;
EFCM_CONVERTRESULT result = convert_fcm(md, fileDropped.c_str());
if(result==FCM_CONVERTRESULT_SUCCESS)
{
std::fstream* outf = FCEUD_UTF8_fstream(outname, "wb");
md.dump(outf,false);
delete outf;
FCEUI_LoadMovie(outname.c_str(), 1, false, false);
} else {
std::string msg = "Failure converting " + fileDropped + "\r\n\r\n" + EFCM_CONVERTRESULT_message(result);
MessageBox(hWnd,msg.c_str(),"Failure converting fcm", 0);
}
}
//-------------------------------------------------------
//Check if Palette file
//-------------------------------------------------------
/*else*/ if (!(fileDropped.find(".pal") == string::npos) && (fileDropped.find(".pal") == fileDropped.length()-4))
else if (!(fileDropped.find(".pal") == string::npos) && (fileDropped.find(".pal") == fileDropped.length()-4))
{
SetPalette(fileDropped.c_str());
}