Merge pull request #1105 from LuigiBlood/64dd_2

[UI-Settings] Add 64DD IPL ROM path to General Settings UI
This commit is contained in:
zilmar 2016-06-06 05:14:43 +10:00
commit dd1cf6a154
8 changed files with 85 additions and 5 deletions

View File

@ -266,6 +266,7 @@ enum LanguageStringID
OPTION_CHANGE_FR = 466,
OPTION_CHECK_RUNNING = 467,
OPTION_UNIQUE_SAVE_DIR = 468,
OPTION_IPL_ROM_PATH = 469,
//Rom Browser Tab
RB_MAX_ROMS = 480,

View File

@ -234,6 +234,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(OPTION_CHECK_RUNNING, "Check if Project64 is already running");
DEF_STR(OPTION_UNIQUE_SAVE_DIR, "Unique Game Save Directory");
DEF_STR(OPTION_CHANGE_FR, "Speed display:");
DEF_STR(OPTION_IPL_ROM_PATH, "64DD IPL ROM Path:");
//ROM Browser Tab
DEF_STR(RB_MAX_ROMS, "Max # of ROMs remembered (0-10):");

View File

@ -122,7 +122,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Setting_UniqueSaveDir, new CSettingTypeApplication("", "Unique Game Dir", (uint32_t)false));
#endif
AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("", "Current Language", ""));
AddHandler(Setting_EnableDisk, new CSettingTypeApplication("", "Enable Disk", (uint32_t)true));
AddHandler(Setting_EnableDisk, new CSettingTypeTempBool(false));
AddHandler(Setting_LanguageDirDefault, new CSettingTypeRelativePath("Lang", ""));
AddHandler(Setting_LanguageDir, new CSettingTypeApplicationPath("Lang Directory", "Directory", Setting_LanguageDirDefault));

View File

@ -27,6 +27,7 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay)
SetDlgItemTextW(m_hWnd, IDC_UNIQUE_SAVE_DIR, wGS(OPTION_UNIQUE_SAVE_DIR).c_str());
SetDlgItemTextW(m_hWnd, IDC_CHECK_RUNNING, wGS(OPTION_CHECK_RUNNING).c_str());
SetDlgItemTextW(m_hWnd, IDC_DISPLAY_FRAMERATE, wGS(OPTION_CHANGE_FR).c_str());
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_TXT, wGS(OPTION_IPL_ROM_PATH).c_str());
AddModCheckBox(GetDlgItem(IDC_START_ON_ROM_OPEN), Setting_AutoStart);
AddModCheckBox(GetDlgItem(IDC_ZIP), Setting_AutoZipInstantSave);
@ -45,6 +46,8 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay)
ComboBox->AddItemW(wGS(STR_FR_PERCENT).c_str(), FR_PERCENT);
}
m_IplDir.Attach(GetDlgItem(IDC_IPL_DIR));
UpdatePageSettings();
}
@ -60,6 +63,16 @@ void CAdvancedOptionsPage::ShowPage()
void CAdvancedOptionsPage::ApplySettings(bool UpdateScreen)
{
if (m_IplDir.IsChanged())
{
stdstr file = m_IplDir.GetWindowText();
g_Settings->SaveString(File_DiskIPLPath, file.c_str());
}
if (m_IplDir.IsReset())
{
g_Settings->DeleteSetting(File_DiskIPLPath);
}
CSettingsPageImpl<CAdvancedOptionsPage>::ApplySettings(UpdateScreen);
}
@ -72,4 +85,53 @@ bool CAdvancedOptionsPage::EnableReset(void)
void CAdvancedOptionsPage::ResetPage()
{
CSettingsPageImpl<CAdvancedOptionsPage>::ResetPage();
}
void CAdvancedOptionsPage::SelectIplDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
SelectFile(DIR_SELECT_PLUGIN, m_IplDir);
}
void CAdvancedOptionsPage::IplDirChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
if (m_InUpdateSettings) { return; }
m_IplDir.SetChanged(true);
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
}
void CAdvancedOptionsPage::UpdatePageSettings(void)
{
m_InUpdateSettings = true;
CSettingsPageImpl<CAdvancedOptionsPage>::UpdatePageSettings();
stdstr File;
g_Settings->LoadStringVal(File_DiskIPLPath, File);
m_IplDir.SetWindowText(File.c_str());
m_InUpdateSettings = false;
}
void CAdvancedOptionsPage::SelectFile(LanguageStringID Title, CModifiedEditBox & EditBox)
{
// 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(RomList_GameDir).c_str());
openfilename.lStructSize = sizeof(openfilename);
openfilename.hwndOwner = m_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))
{
EditBox.SetChanged(true);
EditBox.SetWindowText(FileName);
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
}
}

