1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-30 08:24:05 +00:00

GLideNUI-wtl: Add language translation to config-video

This commit is contained in:
zilmar 2020-04-18 19:20:54 +09:30 committed by Sergey Lipskiy
parent 6c4b18266e
commit c185cecb01
31 changed files with 1098 additions and 209 deletions

View File

@ -102,6 +102,7 @@
<ClCompile Include="..\..\src\GLideNUI-wtl\GlSettings.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\IniFileClass.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\InputDialog.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\Language.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\ScreenShot.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\Settings.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\util.cpp" />
@ -128,6 +129,7 @@
<ClInclude Include="..\..\src\GLideNUI-wtl\GlSettings.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\IniFileClass.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\InputDialog.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\Language.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\resource.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\Settings.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\util.h" />
@ -135,6 +137,7 @@
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-ColorButton.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-OsdButton.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-OsdPreview.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-tooltip.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-WindowFont.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlapp.h" />

View File

@ -90,6 +90,9 @@
<ClCompile Include="..\..\src\GLideNUI-wtl\InputDialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\Language.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\GLideNUI-wtl\About.h">
@ -236,6 +239,12 @@
<ClInclude Include="..\..\src\GLideNUI-wtl\InputDialog.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\Language.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-tooltip.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\src\GLideNUI-wtl\BottomLeft.ico">

View File

