[Project64] remove some of the #ifdef WINDOWS_UI from settings pages

This commit is contained in:
zilmar 2015-11-07 12:11:25 +11:00
parent 6585657d05
commit a1d9af57a6
18 changed files with 645 additions and 678 deletions

Binary file not shown.

View File

@ -31,13 +31,14 @@ struct RECT_STRUCT
long bottom; long bottom;
}; };
struct WINDOWS_PAINTSTRUCT { struct WINDOWS_PAINTSTRUCT
HDC hdc; {
int fErase; HDC hdc;
RECT_STRUCT rcPaint; int fErase;
int fRestore; RECT_STRUCT rcPaint;
int fIncUpdate; int fRestore;
BYTE rgbReserved[32]; int fIncUpdate;
BYTE rgbReserved[32];
}; };
#define CALLBACK __stdcall #define CALLBACK __stdcall
@ -49,9 +50,7 @@ class CN64System;
// Remove this to test compilation outside of the Windows ATL environment. // Remove this to test compilation outside of the Windows ATL environment.
#endif #endif
#ifdef WINDOWS_UI
#include <WTL App.h> #include <WTL App.h>
#endif
#include <User Interface/MenuShortCuts.h> #include <User Interface/MenuShortCuts.h>
#include ".\\User Interface\\Rom Browser.h" #include ".\\User Interface\\Rom Browser.h"
@ -61,6 +60,4 @@ class CN64System;
#include ".\\User Interface\\Notification Class.h" #include ".\\User Interface\\Notification Class.h"
#include ".\\User Interface\\Frame Per Second Class.h" #include ".\\User Interface\\Frame Per Second Class.h"
#include ".\\User Interface\\resource.h" #include ".\\User Interface\\resource.h"
#ifdef WINDOWS_UI
#include ".\\User Interface\\Settings Config.h" #include ".\\User Interface\\Settings Config.h"
#endif

View File

@ -10,7 +10,6 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
CAdvancedOptionsPage::CAdvancedOptionsPage (HWND hParent, const RECT & rcDispay ) CAdvancedOptionsPage::CAdvancedOptionsPage (HWND hParent, const RECT & rcDispay )
@ -71,5 +70,4 @@ bool CAdvancedOptionsPage::EnableReset ( void )
void CAdvancedOptionsPage::ResetPage() void CAdvancedOptionsPage::ResetPage()
{ {
CSettingsPageImpl<CAdvancedOptionsPage>::ResetPage(); CSettingsPageImpl<CAdvancedOptionsPage>::ResetPage();
} }
#endif

View File

@ -10,18 +10,17 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
COptionsDirectoriesPage::COptionsDirectoriesPage (HWND hParent, const RECT & rcDispay ) : COptionsDirectoriesPage::COptionsDirectoriesPage(HWND hParent, const RECT & rcDispay) :
m_InUpdateSettings(false) m_InUpdateSettings(false)
{ {
Create(hParent); Create(hParent);
if (m_hWnd == NULL) if (m_hWnd == NULL)
{ {
return; return;
} }
SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW); SetWindowPos(HWND_TOP, &rcDispay, SWP_HIDEWINDOW);
m_PluginGroup.Attach(GetDlgItem(IDC_DIR_FRAME1)); m_PluginGroup.Attach(GetDlgItem(IDC_DIR_FRAME1));
m_AutoSaveGroup.Attach(GetDlgItem(IDC_DIR_FRAME3)); m_AutoSaveGroup.Attach(GetDlgItem(IDC_DIR_FRAME3));
@ -47,7 +46,7 @@ COptionsDirectoriesPage::COptionsDirectoriesPage (HWND hParent, const RECT & rcD
m_TextureSelected.Attach(GetDlgItem(IDC_TEXTURE_OTHER)); m_TextureSelected.Attach(GetDlgItem(IDC_TEXTURE_OTHER));
//Set Text language for the dialog box //Set Text language for the dialog box
::SetWindowTextW(m_PluginGroup.m_hWnd, GS(DIR_PLUGIN)); ::SetWindowTextW(m_PluginGroup.m_hWnd, GS(DIR_PLUGIN));
::SetWindowTextW(m_AutoSaveGroup.m_hWnd, GS(DIR_AUTO_SAVE)); ::SetWindowTextW(m_AutoSaveGroup.m_hWnd, GS(DIR_AUTO_SAVE));
::SetWindowTextW(m_InstantSaveGroup.m_hWnd, GS(DIR_INSTANT_SAVE)); ::SetWindowTextW(m_InstantSaveGroup.m_hWnd, GS(DIR_INSTANT_SAVE));
::SetWindowTextW(m_ScreenShotGroup.m_hWnd, GS(DIR_SCREEN_SHOT)); ::SetWindowTextW(m_ScreenShotGroup.m_hWnd, GS(DIR_SCREEN_SHOT));
@ -56,25 +55,25 @@ COptionsDirectoriesPage::COptionsDirectoriesPage (HWND hParent, const RECT & rcD
UpdatePageSettings(); UpdatePageSettings();
} }
int CALLBACK COptionsDirectoriesPage::SelectDirCallBack (HWND hwnd,DWORD uMsg,DWORD /*lp*/, DWORD lpData) int CALLBACK COptionsDirectoriesPage::SelectDirCallBack(HWND hwnd, DWORD uMsg, DWORD /*lp*/, DWORD lpData)
{ {
switch(uMsg) switch (uMsg)
{ {
case BFFM_INITIALIZED: case BFFM_INITIALIZED:
// WParam is TRUE since you are passing a path. // WParam is TRUE since you are passing a path.
// It would be FALSE if you were passing a pidl. // It would be FALSE if you were passing a pidl.
if (lpData) if (lpData)
{ {
SendMessage(hwnd,BFFM_SETSELECTION,TRUE,lpData); SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
} }
break; break;
} }
return 0; return 0;
} }
void COptionsDirectoriesPage::SelectDirectory( LanguageStringID Title, CModifiedEditBox & EditBox, CModifiedButton & Default, CModifiedButton & selected ) void COptionsDirectoriesPage::SelectDirectory(LanguageStringID Title, CModifiedEditBox & EditBox, CModifiedButton & Default, CModifiedButton & selected)
{ {
wchar_t Buffer[MAX_PATH], Directory[MAX_PATH]; wchar_t Buffer[MAX_PATH], Directory[MAX_PATH];
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
BROWSEINFOW bi; BROWSEINFOW bi;
@ -87,80 +86,80 @@ void COptionsDirectoriesPage::SelectDirectory( LanguageStringID Title, CModified
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = (BFFCALLBACK)SelectDirCallBack; bi.lpfn = (BFFCALLBACK)SelectDirCallBack;
bi.lParam = (DWORD)InitialDir.c_str(); bi.lParam = (DWORD)InitialDir.c_str();
if ((pidl = SHBrowseForFolderW(&bi)) != NULL) if ((pidl = SHBrowseForFolderW(&bi)) != NULL)
{ {
if (SHGetPathFromIDListW(pidl, Directory)) if (SHGetPathFromIDListW(pidl, Directory))
{ {
stdstr path; stdstr path;
CPath SelectedDir(path.FromUTF16(Directory),""); CPath SelectedDir(path.FromUTF16(Directory), "");
EditBox.SetChanged(true); EditBox.SetChanged(true);
EditBox.SetWindowText(SelectedDir); EditBox.SetWindowText(SelectedDir);
Default.SetChanged(true); Default.SetChanged(true);
Default.SetCheck(BST_UNCHECKED); Default.SetCheck(BST_UNCHECKED);
selected.SetCheck(BM_SETCHECK); selected.SetCheck(BM_SETCHECK);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
} }
} }
void COptionsDirectoriesPage::PluginDirChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::PluginDirChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
if (m_InUpdateSettings) { return; } if (m_InUpdateSettings) { return; }
m_PluginDir.SetChanged(true); m_PluginDir.SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsDirectoriesPage::AutoSaveDirChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::AutoSaveDirChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
if (m_InUpdateSettings) { return; } if (m_InUpdateSettings) { return; }
m_AutoSaveDir.SetChanged(true); m_AutoSaveDir.SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsDirectoriesPage::InstantSaveDirChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::InstantSaveDirChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
if (m_InUpdateSettings) { return; } if (m_InUpdateSettings) { return; }
m_InstantSaveDir.SetChanged(true); m_InstantSaveDir.SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsDirectoriesPage::SnapShotDirChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::SnapShotDirChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
if (m_InUpdateSettings) { return; } if (m_InUpdateSettings) { return; }
m_ScreenShotDir.SetChanged(true); m_ScreenShotDir.SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsDirectoriesPage::TextureDirChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::TextureDirChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
if (m_InUpdateSettings) { return; } if (m_InUpdateSettings) { return; }
m_TextureDir.SetChanged(true); m_TextureDir.SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsDirectoriesPage::SelectPluginDir ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::SelectPluginDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
SelectDirectory(DIR_SELECT_PLUGIN,m_PluginDir,m_PluginDefault, m_PluginSelected); SelectDirectory(DIR_SELECT_PLUGIN, m_PluginDir, m_PluginDefault, m_PluginSelected);
} }
void COptionsDirectoriesPage::SelectAutoDir ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::SelectAutoDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
SelectDirectory(DIR_SELECT_AUTO,m_AutoSaveDir,m_AutoSaveDefault, m_AutoSaveSelected); SelectDirectory(DIR_SELECT_AUTO, m_AutoSaveDir, m_AutoSaveDefault, m_AutoSaveSelected);
} }
void COptionsDirectoriesPage::SelectInstantDir ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::SelectInstantDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
SelectDirectory(DIR_SELECT_INSTANT,m_InstantSaveDir,m_InstantDefault, m_InstantSelected); SelectDirectory(DIR_SELECT_INSTANT, m_InstantSaveDir, m_InstantDefault, m_InstantSelected);
} }
void COptionsDirectoriesPage::SelectSnapShotDir ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::SelectSnapShotDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
SelectDirectory(DIR_SELECT_SCREEN,m_ScreenShotDir,m_ScreenShotDefault, m_ScreenShotSelected); SelectDirectory(DIR_SELECT_SCREEN, m_ScreenShotDir, m_ScreenShotDefault, m_ScreenShotSelected);
} }
void COptionsDirectoriesPage::SelectTextureDir ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsDirectoriesPage::SelectTextureDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
SelectDirectory(DIR_SELECT_TEXTURE,m_TextureDir,m_TextureDefault, m_TextureSelected); SelectDirectory(DIR_SELECT_TEXTURE, m_TextureDir, m_TextureDefault, m_TextureSelected);
} }
void COptionsDirectoriesPage::UpdatePageSettings() void COptionsDirectoriesPage::UpdatePageSettings()
@ -168,42 +167,42 @@ void COptionsDirectoriesPage::UpdatePageSettings()
stdstr Directory; stdstr Directory;
m_InUpdateSettings = true; m_InUpdateSettings = true;
m_PluginDir.SetChanged(g_Settings->LoadStringVal(Directory_PluginSelected,Directory)); m_PluginDir.SetChanged(g_Settings->LoadStringVal(Directory_PluginSelected, Directory));
m_PluginDir.SetWindowText(Directory.c_str()); m_PluginDir.SetWindowText(Directory.c_str());
m_AutoSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_NativeSaveSelected,Directory)); m_AutoSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_NativeSaveSelected, Directory));
m_AutoSaveDir.SetWindowText(Directory.c_str()); m_AutoSaveDir.SetWindowText(Directory.c_str());
m_InstantSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_InstantSaveSelected,Directory)); m_InstantSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_InstantSaveSelected, Directory));
m_InstantSaveDir.SetWindowText(Directory.c_str()); m_InstantSaveDir.SetWindowText(Directory.c_str());
m_ScreenShotDir.SetChanged(g_Settings->LoadStringVal(Directory_SnapShotSelected,Directory)); m_ScreenShotDir.SetChanged(g_Settings->LoadStringVal(Directory_SnapShotSelected, Directory));
m_ScreenShotDir.SetWindowText(Directory.c_str()); m_ScreenShotDir.SetWindowText(Directory.c_str());
m_TextureDir.SetChanged(g_Settings->LoadStringVal(Directory_TextureSelected,Directory)); m_TextureDir.SetChanged(g_Settings->LoadStringVal(Directory_TextureSelected, Directory));
m_TextureDir.SetWindowText(Directory.c_str()); m_TextureDir.SetWindowText(Directory.c_str());
bool UseSelected; bool UseSelected;
m_PluginDefault.SetChanged(g_Settings->LoadBool(Directory_PluginUseSelected,UseSelected)); m_PluginDefault.SetChanged(g_Settings->LoadBool(Directory_PluginUseSelected, UseSelected));
m_PluginDefault.SetCheck(!UseSelected); m_PluginDefault.SetCheck(!UseSelected);
m_PluginSelected.SetCheck(UseSelected); m_PluginSelected.SetCheck(UseSelected);
m_AutoSaveDefault.SetChanged(g_Settings->LoadBool(Directory_NativeSaveUseSelected,UseSelected)); m_AutoSaveDefault.SetChanged(g_Settings->LoadBool(Directory_NativeSaveUseSelected, UseSelected));
m_AutoSaveDefault.SetCheck(!UseSelected); m_AutoSaveDefault.SetCheck(!UseSelected);
m_AutoSaveSelected.SetCheck(UseSelected); m_AutoSaveSelected.SetCheck(UseSelected);
m_InstantDefault.SetChanged(g_Settings->LoadBool(Directory_InstantSaveUseSelected,UseSelected)); m_InstantDefault.SetChanged(g_Settings->LoadBool(Directory_InstantSaveUseSelected, UseSelected));
m_InstantDefault.SetCheck(!UseSelected); m_InstantDefault.SetCheck(!UseSelected);
m_InstantSelected.SetCheck(UseSelected); m_InstantSelected.SetCheck(UseSelected);
m_ScreenShotDefault.SetChanged(g_Settings->LoadBool(Directory_SnapShotUseSelected,UseSelected)); m_ScreenShotDefault.SetChanged(g_Settings->LoadBool(Directory_SnapShotUseSelected, UseSelected));
m_ScreenShotDefault.SetCheck(!UseSelected); m_ScreenShotDefault.SetCheck(!UseSelected);
m_ScreenShotSelected.SetCheck(UseSelected); m_ScreenShotSelected.SetCheck(UseSelected);
m_TextureDefault.SetChanged(g_Settings->LoadBool(Directory_TextureUseSelected,UseSelected)); m_TextureDefault.SetChanged(g_Settings->LoadBool(Directory_TextureUseSelected, UseSelected));
m_TextureDefault.SetCheck(!UseSelected); m_TextureDefault.SetCheck(!UseSelected);
m_TextureSelected.SetCheck(UseSelected); m_TextureSelected.SetCheck(UseSelected);
m_InUpdateSettings = false; m_InUpdateSettings = false;
} }
void COptionsDirectoriesPage::UseSelectedClicked ( UINT /*Code*/, int id, HWND /*ctl*/ ) void COptionsDirectoriesPage::UseSelectedClicked(UINT /*Code*/, int id, HWND /*ctl*/)
{ {
CModifiedButton * Button = NULL; CModifiedButton * Button = NULL;
switch (id) switch (id)
@ -233,7 +232,7 @@ void COptionsDirectoriesPage::UseSelectedClicked ( UINT /*Code*/, int id, HWND /
} }
} }
Button->SetChanged(true); Button->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsDirectoriesPage::HidePage() void COptionsDirectoriesPage::HidePage()
@ -246,37 +245,37 @@ void COptionsDirectoriesPage::ShowPage()
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
} }
void COptionsDirectoriesPage::ResetDirectory( CModifiedEditBox & EditBox, SettingID Type ) void COptionsDirectoriesPage::ResetDirectory(CModifiedEditBox & EditBox, SettingID Type)
{ {
if (!EditBox.IsChanged()) if (!EditBox.IsChanged())
{ {
return; return;
} }
stdstr dir; stdstr dir;
g_Settings->LoadDefaultString(Type,dir); g_Settings->LoadDefaultString(Type, dir);
EditBox.SetWindowText(dir.c_str()); EditBox.SetWindowText(dir.c_str());
EditBox.SetReset(true); EditBox.SetReset(true);
} }
void COptionsDirectoriesPage::ResetDefaultSelected ( CModifiedButton & ButtonDefault, CModifiedButton & ButtonSelected, SettingID Type ) void COptionsDirectoriesPage::ResetDefaultSelected(CModifiedButton & ButtonDefault, CModifiedButton & ButtonSelected, SettingID Type)
{ {
if (!ButtonDefault.IsChanged()) if (!ButtonDefault.IsChanged())
{ {
return; return;
} }
bool UseSelected; bool UseSelected;
g_Settings->LoadDefaultBool(Type,UseSelected); g_Settings->LoadDefaultBool(Type, UseSelected);
ButtonDefault.SetCheck(!UseSelected); ButtonDefault.SetCheck(!UseSelected);
ButtonSelected.SetCheck(UseSelected); ButtonSelected.SetCheck(UseSelected);
ButtonDefault.SetReset(true); ButtonDefault.SetReset(true);
} }
void COptionsDirectoriesPage::UpdateDirectory( CModifiedEditBox & EditBox, SettingID Type ) void COptionsDirectoriesPage::UpdateDirectory(CModifiedEditBox & EditBox, SettingID Type)
{ {
if (EditBox.IsChanged()) if (EditBox.IsChanged())
{ {
stdstr dir = EditBox.GetWindowText(); stdstr dir = EditBox.GetWindowText();
g_Settings->SaveString(Type,dir.c_str()); g_Settings->SaveString(Type, dir.c_str());
} }
if (EditBox.IsReset()) if (EditBox.IsReset())
{ {
@ -284,13 +283,13 @@ void COptionsDirectoriesPage::UpdateDirectory( CModifiedEditBox & EditBox, Setti
} }
} }
void COptionsDirectoriesPage::UpdateDefaultSelected ( CModifiedButton & Button, SettingID Type ) void COptionsDirectoriesPage::UpdateDefaultSelected(CModifiedButton & Button, SettingID Type)
{ {
if (Button.IsChanged()) if (Button.IsChanged())
{ {
bool bUseSelected = (Button.GetCheck() & BST_CHECKED) == 0; bool bUseSelected = (Button.GetCheck() & BST_CHECKED) == 0;
g_Settings->SaveBool(Type,bUseSelected); g_Settings->SaveBool(Type, bUseSelected);
if (Type == Directory_TextureUseSelected && !bUseSelected) if (Type == Directory_TextureUseSelected && !bUseSelected)
{ {
g_Settings->DeleteSetting(Directory_TextureSelected); g_Settings->DeleteSetting(Directory_TextureSelected);
@ -302,27 +301,27 @@ void COptionsDirectoriesPage::UpdateDefaultSelected ( CModifiedButton & Button,
} }
} }
void COptionsDirectoriesPage::ApplySettings( bool UpdateScreen ) void COptionsDirectoriesPage::ApplySettings(bool UpdateScreen)
{ {
UpdateDirectory(m_PluginDir,Directory_PluginSelected); UpdateDirectory(m_PluginDir, Directory_PluginSelected);
UpdateDirectory(m_AutoSaveDir,Directory_NativeSaveSelected); UpdateDirectory(m_AutoSaveDir, Directory_NativeSaveSelected);
UpdateDirectory(m_InstantSaveDir,Directory_InstantSaveSelected); UpdateDirectory(m_InstantSaveDir, Directory_InstantSaveSelected);
UpdateDirectory(m_ScreenShotDir,Directory_SnapShotSelected); UpdateDirectory(m_ScreenShotDir, Directory_SnapShotSelected);
UpdateDirectory(m_TextureDir,Directory_TextureSelected); UpdateDirectory(m_TextureDir, Directory_TextureSelected);
UpdateDefaultSelected(m_PluginDefault, Directory_PluginUseSelected);
UpdateDefaultSelected(m_AutoSaveDefault, Directory_NativeSaveUseSelected);
UpdateDefaultSelected(m_InstantDefault, Directory_InstantSaveUseSelected);
UpdateDefaultSelected(m_ScreenShotDefault, Directory_SnapShotUseSelected);
UpdateDefaultSelected(m_TextureDefault, Directory_TextureUseSelected);
UpdateDefaultSelected(m_PluginDefault,Directory_PluginUseSelected);
UpdateDefaultSelected(m_AutoSaveDefault,Directory_NativeSaveUseSelected);
UpdateDefaultSelected(m_InstantDefault,Directory_InstantSaveUseSelected);
UpdateDefaultSelected(m_ScreenShotDefault,Directory_SnapShotUseSelected);
UpdateDefaultSelected(m_TextureDefault,Directory_TextureUseSelected);
if (UpdateScreen) if (UpdateScreen)
{ {
UpdatePageSettings(); UpdatePageSettings();
} }
} }
bool COptionsDirectoriesPage::EnableReset ( void ) bool COptionsDirectoriesPage::EnableReset(void)
{ {
if (m_PluginDir.IsChanged()) { return true; } if (m_PluginDir.IsChanged()) { return true; }
if (m_AutoSaveDir.IsChanged()) { return true; } if (m_AutoSaveDir.IsChanged()) { return true; }
@ -339,18 +338,17 @@ bool COptionsDirectoriesPage::EnableReset ( void )
void COptionsDirectoriesPage::ResetPage() void COptionsDirectoriesPage::ResetPage()
{ {
ResetDirectory(m_PluginDir,Directory_PluginSelected); ResetDirectory(m_PluginDir, Directory_PluginSelected);
ResetDirectory(m_AutoSaveDir,Directory_NativeSaveSelected); ResetDirectory(m_AutoSaveDir, Directory_NativeSaveSelected);
ResetDirectory(m_InstantSaveDir,Directory_InstantSaveSelected); ResetDirectory(m_InstantSaveDir, Directory_InstantSaveSelected);
ResetDirectory(m_ScreenShotDir,Directory_SnapShotSelected); ResetDirectory(m_ScreenShotDir, Directory_SnapShotSelected);
ResetDirectory(m_TextureDir,Directory_TextureSelected); ResetDirectory(m_TextureDir, Directory_TextureSelected);
ResetDefaultSelected(m_PluginDefault,m_PluginSelected,Directory_PluginUseSelected); ResetDefaultSelected(m_PluginDefault, m_PluginSelected, Directory_PluginUseSelected);
ResetDefaultSelected(m_AutoSaveDefault,m_AutoSaveSelected,Directory_NativeSaveUseSelected); ResetDefaultSelected(m_AutoSaveDefault, m_AutoSaveSelected, Directory_NativeSaveUseSelected);
ResetDefaultSelected(m_InstantDefault,m_InstantSelected,Directory_InstantSaveUseSelected); ResetDefaultSelected(m_InstantDefault, m_InstantSelected, Directory_InstantSaveUseSelected);
ResetDefaultSelected(m_ScreenShotDefault,m_ScreenShotSelected,Directory_SnapShotUseSelected); ResetDefaultSelected(m_ScreenShotDefault, m_ScreenShotSelected, Directory_SnapShotUseSelected);
ResetDefaultSelected(m_TextureDefault,m_TextureSelected,Directory_TextureUseSelected); ResetDefaultSelected(m_TextureDefault, m_TextureSelected, Directory_TextureUseSelected);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
#endif

View File

@ -10,13 +10,12 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
#include "Settings Page - Game - General.h" #include "Settings Page - Game - General.h"
CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay ) CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
{ {
if (!Create(hParent,rcDispay)) if (!Create(hParent, rcDispay))
{ {
return; return;
} }
@ -35,55 +34,55 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay )
SetDlgItemTextW(m_hWnd, IDC_DELAY_DP, GS(ROM_DELAY_DP)); SetDlgItemTextW(m_hWnd, IDC_DELAY_DP, GS(ROM_DELAY_DP));
SetDlgItemTextW(m_hWnd, IDC_SYNC_AUDIO, GS(ROM_SYNC_AUDIO)); SetDlgItemTextW(m_hWnd, IDC_SYNC_AUDIO, GS(ROM_SYNC_AUDIO));
SetDlgItemTextW(m_hWnd, IDC_USE_TLB, GS(ROM_USE_TLB)); SetDlgItemTextW(m_hWnd, IDC_USE_TLB, GS(ROM_USE_TLB));
SetDlgItemTextW(m_hWnd, IDC_DELAY_SI, GS(ROM_DELAY_SI)); SetDlgItemTextW(m_hWnd, IDC_DELAY_SI, GS(ROM_DELAY_SI));
SetDlgItemTextW(m_hWnd, IDC_AUDIO_SIGNAL, GS(ROM_AUDIO_SIGNAL)); SetDlgItemTextW(m_hWnd, IDC_AUDIO_SIGNAL, GS(ROM_AUDIO_SIGNAL));
AddModCheckBox(GetDlgItem(IDC_ROM_32BIT),Game_32Bit); AddModCheckBox(GetDlgItem(IDC_ROM_32BIT), Game_32Bit);
AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO),Game_SyncViaAudio); AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO), Game_SyncViaAudio);
AddModCheckBox(GetDlgItem(IDC_ROM_FIXEDAUDIO),Game_FixedAudio); AddModCheckBox(GetDlgItem(IDC_ROM_FIXEDAUDIO), Game_FixedAudio);
AddModCheckBox(GetDlgItem(IDC_USE_TLB),Game_UseTlb); AddModCheckBox(GetDlgItem(IDC_USE_TLB), Game_UseTlb);
AddModCheckBox(GetDlgItem(IDC_DELAY_DP),Game_DelayDP); AddModCheckBox(GetDlgItem(IDC_DELAY_DP), Game_DelayDP);
AddModCheckBox(GetDlgItem(IDC_DELAY_SI),Game_DelaySI); AddModCheckBox(GetDlgItem(IDC_DELAY_SI), Game_DelaySI);
AddModCheckBox(GetDlgItem(IDC_AUDIO_SIGNAL),Game_RspAudioSignal); AddModCheckBox(GetDlgItem(IDC_AUDIO_SIGNAL), Game_RspAudioSignal);
CModifiedComboBox * ComboBox; CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE),Game_RDRamSize); ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE), Game_RDRamSize);
if (ComboBox) if (ComboBox)
{ {
ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT));
ComboBox->AddItemW(GS(RDRAM_4MB), 0x400000 ); ComboBox->AddItemW(GS(RDRAM_4MB), 0x400000);
ComboBox->AddItemW(GS(RDRAM_8MB), 0x800000 ); ComboBox->AddItemW(GS(RDRAM_8MB), 0x800000);
} }
ComboBox = AddModComboBox(GetDlgItem(IDC_SAVE_TYPE),Game_SaveChip); ComboBox = AddModComboBox(GetDlgItem(IDC_SAVE_TYPE), Game_SaveChip);
if (ComboBox) if (ComboBox)
{ {
ComboBox->SetTextField(GetDlgItem(IDC_SAVE_TYPE_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_SAVE_TYPE_TEXT));
ComboBox->AddItemW(GS(SAVE_FIRST_USED), (WPARAM)SaveChip_Auto ); ComboBox->AddItemW(GS(SAVE_FIRST_USED), (WPARAM)SaveChip_Auto);
ComboBox->AddItemW(GS(SAVE_4K_EEPROM), SaveChip_Eeprom_4K ); ComboBox->AddItemW(GS(SAVE_4K_EEPROM), SaveChip_Eeprom_4K);
ComboBox->AddItemW(GS(SAVE_16K_EEPROM), SaveChip_Eeprom_16K ); ComboBox->AddItemW(GS(SAVE_16K_EEPROM), SaveChip_Eeprom_16K);
ComboBox->AddItemW(GS(SAVE_SRAM), SaveChip_Sram ); ComboBox->AddItemW(GS(SAVE_SRAM), SaveChip_Sram);
ComboBox->AddItemW(GS(SAVE_FLASHRAM), SaveChip_FlashRam ); ComboBox->AddItemW(GS(SAVE_FLASHRAM), SaveChip_FlashRam);
} }
ComboBox = AddModComboBox(GetDlgItem(IDC_COUNTFACT),Game_CounterFactor); ComboBox = AddModComboBox(GetDlgItem(IDC_COUNTFACT), Game_CounterFactor);
if (ComboBox) if (ComboBox)
{ {
ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT));
ComboBox->AddItemW(GS(NUMBER_1), 1 ); ComboBox->AddItemW(GS(NUMBER_1), 1);
ComboBox->AddItemW(GS(NUMBER_2), 2 ); ComboBox->AddItemW(GS(NUMBER_2), 2);
ComboBox->AddItemW(GS(NUMBER_3), 3 ); ComboBox->AddItemW(GS(NUMBER_3), 3);
ComboBox->AddItemW(GS(NUMBER_4), 4 ); ComboBox->AddItemW(GS(NUMBER_4), 4);
ComboBox->AddItemW(GS(NUMBER_5), 5 ); ComboBox->AddItemW(GS(NUMBER_5), 5);
ComboBox->AddItemW(GS(NUMBER_6), 6 ); ComboBox->AddItemW(GS(NUMBER_6), 6);
} }
SetDlgItemText(IDC_GOOD_NAME,g_Settings->LoadStringVal(Game_GoodName).c_str()); SetDlgItemText(IDC_GOOD_NAME, g_Settings->LoadStringVal(Game_GoodName).c_str());
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH),Game_ViRefreshRate, false); CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH), Game_ViRefreshRate, false);
TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT)); TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_COUNTPERBYTE),Game_AiCountPerBytes, false); TxtBox = AddModTextBox(GetDlgItem(IDC_COUNTPERBYTE), Game_AiCountPerBytes, false);
TxtBox->SetTextField(GetDlgItem(IDC_COUNTPERBYTE_TEXT)); TxtBox->SetTextField(GetDlgItem(IDC_COUNTPERBYTE_TEXT));
UpdatePageSettings(); UpdatePageSettings();
@ -99,20 +98,18 @@ void CGameGeneralPage::HidePage()
ShowWindow(SW_HIDE); ShowWindow(SW_HIDE);
} }
void CGameGeneralPage::ApplySettings( bool UpdateScreen ) void CGameGeneralPage::ApplySettings(bool UpdateScreen)
{ {
CSettingsPageImpl<CGameGeneralPage>::ApplySettings(UpdateScreen); CSettingsPageImpl<CGameGeneralPage>::ApplySettings(UpdateScreen);
} }
bool CGameGeneralPage::EnableReset ( void ) bool CGameGeneralPage::EnableReset(void)
{ {
if (CSettingsPageImpl<CGameGeneralPage>::EnableReset()) { return true; } if (CSettingsPageImpl<CGameGeneralPage>::EnableReset()) { return true; }
return false; return false;
} }
void CGameGeneralPage::ResetPage() void CGameGeneralPage::ResetPage()
{ {
CSettingsPageImpl<CGameGeneralPage>::ResetPage(); CSettingsPageImpl<CGameGeneralPage>::ResetPage();
} }
#endif

