void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts(); m_MenuItems.DeleteAllItems(); for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++) { ACCESS_MODE ItemMode = Item->second.AccessMode(); if ((ItemMode & AccessLevel) != AccessLevel) { continue; } //find Parent HTREEITEM hParent = m_MenuItems.GetChildItem(TVI_ROOT); while (hParent) { if (m_MenuItems.GetItemData(hParent) == (DWORD_PTR)Item->second.Section()) { break; } hParent = m_MenuItems.GetNextSiblingItem(hParent); } if (hParent == NULL) { hParent = m_MenuItems.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(Item->second.Section()).c_str(), 0, 0, 0, 0, Item->second.Section(), TVI_ROOT, TVI_LAST); } wstring str = wGS(Item->second.Title()); std::wstring::size_type pos = str.find(L"&"); while (pos != std::wstring::npos) { str.replace(pos, 1, L""); pos = str.find(L"&", pos); } pos = str.find(L"..."); while (pos != std::wstring::npos) { str.replace(pos, 3, L""); 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); const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems(); for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item++) { if (!ShortCut_item->Inactive() && !ShortCut_item->UserAdded()) { continue; } m_MenuItems.SetItemState(hItem, TVIS_BOLD, TVIS_BOLD); m_MenuItems.SetItemState(hParent, TVIS_BOLD, TVIS_BOLD); break; } } }
CGeneralOptionsPage::CGeneralOptionsPage(CSettingConfig * SettingsConfig, HWND hParent, const RECT & rcDispay) : m_SettingsConfig(SettingsConfig) { if (!Create(hParent, rcDispay)) { return; } //Set the text for all gui Items SetDlgItemTextW(m_hWnd, IDC_AUTOSLEEP, wGS(OPTION_AUTO_SLEEP).c_str()); SetDlgItemTextW(m_hWnd, IDC_LOAD_FULLSCREEN, wGS(OPTION_AUTO_FULLSCREEN).c_str()); SetDlgItemTextW(m_hWnd, IDC_SCREEN_SAVER, wGS(OPTION_DISABLE_SS).c_str()); SetDlgItemTextW(m_hWnd, IDC_BASIC_MODE, wGS(OPTION_BASIC_MODE).c_str()); SetDlgItemTextW(m_hWnd, IDC_MAXROMS_TXT, wGS(RB_MAX_ROMS).c_str()); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str()); SetDlgItemTextW(m_hWnd, IDC_MAXROMDIR_TXT, wGS(RB_MAX_DIRS).c_str()); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str()); SetDlgItemTextW(m_hWnd, IDC_IPLDIR_TXT, wGS(OPTION_IPL_ROM_PATH).c_str()); AddModCheckBox(GetDlgItem(IDC_AUTOSLEEP), Setting_AutoSleep); AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN), Setting_AutoFullscreen); AddModCheckBox(GetDlgItem(IDC_SCREEN_SAVER), Setting_DisableScrSaver); AddModCheckBox(GetDlgItem(IDC_BASIC_MODE), UserInterface_BasicMode); CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBER), File_RecentGameFileCount, false); TxtBox->SetTextField(GetDlgItem(IDC_MAXROMS_TXT)); TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBERDIR), Directory_RecentGameDirCount, false); TxtBox->SetTextField(GetDlgItem(IDC_MAXROMDIR_TXT)); UpdatePageSettings(); }
CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay) { if (!Create(hParent, rcDispay)) { return; } //Set the text for all gui Items SetDlgItemTextW(m_hWnd, IDC_START_ON_ROM_OPEN, wGS(ADVANCE_AUTO_START).c_str()); SetDlgItemTextW(m_hWnd, IDC_ZIP, wGS(ADVANCE_COMPRESS).c_str()); SetDlgItemTextW(m_hWnd, IDC_DEBUGGER, wGS(ADVANCE_DEBUGGER).c_str()); SetDlgItemTextW(m_hWnd, IDC_REMEMBER_CHEAT, wGS(OPTION_REMEMBER_CHEAT).c_str()); SetDlgItemTextW(m_hWnd, IDC_CHECK_RUNNING, wGS(OPTION_CHECK_RUNNING).c_str()); SetDlgItemTextW(m_hWnd, IDC_DISPLAY_FRAMERATE, wGS(OPTION_CHANGE_FR).c_str()); AddModCheckBox(GetDlgItem(IDC_START_ON_ROM_OPEN), Setting_AutoStart); AddModCheckBox(GetDlgItem(IDC_ZIP), Setting_AutoZipInstantSave); AddModCheckBox(GetDlgItem(IDC_DEBUGGER), Debugger_Enabled); AddModCheckBox(GetDlgItem(IDC_REMEMBER_CHEAT), Setting_RememberCheats); AddModCheckBox(GetDlgItem(IDC_CHECK_RUNNING), Setting_CheckEmuRunning); AddModCheckBox(GetDlgItem(IDC_DISPLAY_FRAMERATE), UserInterface_DisplayFrameRate); CModifiedComboBox * ComboBox; ComboBox = AddModComboBox(GetDlgItem(IDC_FRAME_DISPLAY_TYPE), UserInterface_FrameDisplayType); if (ComboBox) { ComboBox->AddItemW(wGS(STR_FR_VIS).c_str(), FR_VIs); ComboBox->AddItemW(wGS(STR_FR_DLS).c_str(), FR_DLs); ComboBox->AddItemW(wGS(STR_FR_PERCENT).c_str(), FR_PERCENT); } UpdatePageSettings(); }
void COptionsDirectoriesPage::SelectDirectory(LanguageStringID Title, CModifiedEditBox & EditBox, CModifiedButton & Default, CModifiedButton & selected) { wchar_t Buffer[MAX_PATH], Directory[MAX_PATH]; LPITEMIDLIST pidl; BROWSEINFOW bi; stdstr InitialDir = EditBox.GetWindowText(); std::wstring wTitle = wGS(Title); bi.hwndOwner = m_hWnd; bi.pidlRoot = NULL; bi.pszDisplayName = Buffer; bi.lpszTitle = wTitle.c_str(); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.lpfn = (BFFCALLBACK)SelectDirCallBack; bi.lParam = (DWORD)InitialDir.c_str(); if ((pidl = SHBrowseForFolderW(&bi)) != NULL) { if (SHGetPathFromIDListW(pidl, Directory)) { stdstr path; CPath SelectedDir(path.FromUTF16(Directory), ""); EditBox.SetChanged(true); EditBox.SetWindowText(SelectedDir); Default.SetChanged(true); Default.SetCheck(BST_UNCHECKED); selected.SetCheck(BM_SETCHECK); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); } } }
void COptionsGameBrowserPage::AddFieldClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { int index = m_Avaliable.GetCurSel(); if (index < 0) { return; } //remove from list int i = m_Avaliable.GetItemData(index); m_Avaliable.DeleteString(index); //select next in list int listCount = m_Avaliable.GetCount(); if (index >= listCount) { index -= 1; } m_Avaliable.SetCurSel(index); //Add to list index = m_Using.AddStringW(wGS(m_Fields[i].LangID()).c_str()); m_Using.SetItemData(index, i); m_Using.SetCurSel(index); m_OrderChanged = true; m_OrderReset = false; SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); }
void CNotificationImp::DisplayWarning(const char * Message) const { HWND Parent = NULL; if (m_hWnd) { Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle()); } MessageBoxW(Parent, stdstr(Message).ToUTF16().c_str(), wGS(MSG_MSGBOX_WARNING_TITLE).c_str(), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND); }
COptionsDirectoriesPage::COptionsDirectoriesPage(HWND hParent, const RECT & rcDispay) : m_InUpdateSettings(false) { Create(hParent); if (m_hWnd == NULL) { return; } SetWindowPos(HWND_TOP, &rcDispay, SWP_HIDEWINDOW); m_PluginGroup.Attach(GetDlgItem(IDC_DIR_FRAME1)); m_AutoSaveGroup.Attach(GetDlgItem(IDC_DIR_FRAME3)); m_InstantSaveGroup.Attach(GetDlgItem(IDC_DIR_FRAME4)); m_ScreenShotGroup.Attach(GetDlgItem(IDC_DIR_FRAME5)); m_TextureGroup.Attach(GetDlgItem(IDC_DIR_TEXTURE_FRAME)); m_PluginDir.Attach(GetDlgItem(IDC_PLUGIN_DIR)); m_AutoSaveDir.Attach(GetDlgItem(IDC_AUTO_DIR)); m_InstantSaveDir.Attach(GetDlgItem(IDC_INSTANT_DIR)); m_ScreenShotDir.Attach(GetDlgItem(IDC_SNAP_DIR)); m_TextureDir.Attach(GetDlgItem(IDC_TEXTURE_DIR)); m_PluginDefault.Attach(GetDlgItem(IDC_PLUGIN_DEFAULT)); m_PluginSelected.Attach(GetDlgItem(IDC_PLUGIN_OTHER)); m_AutoSaveDefault.Attach(GetDlgItem(IDC_AUTO_DEFAULT)); m_AutoSaveSelected.Attach(GetDlgItem(IDC_AUTO_OTHER)); m_InstantDefault.Attach(GetDlgItem(IDC_INSTANT_DEFAULT)); m_InstantSelected.Attach(GetDlgItem(IDC_INSTANT_OTHER)); m_ScreenShotDefault.Attach(GetDlgItem(IDC_SNAP_DEFAULT)); m_ScreenShotSelected.Attach(GetDlgItem(IDC_SNAP_OTHER)); m_TextureDefault.Attach(GetDlgItem(IDC_TEXTURE_DEFAULT)); m_TextureSelected.Attach(GetDlgItem(IDC_TEXTURE_OTHER)); //Set Text language for the dialog box ::SetWindowTextW(m_PluginGroup.m_hWnd, wGS(DIR_PLUGIN).c_str()); ::SetWindowTextW(m_AutoSaveGroup.m_hWnd, wGS(DIR_AUTO_SAVE).c_str()); ::SetWindowTextW(m_InstantSaveGroup.m_hWnd, wGS(DIR_INSTANT_SAVE).c_str()); ::SetWindowTextW(m_ScreenShotGroup.m_hWnd, wGS(DIR_SCREEN_SHOT).c_str()); ::SetWindowTextW(m_TextureGroup.m_hWnd, wGS(DIR_TEXTURE).c_str()); UpdatePageSettings(); }
void CNotificationImp::DisplayError(const char * Message) const { WriteTrace(TraceUserInterface, TraceError, Message); WindowMode(); HWND Parent = NULL; if (m_hWnd) { Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle()); } MessageBoxW(Parent, stdstr(Message).ToUTF16().c_str(), wGS(MSG_MSGBOX_ERROR_TITLE).c_str(), MB_OK | MB_ICONERROR | MB_SETFOREGROUND); }
bool CNotificationImp::AskYesNoQuestion(const char * Question) const { WriteTrace(TraceUserInterface, TraceError, Question); WindowMode(); HWND Parent = NULL; if (m_hWnd) { Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle()); } int result = MessageBoxW(Parent, stdstr(Question).ToUTF16().c_str(), wGS(MSG_MSGBOX_WARNING_TITLE).c_str(), MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2 | MB_SETFOREGROUND); return result == IDYES; }
void COptionPluginPage::HleAudioChanged(UINT /*Code*/, int id, HWND /*ctl*/) { for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++) { CModifiedButton * Button = iter->second; if ((int)Button->GetMenu() != id) { continue; } if ((Button->GetCheck() & BST_CHECKED) != 0) { int res = MessageBoxW(m_hWnd, wGS(MSG_SET_HLE_AUD_MSG).c_str(), wGS(MSG_SET_HLE_AUD_TITLE).c_str(), MB_ICONWARNING | MB_YESNO); if (res != IDYES) { Button->SetCheck(BST_UNCHECKED); return; } } Button->SetChanged(true); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); break; } }
void COptionsGameBrowserPage::UpdateFieldList(const ROMBROWSER_FIELDS_LIST & Fields) { m_Avaliable.ResetContent(); m_Using.ResetContent(); m_OrderChanged = false; for (int i = 0, n = Fields.size(); i < n; i++) { if (Fields[i].PosChanged()) { m_OrderChanged = true; } int Pos = Fields[i].Pos(); if (Pos < 0) { m_Avaliable.SetItemData(m_Avaliable.AddStringW(wGS(Fields[i].LangID()).c_str()), i); continue; } int listCount = m_Using.GetCount(); if (Pos > listCount) { Pos = listCount; } m_Using.SetItemData(m_Using.InsertStringW(Pos, wGS(Fields[i].LangID()).c_str()), i); } }
COptionPluginPage::COptionPluginPage(HWND hParent, const RECT & rcDispay) { if (!Create(hParent, rcDispay)) { return; } //Set the text for all gui Items SetDlgItemTextW(m_hWnd, RSP_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemTextW(m_hWnd, GFX_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemTextW(m_hWnd, AUDIO_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemTextW(m_hWnd, CONT_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemTextW(m_hWnd, IDC_RSP_NAME, wGS(PLUG_RSP).c_str()); SetDlgItemTextW(m_hWnd, IDC_GFX_NAME, wGS(PLUG_GFX).c_str()); SetDlgItemTextW(m_hWnd, IDC_AUDIO_NAME, wGS(PLUG_AUDIO).c_str()); SetDlgItemTextW(m_hWnd, IDC_CONT_NAME, wGS(PLUG_CTRL).c_str()); SetDlgItemTextW(m_hWnd, IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str()); SetDlgItemTextW(m_hWnd, IDC_HLE_AUDIO, wGS(PLUG_HLE_AUDIO).c_str()); m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME)); m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME)); m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME)); m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME)); AddPlugins(GFX_LIST, Plugin_GFX_Current, PLUGIN_TYPE_GFX); AddPlugins(AUDIO_LIST, Plugin_AUDIO_Current, PLUGIN_TYPE_AUDIO); AddPlugins(CONT_LIST, Plugin_CONT_Current, PLUGIN_TYPE_CONTROLLER); AddPlugins(RSP_LIST, Plugin_RSP_Current, PLUGIN_TYPE_RSP); AddModCheckBox(GetDlgItem(IDC_HLE_GFX), Plugin_UseHleGfx); AddModCheckBox(GetDlgItem(IDC_HLE_AUDIO), Plugin_UseHleAudio); UpdatePageSettings(); }
void COptionsGameBrowserPage::MoveFieldDownClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { int index = m_Using.GetCurSel(); if (index < 0 || index >= (m_Using.GetCount() - 1)) { return; } int i = m_Using.GetItemData(index); m_Using.DeleteString(index); index = m_Using.InsertStringW(index + 1, wGS(m_Fields[i].LangID()).c_str()); m_Using.SetItemData(index, i); m_Using.SetCurSel(index); m_OrderChanged = true; m_OrderReset = false; SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); }
bool CSettingConfig::UpdateAdvanced(bool AdvancedMode, HTREEITEM hItem) { while (hItem) { CSettingsPage * Page = (CSettingsPage *)m_PagesTreeList.GetItemData(hItem); if (!AdvancedMode && Page == m_AdvancedPage) { m_PagesTreeList.DeleteItem(hItem); return true; } if (AdvancedMode && Page == m_GeneralOptionsPage) { m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(m_AdvancedPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_AdvancedPage, hItem, TVI_FIRST); return true; } if (UpdateAdvanced(AdvancedMode, m_PagesTreeList.GetChildItem(hItem))) { return true; } hItem = m_PagesTreeList.GetNextSiblingItem(hItem); } return false; }
DWORD CALLBACK AboutBoxProc(HWND hWnd, DWORD uMsg, DWORD wParam, DWORD lParam) { static HBITMAP hbmpBackgroundTop = NULL; static HFONT hPageHeadingFont = NULL; static HFONT hTextFont = NULL; static HFONT hAuthorFont = NULL; switch (uMsg) { case WM_INITDIALOG: { //Title SetWindowTextW(hWnd, wGS(PLUG_ABOUT).c_str()); // Use the size of the image hbmpBackgroundTop = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_ABOUT_LOGO)); BITMAP bmTL; GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL); hTextFont = ::CreateFont(18, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial"); hAuthorFont = ::CreateFont(18, 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial"); hPageHeadingFont = ::CreateFont(24, 0, 0, 0, FW_BOLD, 0, FALSE, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial Bold"); SendDlgItemMessage(hWnd, IDC_VERSION, WM_SETFONT, (WPARAM)hTextFont, TRUE); SendDlgItemMessage(hWnd, IDC_TEAM, WM_SETFONT, (WPARAM)hPageHeadingFont, TRUE); SendDlgItemMessage(hWnd, IDC_THANKS, WM_SETFONT, (WPARAM)hPageHeadingFont, TRUE); SendDlgItemMessage(hWnd, IDC_ZILMAR, WM_SETFONT, (WPARAM)hAuthorFont, TRUE); SendDlgItemMessage(hWnd, IDC_JABO, WM_SETFONT, (WPARAM)hAuthorFont, TRUE); SendDlgItemMessage(hWnd, IDC_SMIFF, WM_SETFONT, (WPARAM)hAuthorFont, TRUE); SendDlgItemMessage(hWnd, IDC_GENT, WM_SETFONT, (WPARAM)hAuthorFont, TRUE); SendDlgItemMessage(hWnd, IDC_ZILMAR_DETAILS, WM_SETFONT, (WPARAM)hTextFont, TRUE); SendDlgItemMessage(hWnd, IDC_JABO_DETAILS, WM_SETFONT, (WPARAM)hTextFont, TRUE); SendDlgItemMessage(hWnd, IDC_SMIFF_DETAILS, WM_SETFONT, (WPARAM)hTextFont, TRUE); SendDlgItemMessage(hWnd, IDC_GENT_DETAILS, WM_SETFONT, (WPARAM)hTextFont, TRUE); SendDlgItemMessage(hWnd, IDC_THANK_LIST, WM_SETFONT, (WPARAM)hTextFont, TRUE); stdstr_f VersionDisplay("Version: %s", VER_FILE_VERSION_STR); SetWindowText(GetDlgItem(hWnd, IDC_VERSION), VersionDisplay.c_str()); } break; case WM_CTLCOLORSTATIC: { HDC hdcStatic = (HDC)wParam; SetTextColor(hdcStatic, RGB(0, 0, 0)); SetBkMode(hdcStatic, TRANSPARENT); return (LONG)(LRESULT)((HBRUSH)GetStockObject(NULL_BRUSH)); } break; case WM_ERASEBKGND: { HPEN outline; HBRUSH fill; RECT rect; outline = CreatePen(PS_SOLID, 1, 0x00FFFFFF); fill = CreateSolidBrush(0x00FFFFFF); SelectObject((HDC)wParam, outline); SelectObject((HDC)wParam, fill); GetClientRect(hWnd, &rect); Rectangle((HDC)wParam, rect.left, rect.top, rect.right, rect.bottom); } break; case WM_PAINT: { PAINTSTRUCT ps; if (BeginPaint(hWnd, &ps)) { RECT rcClient; GetClientRect(hWnd, &rcClient); BITMAP bmTL_top; GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL_top); HDC memdc = CreateCompatibleDC(ps.hdc); HGDIOBJ save = SelectObject(memdc, hbmpBackgroundTop); BitBlt(ps.hdc, 0, 0, bmTL_top.bmWidth, bmTL_top.bmHeight, memdc, 0, 0, SRCCOPY); SelectObject(memdc, save); DeleteDC(memdc); EndPaint(hWnd, &ps); } } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: case IDCANCEL: if (hbmpBackgroundTop) { DeleteObject(hbmpBackgroundTop); } if (hTextFont) { ::DeleteObject(hTextFont); } if (hPageHeadingFont) { ::DeleteObject(hPageHeadingFont); } if (hAuthorFont) { ::DeleteObject(hAuthorFont); } //ReleaseCapture(); EndDialog(hWnd, 0); break; } default: return FALSE; } return TRUE; }
COptionsShortCutsPage::COptionsShortCutsPage(HWND hParent, const RECT & rcDispay) : m_EnableReset(false) { if (!Create(hParent, rcDispay)) { return; } SetDlgItemTextW(m_hWnd, IDC_S_CPU_STATE, wGS(ACCEL_CPUSTATE_TITLE).c_str()); SetDlgItemTextW(m_hWnd, IDC_MENU_ITEM_TEXT, wGS(ACCEL_MENUITEM_TITLE).c_str()); SetDlgItemTextW(m_hWnd, IDC_S_CURRENT_KEYS, wGS(ACCEL_CURRENTKEYS_TITLE).c_str()); SetDlgItemTextW(m_hWnd, IDC_S_SELECT_SHORT, wGS(ACCEL_SELKEY_TITLE).c_str()); SetDlgItemTextW(m_hWnd, IDC_S_CURRENT_ASSIGN, wGS(ACCEL_ASSIGNEDTO_TITLE).c_str()); SetDlgItemTextW(m_hWnd, IDC_ASSIGN, wGS(ACCEL_ASSIGN_BTN).c_str()); SetDlgItemTextW(m_hWnd, IDC_REMOVE, wGS(ACCEL_REMOVE_BTN).c_str()); SetDlgItemTextW(m_hWnd, IDC_KEY_PROMPT, wGS(ACCEL_DETECTKEY).c_str()); m_CreateNewShortCut.AttachToDlgItem(m_hWnd, IDC_S_SELECT_SHORT); m_CpuState.Attach(GetDlgItem(IDC_C_CPU_STATE)); m_MenuItems.Attach(GetDlgItem(IDC_MENU_ITEMS)); m_CurrentKeys.Attach(GetDlgItem(IDC_CURRENT_KEYS)); m_VirtualKeyList.Attach(GetDlgItem(IDC_VIRTUALKEY)); m_MenuItems.ModifyStyle(0, TVS_SHOWSELALWAYS); m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_1).c_str()), CMenuShortCutKey::GAME_NOT_RUNNING); m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_3).c_str()), CMenuShortCutKey::GAME_RUNNING_WINDOW); m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_4).c_str()), CMenuShortCutKey::GAME_RUNNING_FULLSCREEN); m_CpuState.SetCurSel(0); int VirtualKeyListSize; VIRTUAL_KEY * VirtualKeyList = CMenuShortCutKey::VirtualKeyList(VirtualKeyListSize); for (int count = 0; count < VirtualKeyListSize; count++) { m_VirtualKeyList.SetItemData(m_VirtualKeyList.AddString(VirtualKeyList[count].Name), VirtualKeyList[count].Key); } OnCpuStateChanged(LBN_SELCHANGE, IDC_C_CPU_STATE, GetDlgItem(IDC_C_CPU_STATE)); CheckResetEnable(); }
DWORD CALLBACK AboutIniBoxProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD /*lParam*/) { static wchar_t RDBHomePage[300], CHTHomePage[300], RDXHomePage[300]; switch (uMsg) { case WM_INITDIALOG: { wchar_t String[200]; //Title SetWindowTextW(hDlg, wGS(INI_TITLE).c_str()); //Language SetDlgItemTextW(hDlg, IDC_LAN, wGS(INI_CURRENT_LANG).c_str()); set_about_field(hDlg, IDC_LAN_AUTHOR, wGS(INI_AUTHOR).c_str(), wGS(LANGUAGE_AUTHOR).c_str()); set_about_field(hDlg, IDC_LAN_VERSION, wGS(INI_VERSION).c_str(), wGS(LANGUAGE_VERSION).c_str()); set_about_field(hDlg, IDC_LAN_DATE, wGS(INI_DATE).c_str(), wGS(LANGUAGE_DATE).c_str()); if (wcslen(wGS(LANGUAGE_NAME).c_str()) == 0) { EnableWindow(GetDlgItem(hDlg, IDC_LAN), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_LAN_AUTHOR), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_LAN_VERSION), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_LAN_DATE), FALSE); } //RDB CIniFile RdbIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str()); wcsncpy(String, RdbIniFile.GetString("Meta", "Author", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); if (wcslen(String) == 0) { EnableWindow(GetDlgItem(hDlg, IDC_RDB), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RDB_AUTHOR), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RDB_VERSION), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RDB_DATE), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RDB_HOME), FALSE); } set_about_field(hDlg, IDC_RDB_AUTHOR, wGS(INI_AUTHOR).c_str(), String); wcsncpy(String, RdbIniFile.GetString("Meta", "Version", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); set_about_field(hDlg, IDC_RDB_VERSION, wGS(INI_VERSION).c_str(), String); wcsncpy(String, RdbIniFile.GetString("Meta", "Date", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); set_about_field(hDlg, IDC_RDB_DATE, wGS(INI_DATE).c_str(), String); wcsncpy(RDBHomePage, RdbIniFile.GetString("Meta", "Homepage", "").ToUTF16().c_str(), sizeof(RDBHomePage) / sizeof(RDBHomePage[0])); SetDlgItemTextW(hDlg, IDC_RDB_HOME, wGS(INI_HOMEPAGE).c_str()); if (wcslen(RDBHomePage) == 0) { EnableWindow(GetDlgItem(hDlg, IDC_RDB_HOME), FALSE); } //Cheat SetDlgItemTextW(hDlg, IDC_CHT, wGS(INI_CURRENT_CHT).c_str()); CIniFile CheatIniFile(g_Settings->LoadStringVal(SupportFile_Cheats).c_str()); wcsncpy(String, CheatIniFile.GetString("Meta", "Author", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); if (wcslen(String) == 0) { EnableWindow(GetDlgItem(hDlg, IDC_CHT), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_CHT_AUTHOR), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_CHT_VERSION), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_CHT_DATE), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_CHT_HOME), FALSE); } set_about_field(hDlg, IDC_CHT_AUTHOR, wGS(INI_AUTHOR).c_str(), String); wcsncpy(String, CheatIniFile.GetString("Meta", "Version", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); set_about_field(hDlg, IDC_CHT_VERSION, wGS(INI_VERSION).c_str(), String); wcsncpy(String, CheatIniFile.GetString("Meta", "Date", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); set_about_field(hDlg, IDC_CHT_DATE, wGS(INI_DATE).c_str(), String); wcsncpy(CHTHomePage, CheatIniFile.GetString("Meta", "Homepage", "").ToUTF16().c_str(), sizeof(CHTHomePage) / sizeof(CHTHomePage[0])); SetDlgItemTextW(hDlg, IDC_CHT_HOME, wGS(INI_HOMEPAGE).c_str()); if (wcslen(CHTHomePage) == 0) { EnableWindow(GetDlgItem(hDlg, IDC_CHT_HOME), FALSE); } //Extended Info SetDlgItemTextW(hDlg, IDC_RDX, wGS(INI_CURRENT_RDX).c_str()); CIniFile RdxIniFile(g_Settings->LoadStringVal(SupportFile_ExtInfo).c_str()); wcsncpy(String, RdxIniFile.GetString("Meta", "Author", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); if (wcslen(String) == 0) { EnableWindow(GetDlgItem(hDlg, IDC_RDX), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RDX_AUTHOR), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RDX_VERSION), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RDX_DATE), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RDX_HOME), FALSE); } set_about_field(hDlg, IDC_RDX_AUTHOR, wGS(INI_AUTHOR).c_str(), String); wcsncpy(String, RdxIniFile.GetString("Meta", "Version", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); set_about_field(hDlg, IDC_RDX_VERSION, wGS(INI_VERSION).c_str(), String); wcsncpy(String, RdxIniFile.GetString("Meta", "Date", "").ToUTF16().c_str(), sizeof(String) / sizeof(String[0])); set_about_field(hDlg, IDC_RDX_DATE, wGS(INI_DATE).c_str(), String); wcsncpy(RDXHomePage, RdxIniFile.GetString("Meta", "Homepage", "").ToUTF16().c_str(), sizeof(RDXHomePage) / sizeof(RDXHomePage[0])); SetDlgItemTextW(hDlg, IDC_RDX_HOME, wGS(INI_HOMEPAGE).c_str()); if (wcslen(RDXHomePage) == 0) { EnableWindow(GetDlgItem(hDlg, IDC_RDX_HOME), FALSE); } SetDlgItemTextW(hDlg, IDOK, wGS(CHEAT_OK).c_str()); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_RDB_HOME: ShellExecuteW(NULL, L"open", RDBHomePage, NULL, NULL, SW_SHOWNORMAL); break; case IDC_CHT_HOME: ShellExecuteW(NULL, L"open", CHTHomePage, NULL, NULL, SW_SHOWNORMAL); break; case IDC_RDX_HOME: ShellExecuteW(NULL, L"open", RDXHomePage, NULL, NULL, SW_SHOWNORMAL); break; case IDOK: case IDCANCEL: EndDialog(hDlg, 0); break; } default: return FALSE; } return TRUE; }
COptionsGameBrowserPage::COptionsGameBrowserPage(HWND hParent, const RECT & rcDispay) : m_OrderChanged(false), m_OrderReset(false) { if (!Create(hParent, rcDispay)) { return; } SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str()); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str()); SetDlgItemTextW(m_hWnd, IDC_USE_ROMBROWSER, wGS(RB_USE).c_str()); SetDlgItemTextW(m_hWnd, IDC_RECURSION, wGS(RB_DIR_RECURSION).c_str()); SetDlgItemTextW(m_hWnd, IDC_SHOW_FILE_EXTENSIONS, wGS(RB_FILEEXT).c_str()); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT5, wGS(RB_AVALIABLE_FIELDS).c_str()); SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT6, wGS(RB_SHOW_FIELDS).c_str()); SetDlgItemTextW(m_hWnd, IDC_ADD, wGS(RB_ADD).c_str()); SetDlgItemTextW(m_hWnd, IDC_REMOVE, wGS(RB_REMOVE).c_str()); SetDlgItemTextW(m_hWnd, IDC_UP, wGS(RB_UP).c_str()); SetDlgItemTextW(m_hWnd, IDC_DOWN, wGS(RB_DOWN).c_str()); AddModCheckBox(GetDlgItem(IDC_USE_ROMBROWSER), RomBrowser_Enabled); AddModCheckBox(GetDlgItem(IDC_RECURSION), RomList_GameDirRecursive); AddModCheckBox(GetDlgItem(IDC_SHOW_FILE_EXTENSIONS), RomList_ShowFileExtensions); m_Avaliable.Attach(GetDlgItem(IDC_AVALIABLE)); m_Using.Attach(GetDlgItem(IDC_USING)); CRomBrowser::GetFieldInfo(m_Fields); UpdatePageSettings(); }
LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { stdstr ConfigRomTitle, GameIni(g_Settings->LoadStringVal(Game_IniKey)); if (!GameIni.empty()) { ConfigRomTitle.Format("Config: %s", g_Settings->LoadStringVal(Game_GoodName).c_str()); } RECT rcSettingInfo; ::GetWindowRect(GetDlgItem(IDC_SETTING_INFO), &rcSettingInfo); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcSettingInfo, 2); CConfigSettingSection * SettingsSection; //Set the text for all gui Items SetDlgItemTextW(m_hWnd, IDC_RESET_PAGE, wGS(BOTTOM_RESET_PAGE).c_str()); SetDlgItemTextW(m_hWnd, IDC_RESET_ALL, wGS(BOTTOM_RESET_ALL).c_str()); SetDlgItemTextW(m_hWnd, IDOK, wGS(CHEAT_OK).c_str()); SetDlgItemTextW(m_hWnd, IDCANCEL, wGS(CHEAT_CANCEL).c_str()); SetDlgItemTextW(m_hWnd, IDAPPLY, wGS(BOTTOM_APPLY).c_str()); if (m_GameConfig) { if (g_Settings->LoadBool(Setting_RdbEditor)) { SetWindowText(stdstr_f("%s ** RDB Edit Mode **", ConfigRomTitle.c_str()).c_str()); } else { SetWindowText(ConfigRomTitle.c_str()); } } else { if (g_Settings->LoadBool(Setting_RdbEditor)) { SetWindowTextW(m_hWnd, stdstr_f("%s ** RDB Edit Mode **", GS(OPTIONS_TITLE)).ToUTF16().c_str()); } else { ::SetWindowTextW(m_hWnd, wGS(OPTIONS_TITLE).c_str()); } if (g_Settings->LoadBool(Setting_PluginPageFirst)) { SettingsSection = new CConfigSettingSection(wGS(TAB_PLUGIN).c_str()); SettingsSection->AddPage(new COptionPluginPage(this->m_hWnd, rcSettingInfo)); m_Sections.push_back(SettingsSection); } m_GeneralOptionsPage = new CGeneralOptionsPage(this, this->m_hWnd, rcSettingInfo); m_AdvancedPage = new CAdvancedOptionsPage(this->m_hWnd, rcSettingInfo); SettingsSection = new CConfigSettingSection(wGS(TAB_OPTIONS).c_str()); SettingsSection->AddPage(m_GeneralOptionsPage); SettingsSection->AddPage(m_AdvancedPage); SettingsSection->AddPage(new COptionsDirectoriesPage(this->m_hWnd, rcSettingInfo)); m_Sections.push_back(SettingsSection); SettingsSection = new CConfigSettingSection(wGS(TAB_ROMSELECTION).c_str()); SettingsSection->AddPage(new COptionsGameBrowserPage(this->m_hWnd, rcSettingInfo)); m_Sections.push_back(SettingsSection); SettingsSection = new CConfigSettingSection(wGS(TAB_SHORTCUTS).c_str()); SettingsSection->AddPage(new COptionsShortCutsPage(this->m_hWnd, rcSettingInfo)); m_Sections.push_back(SettingsSection); if (!g_Settings->LoadBool(Setting_PluginPageFirst)) { SettingsSection = new CConfigSettingSection(wGS(TAB_PLUGIN).c_str()); SettingsSection->AddPage(new COptionPluginPage(this->m_hWnd, rcSettingInfo)); m_Sections.push_back(SettingsSection); } } //Game Settings if (!GameIni.empty()) { CConfigSettingSection * GameSettings = new CConfigSettingSection(ConfigRomTitle.ToUTF16().c_str()); GameSettings->AddPage(new CGameGeneralPage(this->m_hWnd, rcSettingInfo)); GameSettings->AddPage(new CGameRecompilePage(this->m_hWnd, rcSettingInfo)); GameSettings->AddPage(new CGamePluginPage(this->m_hWnd, rcSettingInfo)); if (g_Settings->LoadBool(Setting_RdbEditor)) { GameSettings->AddPage(new CGameStatusPage(this->m_hWnd, rcSettingInfo)); } m_Sections.push_back(GameSettings); } m_PagesTreeList.Attach(GetDlgItem(IDC_PAGELIST)); bool bFirstItem = true; bool HideAdvanced = g_Settings->LoadBool(UserInterface_BasicMode); for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++) { CConfigSettingSection * Section = *iter; HTREEITEM hSectionItem = NULL; for (size_t i = 0; i < Section->GetPageCount(); i++) { CSettingsPage * Page = Section->GetPage(i); if (HideAdvanced && Page == m_AdvancedPage) { continue; } if (i == 0) { hSectionItem = m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, Section->GetPageTitle(), 0, 0, 0, 0, (ULONG)Page, TVI_ROOT, TVI_LAST); continue; } if (hSectionItem == NULL) { continue; } m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(Page->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)Page, hSectionItem, TVI_LAST); } if (bFirstItem && hSectionItem != NULL) { bFirstItem = false; m_PagesTreeList.Expand(hSectionItem); m_PagesTreeList.SelectItem(hSectionItem); } } BoldChangedPages(m_PagesTreeList.GetRootItem()); return TRUE; }
DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam) { switch (uMsg) { case WM_INITDIALOG: { //record class for future usage SetProp(hDlg, "this", (RomInformation *)lParam); RomInformation * _this = (RomInformation *)lParam; SetWindowTextW(hDlg, wGS(INFO_TITLE).c_str()); SetDlgItemTextW(hDlg, IDC_ROM_NAME, wGS(INFO_ROM_NAME_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_FILE_NAME, wGS(INFO_FILE_NAME_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_LOCATION, wGS(INFO_LOCATION_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_ROM_MD5, wGS(INFO_MD5_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_ROM_SIZE, wGS(INFO_SIZE_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_CART_ID, wGS(INFO_CART_ID_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_MANUFACTURER, wGS(INFO_MANUFACTURER_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_COUNTRY, wGS(INFO_COUNTRY_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_CRC1, wGS(INFO_CRC1_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_CRC2, wGS(INFO_CRC2_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_CIC_CHIP, wGS(INFO_CIC_CHIP_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_CLOSE_BUTTON, wGS(BOTTOM_CLOSE).c_str()); SetDlgItemTextW(hDlg, IDC_INFO_ROMNAME, _this->m_pRomInfo->GetRomName().ToUTF16(stdstr::CODEPAGE_932).c_str()); SetDlgItemTextW(hDlg, IDC_INFO_FILENAME, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetNameExtension()).ToUTF16(CP_ACP).c_str()); SetDlgItemTextW(hDlg, IDC_INFO_LOCATION, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetDriveDirectory()).ToUTF16(CP_ACP).c_str()); SetDlgItemTextW(hDlg, IDC_INFO_MD5, _this->m_pRomInfo->GetRomMD5().ToUTF16().c_str()); SetDlgItemTextW(hDlg, IDC_INFO_ROMSIZE, stdstr_f("%.1f MBit", (float)_this->m_pRomInfo->GetRomSize() / 0x20000).ToUTF16().c_str()); BYTE * RomHeader = _this->m_pRomInfo->GetRomAddress(); SetDlgItemTextW(hDlg, IDC_INFO_CARTID, stdstr_f("%c%c", RomHeader[0x3F], RomHeader[0x3E]).ToUTF16().c_str()); switch (RomHeader[0x38]) { case 'N': SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"Nintendo"); break; case 0: SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"None"); break; default: SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"(Unknown)"); break; } switch (RomHeader[0x3D]) { case NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break; case X_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break; case Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break; case USA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break; case french: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break; case Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break; case Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break; case Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break; case Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break; case Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break; case X_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break; case Y_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break; case 0: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break; default: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", RomHeader[0x3D], RomHeader[0x3D]).ToUTF16().c_str()); } SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", *(uint32_t *)(RomHeader + 0x10)).ToUTF16().c_str()); SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", *(DWORD *)(RomHeader + 0x14)).ToUTF16().c_str()); std::wstring CicChip; switch (_this->m_pRomInfo->CicChipID()) { case CIC_UNKNOWN: CicChip = L"Unknown"; break; case CIC_NUS_8303: CicChip = L"CIC-NUS-8303"; break; case CIC_NUS_5167: CicChip = L"CIC-NUS-5167"; break; case CIC_NUS_DDUS: CicChip = L"CIC-NUS-????"; break; default: CicChip = stdstr_f("CIC-NUS-610%d", _this->m_pRomInfo->CicChipID()).ToUTF16(); break; } SetDlgItemTextW(hDlg, IDC_INFO_CIC, CicChip.c_str()); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: RemoveProp(hDlg, "this"); EndDialog(hDlg, 0); break; case IDC_CLOSE_BUTTON: RemoveProp(hDlg, "this"); EndDialog(hDlg, 0); break; } default: return false; } return true; }