[UI] Added 64DD IPL ROM Path to General Settings

This commit is contained in:
luigiblood 2016-06-04 00:23:30 +02:00
parent 010ebcb45b
commit faeeb6fa9d
6 changed files with 80 additions and 0 deletions

View File

@ -265,6 +265,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

@ -233,6 +233,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

@ -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);
@ -41,6 +42,8 @@ m_SettingsConfig(SettingsConfig)
TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBERDIR), Directory_RecentGameDirCount, false);
TxtBox->SetTextField(GetDlgItem(IDC_MAXROMDIR_TXT));
m_IplDir.Attach(GetDlgItem(IDC_IPL_DIR));
UpdatePageSettings();
}
@ -56,6 +59,16 @@ void CGeneralOptionsPage::ShowPage()
void CGeneralOptionsPage::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<CGeneralOptionsPage>::ApplySettings(UpdateScreen);
}
@ -75,4 +88,53 @@ void CGeneralOptionsPage::OnBasicMode(UINT Code, int id, HWND ctl)
{
CheckBoxChanged(Code, id, ctl);
m_SettingsConfig->UpdateAdvanced((int)::SendMessage(ctl, BM_GETCHECK, 0, 0) == 0);
}
void CGeneralOptionsPage::SelectIplDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
SelectFile(DIR_SELECT_PLUGIN, m_IplDir);
}
void CGeneralOptionsPage::IplDirChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
if (m_InUpdateSettings) { return; }
m_IplDir.SetChanged(true);
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
}
void CGeneralOptionsPage::UpdatePageSettings(void)
{
m_InUpdateSettings = true;
CSettingsPageImpl<CGeneralOptionsPage>::UpdatePageSettings();
stdstr File;
g_Settings->LoadStringVal(File_DiskIPLPath, File);
m_IplDir.SetWindowText(File.c_str());
m_InUpdateSettings = false;
}
void CGeneralOptionsPage::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,6 +20,8 @@ class CGeneralOptionsPage :
COMMAND_ID_HANDLER_EX(IDC_LOAD_FULLSCREEN,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SCREEN_SAVER,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_BASIC_MODE,OnBasicMode)
COMMAND_ID_HANDLER_EX(IDC_SELECT_IPL_DIR, SelectIplDir)
COMMAND_HANDLER_EX(IDC_IPL_DIR, EN_UPDATE, IplDirChanged)
COMMAND_HANDLER_EX(IDC_REMEMBER,EN_UPDATE,EditBoxChanged)
COMMAND_HANDLER_EX(IDC_REMEMBERDIR,EN_UPDATE,EditBoxChanged)
END_MSG_MAP()
@ -38,5 +40,12 @@ public:
private:
void OnBasicMode ( UINT Code, int id, HWND ctl );
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 );
CSettingConfig * m_SettingsConfig;
CModifiedEditBox m_IplDir;
bool m_InUpdateSettings;
};

View File

@ -159,6 +159,10 @@ BEGIN
EDITTEXT IDC_REMEMBERDIR,148,94,26,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "dirs",IDC_ROMSEL_TEXT4,178,98,34,10
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,73,208,1
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,112,208,1
EDITTEXT IDC_IPL_DIR,4,130,184,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SELECT_IPL_DIR,194,130,14,12
LTEXT "64DD IPL ROM Path:",IDC_IPLDIR_TXT,6,120,145,10
END
IDD_Rom_Information DIALOGEX 0, 0, 239, 207

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