@ -11,6 +11,7 @@
#include "config-debug.h"
#include "util.h"
#include "InputDialog.h"
#include "Language.h"
CConfigDlg::CConfigDlg() :
m_blockReInit(false),
@ -21,28 +22,22 @@ CConfigDlg::CConfigDlg() :
{
}
CConfigDlg::~CConfigDlg()
{
CConfigDlg::~CConfigDlg() {
m_EmulationTab = NULL;
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
delete m_TabWindows[i];
}
m_TabWindows.clear();
}
void CConfigDlg::setIniPath(const std::string & IniPath)
{
void CConfigDlg::setIniPath(const std::string & IniPath) {
m_strIniPath = IniPath;
}
void CConfigDlg::setRomName(const char * RomName)
{
void CConfigDlg::setRomName(const char * RomName) {
m_romName = RomName == NULL || strlen(RomName) == 0 ? NULL : RomName;
}
LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON));
SetIcon(hIcon, TRUE);
HICON hIconSmall = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
@ -51,20 +46,19 @@ LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPar
m_EmulationTab = new CEmulationTab(*this);
m_Tabs.Attach(GetDlgItem(IDC_TABS));
AddTab(L"Video", new CVideoTab);
AddTab(L"Emulation", m_EmulationTab);
AddTab(L"Frame buffer", new CFrameBufferTab);
AddTab(L"Texture enhancement", new CTextureEnhancementTab);
AddTab(L"OSD", new COsdTab);
AddTab(L"Debug", new CDebugTab);
AddTab(TAB_VIDEO, new CVideoTab(*this, m_strIniPath.c_str()));
AddTab(TAB_EMULATION, m_EmulationTab);
AddTab(TAB_FRAME_BUFFER, new CFrameBufferTab);
AddTab(TAB_TEXTURE_ENHANCEMENT, new CTextureEnhancementTab);
AddTab(TAB_OSD, new COsdTab);
AddTab(TAB_DEBUG, new CDebugTab);
RECT Rect;
GetDlgItem(IDC_TABS).GetWindowRect(&Rect);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
m_TabLeft = Rect.left;
if (m_romName != NULL)
{
if (m_romName != NULL) {
std::wstring RomName(ToUTF16(m_romName));
CWindow dlgItem = GetDlgItem(IDC_GAME_PROFILE_NAME);
CDC dc;
@ -84,9 +78,7 @@ LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPar
CButton(GetDlgItem(IDC_GAME_PROFILE)).SetCheck(BST_CHECKED);
CButton(GetDlgItem(IDC_USE_PROFILE)).SetCheck(BST_UNCHECKED);
}
else
{
} else {
CButton(GetDlgItem(IDC_GAME_PROFILE)).SetCheck(BST_UNCHECKED);
CButton(GetDlgItem(IDC_USE_PROFILE)).SetCheck(BST_CHECKED);
GetDlgItem(IDC_SETTINGS_PROFILE_STATIC).GetWindowRect(&Rect);
@ -98,13 +90,10 @@ LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPar
std::string CurrentProfile = getCurrentProfile(m_strIniPath.c_str());
CComboBox profilesComboBox(GetDlgItem(IDC_PROFILE));
profilesComboBox.ResetContent();
for (ProfileList::const_iterator itr = Profiles.begin(); itr != Profiles.end(); itr++)
{
for (ProfileList::const_iterator itr = Profiles.begin(); itr != Profiles.end(); itr++) {
int Index = profilesComboBox.AddString(ToUTF16(itr->c_str()).c_str());
if (CurrentProfile == *itr)
{
profilesComboBox.SetCurSel(Index);
}
}
profilesComboBox.AddString(L"New...");
GetDlgItem(IDC_REMOVE_PROFILE).EnableWindow(profilesComboBox.GetCount() > 2);
@ -112,12 +101,10 @@ LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPar
return 0;
}
void CConfigDlg::OnCustomSettingsToggled(bool checked)
{
void CConfigDlg::OnCustomSettingsToggled(bool checked) {
if (m_hWnd == NULL)
{
return;
}
checked = m_romName != NULL ? checked : false;
GetDlgItem(IDC_GAME_PROFILE).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE);
GetDlgItem(IDC_SAVE_SETTINGS_STATIC).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE);
@ -125,15 +112,13 @@ void CConfigDlg::OnCustomSettingsToggled(bool checked)
GetDlgItem(IDC_USE_PROFILE).ShowWindow(checked ? SW_SHOWNORMAL : SW_HIDE);
int32_t Move = 0;
if (checked)
{
if (checked) {
RECT Rect;
CWindow UseProfile = GetDlgItem(IDC_USE_PROFILE);
UseProfile.GetWindowRect(&Rect);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
Move = Rect.left - m_ProfileLeft;
if (Move != 0)
{
if (Move != 0) {
Rect.left -= Move;
Rect.right -= Move;
UseProfile.MoveWindow(&Rect);
@ -144,19 +129,15 @@ void CConfigDlg::OnCustomSettingsToggled(bool checked)
ProfileStatic.GetWindowRect(&Rect);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
Move = Rect.left - Left;
}
else
{
} else {
RECT Rect;
GetDlgItem(IDC_SETTINGS_PROFILE_STATIC).GetWindowRect(&Rect);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
Move = Rect.left - m_TabLeft;
}
if (Move != 0)
{
int nID[] =
{
if (Move != 0) {
int nID[] = {
IDC_SETTINGS_PROFILE_STATIC,
IDC_PROFILE,
IDC_REMOVE_PROFILE,
@ -166,8 +147,7 @@ void CConfigDlg::OnCustomSettingsToggled(bool checked)
GetDlgItem(nID[0]).GetWindowRect(&Rect);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
for (size_t i = 0, n = sizeof(nID) / sizeof(nID[0]); i < n; i++)
{
for (size_t i = 0, n = sizeof(nID) / sizeof(nID[0]); i < n; i++) {
CWindow window = GetDlgItem(nID[i]);
window.GetWindowRect(&Rect);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&Rect, 2);
@ -179,8 +159,7 @@ void CConfigDlg::OnCustomSettingsToggled(bool checked)
}
}
LRESULT CConfigDlg::OnProfileChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BOOL& /*bHandled*/)
{
LRESULT CConfigDlg::OnProfileChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BOOL& /*bHandled*/) {
CComboBox profilesComboBox(GetDlgItem(IDC_PROFILE));
int nIndex = profilesComboBox.GetCurSel();
if (nIndex < 0) { return 0; }
@ -233,21 +212,16 @@ LRESULT CConfigDlg::OnProfileChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*
return 0;
}
void CConfigDlg::SaveSettings()
{
void CConfigDlg::SaveSettings() {
m_Saved = true;
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
m_TabWindows[i]->SaveSettings();
}
writeSettings(m_strIniPath.c_str());
}
LRESULT CConfigDlg::OnRestoreDefaults(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
LRESULT CConfigDlg::OnRestoreDefaults(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
int Res = MessageBox(L"Are you sure you want to reset all settings to default?", L"Restore Defaults?", MB_YESNO | MB_ICONWARNING);
if (Res == IDYES)
{
if (Res == IDYES) {
const u32 enableCustomSettings = config.generalEmulation.enableCustomSettings;
config.resetToDefaults();
config.generalEmulation.enableCustomSettings = enableCustomSettings;
@ -257,22 +231,19 @@ LRESULT CConfigDlg::OnRestoreDefaults(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /
return 0;
}
LRESULT CConfigDlg::OnGameProfile(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
LRESULT CConfigDlg::OnGameProfile(UINT /*Code*/, int /*id*/, HWND /*ctl*/) {
CButton(GetDlgItem(IDC_USE_PROFILE)).SetCheck(BST_UNCHECKED);
Init(true, true);
return 0;
}
LRESULT CConfigDlg::OnUseProfile(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
LRESULT CConfigDlg::OnUseProfile(UINT /*Code*/, int /*id*/, HWND /*ctl*/) {
CButton(GetDlgItem(IDC_GAME_PROFILE)).SetCheck(BST_UNCHECKED);
Init(true, true);
return 0;
}
LRESULT CConfigDlg::OnRemoveProfile(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
LRESULT CConfigDlg::OnRemoveProfile(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
CComboBox profilesComboBox(GetDlgItem(IDC_PROFILE));
if (profilesComboBox.GetCount() <= 2)
return 0;
@ -317,59 +288,50 @@ LRESULT CConfigDlg::OnRemoveProfile(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*h
return 0;
}
LRESULT CConfigDlg::OnSaveClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
LRESULT CConfigDlg::OnSaveClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
SaveSettings();
EndDialog(wID);
return 0;
}
LRESULT CConfigDlg::OnSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
LRESULT CConfigDlg::OnSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
SaveSettings();
return 0;
}
LRESULT CConfigDlg::OnTabChange(NMHDR* /*pNMHDR*/)
{
LRESULT CConfigDlg::OnTabChange(NMHDR* /*pNMHDR*/) {
ShowTab(m_Tabs.GetCurSel());
return FALSE;
}
LRESULT CConfigDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
LRESULT CConfigDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
EndDialog(wID);
return 0;
}
void CConfigDlg::Init(bool reInit, bool blockCustomSettings)
{
void CConfigDlg::Init(bool reInit, bool blockCustomSettings) {
if (m_blockReInit)
{
return;
}
m_blockReInit = true;
bool CustomSettings = m_EmulationTab != NULL && CButton(m_EmulationTab->GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED;
if (reInit && m_romName != NULL &&
CustomSettings && CButton(m_EmulationTab->GetDlgItem(IDC_GAME_PROFILE)).GetCheck() == BST_CHECKED)
{
if (reInit && m_romName != NULL && CustomSettings && CButton(m_EmulationTab->GetDlgItem(IDC_GAME_PROFILE)).GetCheck() == BST_CHECKED) {
loadCustomRomSettings(m_strIniPath.c_str(), m_romName);
}
else if (reInit)
{
} else if (reInit) {
loadSettings(m_strIniPath.c_str());
}
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
m_TabWindows[i]->LoadSettings(blockCustomSettings);
}
for (size_t i = 0; i < m_TabWindows.size(); i++)
m_TabWindows[i]->ApplyLanguage();
ApplyLanguage();
m_blockReInit = false;
}
CRect CConfigDlg::GetTabRect()
{
CRect CConfigDlg::GetTabRect() {
CRect TabRect;
m_Tabs.GetWindowRect(&TabRect);
ScreenToClient(&TabRect);
@ -377,25 +339,19 @@ CRect CConfigDlg::GetTabRect()
return TabRect;
}
void CConfigDlg::AddTab(const wchar_t * caption, CConfigTab * tab)
{
m_Tabs.AddItem(caption);
void CConfigDlg::AddTab(languageStringID caption, CConfigTab * tab) {
m_Tabs.AddItem(TCIF_TEXT | TCIF_PARAM, wGS(caption).c_str(), 0, caption);
tab->Create(m_hWnd, 0);
tab->SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW);
m_TabWindows.push_back(tab);
if (m_TabWindows.size() == 1)
{
ShowTab(0);
}
}
void CConfigDlg::ShowTab(int nPage)
{
void CConfigDlg::ShowTab(int nPage) {
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
m_TabWindows[i]->ShowWindow(SW_HIDE);
}
CRect TabRect = GetTabRect();
m_TabWindows[nPage]->SetWindowPos(HWND_TOP, TabRect.left, TabRect.top, TabRect.Width(), TabRect.Height(), SWP_SHOWWINDOW);
@ -407,31 +363,55 @@ void CConfigDlg::ShowTab(int nPage)
m_Tabs.RedrawWindow();
}
void CConfigDlg::SetLanguage(const std::string & language) {
LoadCurrentStrings(m_strIniPath.c_str(), language);
for (int i = 0, n = m_Tabs.GetItemCount(); i < n; i++) {
TCITEM tci = { 0 };
tci.mask = TCIF_PARAM;
m_Tabs.GetItem(i, &tci);
if (tci.lParam != 0) {
tci.mask = TCIF_TEXT;
std::wstring caption = wGS((languageStringID)tci.lParam);
tci.pszText = (LPWSTR)caption.c_str();
m_Tabs.SetItem(i, &tci);
}
}
for (size_t i = 0; i < m_TabWindows.size(); i++)
m_TabWindows[i]->ApplyLanguage();
ApplyLanguage();
}
void CConfigDlg::ApplyLanguage(void)
{
SetDlgItemTextW(IDC_SAVE_SETTINGS_STATIC, wGS(CFG_SAVE_SETTINGS_FOR).c_str());
SetDlgItemTextW(IDC_SETTINGS_PROFILE_STATIC, wGS(CFG_SETTINGS_PROFILE).c_str());
SetDlgItemTextW(IDC_REMOVE_PROFILE, wGS(CFG_REMOVE).c_str());
SetDlgItemTextW(ID_RESTORE_DEFAULTS, wGS(CFG_RESTORE_DEFAULTS).c_str());
SetDlgItemTextW(ID_SAVECLOSE, wGS(CFG_SAVE_AND_CLOSE).c_str());
SetDlgItemTextW(ID_SAVE, wGS(CFG_SAVE).c_str());
SetDlgItemTextW(IDCANCEL, wGS(CFG_CLOSE).c_str());
}
class GlideN64WtlModule :
public CAppModule
{
public:
GlideN64WtlModule(HINSTANCE hinst)
{
GlideN64WtlModule(HINSTANCE hinst) {
Init(NULL, hinst);
}
virtual ~GlideN64WtlModule(void)
{
virtual ~GlideN64WtlModule(void) {
Term();
}
};
GlideN64WtlModule * WtlModule = NULL;
void ConfigInit(void * hinst)
{
void ConfigInit(void * hinst) {
WtlModule = new GlideN64WtlModule((HINSTANCE)hinst);
}
void ConfigCleanup(void)
{
if (WtlModule)
{
void ConfigCleanup(void) {
if (WtlModule) {
delete WtlModule;
WtlModule = NULL;
}

View File

@ -2,6 +2,7 @@
#include <string>
#include "wtl.h"
#include "config-tab.h"
#include "language.h"
#include "resource.h"
#include <vector>
@ -33,6 +34,7 @@ public:
void setRomName(const char * RomName);
bool Saved(void) const { return m_Saved; }
void OnCustomSettingsToggled(bool checked);
void SetLanguage(const std::string & language);
protected:
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
@ -47,10 +49,11 @@ protected:
LRESULT OnUseProfile(UINT /*Code*/, int id, HWND /*ctl*/);
void Init(bool reInit = false, bool blockCustomSettings = false);
void AddTab(const wchar_t * caption, CConfigTab * tab);
void AddTab(languageStringID StringID, CConfigTab * tab);
void ShowTab(int nPage);
CRect GetTabRect();
void SaveSettings();
void ApplyLanguage();
CTabCtrl m_Tabs;
std::vector<CConfigTab *> m_TabWindows;

View File

@ -28,6 +28,8 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, bool &
if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0)
loadCustomRomSettings(IniFolder.c_str(), _romName);
LoadCurrentStrings(IniFolder.c_str(), config.translationFile);
CConfigDlg Dlg;
Dlg.setIniPath(IniFolder.c_str());
Dlg.setRomName(_romName);

Binary file not shown.

View File

@ -0,0 +1,261 @@
#include "Language.h"
#include "util.h"
#include <windows.h>
#include <algorithm>
#include <map>
#include "../Config.h"
typedef std::map<int32_t, std::string> LANG_STRINGS;
typedef LANG_STRINGS::value_type LANG_STR;
bool g_debugLang = false;
LANG_STRINGS g_currentStrings, g_defaultStrings;
void loadDefaultStrings(void)
{
//Config Dialog
g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_VIDEO, "Video"));
g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_EMULATION, "Emulation"));
g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_FRAME_BUFFER, "Frame buffer"));
g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_TEXTURE_ENHANCEMENT, "Texture enhancement"));
g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_OSD, "OSD"));
g_defaultStrings.insert(LANG_STRINGS::value_type(TAB_DEBUG, "Debug"));
g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_SAVE_SETTINGS_FOR, "Save settings for:"));
g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_SETTINGS_PROFILE, "Settings profile:"));
g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_REMOVE, "Remove"));
g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_RESTORE_DEFAULTS, "Restore Defaults"));
g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_SAVE_AND_CLOSE, "Save and Close"));
g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_SAVE, "Save"));
g_defaultStrings.insert(LANG_STRINGS::value_type(CFG_CLOSE, "Close"));
//Video Tab
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_GROUP, "Video"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_FULL_SCREEN_RES, "Full screen resolution:"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_FULL_SCREEN_RES_TOOLTIP, "All the resolutions that your video card/monitor supports should be displayed.\n\n[Recommended: Maximum resolution for your monitor unless performance becomes an issue]"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_REFRESH_RATE, "Refresh rate:"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_REFRESH_RATE_TOOLTIP, ""));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_WINDOWED_RESOLUTION, "Windowed resolution:"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_WINDOWED_RESOLUTION_TOOLTIP, "This option selects the resolution for windowed mode. You also may select Custom and enter your own window size.\n\n[Recommended: 640 x 480, 800 x 600, 1024 x 768, 1280 x 960]"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_RATIO, "Aspect ratio:"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_RATIO_TOOLTIP, "This setting adjusts the aspect ratio of the video output. All N64 games support 4:3. Some games support 16:9 within game settings. Use Stretch to fill the screen without pillar or letterboxing.\nTry to adjust game to fit tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't."));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_4_3, "4:3 (recommended)"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_16_19, "16:9"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_STRETCH, "Stretch"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ASPECT_ADJUST, "Try to adjust game to fit"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_VSYNC, "Enable VSync"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_VSYNC_TOOLTIP, "Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate.This prevents image tearing, but may cause performance problems.\n[Recommended:Usually off, on if you have image tearing problems]"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_THREADED_VIDEO, "Enable threaded video"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_THREADED_VIDEO_TOOLTIP, "Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.\n[Recommended: Usually off, unless there are performance issues]"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_OVERSCAN, "Overscan"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_OVERSCAN_TOOLTIP, "When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games."));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_NTSC, "NTSC"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_PAL, "PAL"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ANTI_ALIASING, "Anti-aliasing"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_NO_ANTI_ALIASING, "No anti-aliasing"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_FAST_ANTI_ALIASING, "Fast approximate anti-aliasing (FXAA)"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_MULTISAMPLE_ANTI_ALIASING, "Multisample anti-aliasing (MSAA):"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_AA_OFF, "Off"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_AA_HIGH, "High"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_AA_TOOLTIP, "GLideN64 offers two methods to smooth jagged polygons:\nFast approximate anti-aliasing (FXAA): FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with N64-style depth compare. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.\nMultisample anti-aliasing (MSAA): MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with N64-style depth compare and may cause minor glitches in some games.\nRecommendation: [Usually 16x MSAA, or FXAA with N64-style depth compare]"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_AA_INFO, "Multisample anti-aliasing is not compatible with N64-style depth compare."));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_FILTERING_GROUP, "Filtering"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ANISOTROPIC, "Anisotropic filtering:"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ANISOTROPIC_OFF, "Off"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_ANISOTROPIC_HIGH, "High"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_BILINEAR, "Bilinear filtering:"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_BILINEAR_STANDARD, "Standard"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_BILINEAR_3POINT, "N64-style 3 point"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_BILINEAR_TOOLTIP, "Bilinear filtering: Textures will use standard PC-style bilinear filtering.\nN64-style 3 point: Textures will be filtered more like the N64. The result is less smooth but more accurate."));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_GROUP, "Dithering"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_PATTERN, "Pattern (RDRAM):"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_APPLY_TO_OUTPUT, "Apply to final output"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_APPLY_TO_OUTPUT_TOOLTIP, "This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled."));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_5BIT_QUANTIZATION, "Enable 5-bit quantization"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_5BIT_QUANTIZATION_TOOLTIP, "Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled."));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_HIRES_NOISE, "High resolution noise"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_HIRES_NOISE_TOOLTIP, "RDRAM dithering prevents color banding in games with framebuffer effects."));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_MODE_TOOLTIP, "Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering. Blue noise dithering produces unobtrusive results. Default = blue noise dithering."));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_DISABLE, "disable"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_BAYER, "Bayer"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_MAGIC_SQUARE, "Magic square"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_DITHERING_BLUE_NOISE, "Blue noise"));
g_defaultStrings.insert(LANG_STRINGS::value_type(VIDEO_LANGUAGE, "Language:"));
}
LANG_STR GetNextLangString(FILE * file)
{
if (feof(file))
return LANG_STR(0, "");
char token = 0;
while (token != '#' && !feof(file))
fread(&token, 1, 1, file);
if (feof(file))
return LANG_STR(0, "");
int32_t StringID;
fscanf_s(file, "%d", &StringID);
token = 0;
while (token != '#' && !feof(file))
fread(&token, 1, 1, file);
if (feof(file))
return LANG_STR(0, "");
while (token != '"' && !feof(file))
fread(&token, 1, 1, file);
if (feof(file))
return LANG_STR(0, "");
fread(&token, 1, 1, file);
std::string text;
while (token != '"' && !feof(file)) {
text += token;
fread(&token, 1, 1, file);
}
std::string::size_type pos = text.find("\\n");
while (pos != std::string::npos) {
text.replace(pos, 1, "\n");
pos = text.find("\\n", pos + 1);
}
return LANG_STR(StringID, text);
}
bool LoadLanguageFile(const std::string & langFile)
{
if (g_defaultStrings.size() == 0)
loadDefaultStrings();
g_currentStrings.clear();
if (g_debugLang)
return true;
FILE *file = NULL;
if (fopen_s(&file, langFile.c_str(), "rb") != 0 || file == NULL)
return false;
uint8_t utf_bom[3];
if (fread(&utf_bom, sizeof(utf_bom), 1, file) != 1 || utf_bom[0] != 0xEF || utf_bom[1] != 0xBB || utf_bom[2] != 0xBF) {
fclose(file);
return false;
}
while (!feof(file))
g_currentStrings.insert(GetNextLangString(file));
fclose(file);
return true;
}
void LoadCurrentStrings(const char * path, const std::string & lang)
{
std::string translationsFolder(path);
std::replace(translationsFolder.begin(), translationsFolder.end(), '/', '\\');
if (translationsFolder[translationsFolder.length() - 1] != '\\')
{
translationsFolder += '\\';
}
translationsFolder += "translations\\";
if (lang.length() > 0)
{
std::string langFile = translationsFolder + lang;
if (LoadLanguageFile(langFile))
{
return;
}
}
std::string langFile = translationsFolder + "gliden64_en.Lang";
LoadLanguageFile(langFile);
}
std::string getLangString(const char * FileName, languageStringID ID)
{
FILE *file = NULL;
if (fopen_s(&file, FileName, "rb") != 0 || file == NULL)
return "";
uint8_t utf_bom[3];
if (fread(&utf_bom, sizeof(utf_bom), 1, file) != 1 ||
utf_bom[0] != 0xEF ||
utf_bom[1] != 0xBB ||
utf_bom[2] != 0xBF)
{
fclose(file);
return "";
}
while (!feof(file)) {
LANG_STR String = GetNextLangString(file);
if (String.first == ID) {
fclose(file);
return String.second;
}
}
fclose(file);
return "";
}
LanguageList GetLanguageList(const char * path)
{
std::string pluginFolder(path);
std::replace(pluginFolder.begin(), pluginFolder.end(), '/', '\\');
if (pluginFolder[pluginFolder.length() - 1] != '\\')
{
pluginFolder += '\\';
}
pluginFolder += "translations\\";
std::string nameFilters = pluginFolder + "gliden64_*.Lang";
WIN32_FIND_DATAA FindData;
HANDLE hFindFile = FindFirstFileA(nameFilters.c_str(), &FindData); // Find anything
LanguageList languages;
if (hFindFile != INVALID_HANDLE_VALUE) {
do {
std::string langFile = pluginFolder + FindData.cFileName;
LanguageFile file;
file.Filename = FindData.cFileName;
file.LanguageName = getLangString(langFile.c_str(), LANGUAGE_NAME);
if (file.LanguageName.length() == 0)
continue;
languages.push_back(file);
} while (FindNextFileA(hFindFile, &FindData));
FindClose(hFindFile);
}
return languages;
}
const std::string & getString(languageStringID stringID)
{
LANG_STRINGS::iterator currentString = g_currentStrings.find(stringID);
if (currentString != g_currentStrings.end())
return currentString->second;
if (g_debugLang) {
char debugStr[300];
sprintf_s(debugStr, "#%d#", stringID);
std::pair<LANG_STRINGS::iterator, bool> ret = g_currentStrings.insert(LANG_STRINGS::value_type(stringID, debugStr));
if (ret.second)
return ret.first->second;
}
LANG_STRINGS::iterator DefString = g_defaultStrings.find(stringID);
if (DefString != g_defaultStrings.end())
{
return DefString->second;
}
static std::string emptyString;
return emptyString;
}
std::wstring wGS(languageStringID StringID)
{
return ToUTF16(getString(StringID).c_str());
}