View File

@ -14,36 +14,33 @@
#include <N64 System/N64 Types.h> #include <N64 System/N64 Types.h>
class CGameGeneralPage : class CGameGeneralPage :
public CSettingsPageImpl<CGameGeneralPage>, public CSettingsPageImpl<CGameGeneralPage>,
public CSettingsPage public CSettingsPage
{ {
BEGIN_MSG_MAP_EX(CGameGeneralPage)
COMMAND_HANDLER_EX(IDC_RDRAM_SIZE,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_HANDLER_EX(IDC_SAVE_TYPE,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTFACT,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_32BIT,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SYNC_AUDIO,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_FIXEDAUDIO,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_USE_TLB,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DELAY_DP,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DELAY_SI,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL,CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_VIREFRESH,EN_UPDATE,EditBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTPERBYTE,EN_UPDATE,EditBoxChanged)
END_MSG_MAP()
BEGIN_MSG_MAP_EX(CGameGeneralPage) enum { IDD = IDD_Settings_GameGeneral };
COMMAND_HANDLER_EX(IDC_RDRAM_SIZE,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_HANDLER_EX(IDC_SAVE_TYPE,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTFACT,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_32BIT,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SYNC_AUDIO,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_FIXEDAUDIO,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_USE_TLB,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DELAY_DP,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DELAY_SI,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL,CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_VIREFRESH,EN_UPDATE,EditBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTPERBYTE,EN_UPDATE,EditBoxChanged)
END_MSG_MAP()
enum { IDD = IDD_Settings_GameGeneral };
public: public:
CGameGeneralPage(HWND hParent, const RECT & rcDispay ); CGameGeneralPage(HWND hParent, const RECT & rcDispay );
LanguageStringID PageTitle ( void ) { return TAB_ROMSETTINGS; } LanguageStringID PageTitle ( void ) { return TAB_ROMSETTINGS; }
void HidePage ( void ); void HidePage ( void );
void ShowPage ( void ); void ShowPage ( void );
void ApplySettings ( bool UpdateScreen ); void ApplySettings ( bool UpdateScreen );
bool EnableReset ( void ); bool EnableReset ( void );
void ResetPage ( void ); void ResetPage ( void );
private:
}; };

View File

@ -10,61 +10,60 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
#include "Settings Page - Game - Plugin.h" #include "Settings Page - Game - Plugin.h"
CGamePluginPage::CGamePluginPage (HWND hParent, const RECT & rcDispay ) CGamePluginPage::CGamePluginPage(HWND hParent, const RECT & rcDispay)
{ {
if (!Create(hParent,rcDispay)) if (!Create(hParent, rcDispay))
{ {
return; return;
} }
//Set the text for all gui Items
SetDlgItemTextW(m_hWnd, RSP_ABOUT,GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, GFX_ABOUT,GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, AUDIO_ABOUT,GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, CONT_ABOUT,GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, IDC_RSP_NAME,GS(PLUG_RSP)); //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, IDC_GFX_NAME,GS(PLUG_GFX)); SetDlgItemTextW(m_hWnd, RSP_ABOUT, GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, IDC_AUDIO_NAME,GS(PLUG_AUDIO)); SetDlgItemTextW(m_hWnd, GFX_ABOUT, GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, IDC_CONT_NAME,GS(PLUG_CTRL)); SetDlgItemTextW(m_hWnd, AUDIO_ABOUT, GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, CONT_ABOUT, GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, IDC_HLE_GFX,GS(PLUG_HLE_GFX));
SetDlgItemTextW(m_hWnd, IDC_HLE_AUDIO,GS(PLUG_HLE_AUDIO)); SetDlgItemTextW(m_hWnd, IDC_RSP_NAME, GS(PLUG_RSP));
SetDlgItemTextW(m_hWnd, IDC_GFX_NAME, GS(PLUG_GFX));
SetDlgItemTextW(m_hWnd, IDC_AUDIO_NAME, GS(PLUG_AUDIO));
SetDlgItemTextW(m_hWnd, IDC_CONT_NAME, GS(PLUG_CTRL));
SetDlgItemTextW(m_hWnd, IDC_HLE_GFX, GS(PLUG_HLE_GFX));
SetDlgItemTextW(m_hWnd, IDC_HLE_AUDIO, GS(PLUG_HLE_AUDIO));
m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME)); m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME));
m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME)); m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME));
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME)); m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME)); m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
AddPlugins(GFX_LIST,Game_EditPlugin_Gfx,PLUGIN_TYPE_GFX); AddPlugins(GFX_LIST, Game_EditPlugin_Gfx, PLUGIN_TYPE_GFX);
AddPlugins(AUDIO_LIST,Game_EditPlugin_Audio,PLUGIN_TYPE_AUDIO); AddPlugins(AUDIO_LIST, Game_EditPlugin_Audio, PLUGIN_TYPE_AUDIO);
AddPlugins(CONT_LIST,Game_EditPlugin_Contr,PLUGIN_TYPE_CONTROLLER); AddPlugins(CONT_LIST, Game_EditPlugin_Contr, PLUGIN_TYPE_CONTROLLER);
AddPlugins(RSP_LIST,Game_EditPlugin_RSP,PLUGIN_TYPE_RSP); AddPlugins(RSP_LIST, Game_EditPlugin_RSP, PLUGIN_TYPE_RSP);
AddModCheckBox(GetDlgItem(IDC_HLE_GFX), Game_UseHleGfx);
AddModCheckBox(GetDlgItem(IDC_HLE_AUDIO), Game_UseHleAudio);
AddModCheckBox(GetDlgItem(IDC_HLE_GFX),Game_UseHleGfx);
AddModCheckBox(GetDlgItem(IDC_HLE_AUDIO),Game_UseHleAudio);
UpdatePageSettings(); UpdatePageSettings();
} }
void CGamePluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType ) void CGamePluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE PluginType)
{ {
stdstr Default; stdstr Default;
bool PluginSelected = g_Settings->LoadStringVal(Type,Default); bool PluginSelected = g_Settings->LoadStringVal(Type, Default);
CModifiedComboBox * ComboBox; CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(ListId),Type); ComboBox = AddModComboBox(GetDlgItem(ListId), Type);
if (!PluginSelected) if (!PluginSelected)
{ {
ComboBox->SetDefault(NULL); ComboBox->SetDefault(NULL);
} }
ComboBox->AddItemW(GS(PLUG_DEFAULT), NULL); ComboBox->AddItemW(GS(PLUG_DEFAULT), NULL);
for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++ ) for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++)
{ {
const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i);
if (Plugin == NULL) if (Plugin == NULL)
@ -75,7 +74,7 @@ void CGamePluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginT
{ {
continue; continue;
} }
if (PluginSelected && _stricmp(Default.c_str(),Plugin->FileName.c_str()) == 0) if (PluginSelected && _stricmp(Default.c_str(), Plugin->FileName.c_str()) == 0)
{ {
ComboBox->SetDefault((WPARAM)Plugin); ComboBox->SetDefault((WPARAM)Plugin);
} }
@ -83,10 +82,10 @@ void CGamePluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginT
} }
} }
void CGamePluginPage::ShowAboutButton ( int id ) void CGamePluginPage::ShowAboutButton(int id)
{ {
CModifiedComboBox * ComboBox = NULL; CModifiedComboBox * ComboBox = NULL;
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{ {
if ((int)(cb_iter->second->GetMenu()) != id) if ((int)(cb_iter->second->GetMenu()) != id)
{ {
@ -100,11 +99,11 @@ void CGamePluginPage::ShowAboutButton ( int id )
return; return;
} }
int index = ComboBox->GetCurSel(); int index = ComboBox->GetCurSel();
if (index == CB_ERR) if (index == CB_ERR)
{ {
return; return;
} }
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index);
if (PluginPtr == NULL) if (PluginPtr == NULL)
{ {
@ -116,30 +115,30 @@ void CGamePluginPage::ShowAboutButton ( int id )
{ {
return; return;
} }
//Load the plugin //Load the plugin
UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); UINT LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
HMODULE hLib = LoadLibrary(Plugin->FullPath); HMODULE hLib = LoadLibrary(Plugin->FullPath);
SetErrorMode(LastErrorMode); SetErrorMode(LastErrorMode);
if (hLib == NULL) if (hLib == NULL)
{ {
return; return;
} }
//Get DLL about //Get DLL about
void (__cdecl *DllAbout) ( HWND hWnd ); void(__cdecl *DllAbout) (HWND hWnd);
DllAbout = (void (__cdecl *)(HWND))GetProcAddress( hLib, "DllAbout" ); DllAbout = (void(__cdecl *)(HWND))GetProcAddress(hLib, "DllAbout");
//call the function from the dll //call the function from the dll
DllAbout(m_hWnd); DllAbout(m_hWnd);
FreeLibrary(hLib); FreeLibrary(hLib);
} }
void CGamePluginPage::PluginItemChanged ( int id, int AboutID, bool bSetChanged ) void CGamePluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged)
{ {
CModifiedComboBox * ComboBox = NULL; CModifiedComboBox * ComboBox = NULL;
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{ {
if ((int)(cb_iter->second->GetMenu()) != id) if ((int)(cb_iter->second->GetMenu()) != id)
{ {
@ -154,9 +153,9 @@ void CGamePluginPage::PluginItemChanged ( int id, int AboutID, bool bSetChanged
} }
int index = ComboBox->GetCurSel(); int index = ComboBox->GetCurSel();
if (index == CB_ERR) if (index == CB_ERR)
{ {
return; return;
} }
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index);
if (PluginPtr) if (PluginPtr)
@ -164,50 +163,51 @@ void CGamePluginPage::PluginItemChanged ( int id, int AboutID, bool bSetChanged
const CPluginList::PLUGIN * Plugin = *PluginPtr; const CPluginList::PLUGIN * Plugin = *PluginPtr;
if (Plugin) if (Plugin)
{ {
::EnableWindow(GetDlgItem(AboutID),Plugin->AboutFunction); ::EnableWindow(GetDlgItem(AboutID), Plugin->AboutFunction);
} }
} }
if (bSetChanged) if (bSetChanged)
{ {
ComboBox->SetChanged(true); ComboBox->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
} }
void CGamePluginPage::UpdatePageSettings ( void ) void CGamePluginPage::UpdatePageSettings(void)
{ {
UpdateCheckBoxes(); UpdateCheckBoxes();
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{ {
CModifiedComboBox * ComboBox = cb_iter->second; CModifiedComboBox * ComboBox = cb_iter->second;
stdstr SelectedValue; stdstr SelectedValue;
bool PluginChanged = g_Settings->LoadStringVal(cb_iter->first,SelectedValue); bool PluginChanged = g_Settings->LoadStringVal(cb_iter->first, SelectedValue);
ComboBox->SetChanged(PluginChanged); ComboBox->SetChanged(PluginChanged);
if (PluginChanged) if (PluginChanged)
{ {
for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++ ) for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++)
{ {
const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i);
if (Plugin == NULL) if (Plugin == NULL)
{ {
continue; continue;
} }
if (_stricmp(SelectedValue.c_str(),Plugin->FileName.c_str()) != 0) if (_stricmp(SelectedValue.c_str(), Plugin->FileName.c_str()) != 0)
{ {
continue; continue;
} }
ComboBox->SetDefault((WPARAM)Plugin); ComboBox->SetDefault((WPARAM)Plugin);
} }
} else { }
else {
ComboBox->SetDefault(NULL); ComboBox->SetDefault(NULL);
} }
} }
PluginItemChanged(GFX_LIST,GFX_ABOUT,false); PluginItemChanged(GFX_LIST, GFX_ABOUT, false);
PluginItemChanged(AUDIO_LIST,AUDIO_ABOUT,false); PluginItemChanged(AUDIO_LIST, AUDIO_ABOUT, false);
PluginItemChanged(CONT_LIST,CONT_ABOUT,false); PluginItemChanged(CONT_LIST, CONT_ABOUT, false);
PluginItemChanged(RSP_LIST,RSP_ABOUT,false); PluginItemChanged(RSP_LIST, RSP_ABOUT, false);
} }
void CGamePluginPage::HidePage() void CGamePluginPage::HidePage()
@ -220,12 +220,12 @@ void CGamePluginPage::ShowPage()
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
} }
void CGamePluginPage::ApplySettings( bool UpdateScreen ) void CGamePluginPage::ApplySettings(bool UpdateScreen)
{ {
CSettingsPageImpl<CGamePluginPage>::ApplySettings(UpdateScreen); CSettingsPageImpl<CGamePluginPage>::ApplySettings(UpdateScreen);
} }
bool CGamePluginPage::EnableReset ( void ) bool CGamePluginPage::EnableReset(void)
{ {
if (CSettingsPageImpl<CGamePluginPage>::EnableReset()) { return true; } if (CSettingsPageImpl<CGamePluginPage>::EnableReset()) { return true; }
return false; return false;
@ -236,17 +236,17 @@ void CGamePluginPage::ResetPage()
CSettingsPageImpl<CGamePluginPage>::ResetPage(); CSettingsPageImpl<CGamePluginPage>::ResetPage();
} }
void CGamePluginPage::ApplyComboBoxes ( void ) void CGamePluginPage::ApplyComboBoxes(void)
{ {
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{ {
CModifiedComboBox * ComboBox = cb_iter->second; CModifiedComboBox * ComboBox = cb_iter->second;
if (ComboBox->IsChanged()) if (ComboBox->IsChanged())
{ {
int index = ComboBox->GetCurSel(); int index = ComboBox->GetCurSel();
if (index == CB_ERR) if (index == CB_ERR)
{ {
return; return;
} }
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index);
@ -261,9 +261,10 @@ void CGamePluginPage::ApplyComboBoxes ( void )
{ {
if (g_Settings->LoadStringVal(cb_iter->first) != Plugin->FileName.c_str()) if (g_Settings->LoadStringVal(cb_iter->first) != Plugin->FileName.c_str())
{ {
g_Settings->SaveString(cb_iter->first,Plugin->FileName.c_str()); g_Settings->SaveString(cb_iter->first, Plugin->FileName.c_str());
} }
} else { }
else {
g_Settings->DeleteSetting(cb_iter->first); g_Settings->DeleteSetting(cb_iter->first);
} }
} }
@ -275,7 +276,7 @@ void CGamePluginPage::ApplyComboBoxes ( void )
} }
} }
bool CGamePluginPage::ResetComboBox ( CModifiedComboBox & ComboBox, SettingID /*Type*/ ) bool CGamePluginPage::ResetComboBox(CModifiedComboBox & ComboBox, SettingID /*Type*/)
{ {
if (!ComboBox.IsChanged()) if (!ComboBox.IsChanged())
{ {
@ -300,18 +301,18 @@ bool CGamePluginPage::ResetComboBox ( CModifiedComboBox & ComboBox, SettingID /*
return false; return false;
} }
void CGamePluginPage::HleGfxChanged ( UINT /*Code*/, int id, HWND /*ctl*/ ) void CGamePluginPage::HleGfxChanged(UINT /*Code*/, int id, HWND /*ctl*/)
{ {
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{ {
CModifiedButton * Button = iter->second; CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id) if ((int)Button->GetMenu() != id)
{ {
continue; continue;
} }
if ((Button->GetCheck() & BST_CHECKED) == 0) if ((Button->GetCheck() & BST_CHECKED) == 0)
{ {
int res = MessageBoxW(m_hWnd, GS(MSG_SET_LLE_GFX_MSG),GS(MSG_SET_LLE_GFX_TITLE),MB_YESNO|MB_ICONWARNING); int res = MessageBoxW(m_hWnd, GS(MSG_SET_LLE_GFX_MSG), GS(MSG_SET_LLE_GFX_TITLE), MB_YESNO | MB_ICONWARNING);
if (res != IDYES) if (res != IDYES)
{ {
Button->SetCheck(BST_CHECKED); Button->SetCheck(BST_CHECKED);
@ -319,23 +320,23 @@ void CGamePluginPage::HleGfxChanged ( UINT /*Code*/, int id, HWND /*ctl*/ )
} }
} }
Button->SetChanged(true); Button->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
break; break;
} }
} }
void CGamePluginPage::HleAudioChanged ( UINT /*Code*/, int id, HWND /*ctl*/ ) void CGamePluginPage::HleAudioChanged(UINT /*Code*/, int id, HWND /*ctl*/)
{ {
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{ {
CModifiedButton * Button = iter->second; CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id) if ((int)Button->GetMenu() != id)
{ {
continue; continue;
} }
if ((Button->GetCheck() & BST_CHECKED) != 0) if ((Button->GetCheck() & BST_CHECKED) != 0)
{ {
int res = MessageBoxW(m_hWnd, GS(MSG_SET_HLE_AUD_MSG),GS(MSG_SET_HLE_AUD_TITLE),MB_ICONWARNING|MB_YESNO); int res = MessageBoxW(m_hWnd, GS(MSG_SET_HLE_AUD_MSG), GS(MSG_SET_HLE_AUD_TITLE), MB_ICONWARNING | MB_YESNO);
if (res != IDYES) if (res != IDYES)
{ {
Button->SetCheck(BST_UNCHECKED); Button->SetCheck(BST_UNCHECKED);
@ -343,8 +344,7 @@ void CGamePluginPage::HleAudioChanged ( UINT /*Code*/, int id, HWND /*ctl*/ )
} }
} }
Button->SetChanged(true); Button->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
break; break;
} }
} }
#endif

View File

@ -17,51 +17,51 @@ class CGamePluginPage :
public CSettingsPage public CSettingsPage
{ {
BEGIN_MSG_MAP_EX(CGamePluginPage) BEGIN_MSG_MAP_EX(CGamePluginPage)
COMMAND_HANDLER_EX(GFX_LIST,LBN_SELCHANGE,GfxPluginChanged) COMMAND_HANDLER_EX(GFX_LIST, LBN_SELCHANGE, GfxPluginChanged)
COMMAND_HANDLER_EX(AUDIO_LIST,LBN_SELCHANGE,AudioPluginChanged) COMMAND_HANDLER_EX(AUDIO_LIST, LBN_SELCHANGE, AudioPluginChanged)
COMMAND_HANDLER_EX(CONT_LIST,LBN_SELCHANGE,ControllerPluginChanged) COMMAND_HANDLER_EX(CONT_LIST, LBN_SELCHANGE, ControllerPluginChanged)
COMMAND_HANDLER_EX(RSP_LIST,LBN_SELCHANGE,RspPluginChanged) COMMAND_HANDLER_EX(RSP_LIST, LBN_SELCHANGE, RspPluginChanged)
COMMAND_ID_HANDLER_EX(GFX_ABOUT,GfxPluginAbout) COMMAND_ID_HANDLER_EX(GFX_ABOUT, GfxPluginAbout)
COMMAND_ID_HANDLER_EX(AUDIO_ABOUT,AudioPluginAbout) COMMAND_ID_HANDLER_EX(AUDIO_ABOUT, AudioPluginAbout)
COMMAND_ID_HANDLER_EX(CONT_ABOUT,ControllerPluginAbout) COMMAND_ID_HANDLER_EX(CONT_ABOUT, ControllerPluginAbout)
COMMAND_ID_HANDLER_EX(RSP_ABOUT,RspPluginAbout) COMMAND_ID_HANDLER_EX(RSP_ABOUT, RspPluginAbout)
COMMAND_ID_HANDLER_EX(IDC_HLE_GFX,HleGfxChanged) COMMAND_ID_HANDLER_EX(IDC_HLE_GFX, HleGfxChanged)
COMMAND_ID_HANDLER_EX(IDC_HLE_AUDIO,HleAudioChanged) COMMAND_ID_HANDLER_EX(IDC_HLE_AUDIO, HleAudioChanged)
END_MSG_MAP() END_MSG_MAP()
enum { IDD = IDD_Settings_GamePlugin }; enum { IDD = IDD_Settings_GamePlugin };
public: public:
CGamePluginPage(HWND hParent, const RECT & rcDispay ); CGamePluginPage(HWND hParent, const RECT & rcDispay);
LanguageStringID PageTitle ( void ) { return TAB_PLUGIN; } LanguageStringID PageTitle(void) { return TAB_PLUGIN; }
void HidePage ( void ); void HidePage(void);
void ShowPage ( void ); void ShowPage(void);
void ApplySettings ( bool UpdateScreen ); void ApplySettings(bool UpdateScreen);
bool EnableReset ( void ); bool EnableReset(void);
void ResetPage ( void ); void ResetPage(void);
private: private:
void GfxPluginAbout ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { ShowAboutButton(GFX_LIST); } void GfxPluginAbout(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ShowAboutButton(GFX_LIST); }
void AudioPluginAbout ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { ShowAboutButton(AUDIO_LIST); } void AudioPluginAbout(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ShowAboutButton(AUDIO_LIST); }
void ControllerPluginAbout ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { ShowAboutButton(CONT_LIST); } void ControllerPluginAbout(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ShowAboutButton(CONT_LIST); }
void RspPluginAbout ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { ShowAboutButton(RSP_LIST); } void RspPluginAbout(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ShowAboutButton(RSP_LIST); }
void GfxPluginChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { PluginItemChanged(GFX_LIST,GFX_ABOUT); } void GfxPluginChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { PluginItemChanged(GFX_LIST, GFX_ABOUT); }
void AudioPluginChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { PluginItemChanged(AUDIO_LIST,AUDIO_ABOUT); } void AudioPluginChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { PluginItemChanged(AUDIO_LIST, AUDIO_ABOUT); }
void ControllerPluginChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { PluginItemChanged(CONT_LIST,CONT_ABOUT); } void ControllerPluginChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { PluginItemChanged(CONT_LIST, CONT_ABOUT); }
void RspPluginChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { PluginItemChanged(RSP_LIST,RSP_ABOUT); } void RspPluginChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { PluginItemChanged(RSP_LIST, RSP_ABOUT); }
void HleGfxChanged ( UINT Code, int id, HWND ctl ); void HleGfxChanged(UINT Code, int id, HWND ctl);
void HleAudioChanged ( UINT Code, int id, HWND ctl ); void HleAudioChanged(UINT Code, int id, HWND ctl);
void ShowAboutButton ( int id ); void ShowAboutButton(int id);
void PluginItemChanged ( int id, int AboutID, bool bSetChanged = true ); void PluginItemChanged(int id, int AboutID, bool bSetChanged = true);
void AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType ); void AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE PluginType);
void UpdatePageSettings ( void ); void UpdatePageSettings(void);
void ApplyComboBoxes ( void ); void ApplyComboBoxes(void);
bool ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type ); bool ResetComboBox(CModifiedComboBox & ComboBox, SettingID Type);
CPartialGroupBox m_GfxGroup, m_AudioGroup, m_ControlGroup, m_RspGroup; CPartialGroupBox m_GfxGroup, m_AudioGroup, m_ControlGroup, m_RspGroup;
CPluginList m_PluginList; CPluginList m_PluginList;

View File

@ -10,13 +10,12 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
#include "Settings Page - Game - Recompiler.h" #include "Settings Page - Game - Recompiler.h"
CGameRecompilePage::CGameRecompilePage (HWND hParent, const RECT & rcDispay ) CGameRecompilePage::CGameRecompilePage(HWND hParent, const RECT & rcDispay)
{ {
if (!Create(hParent,rcDispay)) if (!Create(hParent, rcDispay))
{ {
return; return;
} }
@ -38,19 +37,19 @@ CGameRecompilePage::CGameRecompilePage (HWND hParent, const RECT & rcDispay )
m_SelfModGroup.Attach(GetDlgItem(IDC_SMM_FRAME)); m_SelfModGroup.Attach(GetDlgItem(IDC_SMM_FRAME));
AddModCheckBox(GetDlgItem(IDC_ROM_REGCACHE),Game_RegCache); AddModCheckBox(GetDlgItem(IDC_ROM_REGCACHE), Game_RegCache);
AddModCheckBox(GetDlgItem(IDC_BLOCK_LINKING),Game_BlockLinking); AddModCheckBox(GetDlgItem(IDC_BLOCK_LINKING), Game_BlockLinking);
AddModCheckBox(GetDlgItem(IDC_SMM_CACHE),Game_SMM_Cache); AddModCheckBox(GetDlgItem(IDC_SMM_CACHE), Game_SMM_Cache);
AddModCheckBox(GetDlgItem(IDC_SMM_DMA),Game_SMM_PIDMA); AddModCheckBox(GetDlgItem(IDC_SMM_DMA), Game_SMM_PIDMA);
AddModCheckBox(GetDlgItem(IDC_SMM_VALIDATE),Game_SMM_ValidFunc); AddModCheckBox(GetDlgItem(IDC_SMM_VALIDATE), Game_SMM_ValidFunc);
AddModCheckBox(GetDlgItem(IDC_SMM_TLB),Game_SMM_TLB); AddModCheckBox(GetDlgItem(IDC_SMM_TLB), Game_SMM_TLB);
AddModCheckBox(GetDlgItem(IDC_SMM_PROTECT),Game_SMM_Protect); AddModCheckBox(GetDlgItem(IDC_SMM_PROTECT), Game_SMM_Protect);
::ShowWindow(GetDlgItem(IDC_SMM_STORE),SW_HIDE); ::ShowWindow(GetDlgItem(IDC_SMM_STORE), SW_HIDE);
//AddModCheckBox(GetDlgItem(IDC_SMM_STORE),Game_SMM_StoreInstruc); //AddModCheckBox(GetDlgItem(IDC_SMM_STORE),Game_SMM_StoreInstruc);
AddModCheckBox(GetDlgItem(IDC_ROM_FASTSP),Game_FastSP); AddModCheckBox(GetDlgItem(IDC_ROM_FASTSP), Game_FastSP);
CModifiedComboBox * ComboBox; CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(IDC_CPU_TYPE),Game_CpuType); ComboBox = AddModComboBox(GetDlgItem(IDC_CPU_TYPE), Game_CpuType);
if (ComboBox) if (ComboBox)
{ {
ComboBox->AddItemW(GS(CORE_RECOMPILER), CPU_Recompiler); ComboBox->AddItemW(GS(CORE_RECOMPILER), CPU_Recompiler);
@ -61,7 +60,7 @@ CGameRecompilePage::CGameRecompilePage (HWND hParent, const RECT & rcDispay )
} }
} }
ComboBox = AddModComboBox(GetDlgItem(IDC_FUNCFIND),Game_FuncLookupMode); ComboBox = AddModComboBox(GetDlgItem(IDC_FUNCFIND), Game_FuncLookupMode);
if (ComboBox) if (ComboBox)
{ {
ComboBox->AddItemW(GS(FLM_PLOOKUP), FuncFind_PhysicalLookup); ComboBox->AddItemW(GS(FLM_PLOOKUP), FuncFind_PhysicalLookup);
@ -81,12 +80,12 @@ void CGameRecompilePage::HidePage()
ShowWindow(SW_HIDE); ShowWindow(SW_HIDE);
} }
void CGameRecompilePage::ApplySettings( bool UpdateScreen ) void CGameRecompilePage::ApplySettings(bool UpdateScreen)
{ {
CSettingsPageImpl<CGameRecompilePage>::ApplySettings(UpdateScreen); CSettingsPageImpl<CGameRecompilePage>::ApplySettings(UpdateScreen);
} }
bool CGameRecompilePage::EnableReset ( void ) bool CGameRecompilePage::EnableReset(void)
{ {
if (CSettingsPageImpl<CGameRecompilePage>::EnableReset()) { return true; } if (CSettingsPageImpl<CGameRecompilePage>::EnableReset()) { return true; }
return false; return false;
@ -96,4 +95,3 @@ void CGameRecompilePage::ResetPage()
{ {
CSettingsPageImpl<CGameRecompilePage>::ResetPage(); CSettingsPageImpl<CGameRecompilePage>::ResetPage();
} }
#endif

View File

@ -10,38 +10,37 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
#include "Settings Page - Game - Status.h" #include "Settings Page - Game - Status.h"
CGameStatusPage::CGameStatusPage (HWND hParent, const RECT & rcDispay ) CGameStatusPage::CGameStatusPage(HWND hParent, const RECT & rcDispay)
{ {
if (!Create(hParent,rcDispay)) if (!Create(hParent, rcDispay))
{ {
return; return;
} }
CIniFile RomIniFile (g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str()); CIniFile RomIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
strlist Keys; strlist Keys;
RomIniFile.GetKeyList("Rom Status",Keys); RomIniFile.GetKeyList("Rom Status", Keys);
stdstr Status = g_Settings->LoadStringVal(Rdb_Status); stdstr Status = g_Settings->LoadStringVal(Rdb_Status);
CModifiedComboBoxTxt * ComboBox; CModifiedComboBoxTxt * ComboBox;
ComboBox = AddModComboBoxTxt(GetDlgItem(IDC_STATUS_TYPE),Rdb_Status); ComboBox = AddModComboBoxTxt(GetDlgItem(IDC_STATUS_TYPE), Rdb_Status);
if (ComboBox) if (ComboBox)
{ {
for (strlist::iterator item = Keys.begin(); item != Keys.end(); item++ ) for (strlist::iterator item = Keys.begin(); item != Keys.end(); item++)
{ {
if (strstr(item->c_str(),".Sel") != NULL) { continue; } if (strstr(item->c_str(), ".Sel") != NULL) { continue; }
if (strstr(item->c_str(),".Auto") != NULL) { continue; } if (strstr(item->c_str(), ".Auto") != NULL) { continue; }
ComboBox->AddItem(item->c_str(), item->c_str()); ComboBox->AddItem(item->c_str(), item->c_str());
} }
ComboBox->SetTextField(GetDlgItem(IDC_STATUS_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_STATUS_TEXT));
} }
CModifiedEditBox * TxtBox; CModifiedEditBox * TxtBox;
TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_CORE),Rdb_NotesCore,true); TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_CORE), Rdb_NotesCore, true);
TxtBox->SetTextField(GetDlgItem(IDC_NOTES_CORE_TEXT)); TxtBox->SetTextField(GetDlgItem(IDC_NOTES_CORE_TEXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_PLUGIN),Rdb_NotesPlugin,true); TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_PLUGIN), Rdb_NotesPlugin, true);
TxtBox->SetTextField(GetDlgItem(IDC_NOTES_PLUGIN_TEXT)); TxtBox->SetTextField(GetDlgItem(IDC_NOTES_PLUGIN_TEXT));
UpdatePageSettings(); UpdatePageSettings();
@ -57,12 +56,12 @@ void CGameStatusPage::HidePage()
ShowWindow(SW_HIDE); ShowWindow(SW_HIDE);
} }
void CGameStatusPage::ApplySettings( bool UpdateScreen ) void CGameStatusPage::ApplySettings(bool UpdateScreen)
{ {
CSettingsPageImpl<CGameStatusPage>::ApplySettings(UpdateScreen); CSettingsPageImpl<CGameStatusPage>::ApplySettings(UpdateScreen);
} }
bool CGameStatusPage::EnableReset ( void ) bool CGameStatusPage::EnableReset(void)
{ {
if (CSettingsPageImpl<CGameStatusPage>::EnableReset()) { return true; } if (CSettingsPageImpl<CGameStatusPage>::EnableReset()) { return true; }
return false; return false;
@ -72,4 +71,3 @@ void CGameStatusPage::ResetPage()
{ {
CSettingsPageImpl<CGameStatusPage>::ResetPage(); CSettingsPageImpl<CGameStatusPage>::ResetPage();
} }
#endif

View File

@ -10,31 +10,30 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
COptionsGameBrowserPage::COptionsGameBrowserPage (HWND hParent, const RECT & rcDispay ) : COptionsGameBrowserPage::COptionsGameBrowserPage(HWND hParent, const RECT & rcDispay) :
m_OrderChanged(false), m_OrderChanged(false),
m_OrderReset(false) m_OrderReset(false)
{ {
if (!Create(hParent,rcDispay)) if (!Create(hParent, rcDispay))
{ {
return; return;
} }
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT2,GS(RB_ROMS));
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4,GS(RB_DIRS));
SetDlgItemTextW(m_hWnd, IDC_USE_ROMBROWSER,GS(RB_USE));
SetDlgItemTextW(m_hWnd, IDC_RECURSION,GS(RB_DIR_RECURSION));
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT5,GS(RB_AVALIABLE_FIELDS));
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT6,GS(RB_SHOW_FIELDS));
SetDlgItemTextW(m_hWnd, IDC_ADD,GS(RB_ADD));
SetDlgItemTextW(m_hWnd, IDC_REMOVE,GS(RB_REMOVE));
SetDlgItemTextW(m_hWnd, IDC_UP,GS(RB_UP));
SetDlgItemTextW(m_hWnd, IDC_DOWN,GS(RB_DOWN));
AddModCheckBox(GetDlgItem(IDC_USE_ROMBROWSER),RomBrowser_Enabled); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT2, GS(RB_ROMS));
AddModCheckBox(GetDlgItem(IDC_RECURSION),RomBrowser_Recursive); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, GS(RB_DIRS));
SetDlgItemTextW(m_hWnd, IDC_USE_ROMBROWSER, GS(RB_USE));
SetDlgItemTextW(m_hWnd, IDC_RECURSION, GS(RB_DIR_RECURSION));
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT5, GS(RB_AVALIABLE_FIELDS));
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT6, GS(RB_SHOW_FIELDS));
SetDlgItemTextW(m_hWnd, IDC_ADD, GS(RB_ADD));
SetDlgItemTextW(m_hWnd, IDC_REMOVE, GS(RB_REMOVE));
SetDlgItemTextW(m_hWnd, IDC_UP, GS(RB_UP));
SetDlgItemTextW(m_hWnd, IDC_DOWN, GS(RB_DOWN));
AddModCheckBox(GetDlgItem(IDC_USE_ROMBROWSER), RomBrowser_Enabled);
AddModCheckBox(GetDlgItem(IDC_RECURSION), RomBrowser_Recursive);
m_Avaliable.Attach(GetDlgItem(IDC_AVALIABLE)); m_Avaliable.Attach(GetDlgItem(IDC_AVALIABLE));
m_Using.Attach(GetDlgItem(IDC_USING)); m_Using.Attach(GetDlgItem(IDC_USING));
@ -44,63 +43,63 @@ COptionsGameBrowserPage::COptionsGameBrowserPage (HWND hParent, const RECT & rcD
UpdatePageSettings(); UpdatePageSettings();
} }
void COptionsGameBrowserPage::UpdateFieldList ( const ROMBROWSER_FIELDS_LIST & Fields ) void COptionsGameBrowserPage::UpdateFieldList(const ROMBROWSER_FIELDS_LIST & Fields)
{ {
m_Avaliable.ResetContent(); m_Avaliable.ResetContent();
m_Using.ResetContent(); m_Using.ResetContent();
m_OrderChanged = false; m_OrderChanged = false;
for (int i = 0, n = Fields.size(); i < n; i++) for (int i = 0, n = Fields.size(); i < n; i++)
{ {
if (Fields[i].PosChanged()) if (Fields[i].PosChanged())
{ {
m_OrderChanged = true; m_OrderChanged = true;
} }
int Pos = Fields[i].Pos(); int Pos = Fields[i].Pos();
if (Pos < 0) if (Pos < 0)
{ {
m_Avaliable.SetItemData(m_Avaliable.AddStringW(GS(Fields[i].LangID())),i); m_Avaliable.SetItemData(m_Avaliable.AddStringW(GS(Fields[i].LangID())), i);
continue; continue;
} }
int listCount = m_Using.GetCount(); int listCount = m_Using.GetCount();
if (Pos > listCount) { Pos = listCount; } if (Pos > listCount) { Pos = listCount; }
m_Using.SetItemData(m_Using.InsertStringW(Pos,GS(Fields[i].LangID())),i); m_Using.SetItemData(m_Using.InsertStringW(Pos, GS(Fields[i].LangID())), i);
} }
} }
void COptionsGameBrowserPage::UpdatePageSettings ( void ) void COptionsGameBrowserPage::UpdatePageSettings(void)
{ {
UpdateFieldList(m_Fields); UpdateFieldList(m_Fields);
CSettingsPageImpl<COptionsGameBrowserPage>::UpdatePageSettings(); CSettingsPageImpl<COptionsGameBrowserPage>::UpdatePageSettings();
FixCtrlState(); FixCtrlState();
} }
void COptionsGameBrowserPage::UseRomBrowserChanged ( UINT Code, int id, HWND ctl ) void COptionsGameBrowserPage::UseRomBrowserChanged(UINT Code, int id, HWND ctl)
{ {
CheckBoxChanged(Code,id,ctl); CheckBoxChanged(Code, id, ctl);
FixCtrlState(); FixCtrlState();
} }
void COptionsGameBrowserPage::FixCtrlState ( void ) void COptionsGameBrowserPage::FixCtrlState(void)
{ {
bool bEnabled = (SendDlgItemMessage(IDC_USE_ROMBROWSER,BM_GETCHECK,0,0) == BST_CHECKED); bool bEnabled = (SendDlgItemMessage(IDC_USE_ROMBROWSER, BM_GETCHECK, 0, 0) == BST_CHECKED);
::EnableWindow(GetDlgItem(IDC_ROMSEL_TEXT5),bEnabled); ::EnableWindow(GetDlgItem(IDC_ROMSEL_TEXT5), bEnabled);
::EnableWindow(GetDlgItem(IDC_ROMSEL_TEXT6),bEnabled); ::EnableWindow(GetDlgItem(IDC_ROMSEL_TEXT6), bEnabled);
::EnableWindow(GetDlgItem(IDC_AVALIABLE),bEnabled); ::EnableWindow(GetDlgItem(IDC_AVALIABLE), bEnabled);
::EnableWindow(GetDlgItem(IDC_ADD),bEnabled); ::EnableWindow(GetDlgItem(IDC_ADD), bEnabled);
::EnableWindow(GetDlgItem(IDC_REMOVE),bEnabled); ::EnableWindow(GetDlgItem(IDC_REMOVE), bEnabled);
::EnableWindow(GetDlgItem(IDC_USING),bEnabled); ::EnableWindow(GetDlgItem(IDC_USING), bEnabled);
::EnableWindow(GetDlgItem(IDC_UP),bEnabled); ::EnableWindow(GetDlgItem(IDC_UP), bEnabled);
::EnableWindow(GetDlgItem(IDC_DOWN),bEnabled); ::EnableWindow(GetDlgItem(IDC_DOWN), bEnabled);
::EnableWindow(GetDlgItem(IDC_RECURSION),bEnabled); ::EnableWindow(GetDlgItem(IDC_RECURSION), bEnabled);
} }
void COptionsGameBrowserPage::AddFieldClicked ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsGameBrowserPage::AddFieldClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
int index = m_Avaliable.GetCurSel(); int index = m_Avaliable.GetCurSel();
if (index < 0) if (index < 0)
{ {
return; return;
} }
//remove from list //remove from list
int i = m_Avaliable.GetItemData(index); int i = m_Avaliable.GetItemData(index);
@ -108,20 +107,20 @@ void COptionsGameBrowserPage::AddFieldClicked ( UINT /*Code*/, int /*id*/, HWND
//select next in list //select next in list
int listCount = m_Avaliable.GetCount(); int listCount = m_Avaliable.GetCount();
if (index >= listCount) { index -= 1;} if (index >= listCount) { index -= 1; }
m_Avaliable.SetCurSel(index); m_Avaliable.SetCurSel(index);
//Add to list //Add to list
index = m_Using.AddStringW(GS(m_Fields[i].LangID())); index = m_Using.AddStringW(GS(m_Fields[i].LangID()));
m_Using.SetItemData(index,i); m_Using.SetItemData(index, i);
m_Using.SetCurSel(index); m_Using.SetCurSel(index);
m_OrderChanged = true; m_OrderChanged = true;
m_OrderReset = false; m_OrderReset = false;
SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsGameBrowserPage::RemoveFieldClicked ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsGameBrowserPage::RemoveFieldClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
int index = m_Using.GetCurSel(); int index = m_Using.GetCurSel();
if (index < 0) if (index < 0)
@ -147,42 +146,42 @@ void COptionsGameBrowserPage::RemoveFieldClicked ( UINT /*Code*/, int /*id*/, HW
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsGameBrowserPage::MoveFieldUpClicked ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsGameBrowserPage::MoveFieldUpClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
int index = m_Using.GetCurSel(); int index = m_Using.GetCurSel();
if (index <= 0) if (index <= 0)
{ {
return; return;
} }
int i = m_Using.GetItemData(index); int i = m_Using.GetItemData(index);
m_Using.DeleteString(index); m_Using.DeleteString(index);
index = m_Using.InsertStringW(index - 1,GS(m_Fields[i].LangID())); index = m_Using.InsertStringW(index - 1, GS(m_Fields[i].LangID()));
m_Using.SetItemData(index,i); m_Using.SetItemData(index, i);
m_Using.SetCurSel(index); m_Using.SetCurSel(index);
m_OrderChanged = true; m_OrderChanged = true;
m_OrderReset = false; m_OrderReset = false;
SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsGameBrowserPage::MoveFieldDownClicked ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsGameBrowserPage::MoveFieldDownClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
int index = m_Using.GetCurSel(); int index = m_Using.GetCurSel();
if (index < 0 || index >= (m_Using.GetCount() - 1)) if (index < 0 || index >= (m_Using.GetCount() - 1))
{ {
return; return;
} }
int i = m_Using.GetItemData(index); int i = m_Using.GetItemData(index);
m_Using.DeleteString(index); m_Using.DeleteString(index);
index = m_Using.InsertStringW(index + 1,GS(m_Fields[i].LangID())); index = m_Using.InsertStringW(index + 1, GS(m_Fields[i].LangID()));
m_Using.SetItemData(index,i); m_Using.SetItemData(index, i);
m_Using.SetCurSel(index); m_Using.SetCurSel(index);
m_OrderChanged = true; m_OrderChanged = true;
m_OrderReset = false; m_OrderReset = false;
SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsGameBrowserPage::HidePage() void COptionsGameBrowserPage::HidePage()
@ -195,19 +194,21 @@ void COptionsGameBrowserPage::ShowPage()
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
} }
void COptionsGameBrowserPage::ApplySettings( bool UpdateScreen ) void COptionsGameBrowserPage::ApplySettings(bool UpdateScreen)
{ {
bool bColChanged = false; bool bColChanged = false;
if (m_OrderReset) if (m_OrderReset)
{ {
for (size_t i = 0; i < m_Fields.size(); i++ ) for (size_t i = 0; i < m_Fields.size(); i++)
{ {
m_Fields[i].ResetPos(); m_Fields[i].ResetPos();
} }
bColChanged = true; bColChanged = true;
} else { }
else
{
size_t Item, listCount = m_Using.GetCount(); size_t Item, listCount = m_Using.GetCount();
for (Item = 0; Item < listCount; Item ++ ) for (Item = 0; Item < listCount; Item++)
{ {
int Pos = m_Using.GetItemData(Item); int Pos = m_Using.GetItemData(Item);
if (m_OrderReset || m_Fields[Pos].Pos() != Item) if (m_OrderReset || m_Fields[Pos].Pos() != Item)
@ -218,7 +219,7 @@ void COptionsGameBrowserPage::ApplySettings( bool UpdateScreen )
} }
listCount = m_Avaliable.GetCount(); listCount = m_Avaliable.GetCount();
for (Item = 0; Item < listCount; Item ++ ) for (Item = 0; Item < listCount; Item++)
{ {
int Pos = m_Avaliable.GetItemData(Item); int Pos = m_Avaliable.GetItemData(Item);
if (m_OrderReset || m_Fields[Pos].Pos() != -1) if (m_OrderReset || m_Fields[Pos].Pos() != -1)
@ -230,13 +231,13 @@ void COptionsGameBrowserPage::ApplySettings( bool UpdateScreen )
} }
if (bColChanged) if (bColChanged)
{ {
g_Settings->SaveBool(RomBrowser_ColoumnsChanged,!g_Settings->LoadBool(RomBrowser_ColoumnsChanged)); g_Settings->SaveBool(RomBrowser_ColoumnsChanged, !g_Settings->LoadBool(RomBrowser_ColoumnsChanged));
} }
CSettingsPageImpl<COptionsGameBrowserPage>::ApplySettings(UpdateScreen); CSettingsPageImpl<COptionsGameBrowserPage>::ApplySettings(UpdateScreen);
} }
bool COptionsGameBrowserPage::EnableReset ( void ) bool COptionsGameBrowserPage::EnableReset(void)
{ {
if (m_OrderChanged) { return true; } if (m_OrderChanged) { return true; }
return CSettingsPageImpl<COptionsGameBrowserPage>::EnableReset(); return CSettingsPageImpl<COptionsGameBrowserPage>::EnableReset();
@ -244,14 +245,13 @@ bool COptionsGameBrowserPage::EnableReset ( void )
void COptionsGameBrowserPage::ResetPage() void COptionsGameBrowserPage::ResetPage()
{ {
if (m_OrderChanged) if (m_OrderChanged)
{ {
ROMBROWSER_FIELDS_LIST Fields; ROMBROWSER_FIELDS_LIST Fields;
CRomBrowser::GetFieldInfo(Fields,true); CRomBrowser::GetFieldInfo(Fields, true);
UpdateFieldList(Fields); UpdateFieldList(Fields);
m_OrderReset = true; m_OrderReset = true;
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
CSettingsPageImpl<COptionsGameBrowserPage>::ResetPage(); CSettingsPageImpl<COptionsGameBrowserPage>::ResetPage();
} }
#endif

View File

@ -10,58 +10,56 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
COptionsShortCutsPage::COptionsShortCutsPage (HWND hParent, const RECT & rcDispay ) : COptionsShortCutsPage::COptionsShortCutsPage(HWND hParent, const RECT & rcDispay) :
m_EnableReset(false) m_EnableReset(false)
{ {
if (!Create(hParent,rcDispay)) if (!Create(hParent, rcDispay))
{ {
return; return;
} }
SetDlgItemTextW(m_hWnd, IDC_S_CPU_STATE,GS(ACCEL_CPUSTATE_TITLE)); SetDlgItemTextW(m_hWnd, IDC_S_CPU_STATE, GS(ACCEL_CPUSTATE_TITLE));
SetDlgItemTextW(m_hWnd, IDC_MENU_ITEM_TEXT,GS(ACCEL_MENUITEM_TITLE)); SetDlgItemTextW(m_hWnd, IDC_MENU_ITEM_TEXT, GS(ACCEL_MENUITEM_TITLE));
SetDlgItemTextW(m_hWnd, IDC_S_CURRENT_KEYS,GS(ACCEL_CURRENTKEYS_TITLE)); SetDlgItemTextW(m_hWnd, IDC_S_CURRENT_KEYS, GS(ACCEL_CURRENTKEYS_TITLE));
SetDlgItemTextW(m_hWnd, IDC_S_SELECT_SHORT,GS(ACCEL_SELKEY_TITLE)); SetDlgItemTextW(m_hWnd, IDC_S_SELECT_SHORT, GS(ACCEL_SELKEY_TITLE));
SetDlgItemTextW(m_hWnd, IDC_S_CURRENT_ASSIGN,GS(ACCEL_ASSIGNEDTO_TITLE)); SetDlgItemTextW(m_hWnd, IDC_S_CURRENT_ASSIGN, GS(ACCEL_ASSIGNEDTO_TITLE));
SetDlgItemTextW(m_hWnd, IDC_ASSIGN,GS(ACCEL_ASSIGN_BTN)); SetDlgItemTextW(m_hWnd, IDC_ASSIGN, GS(ACCEL_ASSIGN_BTN));
SetDlgItemTextW(m_hWnd, IDC_REMOVE,GS(ACCEL_REMOVE_BTN)); SetDlgItemTextW(m_hWnd, IDC_REMOVE, GS(ACCEL_REMOVE_BTN));
SetDlgItemTextW(m_hWnd, IDC_KEY_PROMPT, GS(ACCEL_DETECTKEY)); SetDlgItemTextW(m_hWnd, IDC_KEY_PROMPT, GS(ACCEL_DETECTKEY));
m_CreateNewShortCut.AttachToDlgItem(m_hWnd,IDC_S_SELECT_SHORT); m_CreateNewShortCut.AttachToDlgItem(m_hWnd, IDC_S_SELECT_SHORT);
m_CpuState.Attach(GetDlgItem(IDC_C_CPU_STATE)); m_CpuState.Attach(GetDlgItem(IDC_C_CPU_STATE));
m_MenuItems.Attach(GetDlgItem(IDC_MENU_ITEMS)); m_MenuItems.Attach(GetDlgItem(IDC_MENU_ITEMS));
m_CurrentKeys.Attach(GetDlgItem(IDC_CURRENT_KEYS)); m_CurrentKeys.Attach(GetDlgItem(IDC_CURRENT_KEYS));
m_VirtualKeyList.Attach(GetDlgItem(IDC_VIRTUALKEY)); m_VirtualKeyList.Attach(GetDlgItem(IDC_VIRTUALKEY));
m_MenuItems.ModifyStyle(0,TVS_SHOWSELALWAYS); m_MenuItems.ModifyStyle(0, TVS_SHOWSELALWAYS);
m_CpuState.SetItemData(m_CpuState.AddStringW(GS(ACCEL_CPUSTATE_1)),CMenuShortCutKey::GAME_NOT_RUNNING); m_CpuState.SetItemData(m_CpuState.AddStringW(GS(ACCEL_CPUSTATE_1)), CMenuShortCutKey::GAME_NOT_RUNNING);
m_CpuState.SetItemData(m_CpuState.AddStringW(GS(ACCEL_CPUSTATE_3)),CMenuShortCutKey::GAME_RUNNING_WINDOW); m_CpuState.SetItemData(m_CpuState.AddStringW(GS(ACCEL_CPUSTATE_3)), CMenuShortCutKey::GAME_RUNNING_WINDOW);
m_CpuState.SetItemData(m_CpuState.AddStringW(GS(ACCEL_CPUSTATE_4)),CMenuShortCutKey::GAME_RUNNING_FULLSCREEN); m_CpuState.SetItemData(m_CpuState.AddStringW(GS(ACCEL_CPUSTATE_4)), CMenuShortCutKey::GAME_RUNNING_FULLSCREEN);
m_CpuState.SetCurSel(0); m_CpuState.SetCurSel(0);
int VirtualKeyListSize; int VirtualKeyListSize;
VIRTUAL_KEY * VirtualKeyList = CMenuShortCutKey::VirtualKeyList(VirtualKeyListSize); VIRTUAL_KEY * VirtualKeyList = CMenuShortCutKey::VirtualKeyList(VirtualKeyListSize);
for (int count = 0; count < VirtualKeyListSize; count++) for (int count = 0; count < VirtualKeyListSize; count++)
{ {
m_VirtualKeyList.SetItemData(m_VirtualKeyList.AddString(VirtualKeyList[count].Name),VirtualKeyList[count].Key); m_VirtualKeyList.SetItemData(m_VirtualKeyList.AddString(VirtualKeyList[count].Name), VirtualKeyList[count].Key);
} }
OnCpuStateChanged(LBN_SELCHANGE,IDC_C_CPU_STATE,GetDlgItem(IDC_C_CPU_STATE)); OnCpuStateChanged(LBN_SELCHANGE, IDC_C_CPU_STATE, GetDlgItem(IDC_C_CPU_STATE));
CheckResetEnable(); CheckResetEnable();
} }
void COptionsShortCutsPage::CheckResetEnable ( void ) void COptionsShortCutsPage::CheckResetEnable(void)
{ {
MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts(); MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts();
for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++) for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++)
{ {
const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems(); const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems();
for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item ++) for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item++)
{ {
if (!ShortCut_item->Inactive() && !ShortCut_item->UserAdded()) if (!ShortCut_item->Inactive() && !ShortCut_item->UserAdded())
{ {
@ -70,7 +68,6 @@ void COptionsShortCutsPage::CheckResetEnable ( void )
m_EnableReset = true; m_EnableReset = true;
return; return;
} }
} }
m_EnableReset = false; m_EnableReset = false;
} }
@ -82,16 +79,16 @@ void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /*
MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts(); MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts();
m_MenuItems.DeleteAllItems(); m_MenuItems.DeleteAllItems();
for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++) for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++)
{ {
ACCESS_MODE ItemMode = Item->second.AccessMode(); ACCESS_MODE ItemMode = Item->second.AccessMode();
if ((ItemMode & AccessLevel) != AccessLevel ) if ((ItemMode & AccessLevel) != AccessLevel)
{ {
continue; continue;
} }
//find Parent //find Parent
HTREEITEM hParent = m_MenuItems.GetChildItem(TVI_ROOT); HTREEITEM hParent = m_MenuItems.GetChildItem(TVI_ROOT);
while (hParent) while (hParent)
{ {
if (m_MenuItems.GetItemData(hParent) == (DWORD_PTR)Item->second.Section()) if (m_MenuItems.GetItemData(hParent) == (DWORD_PTR)Item->second.Section())
{ {
@ -102,156 +99,156 @@ void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /*
if (hParent == NULL) if (hParent == NULL)
{ {
hParent = m_MenuItems.InsertItemW(TVIF_TEXT | TVIF_PARAM,GS(Item->second.Section()),0,0,0,0, Item->second.Section(),TVI_ROOT,TVI_LAST); hParent = m_MenuItems.InsertItemW(TVIF_TEXT | TVIF_PARAM, GS(Item->second.Section()), 0, 0, 0, 0, Item->second.Section(), TVI_ROOT, TVI_LAST);
} }
wstring str = GS(Item->second.Title()); wstring str = GS(Item->second.Title());
std::wstring::size_type pos = str.find( L"&" ); std::wstring::size_type pos = str.find(L"&");
while ( pos != std::wstring::npos ) while (pos != std::wstring::npos)
{ {
str.replace( pos, 1, L"" ); str.replace(pos, 1, L"");
pos = str.find( L"&", pos ); pos = str.find(L"&", pos);
} }
pos = str.find( L"..." ); pos = str.find(L"...");
while ( pos != std::wstring::npos ) while (pos != std::wstring::npos)
{ {
str.replace( pos, 3, L"" ); str.replace(pos, 3, L"");
pos = str.find( L"...", pos ); pos = str.find(L"...", pos);
} }
HTREEITEM hItem = m_MenuItems.InsertItemW(TVIF_TEXT | TVIF_PARAM,str.c_str(),0,0,0,0, (DWORD_PTR)&Item->second,hParent,TVI_LAST); HTREEITEM hItem = m_MenuItems.InsertItemW(TVIF_TEXT | TVIF_PARAM, str.c_str(), 0, 0, 0, 0, (DWORD_PTR)&Item->second, hParent, TVI_LAST);
const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems(); const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems();
for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item ++) for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item++)
{ {
if (!ShortCut_item->Inactive() && !ShortCut_item->UserAdded()) if (!ShortCut_item->Inactive() && !ShortCut_item->UserAdded())
{ {
continue; continue;
} }
m_MenuItems.SetItemState(hItem,TVIS_BOLD,TVIS_BOLD); m_MenuItems.SetItemState(hItem, TVIS_BOLD, TVIS_BOLD);
m_MenuItems.SetItemState(hParent,TVIS_BOLD,TVIS_BOLD); m_MenuItems.SetItemState(hParent, TVIS_BOLD, TVIS_BOLD);
break; break;
} }
} }
} }
void COptionsShortCutsPage::OnRemoveClicked ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsShortCutsPage::OnRemoveClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem(); HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem();
if (hSelectedItem == NULL) if (hSelectedItem == NULL)
{ {
g_Notify->DisplayError(GS(MSG_NO_SEL_SHORTCUT)); g_Notify->DisplayError(GS(MSG_NO_SEL_SHORTCUT));
return; return;
} }
HTREEITEM hParent = m_MenuItems.GetParentItem(hSelectedItem); HTREEITEM hParent = m_MenuItems.GetParentItem(hSelectedItem);
if (hParent == NULL) if (hParent == NULL)
{ {
g_Notify->DisplayError(GS(MSG_NO_SEL_SHORTCUT)); g_Notify->DisplayError(GS(MSG_NO_SEL_SHORTCUT));
return; return;
} }
CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hSelectedItem); CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hSelectedItem);
//Make sure an item is selected //Make sure an item is selected
int index = m_CurrentKeys.GetCurSel(); int index = m_CurrentKeys.GetCurSel();
if (index < 0) if (index < 0)
{ {
g_Notify->DisplayError(GS(MSG_NO_SEL_SHORTCUT)); g_Notify->DisplayError(GS(MSG_NO_SEL_SHORTCUT));
return; return;
} }
ShortCut->RemoveItem((CMenuShortCutKey *)m_CurrentKeys.GetItemData(index)); ShortCut->RemoveItem((CMenuShortCutKey *)m_CurrentKeys.GetItemData(index));
m_MenuItems.SetItemState(hSelectedItem,TVIS_BOLD,TVIS_BOLD); m_MenuItems.SetItemState(hSelectedItem, TVIS_BOLD, TVIS_BOLD);
m_MenuItems.SetItemState(hParent,TVIS_BOLD,TVIS_BOLD); m_MenuItems.SetItemState(hParent, TVIS_BOLD, TVIS_BOLD);
m_EnableReset = true; m_EnableReset = true;
RefreshShortCutOptions(hSelectedItem); RefreshShortCutOptions(hSelectedItem);
SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsShortCutsPage::OnDetectKeyClicked ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsShortCutsPage::OnDetectKeyClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
CloseHandle(CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)stInputGetKeys,this,0,NULL)); CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)stInputGetKeys, this, 0, NULL));
} }
void COptionsShortCutsPage::OnAssignClicked ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsShortCutsPage::OnAssignClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
//Get the virtual key info //Get the virtual key info
int index = m_VirtualKeyList.GetCurSel(); int index = m_VirtualKeyList.GetCurSel();
if (index < 0) if (index < 0)
{ {
g_Notify->DisplayError(GS(MSG_NO_SHORTCUT_SEL)); g_Notify->DisplayError(GS(MSG_NO_SHORTCUT_SEL));
return; return;
} }
WORD key = (WORD)SendDlgItemMessage(IDC_VIRTUALKEY,CB_GETITEMDATA,index,0); WORD key = (WORD)SendDlgItemMessage(IDC_VIRTUALKEY, CB_GETITEMDATA, index, 0);
bool bCtrl = (SendDlgItemMessage(IDC_CTL,BM_GETCHECK, 0,0) == BST_CHECKED); bool bCtrl = (SendDlgItemMessage(IDC_CTL, BM_GETCHECK, 0, 0) == BST_CHECKED);
bool bAlt = (SendDlgItemMessage(IDC_ALT,BM_GETCHECK, 0,0) == BST_CHECKED); bool bAlt = (SendDlgItemMessage(IDC_ALT, BM_GETCHECK, 0, 0) == BST_CHECKED);
bool bShift = (SendDlgItemMessage(IDC_SHIFT,BM_GETCHECK, 0,0) == BST_CHECKED); bool bShift = (SendDlgItemMessage(IDC_SHIFT, BM_GETCHECK, 0, 0) == BST_CHECKED);
ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem(); HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem();
if (hSelectedItem == NULL) if (hSelectedItem == NULL)
{ {
g_Notify->DisplayError(GS(MSG_NO_MENUITEM_SEL)); g_Notify->DisplayError(GS(MSG_NO_MENUITEM_SEL));
return; return;
} }
HTREEITEM hParent = m_MenuItems.GetParentItem(hSelectedItem); HTREEITEM hParent = m_MenuItems.GetParentItem(hSelectedItem);
if (hParent == NULL) if (hParent == NULL)
{ {
g_Notify->DisplayError(GS(MSG_NO_MENUITEM_SEL)); g_Notify->DisplayError(GS(MSG_NO_MENUITEM_SEL));
return; return;
} }
CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hSelectedItem); CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hSelectedItem);
LanguageStringID strid = m_ShortCuts.GetMenuItemName(key,bCtrl,bAlt,bShift,AccessLevel); LanguageStringID strid = m_ShortCuts.GetMenuItemName(key, bCtrl, bAlt, bShift, AccessLevel);
if (strid != EMPTY_STRING) if (strid != EMPTY_STRING)
{ {
g_Notify->DisplayError(GS(MSG_MENUITEM_ASSIGNED)); g_Notify->DisplayError(GS(MSG_MENUITEM_ASSIGNED));
return; return;
} }
ShortCut->AddShortCut(key,bCtrl,bAlt,bShift,AccessLevel,true,false); ShortCut->AddShortCut(key, bCtrl, bAlt, bShift, AccessLevel, true, false);
m_MenuItems.SetItemState(hSelectedItem,TVIS_BOLD,TVIS_BOLD); m_MenuItems.SetItemState(hSelectedItem, TVIS_BOLD, TVIS_BOLD);
m_MenuItems.SetItemState(hParent,TVIS_BOLD,TVIS_BOLD); m_MenuItems.SetItemState(hParent, TVIS_BOLD, TVIS_BOLD);
m_EnableReset = true; m_EnableReset = true;
RefreshShortCutOptions(hSelectedItem); RefreshShortCutOptions(hSelectedItem);
SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
void COptionsShortCutsPage::OnShortCutChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) void COptionsShortCutsPage::OnShortCutChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{ {
//Get the virtual key info //Get the virtual key info
int index = m_VirtualKeyList.GetCurSel(); int index = m_VirtualKeyList.GetCurSel();
if (index < 0) { return; } if (index < 0) { return; }
WORD key = (WORD)m_VirtualKeyList.GetItemData(index); WORD key = (WORD)m_VirtualKeyList.GetItemData(index);
bool bCtrl = (SendDlgItemMessage(IDC_CTL,BM_GETCHECK, 0,0) == BST_CHECKED); bool bCtrl = (SendDlgItemMessage(IDC_CTL, BM_GETCHECK, 0, 0) == BST_CHECKED);
bool bAlt = (SendDlgItemMessage(IDC_ALT,BM_GETCHECK, 0,0) == BST_CHECKED); bool bAlt = (SendDlgItemMessage(IDC_ALT, BM_GETCHECK, 0, 0) == BST_CHECKED);
bool bShift = (SendDlgItemMessage(IDC_SHIFT,BM_GETCHECK, 0,0) == BST_CHECKED); bool bShift = (SendDlgItemMessage(IDC_SHIFT, BM_GETCHECK, 0, 0) == BST_CHECKED);
ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
stdstr str; stdstr str;
str.FromUTF16(GS(m_ShortCuts.GetMenuItemName(key,bCtrl,bAlt,bShift,AccessLevel))); str.FromUTF16(GS(m_ShortCuts.GetMenuItemName(key, bCtrl, bAlt, bShift, AccessLevel)));
if (str.length() > 0) if (str.length() > 0)
{ {
str.resize(std::remove(str.begin(), str.end(), '&') - str.begin()); str.resize(std::remove(str.begin(), str.end(), '&') - str.begin());
} else { }
else
{
str = "None"; str = "None";
} }
SetDlgItemText(IDC_ASSIGNED_MENU_ITEM,str.c_str()); SetDlgItemText(IDC_ASSIGNED_MENU_ITEM, str.c_str());
} }
LRESULT COptionsShortCutsPage::OnMenuItemChanged ( LPNMHDR lpnmh ) LRESULT COptionsShortCutsPage::OnMenuItemChanged(LPNMHDR lpnmh)
{ {
RefreshShortCutOptions(((LPNMTREEVIEW)lpnmh)->itemNew.hItem); RefreshShortCutOptions(((LPNMTREEVIEW)lpnmh)->itemNew.hItem);
return true; return true;
} }
void COptionsShortCutsPage::RefreshShortCutOptions ( HTREEITEM hItem ) void COptionsShortCutsPage::RefreshShortCutOptions(HTREEITEM hItem)
{ {
HTREEITEM hParent = m_MenuItems.GetParentItem(hItem); HTREEITEM hParent = m_MenuItems.GetParentItem(hItem);
if (hParent == NULL) if (hParent == NULL)
@ -259,14 +256,13 @@ void COptionsShortCutsPage::RefreshShortCutOptions ( HTREEITEM hItem )
return; return;
} }
ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hItem); CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hItem);
m_CurrentKeys.ResetContent(); m_CurrentKeys.ResetContent();
const SHORTCUT_KEY_LIST & ShortCutList = ShortCut->GetAccelItems(); const SHORTCUT_KEY_LIST & ShortCutList = ShortCut->GetAccelItems();
for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item ++) for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item++)
{ {
if (ShortCut_item->Inactive()) if (ShortCut_item->Inactive())
{ {
@ -274,24 +270,23 @@ void COptionsShortCutsPage::RefreshShortCutOptions ( HTREEITEM hItem )
} }
ACCESS_MODE ItemMode = ShortCut_item->AccessMode(); ACCESS_MODE ItemMode = ShortCut_item->AccessMode();
if ((ItemMode & AccessLevel) != AccessLevel ) if ((ItemMode & AccessLevel) != AccessLevel)
{ {
continue; continue;
} }
stdstr Name = ShortCut_item->Name(); stdstr Name = ShortCut_item->Name();
m_CurrentKeys.SetItemData(m_CurrentKeys.AddString(Name.c_str()),(DWORD_PTR)&*ShortCut_item); m_CurrentKeys.SetItemData(m_CurrentKeys.AddString(Name.c_str()), (DWORD_PTR)&*ShortCut_item);
} }
} }
BOOL CALLBACK KeyPromptDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/)
BOOL CALLBACK KeyPromptDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/)
{ {
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
break; break;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
SetForegroundWindow(GetParent(hDlg)); SetForegroundWindow(GetParent(hDlg));
@ -305,49 +300,48 @@ BOOL CALLBACK KeyPromptDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lP
return TRUE; return TRUE;
} }
void COptionsShortCutsPage::InputGetKeys (void) void COptionsShortCutsPage::InputGetKeys(void)
{ {
HWND hKeyDlg = CreateDialogParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_Key_Prompt),m_hWnd,(DLGPROC)KeyPromptDlgProc,(LPARAM)::GetDlgItem(m_hWnd,IDC_VIRTUALKEY)); HWND hKeyDlg = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Key_Prompt), m_hWnd, (DLGPROC)KeyPromptDlgProc, (LPARAM)::GetDlgItem(m_hWnd, IDC_VIRTUALKEY));
::EnableWindow(GetParent(),false); ::EnableWindow(GetParent(), false);
MSG msg; MSG msg;
for(bool fDone=false;!fDone;MsgWaitForMultipleObjects(0,NULL,false,45,QS_ALLINPUT)) { for (bool fDone = false; !fDone; MsgWaitForMultipleObjects(0, NULL, false, 45, QS_ALLINPUT)) {
while(PeekMessage(&msg,0,0,0,PM_REMOVE)) { while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
if(msg.message == WM_QUIT) { if (msg.message == WM_QUIT) {
fDone = true; fDone = true;
::PostMessage(NULL,WM_QUIT,0,0); ::PostMessage(NULL, WM_QUIT, 0, 0);
break; break;
} }
if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN ) { if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) {
int nVirtKey = (int)msg.wParam; int nVirtKey = (int)msg.wParam;
if (nVirtKey == VK_SHIFT) { continue; } if (nVirtKey == VK_SHIFT) { continue; }
if (nVirtKey == VK_CONTROL) { continue; } if (nVirtKey == VK_CONTROL) { continue; }
if (nVirtKey == VK_MENU) { continue; } if (nVirtKey == VK_MENU) { continue; }
SendDlgItemMessage(IDC_VIRTUALKEY,CB_SETCURSEL,(WPARAM)-1,0); SendDlgItemMessage(IDC_VIRTUALKEY, CB_SETCURSEL, (WPARAM)-1, 0);
for (int count = 0; count < SendDlgItemMessage(IDC_VIRTUALKEY,CB_GETCOUNT,0,0); count++) { for (int count = 0; count < SendDlgItemMessage(IDC_VIRTUALKEY, CB_GETCOUNT, 0, 0); count++) {
int Data = (int)SendDlgItemMessage(IDC_VIRTUALKEY,CB_GETITEMDATA,count,0); int Data = (int)SendDlgItemMessage(IDC_VIRTUALKEY, CB_GETITEMDATA, count, 0);
if (Data != nVirtKey) { continue; } if (Data != nVirtKey) { continue; }
SendDlgItemMessage(IDC_VIRTUALKEY,CB_SETCURSEL,count,0); SendDlgItemMessage(IDC_VIRTUALKEY, CB_SETCURSEL, count, 0);
SendDlgItemMessage(IDC_CTL,BM_SETCHECK, (GetKeyState(VK_CONTROL) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); SendDlgItemMessage(IDC_CTL, BM_SETCHECK, (GetKeyState(VK_CONTROL) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(IDC_ALT,BM_SETCHECK, (GetKeyState(VK_MENU) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); SendDlgItemMessage(IDC_ALT, BM_SETCHECK, (GetKeyState(VK_MENU) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(IDC_SHIFT,BM_SETCHECK, (GetKeyState(VK_SHIFT) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); SendDlgItemMessage(IDC_SHIFT, BM_SETCHECK, (GetKeyState(VK_SHIFT) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(WM_COMMAND,MAKELPARAM(IDC_VIRTUALKEY,LBN_SELCHANGE),(LPARAM)::GetDlgItem(m_hWnd,IDC_VIRTUALKEY)); SendMessage(WM_COMMAND, MAKELPARAM(IDC_VIRTUALKEY, LBN_SELCHANGE), (LPARAM)::GetDlgItem(m_hWnd, IDC_VIRTUALKEY));
SetForegroundWindow(GetParent()); SetForegroundWindow(GetParent());
::DestroyWindow(hKeyDlg); ::DestroyWindow(hKeyDlg);
} }
continue; continue;
} }
if(!::IsDialogMessage(hKeyDlg,&msg)) { if (!::IsDialogMessage(hKeyDlg, &msg)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
} }
if(!::IsWindow(hKeyDlg)) { fDone = true; }
if (!::IsWindow(hKeyDlg)) { fDone = true; }
} }
::SetFocus(GetParent()); ::SetFocus(GetParent());
::EnableWindow(GetParent(),true); ::EnableWindow(GetParent(), true);
} }
void COptionsShortCutsPage::HidePage() void COptionsShortCutsPage::HidePage()
@ -360,13 +354,13 @@ void COptionsShortCutsPage::ShowPage()
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
} }
void COptionsShortCutsPage::ApplySettings( bool /*UpdateScreen*/ ) void COptionsShortCutsPage::ApplySettings(bool /*UpdateScreen*/)
{ {
m_ShortCuts.Save(); m_ShortCuts.Save();
g_Settings->SaveBool(Info_ShortCutsChanged,true); g_Settings->SaveBool(Info_ShortCutsChanged, true);
} }
bool COptionsShortCutsPage::EnableReset ( void ) bool COptionsShortCutsPage::EnableReset(void)
{ {
return m_EnableReset; return m_EnableReset;
} }
@ -375,9 +369,8 @@ void COptionsShortCutsPage::ResetPage()
{ {
m_EnableReset = false; m_EnableReset = false;
m_ShortCuts.Load(true); m_ShortCuts.Load(true);
OnCpuStateChanged(LBN_SELCHANGE,IDC_C_CPU_STATE,GetDlgItem(IDC_C_CPU_STATE)); OnCpuStateChanged(LBN_SELCHANGE, IDC_C_CPU_STATE, GetDlgItem(IDC_C_CPU_STATE));
SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
m_CurrentKeys.ResetContent(); m_CurrentKeys.ResetContent();
CSettingsPageImpl<COptionsShortCutsPage>::ResetPage(); CSettingsPageImpl<COptionsShortCutsPage>::ResetPage();
} }
#endif

View File

@ -10,13 +10,12 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
CGeneralOptionsPage::CGeneralOptionsPage(CSettingConfig * SettingsConfig, HWND hParent, const RECT & rcDispay ) : CGeneralOptionsPage::CGeneralOptionsPage(CSettingConfig * SettingsConfig, HWND hParent, const RECT & rcDispay) :
m_SettingsConfig(SettingsConfig) m_SettingsConfig(SettingsConfig)
{ {
if (!Create(hParent,rcDispay)) if (!Create(hParent, rcDispay))
{ {
return; return;
} }
@ -31,15 +30,15 @@ CGeneralOptionsPage::CGeneralOptionsPage(CSettingConfig * SettingsConfig, HWND h
SetDlgItemTextW(m_hWnd, IDC_MAXROMDIR_TXT, GS(RB_MAX_DIRS)); SetDlgItemTextW(m_hWnd, IDC_MAXROMDIR_TXT, GS(RB_MAX_DIRS));
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, GS(RB_DIRS)); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, GS(RB_DIRS));
AddModCheckBox(GetDlgItem(IDC_AUTOSLEEP),Setting_AutoSleep); AddModCheckBox(GetDlgItem(IDC_AUTOSLEEP), Setting_AutoSleep);
AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN),Setting_AutoFullscreen); AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN), Setting_AutoFullscreen);
AddModCheckBox(GetDlgItem(IDC_SCREEN_SAVER),Setting_DisableScrSaver); AddModCheckBox(GetDlgItem(IDC_SCREEN_SAVER), Setting_DisableScrSaver);
AddModCheckBox(GetDlgItem(IDC_BASIC_MODE),UserInterface_BasicMode); AddModCheckBox(GetDlgItem(IDC_BASIC_MODE), UserInterface_BasicMode);
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBER),File_RecentGameFileCount, false); CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBER), File_RecentGameFileCount, false);
TxtBox->SetTextField(GetDlgItem(IDC_MAXROMS_TXT)); TxtBox->SetTextField(GetDlgItem(IDC_MAXROMS_TXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBERDIR),Directory_RecentGameDirCount, false); TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBERDIR), Directory_RecentGameDirCount, false);
TxtBox->SetTextField(GetDlgItem(IDC_MAXROMDIR_TXT)); TxtBox->SetTextField(GetDlgItem(IDC_MAXROMDIR_TXT));
UpdatePageSettings(); UpdatePageSettings();
@ -55,12 +54,12 @@ void CGeneralOptionsPage::ShowPage()
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
} }
void CGeneralOptionsPage::ApplySettings( bool UpdateScreen ) void CGeneralOptionsPage::ApplySettings(bool UpdateScreen)
{ {
CSettingsPageImpl<CGeneralOptionsPage>::ApplySettings(UpdateScreen); CSettingsPageImpl<CGeneralOptionsPage>::ApplySettings(UpdateScreen);
} }
bool CGeneralOptionsPage::EnableReset ( void ) bool CGeneralOptionsPage::EnableReset(void)
{ {
if (CSettingsPageImpl<CGeneralOptionsPage>::EnableReset()) { return true; } if (CSettingsPageImpl<CGeneralOptionsPage>::EnableReset()) { return true; }
return false; return false;
@ -72,9 +71,8 @@ void CGeneralOptionsPage::ResetPage()
m_SettingsConfig->UpdateAdvanced((int)::SendMessage(GetDlgItem(IDC_BASIC_MODE), BM_GETCHECK, 0, 0) == 0); m_SettingsConfig->UpdateAdvanced((int)::SendMessage(GetDlgItem(IDC_BASIC_MODE), BM_GETCHECK, 0, 0) == 0);
} }
void CGeneralOptionsPage::OnBasicMode ( UINT Code, int id, HWND ctl ) void CGeneralOptionsPage::OnBasicMode(UINT Code, int id, HWND ctl)
{ {
CheckBoxChanged(Code,id,ctl); CheckBoxChanged(Code, id, ctl);
m_SettingsConfig->UpdateAdvanced((int)::SendMessage(ctl, BM_GETCHECK, 0, 0) == 0); m_SettingsConfig->UpdateAdvanced((int)::SendMessage(ctl, BM_GETCHECK, 0, 0) == 0);
} }
#endif

