mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
GLideNUI-wtl: Start to add code for handling profiles
This commit is contained in:
parent
2792ae8879
commit
5cb23ede3a
|
@ -9,15 +9,20 @@
|
||||||
#include "config-texture.h"
|
#include "config-texture.h"
|
||||||
#include "config-osd.h"
|
#include "config-osd.h"
|
||||||
#include "config-debug.h"
|
#include "config-debug.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
CConfigDlg::CConfigDlg() :
|
CConfigDlg::CConfigDlg() :
|
||||||
m_blockReInit(false),
|
m_blockReInit(false),
|
||||||
m_Saved(false)
|
m_EmulationTab(NULL),
|
||||||
|
m_Saved(false),
|
||||||
|
m_TabLeft(0),
|
||||||
|
m_ProfileLeft(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigDlg::~CConfigDlg()
|
CConfigDlg::~CConfigDlg()
|
||||||
{
|
{
|
||||||
|
m_EmulationTab = NULL;
|
||||||
for (size_t i = 0; i < m_TabWindows.size(); i++)
|
for (size_t i = 0; i < m_TabWindows.size(); i++)
|
||||||
{
|
{
|
||||||
delete m_TabWindows[i];
|
delete m_TabWindows[i];
|
||||||
|
@ -42,18 +47,118 @@ LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPar
|
||||||
HICON hIconSmall = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
|
HICON hIconSmall = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
|
||||||
SetIcon(hIconSmall, FALSE);
|
SetIcon(hIconSmall, FALSE);
|
||||||
|
|
||||||
|
m_EmulationTab = new CEmulationTab(*this);
|
||||||
|
|
||||||
m_Tabs.Attach(GetDlgItem(IDC_TABS));
|
m_Tabs.Attach(GetDlgItem(IDC_TABS));
|
||||||
AddTab(L"Video", new CVideoTab);
|
AddTab(L"Video", new CVideoTab);
|
||||||
AddTab(L"Emulation", new CEmulationTab);
|
AddTab(L"Emulation", m_EmulationTab);
|
||||||
AddTab(L"Frame buffer", new CFrameBufferTab);
|
AddTab(L"Frame buffer", new CFrameBufferTab);
|
||||||
AddTab(L"Texture enhancement", new CTextureEnhancementTab);
|
AddTab(L"Texture enhancement", new CTextureEnhancementTab);
|
||||||
AddTab(L"OSD", new COsdTab);
|
AddTab(L"OSD", new COsdTab);
|
||||||
AddTab(L"Debug", new CDebugTab);
|
AddTab(L"Debug", new CDebugTab);
|
||||||
|
|
||||||
|
RECT Rect;
|
||||||
|
GetDlgItem(IDC_TABS).GetWindowRect(&Rect);
|
||||||
|
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
|
||||||
|
m_TabLeft = Rect.left;
|
||||||
|
|
||||||
|
if (m_romName != NULL)
|
||||||
|
{
|
||||||
|
std::wstring RomName(ToUTF16(m_romName));
|
||||||
|
CWindow dlgItem = GetDlgItem(IDC_GAME_PROFILE_NAME);
|
||||||
|
CDC dc;
|
||||||
|
dc.CreateCompatibleDC(NULL);
|
||||||
|
dc.SelectFont(dlgItem.GetFont());
|
||||||
|
SIZE size;
|
||||||
|
dc.GetTextExtent(RomName.c_str(), RomName.length(), &size);
|
||||||
|
|
||||||
|
RECT Rect;
|
||||||
|
dlgItem.GetWindowRect(&Rect);
|
||||||
|
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
|
||||||
|
Rect.right = Rect.left + size.cx;
|
||||||
|
dlgItem.MoveWindow(&Rect);
|
||||||
|
dlgItem.SetWindowText(RomName.c_str());
|
||||||
|
|
||||||
|
m_ProfileLeft = Rect.right + 10;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetDlgItem(IDC_SETTINGS_PROFILE_STATIC).GetWindowRect(&Rect);
|
||||||
|
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
|
||||||
|
m_ProfileLeft = Rect.left;
|
||||||
|
}
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CConfigDlg::OnCustomSettingsToggled(bool checked)
|
||||||
|
{
|
||||||
|
if (m_hWnd == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
checked = m_romName != NULL ? checked : false;
|
||||||
|
GetDlgItem(IDC_GAME_PROFILE).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE);
|
||||||
|
GetDlgItem(IDC_SAVE_SETTINGS_STATIC).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE);
|
||||||
|
GetDlgItem(IDC_GAME_PROFILE_NAME).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE);
|
||||||
|
GetDlgItem(IDC_USE_PROFILE).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE);
|
||||||
|
|
||||||
|
int32_t Move = 0;
|
||||||
|
if (checked)
|
||||||
|
{
|
||||||
|
RECT Rect;
|
||||||
|
CWindow UseProfile = GetDlgItem(IDC_USE_PROFILE);
|
||||||
|
UseProfile.GetWindowRect(&Rect);
|
||||||
|
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
|
||||||
|
Move = Rect.left - m_ProfileLeft;
|
||||||
|
if (Move != 0)
|
||||||
|
{
|
||||||
|
Rect.left -= Move;
|
||||||
|
Rect.right -= Move;
|
||||||
|
UseProfile.MoveWindow(&Rect);
|
||||||
|
}
|
||||||
|
uint32_t Left = Rect.right + 7;
|
||||||
|
|
||||||
|
CWindow ProfileStatic = GetDlgItem(IDC_SETTINGS_PROFILE_STATIC);
|
||||||
|
ProfileStatic.GetWindowRect(&Rect);
|
||||||
|
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
|
||||||
|
Move = Rect.left - Left;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RECT Rect;
|
||||||
|
GetDlgItem(IDC_SETTINGS_PROFILE_STATIC).GetWindowRect(&Rect);
|
||||||
|
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
|
||||||
|
|
||||||
|
Move = Rect.left - m_TabLeft;
|
||||||
|
}
|
||||||
|
if (Move != 0)
|
||||||
|
{
|
||||||
|
int nID[] =
|
||||||
|
{
|
||||||
|
IDC_SETTINGS_PROFILE_STATIC,
|
||||||
|
IDC_PROFILE,
|
||||||
|
IDC_REMOVE_PROFILE,
|
||||||
|
};
|
||||||
|
|
||||||
|
RECT Rect;
|
||||||
|
GetDlgItem(nID[0]).GetWindowRect(&Rect);
|
||||||
|
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(nID) / sizeof(nID[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
CWindow window = GetDlgItem(nID[i]);
|
||||||
|
window.GetWindowRect(&Rect);
|
||||||
|
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
|
||||||
|
|
||||||
|
Rect.left -= Move;
|
||||||
|
Rect.right -= Move;
|
||||||
|
window.MoveWindow(&Rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CConfigDlg::SaveSettings()
|
void CConfigDlg::SaveSettings()
|
||||||
{
|
{
|
||||||
m_Saved = true;
|
m_Saved = true;
|
||||||
|
@ -110,8 +215,15 @@ void CConfigDlg::Init(bool reInit, bool blockCustomSettings)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_blockReInit = true;
|
m_blockReInit = true;
|
||||||
|
bool CustomSettings = m_EmulationTab != NULL && CButton(m_EmulationTab->GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED;
|
||||||
|
|
||||||
if (reInit)
|
/*if (reInit && m_romName != NULL &&
|
||||||
|
m_EmulationTab
|
||||||
|
ui->customSettingsCheckBox->isChecked() && ui->settingsDestGameRadioButton->isChecked())
|
||||||
|
{
|
||||||
|
loadCustomRomSettings(m_strIniPath, m_romName);
|
||||||
|
}
|
||||||
|
else*/ if (reInit)
|
||||||
{
|
{
|
||||||
loadSettings(m_strIniPath.c_str());
|
loadSettings(m_strIniPath.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
class CEmulationTab;
|
||||||
|
|
||||||
class CConfigDlg :
|
class CConfigDlg :
|
||||||
public CDialogImpl<CConfigDlg>
|
public CDialogImpl<CConfigDlg>
|
||||||
{
|
{
|
||||||
|
@ -26,6 +28,7 @@ public:
|
||||||
void setIniPath(const std::string & IniPath);
|
void setIniPath(const std::string & IniPath);
|
||||||
void setRomName(const char * RomName);
|
void setRomName(const char * RomName);
|
||||||
bool Saved(void) const { return m_Saved; }
|
bool Saved(void) const { return m_Saved; }
|
||||||
|
void OnCustomSettingsToggled(bool checked);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
|
@ -46,6 +49,8 @@ protected:
|
||||||
std::string m_strIniPath;
|
std::string m_strIniPath;
|
||||||
const char * m_romName;
|
const char * m_romName;
|
||||||
bool m_blockReInit;
|
bool m_blockReInit;
|
||||||
|
CEmulationTab * m_EmulationTab;
|
||||||
|
uint32_t m_TabLeft, m_ProfileLeft;
|
||||||
bool m_Saved;
|
bool m_Saved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -2,9 +2,11 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "../Config.h"
|
#include "../Config.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
#include "ConfigDlg.h"
|
||||||
|
|
||||||
CEmulationTab::CEmulationTab() :
|
CEmulationTab::CEmulationTab(CConfigDlg & Dlg) :
|
||||||
CConfigTab(IDD_TAB_EMULATION)
|
CConfigTab(IDD_TAB_EMULATION),
|
||||||
|
m_Dlg(Dlg)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,11 +58,17 @@ void CEmulationTab::OnGammaCorrection(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEmulationTab::OnPerGameSettings(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
m_Dlg.OnCustomSettingsToggled(CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED);
|
||||||
|
}
|
||||||
|
|
||||||
void CEmulationTab::LoadSettings(bool blockCustomSettings)
|
void CEmulationTab::LoadSettings(bool blockCustomSettings)
|
||||||
{
|
{
|
||||||
if (!blockCustomSettings)
|
if (!blockCustomSettings)
|
||||||
{
|
{
|
||||||
CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).SetCheck(config.generalEmulation.enableCustomSettings != 0 ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).SetCheck(config.generalEmulation.enableCustomSettings != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
m_Dlg.OnCustomSettingsToggled(config.generalEmulation.enableCustomSettings != 0);
|
||||||
}
|
}
|
||||||
CButton(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING)).SetCheck(config.generalEmulation.enableLOD != 0 ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING)).SetCheck(config.generalEmulation.enableLOD != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
CButton(GetDlgItem(IDC_CHK_NOISE)).SetCheck(config.generalEmulation.enableNoise != 0 ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_CHK_NOISE)).SetCheck(config.generalEmulation.enableNoise != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "wtl-BitmapPicture.h"
|
#include "wtl-BitmapPicture.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
class CConfigDlg;
|
||||||
|
|
||||||
class CEmulationTab :
|
class CEmulationTab :
|
||||||
public CConfigTab
|
public CConfigTab
|
||||||
{
|
{
|
||||||
|
@ -13,13 +15,15 @@ public:
|
||||||
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
|
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
|
||||||
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
|
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
|
||||||
COMMAND_HANDLER_EX(IDC_CHK_GAMMA_CORRECTION, BN_CLICKED, OnGammaCorrection)
|
COMMAND_HANDLER_EX(IDC_CHK_GAMMA_CORRECTION, BN_CLICKED, OnGammaCorrection)
|
||||||
|
COMMAND_HANDLER_EX(IDC_CHK_USE_PER_GAME, BN_CLICKED, OnPerGameSettings)
|
||||||
REFLECT_NOTIFICATIONS()
|
REFLECT_NOTIFICATIONS()
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
CEmulationTab();
|
CEmulationTab(CConfigDlg & Dlg);
|
||||||
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
|
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
|
||||||
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
void OnGammaCorrection(UINT /*Code*/, int id, HWND /*ctl*/);
|
void OnGammaCorrection(UINT /*Code*/, int id, HWND /*ctl*/);
|
||||||
|
void OnPerGameSettings(UINT /*Code*/, int id, HWND /*ctl*/);
|
||||||
void LoadSettings(bool /*blockCustomSettings*/);
|
void LoadSettings(bool /*blockCustomSettings*/);
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
|
|
||||||
|
@ -29,4 +33,5 @@ private:
|
||||||
CEdit m_GamaTxt, m_N64ResMultiplerTxt;
|
CEdit m_GamaTxt, m_N64ResMultiplerTxt;
|
||||||
CUpDownCtrl m_GamaSpin, m_N64ResMultiplerSpin;
|
CUpDownCtrl m_GamaSpin, m_N64ResMultiplerSpin;
|
||||||
CBitmapPicture m_GammaIcon;
|
CBitmapPicture m_GammaIcon;
|
||||||
|
CConfigDlg & m_Dlg;
|
||||||
};
|
};
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user