View File

@ -0,0 +1,95 @@
#pragma once
#include <list>
#include <string>
enum languageStringID
{
/*********************************************************************************
* Meta Information *
*********************************************************************************/
LANGUAGE_NAME = 1,
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
TAB_VIDEO = 1000,
TAB_EMULATION = 1001,
TAB_FRAME_BUFFER = 1002,
TAB_TEXTURE_ENHANCEMENT = 1003,
TAB_OSD = 1004,
TAB_DEBUG = 1005,
CFG_SAVE_SETTINGS_FOR = 1010,
CFG_SETTINGS_PROFILE = 1011,
CFG_REMOVE = 1012,
CFG_RESTORE_DEFAULTS = 1013,
CFG_SAVE_AND_CLOSE = 1014,
CFG_SAVE = 1015,
CFG_CLOSE = 1016,
/*********************************************************************************
* Video Tab *
*********************************************************************************/
VIDEO_GROUP = 2000,
VIDEO_FULL_SCREEN_RES = 2001,
VIDEO_FULL_SCREEN_RES_TOOLTIP = 2002,
VIDEO_REFRESH_RATE = 2003,
VIDEO_REFRESH_RATE_TOOLTIP = 2004,
VIDEO_WINDOWED_RESOLUTION = 2005,
VIDEO_WINDOWED_RESOLUTION_TOOLTIP = 2006,
VIDEO_ASPECT_RATIO = 2007,
VIDEO_ASPECT_RATIO_TOOLTIP = 2008,
VIDEO_ASPECT_4_3 = 2009,
VIDEO_ASPECT_16_19 = 2010,
VIDEO_ASPECT_STRETCH = 2011,
VIDEO_ASPECT_ADJUST = 2012,
VIDEO_VSYNC = 2013,
VIDEO_VSYNC_TOOLTIP = 2014,
VIDEO_THREADED_VIDEO = 2015,
VIDEO_THREADED_VIDEO_TOOLTIP = 2016,
VIDEO_OVERSCAN = 2017,
VIDEO_OVERSCAN_TOOLTIP = 2018,
VIDEO_NTSC = 2019,
VIDEO_PAL = 2020,
VIDEO_ANTI_ALIASING = 2021,
VIDEO_NO_ANTI_ALIASING = 2022,
VIDEO_FAST_ANTI_ALIASING = 2023,
VIDEO_MULTISAMPLE_ANTI_ALIASING = 2024,
VIDEO_AA_OFF = 2025,
VIDEO_AA_HIGH = 2026,
VIDEO_AA_TOOLTIP = 2027,
VIDEO_AA_INFO = 2028,
VIDEO_FILTERING_GROUP = 2029,
VIDEO_ANISOTROPIC = 2030,
VIDEO_ANISOTROPIC_OFF = 2031,
VIDEO_ANISOTROPIC_HIGH = 2032,
VIDEO_BILINEAR = 2033,
VIDEO_BILINEAR_STANDARD = 2034,
VIDEO_BILINEAR_3POINT = 2035,
VIDEO_BILINEAR_TOOLTIP = 2036,
VIDEO_DITHERING_GROUP = 2037,
VIDEO_PATTERN = 2038,
VIDEO_DITHERING_APPLY_TO_OUTPUT = 2039,
VIDEO_DITHERING_APPLY_TO_OUTPUT_TOOLTIP = 2040,
VIDEO_DITHERING_5BIT_QUANTIZATION = 2041,
VIDEO_DITHERING_5BIT_QUANTIZATION_TOOLTIP = 2042,
VIDEO_DITHERING_HIRES_NOISE = 2043,
VIDEO_DITHERING_HIRES_NOISE_TOOLTIP = 2044,
VIDEO_DITHERING_MODE_TOOLTIP = 2045,
VIDEO_DITHERING_DISABLE = 2046,
VIDEO_DITHERING_BAYER = 2047,
VIDEO_DITHERING_MAGIC_SQUARE = 2048,
VIDEO_DITHERING_BLUE_NOISE = 2049,
VIDEO_LANGUAGE = 2050,
};
struct LanguageFile
{
std::string Filename;
std::string LanguageName;
};
typedef std::list<LanguageFile> LanguageList;
void LoadCurrentStrings(const char * path, const std::string & lang);
LanguageList GetLanguageList(const char * path);
std::wstring wGS(languageStringID StringID);