View File

@ -10,53 +10,52 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
COptionPluginPage::COptionPluginPage (HWND hParent, const RECT & rcDispay ) COptionPluginPage::COptionPluginPage(HWND hParent, const RECT & rcDispay)
{ {
if (!Create(hParent,rcDispay)) if (!Create(hParent, rcDispay))
{ {
return; return;
} }
//Set the text for all gui Items
SetDlgItemTextW(m_hWnd, RSP_ABOUT,GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, GFX_ABOUT,GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, AUDIO_ABOUT,GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, CONT_ABOUT,GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, IDC_RSP_NAME,GS(PLUG_RSP)); //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, IDC_GFX_NAME,GS(PLUG_GFX)); SetDlgItemTextW(m_hWnd, RSP_ABOUT, GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, IDC_AUDIO_NAME,GS(PLUG_AUDIO)); SetDlgItemTextW(m_hWnd, GFX_ABOUT, GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, IDC_CONT_NAME,GS(PLUG_CTRL)); SetDlgItemTextW(m_hWnd, AUDIO_ABOUT, GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, CONT_ABOUT, GS(PLUG_ABOUT));
SetDlgItemTextW(m_hWnd, IDC_HLE_GFX,GS(PLUG_HLE_GFX));
SetDlgItemTextW(m_hWnd, IDC_HLE_AUDIO,GS(PLUG_HLE_AUDIO)); SetDlgItemTextW(m_hWnd, IDC_RSP_NAME, GS(PLUG_RSP));
SetDlgItemTextW(m_hWnd, IDC_GFX_NAME, GS(PLUG_GFX));
SetDlgItemTextW(m_hWnd, IDC_AUDIO_NAME, GS(PLUG_AUDIO));
SetDlgItemTextW(m_hWnd, IDC_CONT_NAME, GS(PLUG_CTRL));
SetDlgItemTextW(m_hWnd, IDC_HLE_GFX, GS(PLUG_HLE_GFX));
SetDlgItemTextW(m_hWnd, IDC_HLE_AUDIO, GS(PLUG_HLE_AUDIO));
m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME)); m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME));
m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME)); m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME));
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME)); m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME)); m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
AddPlugins(GFX_LIST,Plugin_GFX_Current,PLUGIN_TYPE_GFX); AddPlugins(GFX_LIST, Plugin_GFX_Current, PLUGIN_TYPE_GFX);
AddPlugins(AUDIO_LIST,Plugin_AUDIO_Current,PLUGIN_TYPE_AUDIO); AddPlugins(AUDIO_LIST, Plugin_AUDIO_Current, PLUGIN_TYPE_AUDIO);
AddPlugins(CONT_LIST,Plugin_CONT_Current,PLUGIN_TYPE_CONTROLLER); AddPlugins(CONT_LIST, Plugin_CONT_Current, PLUGIN_TYPE_CONTROLLER);
AddPlugins(RSP_LIST,Plugin_RSP_Current,PLUGIN_TYPE_RSP); AddPlugins(RSP_LIST, Plugin_RSP_Current, PLUGIN_TYPE_RSP);
AddModCheckBox(GetDlgItem(IDC_HLE_GFX), Plugin_UseHleGfx);
AddModCheckBox(GetDlgItem(IDC_HLE_AUDIO), Plugin_UseHleAudio);
AddModCheckBox(GetDlgItem(IDC_HLE_GFX),Plugin_UseHleGfx);
AddModCheckBox(GetDlgItem(IDC_HLE_AUDIO),Plugin_UseHleAudio);
UpdatePageSettings(); UpdatePageSettings();
} }
void COptionPluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType ) void COptionPluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE PluginType)
{ {
stdstr Default = g_Settings->LoadStringVal(Type); stdstr Default = g_Settings->LoadStringVal(Type);
CModifiedComboBox * ComboBox; CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(ListId),Type); ComboBox = AddModComboBox(GetDlgItem(ListId), Type);
for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++ ) for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++)
{ {
const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i);
if (Plugin == NULL) if (Plugin == NULL)
@ -67,7 +66,7 @@ void COptionPluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE Plugi
{ {
continue; continue;
} }
if (_stricmp(Default.c_str(),Plugin->FileName.c_str()) == 0) if (_stricmp(Default.c_str(), Plugin->FileName.c_str()) == 0)
{ {
ComboBox->SetDefault((WPARAM)Plugin); ComboBox->SetDefault((WPARAM)Plugin);
} }
@ -75,10 +74,10 @@ void COptionPluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE Plugi
} }
} }
void COptionPluginPage::ShowAboutButton ( int id ) void COptionPluginPage::ShowAboutButton(int id)
{ {
CModifiedComboBox * ComboBox = NULL; CModifiedComboBox * ComboBox = NULL;
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{ {
if ((int)(cb_iter->second->GetMenu()) != id) if ((int)(cb_iter->second->GetMenu()) != id)
{ {
@ -92,11 +91,11 @@ void COptionPluginPage::ShowAboutButton ( int id )
return; return;
} }
int index = ComboBox->GetCurSel(); int index = ComboBox->GetCurSel();
if (index == CB_ERR) if (index == CB_ERR)
{ {
return; return;
} }
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index);
if (PluginPtr == NULL) if (PluginPtr == NULL)
{ {
@ -108,30 +107,30 @@ void COptionPluginPage::ShowAboutButton ( int id )
{ {
return; return;
} }
//Load the plugin //Load the plugin
UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); UINT LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
HMODULE hLib = LoadLibrary(Plugin->FullPath); HMODULE hLib = LoadLibrary(Plugin->FullPath);
SetErrorMode(LastErrorMode); SetErrorMode(LastErrorMode);
if (hLib == NULL) if (hLib == NULL)
{ {
return; return;
} }
//Get DLL about //Get DLL about
void (__cdecl *DllAbout) ( HWND hWnd ); void(__cdecl *DllAbout) (HWND hWnd);
DllAbout = (void (__cdecl *)(HWND))GetProcAddress( hLib, "DllAbout" ); DllAbout = (void(__cdecl *)(HWND))GetProcAddress(hLib, "DllAbout");
//call the function from the dll //call the function from the dll
DllAbout(m_hWnd); DllAbout(m_hWnd);
FreeLibrary(hLib); FreeLibrary(hLib);
} }
void COptionPluginPage::PluginItemChanged ( int id, int AboutID, bool bSetChanged ) void COptionPluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged)
{ {
CModifiedComboBox * ComboBox = NULL; CModifiedComboBox * ComboBox = NULL;
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{ {
if ((int)(cb_iter->second->GetMenu()) != id) if ((int)(cb_iter->second->GetMenu()) != id)
{ {
@ -146,9 +145,9 @@ void COptionPluginPage::PluginItemChanged ( int id, int AboutID, bool bSetChange
} }
int index = ComboBox->GetCurSel(); int index = ComboBox->GetCurSel();
if (index == CB_ERR) if (index == CB_ERR)
{ {
return; return;
} }
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index);
if (PluginPtr) if (PluginPtr)
@ -156,27 +155,27 @@ void COptionPluginPage::PluginItemChanged ( int id, int AboutID, bool bSetChange
const CPluginList::PLUGIN * Plugin = *PluginPtr; const CPluginList::PLUGIN * Plugin = *PluginPtr;
if (Plugin) if (Plugin)
{ {
::EnableWindow(GetDlgItem(AboutID),Plugin->AboutFunction); ::EnableWindow(GetDlgItem(AboutID), Plugin->AboutFunction);
} }
} }
if (bSetChanged) if (bSetChanged)
{ {
ComboBox->SetChanged(true); ComboBox->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
} }
void COptionPluginPage::UpdatePageSettings ( void ) void COptionPluginPage::UpdatePageSettings(void)
{ {
UpdateCheckBoxes(); UpdateCheckBoxes();
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{ {
CModifiedComboBox * ComboBox = cb_iter->second; CModifiedComboBox * ComboBox = cb_iter->second;
stdstr SelectedValue; stdstr SelectedValue;
ComboBox->SetChanged(g_Settings->LoadStringVal(cb_iter->first,SelectedValue)); ComboBox->SetChanged(g_Settings->LoadStringVal(cb_iter->first, SelectedValue));
for (int i = 0, n = ComboBox->GetCount(); i < n; i++ ) for (int i = 0, n = ComboBox->GetCount(); i < n; i++)
{ {
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(i); const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(i);
if (PluginPtr == NULL) if (PluginPtr == NULL)
@ -188,17 +187,17 @@ void COptionPluginPage::UpdatePageSettings ( void )
{ {
continue; continue;
} }
if (_stricmp(SelectedValue.c_str(),Plugin->FileName.c_str()) != 0) if (_stricmp(SelectedValue.c_str(), Plugin->FileName.c_str()) != 0)
{ {
continue; continue;
} }
ComboBox->SetDefault((WPARAM)Plugin); ComboBox->SetDefault((WPARAM)Plugin);
} }
} }
PluginItemChanged(GFX_LIST,GFX_ABOUT,false); PluginItemChanged(GFX_LIST, GFX_ABOUT, false);
PluginItemChanged(AUDIO_LIST,AUDIO_ABOUT,false); PluginItemChanged(AUDIO_LIST, AUDIO_ABOUT, false);
PluginItemChanged(CONT_LIST,CONT_ABOUT,false); PluginItemChanged(CONT_LIST, CONT_ABOUT, false);
PluginItemChanged(RSP_LIST,RSP_ABOUT,false); PluginItemChanged(RSP_LIST, RSP_ABOUT, false);
} }
void COptionPluginPage::HidePage() void COptionPluginPage::HidePage()
@ -211,12 +210,12 @@ void COptionPluginPage::ShowPage()
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
} }
void COptionPluginPage::ApplySettings( bool UpdateScreen ) void COptionPluginPage::ApplySettings(bool UpdateScreen)
{ {
CSettingsPageImpl<COptionPluginPage>::ApplySettings(UpdateScreen); CSettingsPageImpl<COptionPluginPage>::ApplySettings(UpdateScreen);
} }
bool COptionPluginPage::EnableReset ( void ) bool COptionPluginPage::EnableReset(void)
{ {
if (CSettingsPageImpl<COptionPluginPage>::EnableReset()) { return true; } if (CSettingsPageImpl<COptionPluginPage>::EnableReset()) { return true; }
return false; return false;
@ -227,17 +226,17 @@ void COptionPluginPage::ResetPage()
CSettingsPageImpl<COptionPluginPage>::ResetPage(); CSettingsPageImpl<COptionPluginPage>::ResetPage();
} }
void COptionPluginPage::ApplyComboBoxes ( void ) void COptionPluginPage::ApplyComboBoxes(void)
{ {
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{ {
CModifiedComboBox * ComboBox = cb_iter->second; CModifiedComboBox * ComboBox = cb_iter->second;
if (ComboBox->IsChanged()) if (ComboBox->IsChanged())
{ {
int index = ComboBox->GetCurSel(); int index = ComboBox->GetCurSel();
if (index == CB_ERR) if (index == CB_ERR)
{ {
return; return;
} }
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index);
@ -248,7 +247,7 @@ void COptionPluginPage::ApplyComboBoxes ( void )
const CPluginList::PLUGIN * Plugin = *PluginPtr; const CPluginList::PLUGIN * Plugin = *PluginPtr;
g_Settings->SaveString(cb_iter->first,Plugin->FileName.c_str()); g_Settings->SaveString(cb_iter->first, Plugin->FileName.c_str());
} }
if (ComboBox->IsReset()) if (ComboBox->IsReset())
{ {
@ -258,7 +257,7 @@ void COptionPluginPage::ApplyComboBoxes ( void )
} }
} }
bool COptionPluginPage::ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type ) bool COptionPluginPage::ResetComboBox(CModifiedComboBox & ComboBox, SettingID Type)
{ {
if (!ComboBox.IsChanged()) if (!ComboBox.IsChanged())
{ {
@ -286,18 +285,18 @@ bool COptionPluginPage::ResetComboBox ( CModifiedComboBox & ComboBox, SettingID
return false; return false;
} }
void COptionPluginPage::HleGfxChanged ( UINT /*Code*/, int id, HWND /*ctl*/ ) void COptionPluginPage::HleGfxChanged(UINT /*Code*/, int id, HWND /*ctl*/)
{ {
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{ {
CModifiedButton * Button = iter->second; CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id) if ((int)Button->GetMenu() != id)
{ {
continue; continue;
} }
if ((Button->GetCheck() & BST_CHECKED) == 0) if ((Button->GetCheck() & BST_CHECKED) == 0)
{ {
int res = MessageBoxW(m_hWnd, GS(MSG_SET_LLE_GFX_MSG),GS(MSG_SET_LLE_GFX_TITLE),MB_YESNO|MB_ICONWARNING); int res = MessageBoxW(m_hWnd, GS(MSG_SET_LLE_GFX_MSG), GS(MSG_SET_LLE_GFX_TITLE), MB_YESNO | MB_ICONWARNING);
if (res != IDYES) if (res != IDYES)
{ {
Button->SetCheck(BST_CHECKED); Button->SetCheck(BST_CHECKED);
@ -305,23 +304,23 @@ void COptionPluginPage::HleGfxChanged ( UINT /*Code*/, int id, HWND /*ctl*/ )
} }
} }
Button->SetChanged(true); Button->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
break; break;
} }
} }
void COptionPluginPage::HleAudioChanged ( UINT /*Code*/, int id, HWND /*ctl*/ ) void COptionPluginPage::HleAudioChanged(UINT /*Code*/, int id, HWND /*ctl*/)
{ {
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{ {
CModifiedButton * Button = iter->second; CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id) if ((int)Button->GetMenu() != id)
{ {
continue; continue;
} }
if ((Button->GetCheck() & BST_CHECKED) != 0) if ((Button->GetCheck() & BST_CHECKED) != 0)
{ {
int res = MessageBoxW(m_hWnd, GS(MSG_SET_HLE_AUD_MSG),GS(MSG_SET_HLE_AUD_TITLE),MB_ICONWARNING|MB_YESNO); int res = MessageBoxW(m_hWnd, GS(MSG_SET_HLE_AUD_MSG), GS(MSG_SET_HLE_AUD_TITLE), MB_ICONWARNING | MB_YESNO);
if (res != IDYES) if (res != IDYES)
{ {
Button->SetCheck(BST_UNCHECKED); Button->SetCheck(BST_UNCHECKED);
@ -329,8 +328,7 @@ void COptionPluginPage::HleAudioChanged ( UINT /*Code*/, int id, HWND /*ctl*/ )
} }
} }
Button->SetChanged(true); Button->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
break; break;
} }
} }
#endif

View File

@ -17,51 +17,51 @@ class COptionPluginPage :
public CSettingsPage public CSettingsPage
{ {
BEGIN_MSG_MAP_EX(COptionPluginPage) BEGIN_MSG_MAP_EX(COptionPluginPage)
COMMAND_HANDLER_EX(GFX_LIST,LBN_SELCHANGE,GfxPluginChanged) COMMAND_HANDLER_EX(GFX_LIST, LBN_SELCHANGE, GfxPluginChanged)
COMMAND_HANDLER_EX(AUDIO_LIST,LBN_SELCHANGE,AudioPluginChanged) COMMAND_HANDLER_EX(AUDIO_LIST, LBN_SELCHANGE, AudioPluginChanged)
COMMAND_HANDLER_EX(CONT_LIST,LBN_SELCHANGE,ControllerPluginChanged) COMMAND_HANDLER_EX(CONT_LIST, LBN_SELCHANGE, ControllerPluginChanged)
COMMAND_HANDLER_EX(RSP_LIST,LBN_SELCHANGE,RspPluginChanged) COMMAND_HANDLER_EX(RSP_LIST, LBN_SELCHANGE, RspPluginChanged)
COMMAND_ID_HANDLER_EX(GFX_ABOUT,GfxPluginAbout) COMMAND_ID_HANDLER_EX(GFX_ABOUT, GfxPluginAbout)
COMMAND_ID_HANDLER_EX(AUDIO_ABOUT,AudioPluginAbout) COMMAND_ID_HANDLER_EX(AUDIO_ABOUT, AudioPluginAbout)
COMMAND_ID_HANDLER_EX(CONT_ABOUT,ControllerPluginAbout) COMMAND_ID_HANDLER_EX(CONT_ABOUT, ControllerPluginAbout)
COMMAND_ID_HANDLER_EX(RSP_ABOUT,RspPluginAbout) COMMAND_ID_HANDLER_EX(RSP_ABOUT, RspPluginAbout)
COMMAND_ID_HANDLER_EX(IDC_HLE_GFX,HleGfxChanged) COMMAND_ID_HANDLER_EX(IDC_HLE_GFX, HleGfxChanged)
COMMAND_ID_HANDLER_EX(IDC_HLE_AUDIO,HleAudioChanged) COMMAND_ID_HANDLER_EX(IDC_HLE_AUDIO, HleAudioChanged)
END_MSG_MAP() END_MSG_MAP()
enum { IDD = IDD_Settings_PlugSel }; enum { IDD = IDD_Settings_PlugSel };
public: public:
COptionPluginPage(HWND hParent, const RECT & rcDispay ); COptionPluginPage(HWND hParent, const RECT & rcDispay);
LanguageStringID PageTitle ( void ) { return TAB_PLUGIN; } LanguageStringID PageTitle(void) { return TAB_PLUGIN; }
void HidePage ( void ); void HidePage(void);
void ShowPage ( void ); void ShowPage(void);
void ApplySettings ( bool UpdateScreen ); void ApplySettings(bool UpdateScreen);
bool EnableReset ( void ); bool EnableReset(void);
void ResetPage ( void ); void ResetPage(void);
private: private:
void GfxPluginAbout ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { ShowAboutButton(GFX_LIST); } void GfxPluginAbout(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ShowAboutButton(GFX_LIST); }
void AudioPluginAbout ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { ShowAboutButton(AUDIO_LIST); } void AudioPluginAbout(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ShowAboutButton(AUDIO_LIST); }
void ControllerPluginAbout ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { ShowAboutButton(CONT_LIST); } void ControllerPluginAbout(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ShowAboutButton(CONT_LIST); }
void RspPluginAbout ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { ShowAboutButton(RSP_LIST); } void RspPluginAbout(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ShowAboutButton(RSP_LIST); }
void GfxPluginChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { PluginItemChanged(GFX_LIST,GFX_ABOUT); } void GfxPluginChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { PluginItemChanged(GFX_LIST, GFX_ABOUT); }
void AudioPluginChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { PluginItemChanged(AUDIO_LIST,AUDIO_ABOUT); } void AudioPluginChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { PluginItemChanged(AUDIO_LIST, AUDIO_ABOUT); }
void ControllerPluginChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { PluginItemChanged(CONT_LIST,CONT_ABOUT); } void ControllerPluginChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { PluginItemChanged(CONT_LIST, CONT_ABOUT); }
void RspPluginChanged ( UINT /*Code*/, int /*id*/, HWND /*ctl*/ ) { PluginItemChanged(RSP_LIST,RSP_ABOUT); } void RspPluginChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { PluginItemChanged(RSP_LIST, RSP_ABOUT); }
void HleGfxChanged ( UINT Code, int id, HWND ctl ); void HleGfxChanged(UINT Code, int id, HWND ctl);
void HleAudioChanged ( UINT Code, int id, HWND ctl ); void HleAudioChanged(UINT Code, int id, HWND ctl);
void ShowAboutButton ( int id ); void ShowAboutButton(int id);
void PluginItemChanged ( int id, int AboutID, bool bSetChanged = true ); void PluginItemChanged(int id, int AboutID, bool bSetChanged = true);
void AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType ); void AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE PluginType);
void UpdatePageSettings ( void ); void UpdatePageSettings(void);
void ApplyComboBoxes ( void ); void ApplyComboBoxes(void);
bool ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type ); bool ResetComboBox(CModifiedComboBox & ComboBox, SettingID Type);
CPartialGroupBox m_GfxGroup, m_AudioGroup, m_ControlGroup, m_RspGroup; CPartialGroupBox m_GfxGroup, m_AudioGroup, m_ControlGroup, m_RspGroup;
CPluginList m_PluginList; CPluginList m_PluginList;

View File

@ -10,15 +10,14 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Settings Page.h" #include "Settings Page.h"
CConfigSettingSection::CConfigSettingSection( LPCWSTR PageTitle ) : CConfigSettingSection::CConfigSettingSection(LPCWSTR PageTitle) :
m_PageTitle(PageTitle) m_PageTitle(PageTitle)
{ {
} }
CConfigSettingSection::~CConfigSettingSection () CConfigSettingSection::~CConfigSettingSection()
{ {
for (size_t i = 0; i < m_Pages.size(); i++) for (size_t i = 0; i < m_Pages.size(); i++)
{ {
@ -28,12 +27,12 @@ CConfigSettingSection::~CConfigSettingSection ()
m_Pages.clear(); m_Pages.clear();
} }
void CConfigSettingSection::AddPage(CSettingsPage * Page ) void CConfigSettingSection::AddPage(CSettingsPage * Page)
{ {
m_Pages.push_back(Page); m_Pages.push_back(Page);
} }
CSettingsPage * CConfigSettingSection::GetPage ( int PageNo ) CSettingsPage * CConfigSettingSection::GetPage(int PageNo)
{ {
if (PageNo < 0 || PageNo >= (int)m_Pages.size()) if (PageNo < 0 || PageNo >= (int)m_Pages.size())
{ {
@ -41,4 +40,3 @@ CSettingsPage * CConfigSettingSection::GetPage ( int PageNo )
} }
return m_Pages[PageNo]; return m_Pages[PageNo];
} }
#endif

View File

@ -10,16 +10,15 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
CModifiedEditBox::CModifiedEditBox(bool bString /* = true */, HWND hWnd /* = NULL */) : CModifiedEditBox::CModifiedEditBox(bool bString /* = true */, HWND hWnd /* = NULL */) :
CEdit(hWnd), CEdit(hWnd),
m_Changed(false), m_Changed(false),
m_Reset(false), m_Reset(false),
m_BoldFont(NULL), m_BoldFont(NULL),
m_OriginalFont(NULL), m_OriginalFont(NULL),
m_TextField(NULL), m_TextField(NULL),
m_bString(bString) m_bString(bString)
{ {
} }
CModifiedEditBox::~CModifiedEditBox() CModifiedEditBox::~CModifiedEditBox()
@ -30,7 +29,7 @@ CModifiedEditBox::~CModifiedEditBox()
} }
} }
void CModifiedEditBox::SetReset ( bool Reset ) void CModifiedEditBox::SetReset(bool Reset)
{ {
m_Reset = Reset; m_Reset = Reset;
if (m_Reset) if (m_Reset)
@ -39,7 +38,7 @@ void CModifiedEditBox::SetReset ( bool Reset )
} }
} }
void CModifiedEditBox::SetChanged (bool Changed) void CModifiedEditBox::SetChanged(bool Changed)
{ {
m_Changed = Changed; m_Changed = Changed;
if (m_Changed) if (m_Changed)
@ -47,61 +46,61 @@ void CModifiedEditBox::SetChanged (bool Changed)
SetReset(false); SetReset(false);
if (m_BoldFont == NULL) if (m_BoldFont == NULL)
{ {
m_OriginalFont = (HFONT)SendMessage(WM_GETFONT); m_OriginalFont = (HFONT)SendMessage(WM_GETFONT);
LOGFONT lfSystemVariableFont; LOGFONT lfSystemVariableFont;
GetObject ( m_OriginalFont, sizeof(LOGFONT), &lfSystemVariableFont ); GetObject(m_OriginalFont, sizeof(LOGFONT), &lfSystemVariableFont);
lfSystemVariableFont.lfWeight = FW_BOLD; lfSystemVariableFont.lfWeight = FW_BOLD;
m_BoldFont = CreateFontIndirect ( &lfSystemVariableFont ); m_BoldFont = CreateFontIndirect(&lfSystemVariableFont);
} }
SendMessage(WM_SETFONT,(WPARAM)m_BoldFont); SendMessage(WM_SETFONT, (WPARAM)m_BoldFont);
InvalidateRect(NULL); InvalidateRect(NULL);
if (m_TextField) if (m_TextField)
{ {
::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_BoldFont,0); ::SendMessage(m_TextField, WM_SETFONT, (WPARAM)m_BoldFont, 0);
::InvalidateRect(m_TextField, NULL, true); ::InvalidateRect(m_TextField, NULL, true);
} }
} else { }
else
{
if (m_OriginalFont) if (m_OriginalFont)
{ {
SendMessage(WM_SETFONT,(WPARAM)m_OriginalFont); SendMessage(WM_SETFONT, (WPARAM)m_OriginalFont);
InvalidateRect(NULL); InvalidateRect(NULL);
if (m_TextField) if (m_TextField)
{ {
::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_OriginalFont,0); ::SendMessage(m_TextField, WM_SETFONT, (WPARAM)m_OriginalFont, 0);
::InvalidateRect(m_TextField, NULL, true); ::InvalidateRect(m_TextField, NULL, true);
} }
} }
} }
} }
stdstr CModifiedEditBox::GetWindowText( void ) stdstr CModifiedEditBox::GetWindowText(void)
{ {
stdstr Result; stdstr Result;
ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(::IsWindow(m_hWnd));
int nLen = ::GetWindowTextLength(m_hWnd); int nLen = ::GetWindowTextLength(m_hWnd);
if(nLen == 0) if (nLen == 0)
{ {
return Result; return Result;
} }
Result.resize(nLen+1); Result.resize(nLen + 1);
::GetWindowText(m_hWnd,(char *)Result.c_str(),nLen+1); ::GetWindowText(m_hWnd, (char *)Result.c_str(), nLen + 1);
return Result; return Result;
} }
void CModifiedEditBox::SetTextField (HWND hWnd) void CModifiedEditBox::SetTextField(HWND hWnd)
{ {
if (m_TextField && m_OriginalFont) if (m_TextField && m_OriginalFont)
{ {
::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_OriginalFont,0); ::SendMessage(m_TextField, WM_SETFONT, (WPARAM)m_OriginalFont, 0);
} }
m_TextField = hWnd; m_TextField = hWnd;
if (m_Changed && m_BoldFont) if (m_Changed && m_BoldFont)
{ {
::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_BoldFont,0); ::SendMessage(m_TextField, WM_SETFONT, (WPARAM)m_BoldFont, 0);
} }
} }
#endif

