Win32 - CD Logger - Drag and Drop for .cdl files
This commit is contained in:
parent
9e2c3ef5b2
commit
dbaa85bfc3
|
@ -1,3 +1,4 @@
|
||||||
|
25-jun-2009 - adelikat - Win32 - CD Logger - Drag and Drop for .cdl files
|
||||||
24-jun-2009 - qeed - sound/ppu - reverted to old noise table value since
|
24-jun-2009 - qeed - sound/ppu - reverted to old noise table value since
|
||||||
this seems to get correct sound for
|
this seems to get correct sound for
|
||||||
double dragon 2. Also added experimental
|
double dragon 2. Also added experimental
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#define INESPRIV
|
#define INESPRIV
|
||||||
#include "../../ines.h"
|
#include "../../ines.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
void LoadCDLogFile();
|
void LoadCDLogFile();
|
||||||
void SaveCDLogFileAs();
|
void SaveCDLogFileAs();
|
||||||
void SaveCDLogFile();
|
void SaveCDLogFile();
|
||||||
|
@ -49,9 +51,39 @@ int CDLogger_wndx=0, CDLogger_wndy=0;
|
||||||
HWND hCDLogger;
|
HWND hCDLogger;
|
||||||
char loadedcdfile[1024];
|
char loadedcdfile[1024];
|
||||||
|
|
||||||
|
//Prototypes
|
||||||
|
void LoadCDLog (const char* nameo);
|
||||||
|
|
||||||
BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||||
switch(uMsg) {
|
switch(uMsg) {
|
||||||
|
case WM_DROPFILES:
|
||||||
|
{
|
||||||
|
UINT len;
|
||||||
|
char *ftmp;
|
||||||
|
|
||||||
|
len=DragQueryFile((HDROP)wParam,0,0,0)+1;
|
||||||
|
if((ftmp=(char*)malloc(len)))
|
||||||
|
{
|
||||||
|
DragQueryFile((HDROP)wParam,0,ftmp,len);
|
||||||
|
string fileDropped = ftmp;
|
||||||
|
//adelikat: Drag and Drop only checks file extension, the internal functions are responsible for file error checking
|
||||||
|
//-------------------------------------------------------
|
||||||
|
//Check if .tbl
|
||||||
|
//-------------------------------------------------------
|
||||||
|
if (!(fileDropped.find(".cdl") == string::npos) && (fileDropped.find(".cdl") == fileDropped.length()-4))
|
||||||
|
{
|
||||||
|
LoadCDLog(fileDropped.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string str = "Could not open " + fileDropped;
|
||||||
|
MessageBox(hwndDlg, str.c_str(), "File error", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_MOVE: {
|
case WM_MOVE: {
|
||||||
RECT wrect;
|
RECT wrect;
|
||||||
GetWindowRect(hwndDlg,&wrect);
|
GetWindowRect(hwndDlg,&wrect);
|
||||||
|
@ -135,23 +167,11 @@ MB_OK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadCDLogFile(){
|
void LoadCDLog (const char* nameo)
|
||||||
|
{
|
||||||
FILE *FP;
|
FILE *FP;
|
||||||
int i, j;
|
int i,j;
|
||||||
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\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 Code Data Log File...";
|
|
||||||
ofn.lpstrFilter=filter;
|
|
||||||
nameo[0]=0;
|
|
||||||
ofn.lpstrFile=nameo;
|
|
||||||
ofn.nMaxFile=256;
|
|
||||||
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
|
|
||||||
ofn.hwndOwner = hCDLogger;
|
|
||||||
if(!GetOpenFileName(&ofn))return;
|
|
||||||
strcpy(loadedcdfile,nameo);
|
strcpy(loadedcdfile,nameo);
|
||||||
//FCEUD_PrintError(loadedcdfile);
|
//FCEUD_PrintError(loadedcdfile);
|
||||||
|
|
||||||
|
@ -184,6 +204,24 @@ void LoadCDLogFile(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadCDLogFile(){
|
||||||
|
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\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 Code Data Log File...";
|
||||||
|
ofn.lpstrFilter=filter;
|
||||||
|
nameo[0]=0;
|
||||||
|
ofn.lpstrFile=nameo;
|
||||||
|
ofn.nMaxFile=256;
|
||||||
|
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
|
||||||
|
ofn.hwndOwner = hCDLogger;
|
||||||
|
if(!GetOpenFileName(&ofn))return;
|
||||||
|
LoadCDLog(nameo);
|
||||||
|
}
|
||||||
|
|
||||||
void SaveCDLogFileAs(){
|
void SaveCDLogFileAs(){
|
||||||
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0";
|
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0";
|
||||||
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
|
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
|
||||||
|
|
|
@ -1283,6 +1283,7 @@ END
|
||||||
|
|
||||||
CDLOGGER DIALOGEX 0, 0, 322, 213
|
CDLOGGER DIALOGEX 0, 0, 322, 213
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Code Data Logger"
|
CAPTION "Code Data Logger"
|
||||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
Loading…
Reference in New Issue