View File

@ -13,6 +13,10 @@ BOOL CDebugTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
return true;
}
void CDebugTab::ApplyLanguage(void)
{
}
LRESULT CDebugTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);

View File

@ -15,6 +15,7 @@ public:
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
void ApplyLanguage(void);
void LoadSettings(bool /*blockCustomSettings*/);
void SaveSettings();
};

View File

@ -65,6 +65,10 @@ void CEmulationTab::OnPerGameSettings(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
m_Dlg.OnCustomSettingsToggled(CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED);
}
void CEmulationTab::ApplyLanguage(void)
{
}
void CEmulationTab::LoadSettings(bool blockCustomSettings)
{
if (!blockCustomSettings)

View File

@ -24,6 +24,7 @@ public:
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
void OnGammaCorrection(UINT /*Code*/, int id, HWND /*ctl*/);
void OnPerGameSettings(UINT /*Code*/, int id, HWND /*ctl*/);
void ApplyLanguage(void);
void LoadSettings(bool /*blockCustomSettings*/);
void SaveSettings();

View File

@ -37,6 +37,10 @@ BOOL CFrameBufferTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
return true;
}
void CFrameBufferTab::ApplyLanguage(void)
{
}
LRESULT CFrameBufferTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);

View File

@ -20,6 +20,7 @@ public:
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnEnableFramebuffer(UINT /*Code*/, int id, HWND /*ctl*/);
LRESULT OnFbInfoEnable(UINT /*Code*/, int id, HWND /*ctl*/);
void ApplyLanguage(void);
void LoadSettings(bool blockCustomSettings);
void SaveSettings();

View File

@ -93,6 +93,10 @@ BOOL COsdTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
return true;
}
void COsdTab::ApplyLanguage(void)
{
}
LRESULT COsdTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
LONG CtrlId = CWindow((HWND)lParam).GetWindowLong(GWL_ID);

View File

@ -40,6 +40,7 @@ public:
LRESULT OnFontItemChanged(NMHDR* /*phdr*/);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnNotifyOsdColor(LPNMHDR pnmh);
void ApplyLanguage(void);
void LoadSettings(bool blockCustomSettings);
void SaveSettings();

View File

@ -12,6 +12,7 @@ public:
BEGIN_MSG_MAP(CConfigTab)
END_MSG_MAP()
virtual void ApplyLanguage() = 0;
virtual void LoadSettings(bool blockCustomSettings) = 0;
virtual void SaveSettings() = 0;

View File

@ -45,6 +45,10 @@ BOOL CTextureEnhancementTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitPa
return true;
}
void CTextureEnhancementTab::ApplyLanguage(void)
{
}
LRESULT CTextureEnhancementTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);

View File

@ -24,6 +24,7 @@ public:
LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/);
void OnFileStorage(UINT /*Code*/, int id, HWND /*ctl*/);
void OnTexturePack(UINT /*Code*/, int id, HWND /*ctl*/);
void ApplyLanguage(void);
void LoadSettings(bool blockCustomSettings);
void SaveSettings();

View File