View File

@ -20,9 +20,11 @@ class CAdvancedOptionsPage :
COMMAND_ID_HANDLER_EX(IDC_ZIP,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DEBUGGER,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_REMEMBER_CHEAT,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_CHECK_RUNNING, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_UNIQUE_SAVE_DIR, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DISPLAY_FRAMERATE, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_CHECK_RUNNING, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_UNIQUE_SAVE_DIR, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DISPLAY_FRAMERATE, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SELECT_IPL_DIR, SelectIplDir)
COMMAND_HANDLER_EX(IDC_IPL_DIR, EN_UPDATE, IplDirChanged)
COMMAND_HANDLER_EX(IDC_FRAME_DISPLAY_TYPE,LBN_SELCHANGE,ComboBoxChanged)
END_MSG_MAP()
@ -40,4 +42,11 @@ public:
void ResetPage ( void );
private:
void SelectIplDir(UINT Code, int id, HWND ctl);
void IplDirChanged(UINT Code, int id, HWND ctl);
void UpdatePageSettings(void);
void SelectFile(LanguageStringID Title, CModifiedEditBox & EditBox);
CModifiedEditBox m_IplDir;
bool m_InUpdateSettings;
};

View File

@ -29,6 +29,7 @@ m_SettingsConfig(SettingsConfig)
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str());
SetDlgItemTextW(m_hWnd, IDC_MAXROMDIR_TXT, wGS(RB_MAX_DIRS).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str());
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_TXT, wGS(OPTION_IPL_ROM_PATH).c_str());
AddModCheckBox(GetDlgItem(IDC_AUTOSLEEP), Setting_AutoSleep);
AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN), Setting_AutoFullscreen);
@ -75,4 +76,4 @@ void CGeneralOptionsPage::OnBasicMode(UINT Code, int id, HWND ctl)
{
CheckBoxChanged(Code, id, ctl);
m_SettingsConfig->UpdateAdvanced((int)::SendMessage(ctl, BM_GETCHECK, 0, 0) == 0);
}
}

View File

@ -335,6 +335,9 @@ BEGIN
CONTROL "Frame rate display",IDC_DISPLAY_FRAMERATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,98,86,10
COMBOBOX IDC_FRAME_DISPLAY_TYPE,101,97,99,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Unique Game Save Directory",IDC_UNIQUE_SAVE_DIR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,83,189,10
EDITTEXT IDC_IPL_DIR,4,125,184,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SELECT_IPL_DIR,194,125,14,12
LTEXT "64DD IPL ROM Path:",IDC_IPLDIR_TXT,6,115,145,10
END
IDD_Settings_ShellInt DIALOGEX 0, 0, 231, 206

View File

@ -329,6 +329,9 @@
#define IDC_VALUE_TEXT 1207
#define IDC_NOTES_TEXT 1208
#define IDC_LANG_SEL 1219
#define IDC_IPL_DIR 1220
#define IDC_SELECT_IPL_DIR 1221
#define IDC_IPLDIR_TXT 1222
#define ID_POPUP_SHOWINMEMORYVIEWER 40005
#define ID_POPUPMENU_PLAYGAMEWITHDISK 40008
#define ID_POPUPMENU_ROMDIRECTORY 40137