View File

@ -10,7 +10,6 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
BOOL CPartialGroupBox::Attach(HWND hWnd) BOOL CPartialGroupBox::Attach(HWND hWnd)
{ {
ATLASSUME(m_hWnd == NULL); ATLASSUME(m_hWnd == NULL);
@ -34,7 +33,7 @@ BOOL CPartialGroupBox::Attach(HWND hWnd)
BOOL CPartialGroupBox::AttachToDlgItem(HWND parent, UINT dlgID) BOOL CPartialGroupBox::AttachToDlgItem(HWND parent, UINT dlgID)
{ {
return Attach(::GetDlgItem(parent,dlgID)); return Attach(::GetDlgItem(parent, dlgID));
} }
void CPartialGroupBox::Draw3dLine(CPaintDC & dc, LPCRECT lpRect, COLORREF clrTopLeft, COLORREF /*clrBottomRight*/) void CPartialGroupBox::Draw3dLine(CPaintDC & dc, LPCRECT lpRect, COLORREF clrTopLeft, COLORREF /*clrBottomRight*/)
@ -68,39 +67,39 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
wchar_t grptext[500]; wchar_t grptext[500];
GetWindowTextW(m_hWnd, grptext, sizeof(grptext) / sizeof(grptext[0])); GetWindowTextW(m_hWnd, grptext, sizeof(grptext) / sizeof(grptext[0]));
CRect fontsizerect(0,0,0,0); CRect fontsizerect(0, 0, 0, 0);
dc.DrawTextW(grptext, -1, fontsizerect, DT_SINGLELINE | DT_LEFT | DT_CALCRECT); dc.DrawTextW(grptext, -1, fontsizerect, DT_SINGLELINE | DT_LEFT | DT_CALCRECT);
CRect framerect(controlrect); CRect framerect(controlrect);
framerect.top += (fontsizerect.Height())/2; framerect.top += (fontsizerect.Height()) / 2;
long Style = GetStyle(); long Style = GetStyle();
if((Style & 0xF000) == BS_FLAT) if ((Style & 0xF000) == BS_FLAT)
{ {
dc.Draw3dRect(framerect,RGB(0,0,0),RGB(0,0,0)); dc.Draw3dRect(framerect, RGB(0, 0, 0), RGB(0, 0, 0));
framerect.DeflateRect(1,1); framerect.DeflateRect(1, 1);
dc.Draw3dRect(framerect,RGB(255,255,255),RGB(255,255,255)); dc.Draw3dRect(framerect, RGB(255, 255, 255), RGB(255, 255, 255));
} }
else else
{ {
Draw3dLine(dc,framerect,GetSysColor(COLOR_3DSHADOW),GetSysColor(COLOR_3DHILIGHT)); Draw3dLine(dc, framerect, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
framerect.DeflateRect(1,1); framerect.DeflateRect(1, 1);
Draw3dLine(dc,framerect,GetSysColor(COLOR_3DHILIGHT),GetSysColor(COLOR_3DSHADOW)); Draw3dLine(dc, framerect, GetSysColor(COLOR_3DHILIGHT), GetSysColor(COLOR_3DSHADOW));
} }
if (wcslen(grptext)) if (wcslen(grptext))
{ {
CRect fontrect(controlrect); CRect fontrect(controlrect);
fontrect.bottom = controlrect.top+fontsizerect.Height(); fontrect.bottom = controlrect.top + fontsizerect.Height();
if((Style & 0xF00) == BS_RIGHT) if ((Style & 0xF00) == BS_RIGHT)
{ {
fontrect.right -= 6; fontrect.right -= 6;
fontrect.left = fontrect.right - fontsizerect.Width(); fontrect.left = fontrect.right - fontsizerect.Width();
} }
else if((Style & 0xF00) == BS_CENTER) else if ((Style & 0xF00) == BS_CENTER)
{ {
fontrect.left += (controlrect.Width()-fontsizerect.Width())/2; fontrect.left += (controlrect.Width() - fontsizerect.Width()) / 2;
fontrect.right = fontrect.left + fontsizerect.Width(); fontrect.right = fontrect.left + fontsizerect.Width();
} }
else //BS_LEFT or default else //BS_LEFT or default
@ -109,15 +108,14 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
fontrect.right = fontrect.left + fontsizerect.Width(); fontrect.right = fontrect.left + fontsizerect.Width();
} }
fontrect.InflateRect(2,0); fontrect.InflateRect(2, 0);
dc.FillRect(fontrect,GetSysColor(COLOR_BTNFACE)); dc.FillRect(fontrect, GetSysColor(COLOR_BTNFACE));
fontrect.DeflateRect(2,0); fontrect.DeflateRect(2, 0);
//Draw Caption //Draw Caption
dc.SetBkMode(OPAQUE); dc.SetBkMode(OPAQUE);
dc.SetBkColor(GetSysColor(COLOR_BTNFACE)); dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
dc.DrawTextW(grptext,-1,fontrect,DT_SINGLELINE|DT_LEFT); dc.DrawTextW(grptext, -1, fontrect, DT_SINGLELINE | DT_LEFT);
} }
} }
#endif