@ -1,15 +1,16 @@
#include "config-video.h"
#include "FullscreenResolutions.h"
#include "util.h"
#include "Language.h"
#include "ConfigDlg.h"
#include "../Config.h"
#include "wtl-tooltip.h"
static struct
{
static struct {
unsigned short width, height;
LPCTSTR description;
}
WindowedModes[] =
{
WindowedModes[] = {
{ 320, 240, _T("320 x 240") },
{ 400, 300, _T("400 x 300") },
{ 480, 360, _T("480 x 360") },
@ -26,26 +27,27 @@ WindowedModes[] =
};
static const unsigned int numWindowedModes = sizeof(WindowedModes) / sizeof(WindowedModes[0]);
CVideoTab::CVideoTab() :
CConfigTab(IDD_TAB_VIDEO)
CVideoTab::CVideoTab(CConfigDlg & Dlg, const char * strIniPath) :
CConfigTab(IDD_TAB_VIDEO),
m_strIniPath(strIniPath),
m_LangList(GetLanguageList(strIniPath)),
m_Dlg(Dlg)
{
}
CVideoTab::~CVideoTab()
{
CVideoTab::~CVideoTab() {
for (size_t i = 0; i < m_OverscanTabs.size(); i++)
{
delete m_OverscanTabs[i];
}
m_OverscanTabs.clear();
}
BOOL CVideoTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
BOOL CVideoTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/) {
TTInit();
TTSize(400);
m_OverScanTab.Attach(GetDlgItem(IDC_TAB_OVERSCAN));
AddOverScanTab(L"NTSC");
AddOverScanTab(L"PAL");
AddOverScanTab(VIDEO_NTSC);
AddOverScanTab(VIDEO_PAL);
m_AliasingSlider.Attach(GetDlgItem(IDC_ALIASING_SLIDER));
m_AliasingSlider.SetTicFreq(1);
@ -58,72 +60,171 @@ BOOL CVideoTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
m_AnisotropicSlider.SetRangeMax(16);
CComboBox aspectComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO));
aspectComboBox.AddString(L"4:3 (recommended)");
aspectComboBox.AddString(L"16:9");
aspectComboBox.AddString(L"Stretch");
aspectComboBox.AddString(L"Try to adjust game to fit");
aspectComboBox.AddString(wGS(VIDEO_ASPECT_4_3).c_str());
aspectComboBox.AddString(wGS(VIDEO_ASPECT_16_19).c_str());
aspectComboBox.AddString(wGS(VIDEO_ASPECT_STRETCH).c_str());
aspectComboBox.AddString(wGS(VIDEO_ASPECT_ADJUST).c_str());
CComboBox ditheringModeComboBox(GetDlgItem(IDC_CMB_PATTERN));
ditheringModeComboBox.AddString(L"disable");
ditheringModeComboBox.AddString(L"Bayer");
ditheringModeComboBox.AddString(L"Magic square");
ditheringModeComboBox.AddString(L"Blue noise");
ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_DISABLE).c_str());
ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_BAYER).c_str());
ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_MAGIC_SQUARE).c_str());
ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_BLUE_NOISE).c_str());
SIZE iconSz = { ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON) };
m_AAInfoIcon.SubclassWindow(GetDlgItem(IDC_AA_INFO_ICON));
m_AAInfoIcon.SetIcon(MAKEINTRESOURCE(IDI_ICON_INFO), iconSz.cx, iconSz.cy);
m_AAInfoIcon.SetWindowPos(HWND_TOP, 0, 0, iconSz.cx, iconSz.cy, SWP_NOMOVE | SWP_NOZORDER);
m_AAInfoIcon.SetBackroundBrush((HBRUSH)GetStockObject(WHITE_BRUSH));
CComboBox translationsComboBox(GetDlgItem(IDC_CMB_LANGUAGE));
for (LanguageList::const_iterator itr = m_LangList.begin(); itr != m_LangList.end(); itr++) {
int indx = translationsComboBox.AddString(ToUTF16(itr->LanguageName.c_str()).c_str());
translationsComboBox.SetItemData(indx, (DWORD_PTR)itr->Filename.c_str());
}
return true;
}
LRESULT CVideoTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
void CVideoTab::ApplyLanguage(void) {
SetDlgItemTextW(IDC_VIDEO_GROUP, wGS(VIDEO_GROUP).c_str());
SetDlgItemTextW(IDC_TXT_FULL_SCREEN_RES, wGS(VIDEO_FULL_SCREEN_RES).c_str());
SetDlgItemTextW(IDC_TXT_REFRESH_RATE, wGS(VIDEO_REFRESH_RATE).c_str());
SetDlgItemTextW(IDC_TXT_WINDOWED_RESOLUTION, wGS(VIDEO_WINDOWED_RESOLUTION).c_str());
SetDlgItemTextW(IDC_TXT_ASPECT_RATIO, wGS(VIDEO_ASPECT_RATIO).c_str());
SetDlgItemTextW(IDC_CHK_VERTICAL_SYNC, wGS(VIDEO_VSYNC).c_str());
SetDlgItemTextW(IDC_CHK_THREADED_VIDEO, wGS(VIDEO_THREADED_VIDEO).c_str());
SetDlgItemTextW(IDC_CHK_OVERSCAN, wGS(VIDEO_OVERSCAN).c_str());
SetDlgItemTextW(IDC_AA_GROUP, wGS(VIDEO_ANTI_ALIASING).c_str());
SetDlgItemTextW(IDC_NOAA_RADIO, wGS(VIDEO_NO_ANTI_ALIASING).c_str());
SetDlgItemTextW(IDC_FXAA_RADIO, wGS(VIDEO_FAST_ANTI_ALIASING).c_str());
SetDlgItemTextW(IDC_MSAA_RADIO, wGS(VIDEO_MULTISAMPLE_ANTI_ALIASING).c_str());
SetDlgItemTextW(IDC_AA_OFF, wGS(VIDEO_AA_OFF).c_str());
SetDlgItemTextW(IDC_AA_HIGH, wGS(VIDEO_AA_HIGH).c_str());
SetDlgItemTextW(IDC_AA_INFO, wGS(VIDEO_AA_INFO).c_str());
SetDlgItemTextW(IDC_FILTERING_GROUP, wGS(VIDEO_FILTERING_GROUP).c_str());
SetDlgItemTextW(IDC_ANISOTROPIC, wGS(VIDEO_ANISOTROPIC).c_str());
SetDlgItemTextW(IDC_ANISOTROPIC_OFF, wGS(VIDEO_ANISOTROPIC_OFF).c_str());
SetDlgItemTextW(IDC_ANISOTROPIC_HIGH, wGS(VIDEO_ANISOTROPIC_HIGH).c_str());
SetDlgItemTextW(IDC_BILINEAR, wGS(VIDEO_BILINEAR).c_str());
SetDlgItemTextW(IDC_BILINEAR_STANDARD, wGS(VIDEO_BILINEAR_STANDARD).c_str());
SetDlgItemTextW(IDC_BILINEAR_3POINT, wGS(VIDEO_BILINEAR_3POINT).c_str());
SetDlgItemTextW(IDC_DITHERING_GROUP, wGS(VIDEO_DITHERING_GROUP).c_str());
SetDlgItemTextW(IDC_PATTERN, wGS(VIDEO_PATTERN).c_str());
SetDlgItemTextW(IDC_CHK_APPLY_TO_OUTPUT, wGS(VIDEO_DITHERING_APPLY_TO_OUTPUT).c_str());
SetDlgItemTextW(IDC_CHK_5BIT_QUANTIZATION, wGS(VIDEO_DITHERING_5BIT_QUANTIZATION).c_str());
SetDlgItemTextW(IDC_CHK_HIRES_NOISE, wGS(VIDEO_DITHERING_HIRES_NOISE).c_str());
SetDlgItemTextW(IDC_LANGUAGE, wGS(VIDEO_LANGUAGE).c_str());
std::wstring tooltip = wGS(VIDEO_FULL_SCREEN_RES_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_TXT_FULL_SCREEN_RES), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_CMB_FULL_SCREEN_RES), tooltip.c_str());
tooltip = wGS(VIDEO_REFRESH_RATE_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_TXT_REFRESH_RATE), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_CMB_REFRESH_RATE), tooltip.c_str());
tooltip = wGS(VIDEO_WINDOWED_RESOLUTION_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_TXT_WINDOWED_RESOLUTION), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_CMB_WINDOWED_RESOLUTION), tooltip.c_str());
tooltip = wGS(VIDEO_ASPECT_RATIO_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_TXT_ASPECT_RATIO), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_CMB_ASPECT_RATIO), tooltip.c_str());
tooltip = wGS(VIDEO_VSYNC_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_CHK_VERTICAL_SYNC), tooltip.c_str());
tooltip = wGS(VIDEO_THREADED_VIDEO_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_CHK_THREADED_VIDEO), tooltip.c_str());
tooltip = wGS(VIDEO_OVERSCAN_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_CHK_OVERSCAN), tooltip.c_str());
tooltip = wGS(VIDEO_AA_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_AA_GROUP), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_NOAA_RADIO), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_FXAA_RADIO), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_MSAA_RADIO), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_ALIASING_SLIDER), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_AA_OFF), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_AA_HIGH), tooltip.c_str());
tooltip = wGS(VIDEO_BILINEAR_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_BILINEAR), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_BILINEAR_STANDARD), tooltip.c_str());
TTSetTxt(GetDlgItem(IDC_BILINEAR_3POINT), tooltip.c_str());
tooltip = wGS(VIDEO_DITHERING_APPLY_TO_OUTPUT_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_CHK_APPLY_TO_OUTPUT), tooltip.c_str());
tooltip = wGS(VIDEO_DITHERING_5BIT_QUANTIZATION_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_CHK_5BIT_QUANTIZATION), tooltip.c_str());
tooltip = wGS(VIDEO_DITHERING_HIRES_NOISE_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_CHK_HIRES_NOISE), tooltip.c_str());
tooltip = wGS(VIDEO_DITHERING_MODE_TOOLTIP);
TTSetTxt(GetDlgItem(IDC_CMB_PATTERN), tooltip.c_str());
CComboBox aspectComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO));
int selectedIndx = aspectComboBox.GetCurSel();
aspectComboBox.ResetContent();
aspectComboBox.AddString(wGS(VIDEO_ASPECT_4_3).c_str());
aspectComboBox.AddString(wGS(VIDEO_ASPECT_16_19).c_str());
aspectComboBox.AddString(wGS(VIDEO_ASPECT_STRETCH).c_str());
aspectComboBox.AddString(wGS(VIDEO_ASPECT_ADJUST).c_str());
if (selectedIndx >= 0)
aspectComboBox.SetCurSel(selectedIndx);
CComboBox ditheringModeComboBox(GetDlgItem(IDC_CMB_PATTERN));
selectedIndx = ditheringModeComboBox.GetCurSel();
ditheringModeComboBox.ResetContent();
ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_DISABLE).c_str());
ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_BAYER).c_str());
ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_MAGIC_SQUARE).c_str());
ditheringModeComboBox.AddString(wGS(VIDEO_DITHERING_BLUE_NOISE).c_str());
if (selectedIndx >= 0)
ditheringModeComboBox.SetCurSel(selectedIndx);
for (int i = 0, n = m_OverScanTab.GetItemCount(); i < n; i++) {
TCITEM tci = { 0 };
tci.mask = TCIF_PARAM;
m_OverScanTab.GetItem(i, &tci);
if (tci.lParam != 0) {
tci.mask = TCIF_TEXT;
std::wstring caption = wGS((languageStringID)tci.lParam);
tci.pszText = (LPWSTR)caption.c_str();
m_OverScanTab.SetItem(i, &tci);
}
}
}
LRESULT CVideoTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) {
LONG SliderId = CWindow((HWND)lParam).GetWindowLong(GWL_ID);
if (SliderId == IDC_ALIASING_SLIDER)
{
if (SliderId == IDC_ALIASING_SLIDER) {
int32_t value = m_AliasingSlider.GetPos();
std::wstring AliasingText = FormatStrW(L"%dx", value > 0 ? 1 << value : 0);
CWindow(GetDlgItem(IDC_ALIASING_LABEL)).SetWindowTextW(AliasingText.c_str());
CButton(GetDlgItem(value != 0 ? IDC_MSAA_RADIO : IDC_NOAA_RADIO)).SetCheck(BST_CHECKED);
CButton(GetDlgItem(value != 0 ? IDC_NOAA_RADIO : IDC_MSAA_RADIO)).SetCheck(BST_UNCHECKED);
CButton(GetDlgItem(IDC_FXAA_RADIO)).SetCheck(BST_UNCHECKED);
}
else if (SliderId == IDC_ANISOTROPIC_SLIDER)
{
} else if (SliderId == IDC_ANISOTROPIC_SLIDER) {
CWindow(GetDlgItem(IDC_ANISOTROPIC_LABEL)).SetWindowTextW(FormatStrW(L"%dx", m_AnisotropicSlider.GetPos()).c_str());
}
return 0;
}
void CVideoTab::OnOverscan(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
void CVideoTab::OnOverscan(UINT /*Code*/, int /*id*/, HWND /*ctl*/) {
CButton OverScan(GetDlgItem(IDC_CHK_OVERSCAN));
if (OverScan.GetCheck() == BST_CHECKED)
{
if (OverScan.GetCheck() == BST_CHECKED) {
GetDlgItem(IDC_TAB_OVERSCAN).ShowWindow(SW_SHOW);
ShowOverScanTab(m_OverScanTab.GetCurSel());
}
else
{
} else {
GetDlgItem(IDC_TAB_OVERSCAN).ShowWindow(SW_HIDE);
m_OverscanTabs[m_OverScanTab.GetCurSel()]->ShowWindow(SW_HIDE);
}
}
LRESULT CVideoTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
LRESULT CVideoTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
LRESULT CVideoTab::OnOverscanTabChange(NMHDR* /*pNMHDR*/)
{
LRESULT CVideoTab::OnOverscanTabChange(NMHDR* /*pNMHDR*/) {
ShowOverScanTab(m_OverScanTab.GetCurSel());
return FALSE;
}
void CVideoTab::OnFullScreenChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
void CVideoTab::OnFullScreenChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) {
CComboBox fullScreenResolutionComboBox(GetDlgItem(IDC_CMB_FULL_SCREEN_RES));
int32_t index = fullScreenResolutionComboBox.GetCurSel();
StringList fullscreenRatesList;
@ -132,20 +233,23 @@ void CVideoTab::OnFullScreenChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
CComboBox RefreshRateComboBox(GetDlgItem(IDC_CMB_REFRESH_RATE));
RefreshRateComboBox.ResetContent();
for (size_t i = 0, n = fullscreenRatesList.size(); i < n; i++)
{
for (size_t i = 0, n = fullscreenRatesList.size(); i < n; i++) {
std::wstring fullscreenRateStr(fullscreenRatesList[i].begin(), fullscreenRatesList[i].end());
int index = RefreshRateComboBox.AddString(fullscreenRateStr.c_str());
if (fullscreenRate == i)
{
RefreshRateComboBox.SetCurSel(index);
}
}
}
void CVideoTab::AddOverScanTab(const wchar_t * caption)
{
m_OverScanTab.AddItem(caption);
LRESULT CVideoTab::OnLanguageChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BOOL& /*bHandled*/) {
CComboBox translationsComboBox(GetDlgItem(IDC_CMB_LANGUAGE));
std::string currentLang = translationsComboBox.GetCurSel() >= 0 ? (const char *)translationsComboBox.GetItemDataPtr(translationsComboBox.GetCurSel()) : "";
m_Dlg.SetLanguage(currentLang);
return 0;
}
void CVideoTab::AddOverScanTab(languageStringID caption) {
m_OverScanTab.AddItem(TCIF_TEXT | TCIF_PARAM, wGS(caption).c_str(), 0, caption);
COverScanTab * tab = new COverScanTab;
tab->Create(m_hWnd, 0);
@ -153,17 +257,12 @@ void CVideoTab::AddOverScanTab(const wchar_t * caption)
m_OverscanTabs.push_back(tab);
if (m_OverscanTabs.size() == 1)
{
ShowOverScanTab(0);
}
}
void CVideoTab::ShowOverScanTab(int nTab)
{
void CVideoTab::ShowOverScanTab(int nTab) {
for (size_t i = 0; i < m_OverscanTabs.size(); i++)
{
m_OverscanTabs[i]->ShowWindow(SW_HIDE);
}
CRect TabRect;
m_OverScanTab.GetWindowRect(&TabRect);
@ -179,23 +278,16 @@ void CVideoTab::ShowOverScanTab(int nTab)
m_OverScanTab.RedrawWindow();
}
void CVideoTab::LoadSettings(bool /*blockCustomSettings*/)
{
void CVideoTab::LoadSettings(bool /*blockCustomSettings*/) {
CComboBox WindowedResolutionComboBox(GetDlgItem(IDC_CMB_WINDOWED_RESOLUTION));
for (unsigned int i = 0; i < numWindowedModes; ++i)
{
for (unsigned int i = 0; i < numWindowedModes; ++i) {
int index = WindowedResolutionComboBox.AddString(WindowedModes[i].description);
WindowedResolutionComboBox.SetItemData(index, i);
if (WindowedModes[i].width == config.video.windowedWidth &&
WindowedModes[i].height == config.video.windowedHeight)
{
if (WindowedModes[i].width == config.video.windowedWidth && WindowedModes[i].height == config.video.windowedHeight)
WindowedResolutionComboBox.SetCurSel(index);
}
}
if (WindowedResolutionComboBox.GetCount() > 0 && WindowedResolutionComboBox.GetCurSel() < 0)
{
WindowedResolutionComboBox.SetCurSel(0);
}
CButton overscanCheckBox(GetDlgItem(IDC_CHK_OVERSCAN));
overscanCheckBox.SetCheck(config.frameBufferEmulation.enableOverscan != 0 ? BST_CHECKED : BST_UNCHECKED);
@ -221,14 +313,11 @@ void CVideoTab::LoadSettings(bool /*blockCustomSettings*/)
CComboBox fullScreenResolutionComboBox(GetDlgItem(IDC_CMB_FULL_SCREEN_RES));
fullScreenResolutionComboBox.ResetContent();
for (size_t i = 0, n = fullscreenModesList.size(); i < n; i++)
{
for (size_t i = 0, n = fullscreenModesList.size(); i < n; i++) {
std::wstring fullscreenModeStr(fullscreenModesList[i].begin(), fullscreenModesList[i].end());
int index = fullScreenResolutionComboBox.AddString(fullscreenModeStr.c_str());
if (fullscreenMode == i)
{
fullScreenResolutionComboBox.SetCurSel(index);
}
}
OnFullScreenChanged(0, 0, NULL);
m_AliasingSlider.SetPos(config.video.multisampling >> 1);
@ -248,26 +337,34 @@ void CVideoTab::LoadSettings(bool /*blockCustomSettings*/)
CButton(GetDlgItem(IDC_BILINEAR_STANDARD)).SetCheck(config.texture.bilinearMode == BILINEAR_STANDARD ? BST_CHECKED : BST_UNCHECKED);
CComboBox aspectComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO));
switch (config.frameBufferEmulation.aspect)
{
case Config::aStretch:
aspectComboBox.SetCurSel(2);
break;
case Config::a43:
aspectComboBox.SetCurSel(0);
break;
case Config::a169:
aspectComboBox.SetCurSel(1);
break;
case Config::aAdjust:
aspectComboBox.SetCurSel(3);
break;
switch (config.frameBufferEmulation.aspect) {
case Config::aStretch: aspectComboBox.SetCurSel(2); break;
case Config::a43: aspectComboBox.SetCurSel(0); break;
case Config::a169: aspectComboBox.SetCurSel(1); break;
case Config::aAdjust: aspectComboBox.SetCurSel(3); break;
}
CComboBox(GetDlgItem(IDC_CMB_PATTERN)).SetCurSel(config.generalEmulation.rdramImageDitheringMode);
CButton(GetDlgItem(IDC_CHK_APPLY_TO_OUTPUT)).SetCheck(config.generalEmulation.enableDitheringPattern == 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_5BIT_QUANTIZATION)).SetCheck(config.generalEmulation.enableDitheringQuantization == 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_HIRES_NOISE)).SetCheck(config.generalEmulation.enableHiresNoiseDithering == 0 ? BST_CHECKED : BST_UNCHECKED);
CComboBox translationsComboBox(GetDlgItem(IDC_CMB_LANGUAGE));
std::string currentLang = translationsComboBox.GetCurSel() > 0 ? (const char *)translationsComboBox.GetItemDataPtr(translationsComboBox.GetCurSel()) : "";
translationsComboBox.SetCurSel(-1);
int englishIndx = -1;
for (int i = 0, n = translationsComboBox.GetCount(); i < n; i++) {
const char * translations = (const char *)translationsComboBox.GetItemDataPtr(i);
if (_stricmp(translations, "gliden64_en.Lang") == 0)
englishIndx = i;
if (config.translationFile == translations) {
translationsComboBox.SetCurSel(i);
break;
}
}
if (englishIndx >= 0 && translationsComboBox.GetCurSel() < 0)
translationsComboBox.SetCurSel(englishIndx);
}
void CVideoTab::SaveSettings()
@ -277,29 +374,16 @@ void CVideoTab::SaveSettings()
CComboBox WindowResCB(GetDlgItem(IDC_CMB_WINDOWED_RESOLUTION));
int WindowResIndx = WindowResCB.GetItemData(WindowResCB.GetCurSel());
if (WindowResIndx >= 0 && WindowResIndx < numWindowedModes)
{
if (WindowResIndx >= 0 && WindowResIndx < numWindowedModes) {
config.video.windowedWidth = WindowedModes[WindowResIndx].width;
config.video.windowedHeight = WindowedModes[WindowResIndx].height;
}
int AspectIndx = CComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO)).GetCurSel();
if (AspectIndx == 2)
{
config.frameBufferEmulation.aspect = Config::aStretch;
}
else if (AspectIndx == 0)
{
config.frameBufferEmulation.aspect = Config::a43;
}
else if (AspectIndx == 1)
{
config.frameBufferEmulation.aspect = Config::a169;
}
else if (AspectIndx == 3)
{
config.frameBufferEmulation.aspect = Config::aAdjust;
}
if (AspectIndx == 2) { config.frameBufferEmulation.aspect = Config::aStretch; }
else if (AspectIndx == 0) { config.frameBufferEmulation.aspect = Config::a43; }
else if (AspectIndx == 1) { config.frameBufferEmulation.aspect = Config::a169; }
else if (AspectIndx == 3) { config.frameBufferEmulation.aspect = Config::aAdjust; }
config.video.verticalSync = CButton(GetDlgItem(IDC_CHK_VERTICAL_SYNC)).GetCheck() == BST_CHECKED;
config.video.threadedVideo = CButton(GetDlgItem(IDC_CHK_THREADED_VIDEO)).GetCheck() == BST_CHECKED;
@ -324,16 +408,15 @@ void CVideoTab::SaveSettings()
config.texture.maxAnisotropy = m_AnisotropicSlider.GetPos();
if (CButton(GetDlgItem(IDC_BILINEAR_3POINT)).GetCheck() == BST_CHECKED)
{
config.texture.bilinearMode = BILINEAR_3POINT;
}
if (CButton(GetDlgItem(IDC_BILINEAR_STANDARD)).GetCheck() == BST_CHECKED)
{
config.texture.bilinearMode = BILINEAR_STANDARD;
}
config.generalEmulation.rdramImageDitheringMode = CComboBox(GetDlgItem(IDC_CMB_PATTERN)).GetCurSel();
config.generalEmulation.enableDitheringPattern = CButton(GetDlgItem(IDC_CHK_APPLY_TO_OUTPUT)).GetCheck() == BST_CHECKED ? 1 : 0;
config.generalEmulation.enableDitheringQuantization = CButton(GetDlgItem(IDC_CHK_5BIT_QUANTIZATION)).GetCheck() == BST_CHECKED ? 1 : 0;
config.generalEmulation.enableHiresNoiseDithering = CButton(GetDlgItem(IDC_CHK_HIRES_NOISE)).GetCheck() == BST_CHECKED ? 1 : 0;
CComboBox translationsComboBox(GetDlgItem(IDC_CMB_LANGUAGE));
config.translationFile = translationsComboBox.GetCurSel() >= 0 ? (const char *)translationsComboBox.GetItemDataPtr(translationsComboBox.GetCurSel()) : "";
}

View File

@ -2,11 +2,16 @@
#include "config-tab.h"
#include "config-overscan.h"
#include "wtl-BitmapPicture.h"
#include "wtl-tooltip.h"
#include "resource.h"
#include "Language.h"
#include <vector>
class CConfigDlg;
class CVideoTab :
public CConfigTab
public CConfigTab,
public CToolTipDialog<CVideoTab>
{
public:
BEGIN_MSG_MAP(CVideoTab)
@ -17,12 +22,14 @@ public:
NOTIFY_HANDLER_EX(IDC_TAB_OVERSCAN, TCN_SELCHANGE, OnOverscanTabChange)
COMMAND_HANDLER_EX(IDC_CMB_FULL_SCREEN_RES, CBN_SELCHANGE, OnFullScreenChanged)
COMMAND_HANDLER_EX(IDC_CHK_OVERSCAN, BN_CLICKED, OnOverscan)
COMMAND_HANDLER(IDC_CMB_LANGUAGE, CBN_SELCHANGE, OnLanguageChanged)
MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
CHAIN_MSG_MAP(CToolTipDialog<CVideoTab>)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
CVideoTab();
CVideoTab(CConfigDlg & Dlg, const char * strIniPath);
~CVideoTab();
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
@ -31,8 +38,10 @@ public:
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnOverscanTabChange(NMHDR* /*pNMHDR*/);
void OnFullScreenChanged(UINT /*Code*/, int id, HWND /*ctl*/);
void AddOverScanTab(const wchar_t * caption);
LRESULT OnLanguageChanged(WORD wNotifyCode, WORD wID, HWND hwnd, BOOL& bHandled);
void AddOverScanTab(languageStringID caption);
void ShowOverScanTab(int nTab);
void ApplyLanguage(void);
void LoadSettings(bool blockCustomSettings);
void SaveSettings();
@ -41,4 +50,7 @@ public:
CTrackBarCtrl m_AliasingSlider;
CTrackBarCtrl m_AnisotropicSlider;
CBitmapPicture m_AAInfoIcon;
std::string m_strIniPath;
LanguageList m_LangList;
CConfigDlg & m_Dlg;
};

Binary file not shown.

View File

@ -0,0 +1,106 @@
#pragma once
template < class T, class TT = CToolTipCtrl >
class CToolTipDialog
{
// Data declarations and members
public:
TT& GetTT() { return m_TT; }
protected:
TT m_TT;
UINT m_uTTStyle;
UINT m_uToolFlags;
// Construction
CToolTipDialog(UINT uTTSTyle = TTS_NOPREFIX | TTS_BALLOON, UINT uToolFlags = TTF_IDISHWND | TTF_SUBCLASS)
: m_TT(NULL), m_uTTStyle(uTTSTyle),
m_uToolFlags(uToolFlags | TTF_SUBCLASS)
{}
void TTInit()
{
T* pT = (T*)this;
ATLASSERT(::IsWindow(*pT));
m_TT.Create(*pT, NULL, NULL, m_uTTStyle);
CToolInfo ToolInfo(pT->m_uToolFlags, *pT, 0, 0, MAKEINTRESOURCE(pT->IDD));
m_TT.AddTool(&ToolInfo);
::EnumChildWindows(*pT, SetTool, (LPARAM)pT);
TTSize(0);
TTActivate(TRUE);
}
// Operations
public:
void TTActivate(BOOL bActivate)
{
m_TT.Activate(bActivate);
}
void TTSize(int nPixel)
{
m_TT.SetMaxTipWidth(nPixel);
}
void TTSetTxt(HWND hTool, _U_STRINGorID text)
{
m_TT.UpdateTipText(text, hTool);
}
void TTSetTxt(UINT idTool, _U_STRINGorID text)
{
TTSetTxt(GetHWND(idTool), text);
}
BOOL TTAdd(HWND hTool)
{
return SetTool(hTool, (LPARAM)(T*)this);
}
BOOL TTAdd(UINT idTool)
{
return TTAdd(GetHWND(idTool));
}
void TTRemove(HWND hTool)
{
m_TT.DelTool(hTool);
}
void TTRemove(UINT idTool)
{
TTRemove(GetHWND(idTool));
}
// Message map and handlers
BEGIN_MSG_MAP(CToolTipDialog)
MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouse)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
END_MSG_MAP()
LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL& bHandled)
{
TTInit();
bHandled = FALSE;
return TRUE;
}
LRESULT OnMouse(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
T* pT = (T*)this;
bHandled = FALSE;
if (m_TT.IsWindow())
m_TT.RelayEvent((LPMSG)pT->GetCurrentMessage());
return 0;
}
// Implementation
private:
HWND GetHWND(UINT idTool)
{
return ::GetDlgItem(*(T*)this, idTool);
}
static BOOL CALLBACK SetTool(HWND hTool, LPARAM pDlg)
{
T* pT = (T*)pDlg;
int idTool = ::GetWindowLong(hTool, GWL_ID);
if (idTool != IDC_STATIC)
{
CToolInfo ToolInfo(pT->m_uToolFlags, hTool, 0, 0, (LPTSTR)idTool);
pT->m_TT.AddTool(&ToolInfo);
}
return TRUE;
}
};

View File

@ -0,0 +1,63 @@
/*********************************************************************************
* Meta Information *
*********************************************************************************/
#0001# "Deutsch"
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
#1000# "Video"
#1001# "Emulation"
#1002# "Frame-Buffer"
#1003# "Textur-Verbesserungen"
#1004# "OSD"
#1005# "Debuggen"
#1010# "Einstellungen speichern für:"
#1011# "Einstellungen Profil:"
#1012# "Entfernen"
#1013# "Standardeinstellungen wiederherstellen"
#1014# "Speichern und schließen"
#1015# "Speichern"
#1016# "Schließen"
/*********************************************************************************
* Video Tab *
*********************************************************************************/
#2000# "Video"
#2001# "Vollbild-Auflösung:"
#2002# "Alle von der Grafikkarte/Monitor unterstützten Auflösungen sollten angezeigt werden.\n[Empfehlung: Die maximale Auflösung des Monitors, außer es gibt Geschwindigkeitprobleme]"
#2003# "Aktualisierungsrate:"
#2005# "Fenster-Auflösung:"
#2006# "Diese Option wählt die Auflösung für den Fenstermodus aus. Du kannst auch eine benutzerdefinierte Fenstergröße eingeben.\n[Empfehlung: 640 x 480, 800 x 600, 1024 x 768, 1280 x 960]"
#2007# "Seitenverhältnis:"
#2008# "Diese Einstellung legt das Seitenverhältnis der Ausgabe fest. Alle N64 Spiele unterstützen 4:3. Einige Spiele unterstützen 16:9 innerhalb der Spieleinstellungen. Verwende Strecken um den kompletten Bildschirm ohne schwarze Ränder anzuzeigen.\nVersuche das Spiel passend einzustellen versucht den Betrachtungsraum ohne Strecken anzupassen. Viele Spiele funktionieren gut. Einige nicht."
#2009# "4:3 (empfohlen)"
#2010# "16:9"
#2011# "Strecken"
#2012# "Versuche das Spiel passend einzustellen"
#2013# "Aktiviere VSync"
#2014# "Vertikale Synchronisation, oder VSync, kann die Bildqualität durch die Synchronisation der Aktualisierungsrate des Spiels mit der Bildwiederholrate des Monitors verbessern. Dies verhindert Bildversatz/Tearing, kann zu Leistungseinbrüchen führen.\n[Empfehlung: Gewöhnlich aus, außer es gibt Tearing]"
#2015# "Threaded Video aktivieren"
#2016# "Threaded Video kann die Leistung mit schlechten OpenGL-Treibern auf Kosten einer sehr marginalen Eingangsverzögerung, normalerweise weniger als ein halbes Frame, verbessern.\n[Empfehlung: Gewöhnlich aus, es sei denn, es gibt Leistungsprobleme]"
#2017# "Overscan"
#2018# "Wenn aktiviert, wird das Bild um die in N64 Pixel angegebenen Werte beschnitten. Nützlich, um schwarze Ränder in einigen Spielen zu entfernen."
#2019# "NTSC"
#2020# "PAL"
#2021# "Antialiasing"
#2022# "Kein Antialiasing"
#2023# "Fast Approximate Antialiasing (FXAA)"
#2024# "Multisample-Antialiasing (MSAA):"
#2025# "Aus"
#2026# "Hoch"
#2027# "GLideN64 bietet zwei Methoden zur Kantenglättung an:\nFast Approximate Antialiasing (FXAA): FXAA ist ein Nachbearbeitungsfilter, der ein anständiges Ergebnis liefern kann, aber so gut wie MSAA ist. Der Hauptgrund für die Verwendung von FXAA ist die Verwendung mit N64-Style-Tiefenvergleich. FXAA fügt dem Ausgabebild etwas Unschärfe hinzu, wodurch einige Texturen wie Text möglicherweise schlechter aussehen.\nMultisample-Antialiasing (MSAA): MSAA ist eine Standard-Antialiasing-Technik, die in der Computergrafik zur Verbesserung der Bildqualität eingesetzt wird. Die meisten modernen GPUs unterstützen 2, 4, 8 und 16 Samples. Mehr Samples bedeuten bessere Qualität, sind aber langsamer. Es gibt zwei Nachteile: Es ist inkompatibel mit N64-Style-Tiefenvergleich und kann bei einigen Spielen zu kleineren Störungen führen.\nEmpfehlung: [Normalerweise 16x MSAA, oder FXAA mit N64-Style-Tiefenvergleich]"
#2028# "Multisample-Antialiasing ist nicht kompatibel mit N64-Style-Tiefenvergleich."
#2029# "Filtern"
#2030# "Anisotrope Filterung:"
#2031# "Aus"
#2032# "Hoch"
#2033# "Bilineare Filterung:"
#2034# "Standard"
#2035# "N64-Style 3 Punkt"
#2036# "Bilineare Filterung: Texturen verwenden standard PC-Style bilineare Filtering.\nN64-Style 3 point: Texturen werden ähnlich dem N64 gefiltert. Das Resultat sieht nicht so weich aus, entspricht aber ehr dem N64."
#2046# "Deaktivieren"
#2050# "Sprache:"

View File

@ -0,0 +1,75 @@
/*********************************************************************************
* Meta Information *
*********************************************************************************/
#0001# "English"
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
#1000# "Video"
#1001# "Emulation"
#1002# "Frame buffer"
#1003# "Texture enhancement"
#1004# "OSD"
#1005# "Debug"
#1010# "Save settings for:"
#1011# "Settings profile:"
#1012# "Remove"
#1013# "Restore Defaults"
#1014# "Save and Close"
#1015# "Save"
#1016# "Close"
/*********************************************************************************
* Video Tab *
*********************************************************************************/
#2000# "Video"
#2001# "Full screen resolution:"
#2002# "All the resolutions that your video card/monitor supports should be displayed.\n[Recommended: Maximum resolution for your monitor unless performance becomes an issue]"
#2003# "Refresh rate:"
#2005# "Windowed resolution:"
#2006# "This option selects the resolution for windowed mode. You can also type in a custom window size.\n[Recommended: 640 x 480, 800 x 600, 1024 x 768, 1280 x 960]"
#2007# "Aspect ratio:"
#2008# "This setting adjusts the aspect ratio of the video output. All N64 games support 4:3. Some games support 16:9 within game settings. Use Stretch to fill the screen without pillar or letterboxing.\nTry to adjust game to fit tries to adjust the viewing space to fit without stretching. Many games work well adjusted, but some don't."
#2009# "4:3 (recommended)"
#2010# "16:9"
#2011# "Stretch"
#2012# "Try to adjust game to fit"
#2013# "Enable VSync"
#2014# "Vertical sync, or VSync, can improve the image by syncing the game's frame rate to your monitor's refresh rate. This prevents image tearing, but may cause performance problems.\n[Recommended: Usually off, on if you have image tearing problems]"
#2015# "Enable threaded video"
#2016# "Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame.\n[Recommended: Usually off, unless there are performance issues]"
#2017# "Overscan"
#2018# "When enabled, the image is cropped by values specified in N64 pixels. Useful to remove black borders in some games."
#2019# "NTSC"
#2020# "PAL"
#2021# "Anti-aliasing"
#2022# "No anti-aliasing"
#2023# "Fast approximate anti-aliasing (FXAA)"
#2024# "Multisample anti-aliasing (MSAA):"
#2025# "Off"
#2026# "High"
#2027# "GLideN64 offers two methods to smooth jagged polygons:\nFast approximate anti-aliasing (FXAA): FXAA is a post-processing filter that can provide a decent result, but as good as MSAA. The main reason to use FXAA is to use with N64-style depth compare. FXAA adds some blurriness to the output image, causing some textures like text to possibly look worse.\nMultisample anti-aliasing (MSAA): MSAA is a standard anti-aliasing technique used in computer graphics to improve image quality. Most modern GPUs support 2, 4, 8, and 16 samples. More samples mean better quality, but are slower. There are two downsides: it's incompatible with N64-style depth compare and may cause minor glitches in some games.\nRecommendation: [Usually 16x MSAA, or FXAA with N64-style depth compare]"
#2028# "Multisample anti-aliasing is not compatible with N64-style depth compare."
#2029# "Filtering"
#2030# "Anisotropic filtering:"
#2031# "Off"
#2032# "High"
#2033# "Bilinear filtering:"
#2034# "Standard"
#2035# "N64-style 3 point"
#2036# "Bilinear filtering: Textures will use standard PC-style bilinear filtering.\nN64-style 3 point: Textures will be filtered more like the N64. The result is less smooth but more accurate."
#2037# "Dithering"
#2038# "Pattern (RDRAM):"
#2039# "Apply to final output"
#2040# "This setting enables game controlled ordered grid dithering. Enable it for accurate representation. Default = disabled."
#2041# "Enable 5-bit quantization"
#2042# "Like real hardware this setting reduces the number of colors if dithering is used. Removes undesired dithering fragments. Default = enabled."
#2043# "High resolution noise"
#2044# "RDRAM dithering prevents color banding in games with framebuffer effects."
#2045# "Settings: Disabled, Bayer ordered grid dithering, Magic Square ordered grid dithering or blue noise dithering.Blue noise dithering produces unobtrusive results.Default = blue noise dithering."
#2046# "Disable"
#2047# "Bayer"
#2048# "Magic square"
#2049# "Blue noise"
#2050# "Language:"

View File

@ -0,0 +1,41 @@
/*********************************************************************************
* Meta Information *
*********************************************************************************/
#0001# "Español"
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
#1000# "Vídeo"
#1001# "Emulación"
#1002# "Frame buffer"
#1003# "Mejora de texturas"
#1004# "OSD"
/*********************************************************************************
* Video Tab *
*********************************************************************************/
#2000# "Vídeo"
#2001# "Resolución de pantalla completa:"
#2002# "Aquí deberían aparecer todas las resoluciones que admite tu tarjeta gráfica o monitor.\n[Recomendación: La resolución máxima que permita tu monitor salvo que haya problemas de rendimiento]"
#2003# "Frecuencia de actualización:"
#2005# "Resolución de ventana:"
#2007# "Proporción de aspecto:"
#2008# "Ajusta la proporción de aspecto de la salida de vídeo. Todos los juegos de N64 admiten la proporción 4:3. Algunos son compatibles con 16:9 dentro de las opciones de cada juego. Utiliza la opción «estirar» para llenar toda la pantalla sin provocar bordes en cualquier punto de la pantalla.\n«Intentar ajustar el tamaño del juego» intentará ajustar el espacio de la pantalla sin estirar la imagen. Muchos juegos funcionan correctamente bajo este ajuste, pero algunos no funcionarán bien."
#2009# "4:3 (recomendado)"
#2010# "16:9"
#2011# "Estirar"
#2012# "Intentar ajustar el tamaño del juego"
#2013# "Sincronía vertical"
#2014# "La sincronía vertical (También llamada VSync) puede mejorar la calidad de imagen sincronizando la velocidad de fotogramas del juego con la frecuencia de actualización de tu monitor. Esto evita que la imagen aparezca cortada, pero podría provocar problemas de rendimiento.\n[Recomendación: Por norma general desactivado, activar si las imágenes salen cortadas]"
#2025# "Desactivado"
#2026# "Alto"
#2030# "Filtro anisotrópico:"
#2031# "Desactivado"
#2032# "Alto"
#2033# "Filtrado bilineal:"
#2034# "Estándar"
#2035# "Tripunto N64"
#2036# "Filtrado bilineal: Las texturas utilizarán el filtro bilineal estándar de PC.\nTripunto N64: Las texturas se filtrarán de una forma más parecida a la que hace la N64. El resultado será menos suave, pero más preciso."
#2046# "Desactivado"
#2050# "Idioma:"

View File

@ -0,0 +1,41 @@
/*********************************************************************************
* Meta Information *
*********************************************************************************/
#0001# "Français"
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
#1000# "Vidéo"
#1001# "Émulation"
#1002# "Tampon image"
#1003# "Améliorations des Textures"
#1004# "OSD"
/*********************************************************************************
* Video Tab *
*********************************************************************************/
#2000# "Vidéo"
#2001# "Résolution Plein Ecran :"
#2002# "Toutes les résolutions supportées par votre carte graphique / moniteur devraient être affichées.\n[Recommandé : Résolution native (maximum) de votre moniteur - sauf si les performances sont dégradées]"
#2003# "Taux de rafraîchissement :"
#2005# "Résolution en Mode Fenêtré :"
#2007# "Format d'écran :"
#2008# "Cette option ajuste le format d'écran de la sortie vidéo. Tous les jeux N64 supportent 4:3. Quelques jeux supportent 16:9 dans leurs paramétrages. Utilisez Étiré pour remplir l'écran sans bords noirs.\nAjusté à l'écran sans étirer tente d'ajuster l'espace de vue afin de remplir sans étirer. De nombreux jeux fonctionnent correctement en mode ajusté, mais d'autres non."
#2009# "4:3 (recommandé)"
#2010# "16:9"
#2011# "Étiré"
#2012# "Ajusté à l'écran sans étirer"
#2013# "Activer la synchro verticale"
#2014# "La synchronisation verticale, ou VSync, peut améliorer l'image en synchronisant le taux d'échantillonage du jeu à celui du taux de rafraîchissement de votre écran. Cela évite la déchirure de l'image, mais peut engendrer des problèmes de performance.\n[Recommandé : Généralement désactivé, sauf si vous avez des problèmes de déchirure d'image]"
#2025# "Off"
#2026# "Max"
#2030# "Filtrage Anisotropique :"
#2031# "Off"
#2032# "Max"
#2033# "Filtrage bilinéaire :"
#2034# "Standard"
#2035# "Style N64 3 points"
#2036# "Filtrage bilinéaire: les textures vont utiliser le filtrage bilinéaire standard d'un PC.\nStyle N64 3 points: Les textures seront filtrés comme sur la N64. Le résultat est moins lisse mais plus authentique."
#2046# "Désactivé"
#2050# "Langue :"

View File

@ -0,0 +1,20 @@
/*********************************************************************************
* Meta Information *
*********************************************************************************/
#0001# "Italiano"
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
#1001# "Emulazione"
#1003# "Miglioramenti texture"
/*********************************************************************************
* Video Tab *
*********************************************************************************/
#2001# "Risoluzione a schermo intero:"
#2003# "Frequenza di aggiornamento:"
#2005# "Risoluzione finestra:"
#2011# "Adatta"
#2030# "Filtro Anisotropico:"
#2050# "Lingua:"

View File

@ -0,0 +1,23 @@
/*********************************************************************************
* Meta Information *
*********************************************************************************/
#0001# "Japanese"
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
#1000# "ビデオ"
#1001# "エミュレーション"
#1003# "テクスチャ拡張"
/*********************************************************************************
* Video Tab *
*********************************************************************************/
#2000# "ビデオ"
#2001# "フルスクリーン解像度:"
#2003# "リフレッシュレート:"
#2005# "ウィンドウ解像度:"
#2010# "16:9"
#2011# "引き伸ばし"
#2030# "異方性フィルタリング:"
#2050# "言語:"

View File

@ -0,0 +1,23 @@
/*********************************************************************************
* Meta Information *
*********************************************************************************/
#0001# "Polski"
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
#1000# "Obraz"
#1001# "Emulacja"
#1003# "Uwydatnienie tekstur"
/*********************************************************************************
* Video Tab *
*********************************************************************************/
#2000# "Obraz"
#2001# "Rozdzielczość pełnoekranowa:"
#2003# "Częstotliwość odświeżania:"
#2005# "Rozdzielczość w oknie:"
#2010# "16:9"
#2011# "Rozciągnij"
#2030# "Filtrowanie anizotropowe:"
#2050# "Język:"

View File

@ -0,0 +1,23 @@
/*********************************************************************************
* Meta Information *
*********************************************************************************/
#0001# "Português Brasileiro"
/*********************************************************************************
* Config Dialog *
*********************************************************************************/
#1000# "Vídeo"
#1001# "Emulação"
#1003# "Melhoramento de Textura"
/*********************************************************************************
* Video Tab *
*********************************************************************************/
#2000# "Vídeo"
#2001# "Resolução Tela Cheia:"
#2003# "Freqüência do Refresh:"
#2005# "Resolução de Janela:"
#2010# "16:9"
#2011# "Estendido"
#2030# "Filtragem Anisotrópica:"
#2050# "Língua:"