2020-08-04 12:58:40 +00:00
|
|
|
#include "stdafx.h"
|
2022-09-21 05:16:07 +00:00
|
|
|
|
2020-08-04 12:58:40 +00:00
|
|
|
#include "WelcomeScreen.h"
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
WelcomeScreen::WelcomeScreen()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WelcomeScreen::SelectGameDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
|
|
|
{
|
|
|
|
wchar_t Buffer[MAX_PATH], Directory[MAX_PATH];
|
|
|
|
LPITEMIDLIST pidl;
|
2021-01-02 03:37:00 +00:00
|
|
|
BROWSEINFO bi;
|
2020-08-04 12:58:40 +00:00
|
|
|
|
|
|
|
stdstr InitialDir = g_Settings->LoadStringVal(RomList_GameDir);
|
|
|
|
std::wstring wTitle = L"Select Game Directory";
|
|
|
|
bi.hwndOwner = m_hWnd;
|
2021-04-12 11:35:39 +00:00
|
|
|
bi.pidlRoot = nullptr;
|
2020-08-04 12:58:40 +00:00
|
|
|
bi.pszDisplayName = Buffer;
|
|
|
|
bi.lpszTitle = wTitle.c_str();
|
|
|
|
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
|
|
|
|
bi.lpfn = (BFFCALLBACK)SelectDirCallBack;
|
2022-08-29 08:27:17 +00:00
|
|
|
bi.lParam = (LPARAM)InitialDir.c_str();
|
2021-04-12 11:35:39 +00:00
|
|
|
if ((pidl = SHBrowseForFolder(&bi)) != nullptr)
|
2020-08-04 12:58:40 +00:00
|
|
|
{
|
2021-01-02 03:37:00 +00:00
|
|
|
if (SHGetPathFromIDList(pidl, Directory))
|
2020-08-04 12:58:40 +00:00
|
|
|
{
|
|
|
|
stdstr path;
|
|
|
|
CPath SelectedDir(path.FromUTF16(Directory), "");
|
|
|
|
if (SelectedDir.DirectoryExists())
|
|
|
|
{
|
|
|
|
GetDlgItem(IDC_GAME_DIR).SetWindowText(Directory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-21 05:16:07 +00:00
|
|
|
LRESULT WelcomeScreen::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/)
|
2020-08-04 12:58:40 +00:00
|
|
|
{
|
|
|
|
m_Logo.SubclassWindow(GetDlgItem(IDC_BMP_LOGO));
|
|
|
|
m_Logo.SetBitmap(MAKEINTRESOURCE(IDB_ABOUT_LOGO));
|
2022-09-21 05:16:07 +00:00
|
|
|
|
2020-08-04 12:58:40 +00:00
|
|
|
LanguageList LangList = g_Lang->GetLangList();
|
|
|
|
CComboBox LangCB(GetDlgItem(IDC_LANG_SEL));
|
|
|
|
for (LanguageList::iterator Language = LangList.begin(); Language != LangList.end(); Language++)
|
|
|
|
{
|
|
|
|
int Index = LangCB.AddString(stdstr(Language->LanguageName).ToUTF16().c_str());
|
|
|
|
if (_stricmp(Language->LanguageName.c_str(), "English") == 0)
|
|
|
|
{
|
|
|
|
LangCB.SetCurSel(Index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (LangCB.GetCurSel() < 0)
|
|
|
|
{
|
|
|
|
LangCB.SetCurSel(0);
|
|
|
|
}
|
2021-03-01 09:38:29 +00:00
|
|
|
CButton(GetDlgItem(IDC_RADIO_GLIDEN64)).SetCheck(BST_CHECKED);
|
2020-08-04 12:58:40 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-09-21 05:16:07 +00:00
|
|
|
LRESULT WelcomeScreen::OnCtlColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL & /*bHandled*/)
|
2020-08-04 12:58:40 +00:00
|
|
|
{
|
|
|
|
HDC hdcStatic = (HDC)wParam;
|
|
|
|
SetTextColor(hdcStatic, RGB(0, 0, 0));
|
|
|
|
SetBkMode(hdcStatic, TRANSPARENT);
|
|
|
|
return (LONG)(LRESULT)((HBRUSH)GetStockObject(NULL_BRUSH));
|
|
|
|
}
|
|
|
|
|
2021-03-01 09:38:29 +00:00
|
|
|
BOOL WelcomeScreen::OnEraseBackground(CDCHandle dc)
|
2020-08-04 12:58:40 +00:00
|
|
|
{
|
|
|
|
static HPEN outline = CreatePen(PS_SOLID, 1, 0x00FFFFFF);
|
|
|
|
static HBRUSH fill = CreateSolidBrush(0x00FFFFFF);
|
2021-03-01 09:38:29 +00:00
|
|
|
dc.SelectPen(outline);
|
|
|
|
dc.SelectBrush(fill);
|
2020-08-04 12:58:40 +00:00
|
|
|
|
|
|
|
RECT rect;
|
|
|
|
GetClientRect(&rect);
|
2021-03-01 09:38:29 +00:00
|
|
|
dc.Rectangle(&rect);
|
2020-08-04 12:58:40 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-03-01 09:38:29 +00:00
|
|
|
HBRUSH WelcomeScreen::OnCtlColorStatic(CDCHandle dc, CStatic /*wndStatic*/)
|
|
|
|
{
|
|
|
|
dc.SetBkColor(RGB(255, 255, 255));
|
|
|
|
dc.SetDCBrushColor(RGB(255, 255, 255));
|
|
|
|
return (HBRUSH)GetStockObject(DC_BRUSH);
|
|
|
|
}
|
|
|
|
|
2020-08-04 12:58:40 +00:00
|
|
|
LRESULT WelcomeScreen::OnOkCmd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/)
|
|
|
|
{
|
|
|
|
CComboBox LangCB(GetDlgItem(IDC_LANG_SEL));
|
|
|
|
int Index = LangCB.GetCurSel();
|
|
|
|
if (Index >= 0)
|
|
|
|
{
|
|
|
|
wchar_t String[255];
|
|
|
|
LangCB.GetLBText(Index, String);
|
|
|
|
g_Lang->SetLanguage(stdstr().FromUTF16(String).c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
CPath GameDir(GetCWindowText(GetDlgItem(IDC_GAME_DIR)).c_str(), "");
|
|
|
|
if (GameDir.DirectoryExists())
|
|
|
|
{
|
2020-10-12 01:18:38 +00:00
|
|
|
g_Settings->SaveString(RomList_GameDir, GameDir.GetDriveDirectory().c_str());
|
2020-08-04 12:58:40 +00:00
|
|
|
Notify().AddRecentDir(GameDir);
|
|
|
|
}
|
2021-03-01 09:38:29 +00:00
|
|
|
|
2021-03-02 22:08:41 +00:00
|
|
|
string Project64VideoPluginPath = g_Settings->LoadStringVal(Plugin_GFX_Default);
|
2022-09-21 05:16:07 +00:00
|
|
|
if (Project64VideoPluginPath.find("Project64-Video") == string::npos)
|
|
|
|
{
|
2021-03-02 22:08:41 +00:00
|
|
|
Project64VideoPluginPath = "GFX\\Project64-Video.dll";
|
|
|
|
}
|
|
|
|
g_Settings->SaveString(Plugin_GFX_Default, CButton(GetDlgItem(IDC_RADIO_GLIDEN64)).GetCheck() == BST_CHECKED ? "GFX\\GLideN64\\GLideN64.dll" : Project64VideoPluginPath);
|
|
|
|
g_Settings->SaveString(Plugin_GFX_Current, g_Settings->LoadStringVal(Plugin_GFX_Default));
|
2020-08-04 12:58:40 +00:00
|
|
|
EndDialog(0);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int CALLBACK WelcomeScreen::SelectDirCallBack(HWND hwnd, DWORD uMsg, DWORD /*lp*/, DWORD lpData)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case BFFM_INITIALIZED:
|
2021-03-17 08:33:42 +00:00
|
|
|
// WParam is TRUE since you are passing a path
|
|
|
|
// It would be FALSE if you were passing a PIDL
|
2020-08-04 12:58:40 +00:00
|
|
|
if (lpData)
|
|
|
|
{
|
|
|
|
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|