Win32 - Drag & Drop support for palette files
This commit is contained in:
parent
e4e2774f1a
commit
83623cc9b9
|
@ -1,3 +1,4 @@
|
||||||
|
24-jun-2009 - adelikat - win32 - Drag & Drop support for palette files
|
||||||
23-jun-2009 - adelikat - win32 - Drag & Drop support for savestates
|
23-jun-2009 - adelikat - win32 - Drag & Drop support for savestates
|
||||||
22-jun-2009 - qeed - Revert IRQ inhibit fix, since this seems to break Dragon
|
22-jun-2009 - qeed - Revert IRQ inhibit fix, since this seems to break Dragon
|
||||||
Warrior 4, added palette reading cases for the new PPU.
|
Warrior 4, added palette reading cases for the new PPU.
|
||||||
|
|
|
@ -5,6 +5,24 @@
|
||||||
|
|
||||||
uint8 cpalette[192];
|
uint8 cpalette[192];
|
||||||
|
|
||||||
|
bool SetPalette(const char* nameo)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
if((fp = FCEUD_UTF8fopen(nameo, "rb")))
|
||||||
|
{
|
||||||
|
fread(cpalette, 1, 192, fp);
|
||||||
|
fclose(fp);
|
||||||
|
FCEUI_SetPaletteArray(cpalette);
|
||||||
|
eoptions |= EO_CPALETTE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FCEUD_PrintError("Error opening palette file!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts the user for a palette file and opens that file.
|
* Prompts the user for a palette file and opens that file.
|
||||||
*
|
*
|
||||||
|
@ -14,7 +32,7 @@ int LoadPaletteFile()
|
||||||
{
|
{
|
||||||
const char filter[]="All usable files(*.pal)\0*.pal\0All files (*.*)\0*.*\0";
|
const char filter[]="All usable files(*.pal)\0*.pal\0All files (*.*)\0*.*\0";
|
||||||
|
|
||||||
FILE *fp;
|
bool success = false;
|
||||||
char nameo[2048];
|
char nameo[2048];
|
||||||
|
|
||||||
// Display open file dialog
|
// Display open file dialog
|
||||||
|
@ -32,23 +50,10 @@ int LoadPaletteFile()
|
||||||
|
|
||||||
if(GetOpenFileName(&ofn))
|
if(GetOpenFileName(&ofn))
|
||||||
{
|
{
|
||||||
if((fp = FCEUD_UTF8fopen(nameo, "rb")))
|
success = SetPalette(nameo);
|
||||||
{
|
|
||||||
fread(cpalette, 1, 192, fp);
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
FCEUI_SetPaletteArray(cpalette);
|
|
||||||
|
|
||||||
eoptions |= EO_CPALETTE;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FCEUD_PrintError("Error opening palette file!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
#define WIN_PALETTE_H
|
#define WIN_PALETTE_H
|
||||||
|
|
||||||
void ConfigPalette();
|
void ConfigPalette();
|
||||||
|
bool SetPalette(const char* nameo);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1246,6 +1246,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
{
|
{
|
||||||
DragQueryFile((HDROP)wParam,0,ftmp,len);
|
DragQueryFile((HDROP)wParam,0,ftmp,len);
|
||||||
string fileDropped = ftmp;
|
string fileDropped = ftmp;
|
||||||
|
//adelikat: Drag and Drop only checks file extension, the internal functions are responsible for file error checking
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
//Check if .fcm file, if so, convert it
|
//Check if .fcm file, if so, convert it
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
@ -1255,10 +1256,18 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
//I'm thinking it converts it to the original directory of the .fcm then loads the resulting .fm2 automatically
|
//I'm thinking it converts it to the original directory of the .fcm then loads the resulting .fm2 automatically
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
//Check if Palette file
|
||||||
|
//-------------------------------------------------------
|
||||||
|
/*else*/ if (!(fileDropped.find(".pal") == string::npos) && (fileDropped.find(".pal") == fileDropped.length()-4))
|
||||||
|
{
|
||||||
|
SetPalette(fileDropped.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
//Check if Movie file
|
//Check if Movie file
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
/*else*/ if (!(fileDropped.find(".fm2") == string::npos) && (fileDropped.find(".fm2") == fileDropped.length()-4)) //ROM is already loaded and .fm2 in filename
|
else if (!(fileDropped.find(".fm2") == string::npos) && (fileDropped.find(".fm2") == fileDropped.length()-4)) //ROM is already loaded and .fm2 in filename
|
||||||
{
|
{
|
||||||
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
|
FCEUI_LoadMovie(ftmp, 1, false, false); //We are convinced it is a movie file, attempt to load it
|
||||||
|
|
Loading…
Reference in New Issue