[Disk] Add Disk Drive Settings file
This commit is contained in:
parent
ddaff077b2
commit
5eb8c8715f
|
@ -0,0 +1,162 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
#include "SettingsPage.h"
|
||||||
|
|
||||||
|
CDiskDrivePage::CDiskDrivePage(HWND hParent, const RECT & rcDispay)
|
||||||
|
{
|
||||||
|
if (!Create(hParent, rcDispay))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set the text for all gui Items
|
||||||
|
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_JP_TXT, wGS(OPTION_IPL_ROM_PATH).c_str());
|
||||||
|
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_US_TXT, wGS(OPTION_IPL_ROM_USA_PATH).c_str());
|
||||||
|
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_TL_TXT, wGS(OPTION_IPL_ROM_TOOL_PATH).c_str());
|
||||||
|
SetDlgItemTextW(m_hWnd, IDC_DISKSAVETYPE_TXT, wGS(OPTION_DISKSAVETYPE).c_str());
|
||||||
|
|
||||||
|
m_IplDirJp.Attach(GetDlgItem(IDC_IPL_JP_DIR));
|
||||||
|
m_IplDirUs.Attach(GetDlgItem(IDC_IPL_US_DIR));
|
||||||
|
m_IplDirTl.Attach(GetDlgItem(IDC_IPL_TL_DIR));
|
||||||
|
|
||||||
|
CModifiedComboBox * ComboBox;
|
||||||
|
ComboBox = AddModComboBox(GetDlgItem(IDC_DISKSAVETYPE), Setting_DiskSaveType);
|
||||||
|
if (ComboBox)
|
||||||
|
{
|
||||||
|
ComboBox->AddItemW(wGS(DISKSAVE_SHADOW).c_str(), SaveDisk_ShadowFile);
|
||||||
|
ComboBox->AddItemW(wGS(DISKSAVE_RAM).c_str(), SaveDisk_RAMFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdatePageSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::HidePage()
|
||||||
|
{
|
||||||
|
ShowWindow(SW_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::ShowPage()
|
||||||
|
{
|
||||||
|
ShowWindow(SW_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::ApplySettings(bool UpdateScreen)
|
||||||
|
{
|
||||||
|
if (m_IplDirJp.IsChanged())
|
||||||
|
{
|
||||||
|
stdstr file = m_IplDirJp.GetWindowText();
|
||||||
|
g_Settings->SaveString(File_DiskIPLPath, file.c_str());
|
||||||
|
}
|
||||||
|
if (m_IplDirJp.IsReset())
|
||||||
|
{
|
||||||
|
g_Settings->DeleteSetting(File_DiskIPLPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_IplDirUs.IsChanged())
|
||||||
|
{
|
||||||
|
stdstr file = m_IplDirUs.GetWindowText();
|
||||||
|
g_Settings->SaveString(File_DiskIPLUSAPath, file.c_str());
|
||||||
|
}
|
||||||
|
if (m_IplDirUs.IsReset())
|
||||||
|
{
|
||||||
|
g_Settings->DeleteSetting(File_DiskIPLUSAPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_IplDirTl.IsChanged())
|
||||||
|
{
|
||||||
|
stdstr file = m_IplDirTl.GetWindowText();
|
||||||
|
g_Settings->SaveString(File_DiskIPLTOOLPath, file.c_str());
|
||||||
|
}
|
||||||
|
if (m_IplDirTl.IsReset())
|
||||||
|
{
|
||||||
|
g_Settings->DeleteSetting(File_DiskIPLTOOLPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSettingsPageImpl<CDiskDrivePage>::ApplySettings(UpdateScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDiskDrivePage::EnableReset(void)
|
||||||
|
{
|
||||||
|
if (CSettingsPageImpl<CDiskDrivePage>::EnableReset()) { return true; }
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::ResetPage()
|
||||||
|
{
|
||||||
|
CSettingsPageImpl<CDiskDrivePage>::ResetPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::SelectIplDirJp(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
SelectFile(DIR_SELECT_PLUGIN, m_IplDirJp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::SelectIplDirUs(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
SelectFile(DIR_SELECT_PLUGIN, m_IplDirUs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::SelectIplDirTl(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
SelectFile(DIR_SELECT_PLUGIN, m_IplDirTl);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::IplDirJpChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
if (m_InUpdateSettings) { return; }
|
||||||
|
m_IplDirJp.SetChanged(true);
|
||||||
|
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::IplDirUsChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
if (m_InUpdateSettings) { return; }
|
||||||
|
m_IplDirUs.SetChanged(true);
|
||||||
|
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::IplDirTlChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
if (m_InUpdateSettings) { return; }
|
||||||
|
m_IplDirTl.SetChanged(true);
|
||||||
|
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::UpdatePageSettings(void)
|
||||||
|
{
|
||||||
|
m_InUpdateSettings = true;
|
||||||
|
CSettingsPageImpl<CDiskDrivePage>::UpdatePageSettings();
|
||||||
|
|
||||||
|
stdstr File;
|
||||||
|
g_Settings->LoadStringVal(File_DiskIPLPath, File);
|
||||||
|
m_IplDirJp.SetWindowText(File.c_str());
|
||||||
|
g_Settings->LoadStringVal(File_DiskIPLUSAPath, File);
|
||||||
|
m_IplDirUs.SetWindowText(File.c_str());
|
||||||
|
g_Settings->LoadStringVal(File_DiskIPLTOOLPath, File);
|
||||||
|
m_IplDirTl.SetWindowText(File.c_str());
|
||||||
|
|
||||||
|
m_InUpdateSettings = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDiskDrivePage::SelectFile(LanguageStringID /*Title*/, CModifiedEditBox & EditBox)
|
||||||
|
{
|
||||||
|
const char * Filter = "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";
|
||||||
|
|
||||||
|
CPath FileName;
|
||||||
|
if (FileName.SelectFile(m_hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
|
||||||
|
{
|
||||||
|
EditBox.SetChanged(true);
|
||||||
|
EditBox.SetWindowText(FileName);
|
||||||
|
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class CDiskDrivePage :
|
||||||
|
public CSettingsPageImpl<CDiskDrivePage>,
|
||||||
|
public CSettingsPage
|
||||||
|
{
|
||||||
|
|
||||||
|
BEGIN_MSG_MAP_EX(CDiskDrivePage)
|
||||||
|
COMMAND_ID_HANDLER_EX(IDC_SELECT_IPL_JP_DIR, SelectIplDirJp)
|
||||||
|
COMMAND_ID_HANDLER_EX(IDC_SELECT_IPL_US_DIR, SelectIplDirUs)
|
||||||
|
COMMAND_ID_HANDLER_EX(IDC_SELECT_IPL_TL_DIR, SelectIplDirTl)
|
||||||
|
COMMAND_HANDLER_EX(IDC_IPL_JP_DIR, EN_UPDATE, IplDirJpChanged)
|
||||||
|
COMMAND_HANDLER_EX(IDC_IPL_US_DIR, EN_UPDATE, IplDirUsChanged)
|
||||||
|
COMMAND_HANDLER_EX(IDC_IPL_TL_DIR, EN_UPDATE, IplDirTlChanged)
|
||||||
|
COMMAND_HANDLER_EX(IDC_DISKSAVETYPE, LBN_SELCHANGE, ComboBoxChanged)
|
||||||
|
END_MSG_MAP()
|
||||||
|
|
||||||
|
enum { IDD = IDD_Settings_DiskDrive };
|
||||||
|
|
||||||
|
public:
|
||||||
|
CDiskDrivePage(HWND hParent, const RECT & rcDispay );
|
||||||
|
|
||||||
|
LanguageStringID PageTitle ( void ) { return TAB_DISKDRIVE; }
|
||||||
|
void HidePage ( void );
|
||||||
|
void ShowPage ( void );
|
||||||
|
void ApplySettings ( bool UpdateScreen );
|
||||||
|
bool EnableReset ( void );
|
||||||
|
void ResetPage ( void );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SelectIplDirJp(UINT Code, int id, HWND ctl);
|
||||||
|
void SelectIplDirUs(UINT Code, int id, HWND ctl);
|
||||||
|
void SelectIplDirTl(UINT Code, int id, HWND ctl);
|
||||||
|
|
||||||
|
void IplDirJpChanged(UINT Code, int id, HWND ctl);
|
||||||
|
void IplDirUsChanged(UINT Code, int id, HWND ctl);
|
||||||
|
void IplDirTlChanged(UINT Code, int id, HWND ctl);
|
||||||
|
|
||||||
|
void UpdatePageSettings(void);
|
||||||
|
void SelectFile(LanguageStringID Title, CModifiedEditBox & EditBox);
|
||||||
|
CModifiedEditBox m_IplDirJp;
|
||||||
|
CModifiedEditBox m_IplDirUs;
|
||||||
|
CModifiedEditBox m_IplDirTl;
|
||||||
|
|
||||||
|
bool m_InUpdateSettings;
|
||||||
|
};
|
Loading…
Reference in New Issue