Win32 - TextHooker - drag & drop for table files
This commit is contained in:
parent
78af47d32c
commit
815a525714
|
@ -1,3 +1,4 @@
|
|||
01-july-2009 - adelikat - win32 - texthooker - drag & drop for table files
|
||||
01-july-2009 - adelikat - win32 - drag & drop for cheat (.cht) files
|
||||
25-jun-2009 - qeed - sound/ppu - fixed the noise value, it seems that the noise logic was shifting the values to the left by 1 when reloading, but this doesnt work for PAL since one of the PAL reload value is odd, so fix the logic and used the old tables. Revert a stupid CPU ignore logic in PPU. Sorry about that.
|
||||
25-jun-2009 - adelikat - Win32 - CD Logger - Drag and Drop for .cdl files
|
||||
|
|
|
@ -1335,6 +1335,7 @@ END
|
|||
|
||||
TEXTHOOKER DIALOGEX 0, 0, 456, 327
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Text Hooker"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
|
|
@ -407,29 +407,13 @@ void KillTextHooker() {
|
|||
* It should return -1, otherwise returns the line number it had the error on
|
||||
*/
|
||||
|
||||
int TextHookerLoadTableFile(){
|
||||
//adelikat: Pulled this from TextHookerLoadTableFile so that a specific file can be loaded (such as in drag & drop)
|
||||
int TextHookerLoadTable(const char* nameo)
|
||||
{
|
||||
char str[500]; //holds the current line of the table file
|
||||
FILE *FP; //file pointer
|
||||
unsigned int i, j, line, charcode1, charcode2; //various useful variables
|
||||
|
||||
//initialize the "File open" dialogue box
|
||||
const char filter[]="Table Files (*.THT)\0*.tht\0All Files (*.*)\0*.*\0";
|
||||
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn,0,sizeof(ofn));
|
||||
ofn.lStructSize=sizeof(ofn);
|
||||
ofn.hInstance=fceu_hInstance;
|
||||
ofn.lpstrTitle="Load Table File...";
|
||||
ofn.lpstrFilter=filter;
|
||||
nameo[0]=0;
|
||||
ofn.lpstrFile=nameo;
|
||||
ofn.nMaxFile=256;
|
||||
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
|
||||
ofn.hwndOwner = hCDLogger;
|
||||
|
||||
//get the file name or stop
|
||||
if(!GetOpenFileName(&ofn))return -1;
|
||||
|
||||
//get rid of any existing table info
|
||||
TextHookerUnloadTableFile();
|
||||
|
||||
|
@ -655,7 +639,30 @@ int TextHookerLoadTableFile(){
|
|||
fclose(FP);
|
||||
//return successfully
|
||||
return -1;
|
||||
}
|
||||
|
||||
int TextHookerLoadTableFile(){
|
||||
//initialize the "File open" dialogue box
|
||||
const char filter[]="Table Files (*.THT)\0*.tht\0All Files (*.*)\0*.*\0";
|
||||
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn,0,sizeof(ofn));
|
||||
ofn.lStructSize=sizeof(ofn);
|
||||
ofn.hInstance=fceu_hInstance;
|
||||
ofn.lpstrTitle="Load Table File...";
|
||||
ofn.lpstrFilter=filter;
|
||||
nameo[0]=0;
|
||||
ofn.lpstrFile=nameo;
|
||||
ofn.nMaxFile=256;
|
||||
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
|
||||
ofn.hwndOwner = hCDLogger;
|
||||
|
||||
//get the file name or stop
|
||||
if(!GetOpenFileName(&ofn))return -1;
|
||||
|
||||
int result = TextHookerLoadTable(nameo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -829,6 +836,31 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
|
||||
TextHooker=1;
|
||||
break;
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
//adelikat: Drag and Drop does not check extension, it will simply attempt to open it as a table file
|
||||
UINT len;
|
||||
char *ftmp;
|
||||
len=DragQueryFile((HDROP)wParam,0,0,0)+1;
|
||||
if((ftmp=(char*)malloc(len)))
|
||||
{
|
||||
DragQueryFile((HDROP)wParam,0,ftmp,len);
|
||||
std::string fileDropped = ftmp;
|
||||
|
||||
int result = TextHookerLoadTable(fileDropped.c_str());
|
||||
//write a response message to str based on x's value
|
||||
if ( result == -1 )
|
||||
sprintf( str, "Table Loaded Successfully!" );
|
||||
else
|
||||
sprintf( str, "Table is not Loaded!\r\nError on line: %d", result );
|
||||
//store the current text into the buffer
|
||||
GetDlgItemText(hwndDlg,102,bufferstr,10240);
|
||||
strcat( bufferstr, "\r\n" ); //add a newline
|
||||
strcat( bufferstr, str ); //add the status message to the buffer
|
||||
SetDlgItemText(hwndDlg,102,bufferstr); //display the buffer
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_PAINT:
|
||||
TextHookerDoBlit();
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue