[Project64] Clean up UserInterface/MainMenuClass.cpp
This commit is contained in:
parent
b1239a44b5
commit
8a5c3990fb
|
@ -5,9 +5,9 @@
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
|
|
||||||
CMainMenu::CMainMenu(CMainGui * hMainWindow) :
|
CMainMenu::CMainMenu(CMainGui * hMainWindow) :
|
||||||
CBaseMenu(),
|
CBaseMenu(),
|
||||||
m_ResetAccelerators(true),
|
m_ResetAccelerators(true),
|
||||||
m_Gui(hMainWindow)
|
m_Gui(hMainWindow)
|
||||||
{
|
{
|
||||||
ResetMenu();
|
ResetMenu();
|
||||||
|
|
||||||
|
@ -115,60 +115,59 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
||||||
{
|
{
|
||||||
switch (MenuID) {
|
switch (MenuID) {
|
||||||
case ID_FILE_OPEN_ROM:
|
case ID_FILE_OPEN_ROM:
|
||||||
{
|
|
||||||
stdstr File = ChooseFileToOpen(hWnd);
|
|
||||||
if (File.length() > 0)
|
|
||||||
{
|
{
|
||||||
stdstr ext = CPath(File).GetExtension();
|
stdstr File = ChooseFileToOpen(hWnd);
|
||||||
if (!(_stricmp(ext.c_str(), "ndd") == 0))
|
if (File.length() > 0)
|
||||||
{
|
{
|
||||||
delete g_DDRom;
|
stdstr ext = CPath(File).GetExtension();
|
||||||
g_DDRom = NULL;
|
if (!(_stricmp(ext.c_str(), "ndd") == 0))
|
||||||
g_BaseSystem->RunFileImage(File.c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Open Disk
|
|
||||||
if (g_BaseSystem->RunDiskImage(File.c_str()))
|
|
||||||
{
|
{
|
||||||
stdstr IPLROM = g_Settings->LoadStringVal(File_DiskIPLPath);
|
delete g_DDRom;
|
||||||
if ((IPLROM.length() <= 0) || (!g_BaseSystem->RunFileImage(IPLROM.c_str())))
|
g_DDRom = NULL;
|
||||||
|
g_BaseSystem->RunFileImage(File.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Open Disk
|
||||||
|
if (g_BaseSystem->RunDiskImage(File.c_str()))
|
||||||
{
|
{
|
||||||
// Open DDROM
|
stdstr IPLROM = g_Settings->LoadStringVal(File_DiskIPLPath);
|
||||||
OPENFILENAME openfilename;
|
if ((IPLROM.length() <= 0) || (!g_BaseSystem->RunFileImage(IPLROM.c_str())))
|
||||||
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
|
||||||
memset(&FileName, 0, sizeof(FileName));
|
|
||||||
memset(&openfilename, 0, sizeof(openfilename));
|
|
||||||
|
|
||||||
strcpy(Directory, g_Settings->LoadStringVal(Directory_Game).c_str());
|
|
||||||
openfilename.lStructSize = sizeof(openfilename);
|
|
||||||
openfilename.hwndOwner = (HWND)hWnd;
|
|
||||||
openfilename.lpstrFilter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
|
|
||||||
openfilename.lpstrFile = FileName;
|
|
||||||
openfilename.lpstrInitialDir = Directory;
|
|
||||||
openfilename.nMaxFile = MAX_PATH;
|
|
||||||
openfilename.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
|
||||||
|
|
||||||
if (GetOpenFileName(&openfilename))
|
|
||||||
{
|
{
|
||||||
g_BaseSystem->RunFileImage(FileName);
|
// Open DDROM
|
||||||
|
OPENFILENAME openfilename;
|
||||||
|
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
||||||
|
memset(&FileName, 0, sizeof(FileName));
|
||||||
|
memset(&openfilename, 0, sizeof(openfilename));
|
||||||
|
|
||||||
|
strcpy(Directory, g_Settings->LoadStringVal(Directory_Game).c_str());
|
||||||
|
openfilename.lStructSize = sizeof(openfilename);
|
||||||
|
openfilename.hwndOwner = (HWND)hWnd;
|
||||||
|
openfilename.lpstrFilter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
|
||||||
|
openfilename.lpstrFile = FileName;
|
||||||
|
openfilename.lpstrInitialDir = Directory;
|
||||||
|
openfilename.nMaxFile = MAX_PATH;
|
||||||
|
openfilename.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||||
|
|
||||||
|
if (GetOpenFileName(&openfilename))
|
||||||
|
{
|
||||||
|
g_BaseSystem->RunFileImage(FileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
case ID_FILE_ROM_INFO:
|
case ID_FILE_ROM_INFO:
|
||||||
{
|
|
||||||
if (g_Rom)
|
|
||||||
{
|
{
|
||||||
RomInformation Info(g_Rom);
|
if (g_Rom)
|
||||||
Info.DisplayInformation(hWnd);
|
{
|
||||||
|
RomInformation Info(g_Rom);
|
||||||
|
Info.DisplayInformation(hWnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
case ID_FILE_STARTEMULATION:
|
case ID_FILE_STARTEMULATION:
|
||||||
m_Gui->SaveWindowLoc();
|
m_Gui->SaveWindowLoc();
|
||||||
//Before we go and create the new system, ensure the previous one has been closed
|
//Before we go and create the new system, ensure the previous one has been closed
|
||||||
|
@ -180,10 +179,10 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
||||||
break;
|
break;
|
||||||
case ID_FILE_ENDEMULATION:
|
case ID_FILE_ENDEMULATION:
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ENDEMULATION");
|
WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ENDEMULATION");
|
||||||
CN64System::CloseSystem();
|
CN64System::CloseSystem();
|
||||||
m_Gui->SaveWindowLoc();
|
m_Gui->SaveWindowLoc();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_FILE_ROMDIRECTORY:
|
case ID_FILE_ROMDIRECTORY:
|
||||||
|
@ -210,13 +209,13 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_PAUSE 1");
|
WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_PAUSE 1");
|
||||||
break;
|
break;
|
||||||
case ID_SYSTEM_BITMAP:
|
case ID_SYSTEM_BITMAP:
|
||||||
{
|
{
|
||||||
stdstr Dir(g_Settings->LoadStringVal(Directory_SnapShot));
|
stdstr Dir(g_Settings->LoadStringVal(Directory_SnapShot));
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "CaptureScreen(%s): Starting", Dir.c_str());
|
WriteTrace(TraceGFXPlugin, TraceDebug, "CaptureScreen(%s): Starting", Dir.c_str());
|
||||||
g_Plugins->Gfx()->CaptureScreen(Dir.c_str());
|
g_Plugins->Gfx()->CaptureScreen(Dir.c_str());
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "CaptureScreen: Done");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "CaptureScreen: Done");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_SYSTEM_LIMITFPS:
|
case ID_SYSTEM_LIMITFPS:
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_LIMITFPS");
|
WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_LIMITFPS");
|
||||||
g_Settings->SaveBool(GameRunning_LimitFPS, !g_Settings->LoadBool(GameRunning_LimitFPS));
|
g_Settings->SaveBool(GameRunning_LimitFPS, !g_Settings->LoadBool(GameRunning_LimitFPS));
|
||||||
|
@ -227,86 +226,86 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
|
g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
|
||||||
break;
|
break;
|
||||||
case ID_SYSTEM_SAVEAS:
|
case ID_SYSTEM_SAVEAS:
|
||||||
{
|
|
||||||
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
|
||||||
char Directory[255], SaveFile[255];
|
|
||||||
OPENFILENAME openfilename;
|
|
||||||
|
|
||||||
memset(&SaveFile, 0, sizeof(SaveFile));
|
|
||||||
memset(&openfilename, 0, sizeof(openfilename));
|
|
||||||
|
|
||||||
g_Settings->LoadStringVal(Directory_LastSave, Directory, sizeof(Directory));
|
|
||||||
|
|
||||||
openfilename.lStructSize = sizeof(openfilename);
|
|
||||||
openfilename.hwndOwner = (HWND)hWnd;
|
|
||||||
openfilename.lpstrFilter = "PJ64 Saves (*.zip, *.pj)\0*.pj?;*.pj;*.zip;";
|
|
||||||
openfilename.lpstrFile = SaveFile;
|
|
||||||
openfilename.lpstrInitialDir = Directory;
|
|
||||||
openfilename.nMaxFile = MAX_PATH;
|
|
||||||
openfilename.Flags = OFN_HIDEREADONLY;
|
|
||||||
|
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
|
|
||||||
if (GetSaveFileName(&openfilename))
|
|
||||||
{
|
{
|
||||||
_splitpath(SaveFile, drive, dir, fname, ext);
|
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||||
if (_stricmp(ext, ".pj") == 0 || _stricmp(ext, ".zip") == 0)
|
char Directory[255], SaveFile[255];
|
||||||
|
OPENFILENAME openfilename;
|
||||||
|
|
||||||
|
memset(&SaveFile, 0, sizeof(SaveFile));
|
||||||
|
memset(&openfilename, 0, sizeof(openfilename));
|
||||||
|
|
||||||
|
g_Settings->LoadStringVal(Directory_LastSave, Directory, sizeof(Directory));
|
||||||
|
|
||||||
|
openfilename.lStructSize = sizeof(openfilename);
|
||||||
|
openfilename.hwndOwner = (HWND)hWnd;
|
||||||
|
openfilename.lpstrFilter = "PJ64 Saves (*.zip, *.pj)\0*.pj?;*.pj;*.zip;";
|
||||||
|
openfilename.lpstrFile = SaveFile;
|
||||||
|
openfilename.lpstrInitialDir = Directory;
|
||||||
|
openfilename.nMaxFile = MAX_PATH;
|
||||||
|
openfilename.Flags = OFN_HIDEREADONLY;
|
||||||
|
|
||||||
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
|
||||||
|
if (GetSaveFileName(&openfilename))
|
||||||
{
|
{
|
||||||
_makepath(SaveFile, drive, dir, fname, NULL);
|
|
||||||
_splitpath(SaveFile, drive, dir, fname, ext);
|
_splitpath(SaveFile, drive, dir, fname, ext);
|
||||||
if (_stricmp(ext, ".pj") == 0)
|
if (_stricmp(ext, ".pj") == 0 || _stricmp(ext, ".zip") == 0)
|
||||||
{
|
{
|
||||||
_makepath(SaveFile, drive, dir, fname, NULL);
|
_makepath(SaveFile, drive, dir, fname, NULL);
|
||||||
|
_splitpath(SaveFile, drive, dir, fname, ext);
|
||||||
|
if (_stricmp(ext, ".pj") == 0)
|
||||||
|
{
|
||||||
|
_makepath(SaveFile, drive, dir, fname, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
g_Settings->SaveString(GameRunning_InstantSaveFile, SaveFile);
|
||||||
g_Settings->SaveString(GameRunning_InstantSaveFile, SaveFile);
|
|
||||||
|
|
||||||
char SaveDir[MAX_PATH];
|
char SaveDir[MAX_PATH];
|
||||||
_makepath(SaveDir, drive, dir, NULL, NULL);
|
_makepath(SaveDir, drive, dir, NULL, NULL);
|
||||||
g_Settings->SaveString(Directory_LastSave, SaveDir);
|
g_Settings->SaveString(Directory_LastSave, SaveDir);
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
|
g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
|
||||||
|
}
|
||||||
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
|
||||||
}
|
}
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ID_SYSTEM_RESTORE: WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_RESTORE"); g_BaseSystem->ExternalEvent(SysEvent_LoadMachineState); break;
|
case ID_SYSTEM_RESTORE: WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_RESTORE"); g_BaseSystem->ExternalEvent(SysEvent_LoadMachineState); break;
|
||||||
case ID_SYSTEM_LOAD:
|
case ID_SYSTEM_LOAD:
|
||||||
{
|
|
||||||
char Directory[255], SaveFile[255];
|
|
||||||
OPENFILENAME openfilename;
|
|
||||||
|
|
||||||
memset(&SaveFile, 0, sizeof(SaveFile));
|
|
||||||
memset(&openfilename, 0, sizeof(openfilename));
|
|
||||||
|
|
||||||
g_Settings->LoadStringVal(Directory_LastSave, Directory, sizeof(Directory));
|
|
||||||
|
|
||||||
openfilename.lStructSize = sizeof(openfilename);
|
|
||||||
openfilename.hwndOwner = (HWND)hWnd;
|
|
||||||
openfilename.lpstrFilter = "PJ64 Saves (*.zip, *.pj)\0*.pj?;*.pj;*.zip;";
|
|
||||||
openfilename.lpstrFile = SaveFile;
|
|
||||||
openfilename.lpstrInitialDir = Directory;
|
|
||||||
openfilename.nMaxFile = MAX_PATH;
|
|
||||||
openfilename.Flags = OFN_HIDEREADONLY;
|
|
||||||
|
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame);
|
|
||||||
if (GetOpenFileName(&openfilename))
|
|
||||||
{
|
{
|
||||||
g_Settings->SaveString(GameRunning_InstantSaveFile, SaveFile);
|
char Directory[255], SaveFile[255];
|
||||||
char SaveDir[MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
OPENFILENAME openfilename;
|
||||||
_splitpath(SaveFile, drive, dir, fname, ext);
|
|
||||||
_makepath(SaveDir, drive, dir, NULL, NULL);
|
memset(&SaveFile, 0, sizeof(SaveFile));
|
||||||
g_Settings->SaveString(Directory_LastSave, SaveDir);
|
memset(&openfilename, 0, sizeof(openfilename));
|
||||||
g_System->LoadState();
|
|
||||||
|
g_Settings->LoadStringVal(Directory_LastSave, Directory, sizeof(Directory));
|
||||||
|
|
||||||
|
openfilename.lStructSize = sizeof(openfilename);
|
||||||
|
openfilename.hwndOwner = (HWND)hWnd;
|
||||||
|
openfilename.lpstrFilter = "PJ64 Saves (*.zip, *.pj)\0*.pj?;*.pj;*.zip;";
|
||||||
|
openfilename.lpstrFile = SaveFile;
|
||||||
|
openfilename.lpstrInitialDir = Directory;
|
||||||
|
openfilename.nMaxFile = MAX_PATH;
|
||||||
|
openfilename.Flags = OFN_HIDEREADONLY;
|
||||||
|
|
||||||
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame);
|
||||||
|
if (GetOpenFileName(&openfilename))
|
||||||
|
{
|
||||||
|
g_Settings->SaveString(GameRunning_InstantSaveFile, SaveFile);
|
||||||
|
char SaveDir[MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||||
|
_splitpath(SaveFile, drive, dir, fname, ext);
|
||||||
|
_makepath(SaveDir, drive, dir, NULL, NULL);
|
||||||
|
g_Settings->SaveString(Directory_LastSave, SaveDir);
|
||||||
|
g_System->LoadState();
|
||||||
|
}
|
||||||
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
|
||||||
}
|
}
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ID_SYSTEM_CHEAT:
|
case ID_SYSTEM_CHEAT:
|
||||||
{
|
{
|
||||||
CCheatsUI * cheatUI = new CCheatsUI;
|
CCheatsUI * cheatUI = new CCheatsUI;
|
||||||
g_cheatUI = cheatUI;
|
g_cheatUI = cheatUI;
|
||||||
cheatUI->SelectCheats(hWnd, false);
|
cheatUI->SelectCheats(hWnd, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_SYSTEM_GSBUTTON:
|
case ID_SYSTEM_GSBUTTON:
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_GSButtonPressed);
|
g_BaseSystem->ExternalEvent(SysEvent_GSButtonPressed);
|
||||||
break;
|
break;
|
||||||
|
@ -420,11 +419,11 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_OPTIONS_SETTINGS:
|
case ID_OPTIONS_SETTINGS:
|
||||||
{
|
{
|
||||||
CSettingConfig SettingConfig;
|
CSettingConfig SettingConfig;
|
||||||
SettingConfig.Display(hWnd);
|
SettingConfig.Display(hWnd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_PROFILE_PROFILE:
|
case ID_PROFILE_PROFILE:
|
||||||
g_Settings->SaveBool(Debugger_ProfileCode, !g_Settings->LoadBool(Debugger_ProfileCode));
|
g_Settings->SaveBool(Debugger_ProfileCode, !g_Settings->LoadBool(Debugger_ProfileCode));
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_Profile_StartStop);
|
g_BaseSystem->ExternalEvent(SysEvent_Profile_StartStop);
|
||||||
|
|
Loading…
Reference in New Issue