-Support for importing *.duc files added to windows port

This commit is contained in:
cyberwarriorx 2007-02-10 02:13:09 +00:00
parent 1c93a66573
commit 892fe07a1d
3 changed files with 33 additions and 1 deletions

View File

@ -59,7 +59,7 @@ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */ /* Make the class name into a global variable */
char SavName[MAX_PATH] = ""; char SavName[MAX_PATH] = "";
char SavName2[MAX_PATH] = ""; char ImportSavName[MAX_PATH] = "";
char szClassName[ ] = "DeSmuME"; char szClassName[ ] = "DeSmuME";
int romnum = 0; int romnum = 0;
@ -506,6 +506,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED); EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
EnableMenuItem(menu, IDM_RESET, MF_ENABLED); EnableMenuItem(menu, IDM_RESET, MF_ENABLED);
EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED); EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED);
EnableMenuItem(menu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED);
romloaded = TRUE; romloaded = TRUE;
NDS_UnPause(); NDS_UnPause();
} }
@ -515,6 +516,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
EnableMenuItem(menu, IDM_PAUSE, MF_GRAYED); EnableMenuItem(menu, IDM_PAUSE, MF_GRAYED);
EnableMenuItem(menu, IDM_RESET, MF_GRAYED); EnableMenuItem(menu, IDM_RESET, MF_GRAYED);
EnableMenuItem(menu, IDM_GAME_INFO, MF_GRAYED); EnableMenuItem(menu, IDM_GAME_INFO, MF_GRAYED);
EnableMenuItem(menu, IDM_IMPORTBACKUPMEMORY, MF_GRAYED);
} }
CheckMenuItem(menu, IDC_SAVETYPE1, MF_BYCOMMAND | MF_CHECKED); CheckMenuItem(menu, IDC_SAVETYPE1, MF_BYCOMMAND | MF_CHECKED);
@ -613,6 +615,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED); EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
EnableMenuItem(menu, IDM_RESET, MF_ENABLED); EnableMenuItem(menu, IDM_RESET, MF_ENABLED);
EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED); EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED);
EnableMenuItem(menu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED);
romloaded = TRUE; romloaded = TRUE;
NDS_UnPause(); NDS_UnPause();
} }
@ -870,6 +873,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED); EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED);
EnableMenuItem(menu, IDM_RESET, MF_ENABLED); EnableMenuItem(menu, IDM_RESET, MF_ENABLED);
EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED); EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED);
EnableMenuItem(menu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED);
romloaded = TRUE; romloaded = TRUE;
NDS_UnPause(); NDS_UnPause();
} }
@ -1002,6 +1006,30 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDM_STATE_LOAD_F10: case IDM_STATE_LOAD_F10:
StateLoadSlot(10); StateLoadSlot(10);
return 0; return 0;
case IDM_IMPORTBACKUPMEMORY:
{
OPENFILENAME ofn;
NDS_Pause();
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Action Replay DS Save (*.duc)\0*.duc\0\0";
ofn.nFilterIndex = 1;
ofn.lpstrFile = ImportSavName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "duc";
if(!GetOpenFileName(&ofn))
{
NDS_UnPause();
return 0;
}
if (!NDS_ImportSave(ImportSavName))
MessageBox(hwnd,"Save was not successfully imported","Error",MB_OK);
NDS_UnPause();
return 0;
}
case IDM_SOUNDSETTINGS: case IDM_SOUNDSETTINGS:
{ {
DialogBox(GetModuleHandle(NULL), "SoundSettingsDlg", hwnd, (DLGPROC)SoundSettingsDlgProc); DialogBox(GetModuleHandle(NULL), "SoundSettingsDlg", hwnd, (DLGPROC)SoundSettingsDlgProc);

View File

@ -131,6 +131,8 @@ void refreshAll();
#define IDC_FRAMESKIP8 199 #define IDC_FRAMESKIP8 199
#define IDC_FRAMESKIP9 200 #define IDC_FRAMESKIP9 200
#define IDM_IMPORTBACKUPMEMORY 201
#define IDD_MEM_VIEWER 301 #define IDD_MEM_VIEWER 301
#define IDC_8_BIT 302 #define IDC_8_BIT 302
#define IDC_16_BIT 303 #define IDC_16_BIT 303

View File

@ -344,6 +344,8 @@ MENU_PRINCIPAL MENU
MENUITEM "10", IDM_STATE_LOAD_F10 MENUITEM "10", IDM_STATE_LOAD_F10
} }
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Import Backup Memory", IDM_IMPORTBACKUPMEMORY
MENUITEM SEPARATOR
MENUITEM "Save Screenshot &As", IDM_PRINTSCREEN MENUITEM "Save Screenshot &As", IDM_PRINTSCREEN
MENUITEM "&Quick Screenshot", IDM_QUICK_PRINTSCREEN MENUITEM "&Quick Screenshot", IDM_QUICK_PRINTSCREEN
MENUITEM SEPARATOR MENUITEM SEPARATOR