void CMemoryWindow::OnAddrBoxChange(wxCommandEvent& event) { wxString txt = addrbox->GetValue(); if (txt.size()) { u32 addr; sscanf(WxStrToStr(txt).c_str(), "%08x", &addr); memview->Center(addr & ~3); } event.Skip(1); }
void CFrame::SaveIniPerspectives() { if (Perspectives.size() == 0) return; if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0; // Turn off edit before saving TogglePaneStyle(false, IDM_EDIT_PERSPECTIVES); UpdateCurrentPerspective(); IniFile ini; ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); // Save perspective names std::string STmp = ""; for (auto& Perspective : Perspectives) { STmp += Perspective.Name + ","; } STmp = STmp.substr(0, STmp.length() - 1); IniFile::Section* perspectives = ini.GetOrCreateSection("Perspectives"); perspectives->Set("Perspectives", STmp); perspectives->Set("Active", ActivePerspective); // Save the perspectives for (auto& Perspective : Perspectives) { std::string _Section = "P - " + Perspective.Name; IniFile::Section* perspec_section = ini.GetOrCreateSection(_Section); perspec_section->Set("Perspective", WxStrToStr(Perspective.Perspective)); std::string SWidth = "", SHeight = ""; for (u32 j = 0; j < Perspective.Width.size(); j++) { SWidth += StringFromFormat("%i,", Perspective.Width[j]); SHeight += StringFromFormat("%i,", Perspective.Height[j]); } // Remove the ending "," SWidth = SWidth.substr(0, SWidth.length() - 1); SHeight = SHeight.substr(0, SHeight.length() - 1); perspec_section->Set("Width", SWidth); perspec_section->Set("Height", SHeight); } ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); // Save notebook affiliations g_pCodeWindow->Save(); TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES); }
void NetPlaySetupDiag::MakeNetPlayDiag(int port, const std::string &game, bool is_hosting) { NetPlayDiag *&npd = NetPlayDiag::GetInstance(); std::string ip; npd = new NetPlayDiag(m_parent, m_game_list, game, is_hosting); if (is_hosting) ip = "127.0.0.1"; else ip = WxStrToStr(m_connect_ip_text->GetValue()); netplay_client = new NetPlayClient(ip, (u16)port, npd, WxStrToStr(m_nickname_text->GetValue())); if (netplay_client->is_connected) { npd->Show(); Destroy(); } else { npd->Destroy(); } }
void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event) { std::string nand_path = SConfig::GetInstance().m_NANDPath = WxStrToStr(m_nand_root_dirpicker->GetPath()); File::SetUserPath(D_WIIROOT_IDX, nand_path); m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path)); DiscIO::CNANDContentManager::Access().ClearCache(); main_frame->UpdateWiiMenuChoice(); }
void CMemoryWindow::OnSearchAddressChanged(wxCommandEvent& event) { wxString txt = m_address_search_ctrl->GetValue(); if (txt.size()) { u32 addr; sscanf(WxStrToStr(txt).c_str(), "%08x", &addr); m_memory_view->Center(addr & ~3); } event.Skip(); }
bool DolphinApp::OnInit() { std::lock_guard<std::mutex> lk(s_init_mutex); if (!wxApp::OnInit()) return false; Bind(wxEVT_QUERY_END_SESSION, &DolphinApp::OnEndSession, this); Bind(wxEVT_END_SESSION, &DolphinApp::OnEndSession, this); Bind(wxEVT_IDLE, &DolphinApp::OnIdle, this); Bind(wxEVT_ACTIVATE_APP, &DolphinApp::OnActivate, this); // Register message box and translation handlers RegisterMsgAlertHandler(&wxMsgAlert); RegisterStringTranslator(&wxStringTranslator); #if wxUSE_ON_FATAL_EXCEPTION wxHandleFatalExceptions(true); #endif UICommon::SetUserDirectory(m_user_path.ToStdString()); UICommon::CreateDirectories(); InitLanguageSupport(); // The language setting is loaded from the user directory UICommon::Init(); if (m_select_video_backend && !m_video_backend_name.empty()) SConfig::GetInstance().m_strVideoBackend = WxStrToStr(m_video_backend_name); if (m_select_audio_emulation) SConfig::GetInstance().bDSPHLE = (m_audio_emulation_name.Upper() == "HLE"); VideoBackendBase::ActivateBackend(SConfig::GetInstance().m_strVideoBackend); DolphinAnalytics::Instance()->ReportDolphinStart("wx"); wxToolTip::Enable(!SConfig::GetInstance().m_DisableTooltips); // Enable the PNG image handler for screenshots wxImage::AddHandler(new wxPNGHandler); // We have to copy the size and position out of SConfig now because CFrame's OnMove // handler will corrupt them during window creation (various APIs like SetMenuBar cause // event dispatch including WM_MOVE/WM_SIZE) wxRect window_geometry(SConfig::GetInstance().iPosX, SConfig::GetInstance().iPosY, SConfig::GetInstance().iWidth, SConfig::GetInstance().iHeight); main_frame = new CFrame(nullptr, wxID_ANY, StrToWxStr(scm_rev_str), window_geometry, m_use_debugger, m_batch_mode, m_use_logger); SetTopWindow(main_frame); AfterInit(); return true; }
void NetPlayDiag::OnChangeGame(wxCommandEvent&) { wxString game_name; ChangeGameDiag* const cgd = new ChangeGameDiag(this, m_game_list, game_name); cgd->ShowModal(); if (game_name.length()) { m_selected_game = WxStrToStr(game_name); netplay_server->ChangeGame(m_selected_game); m_game_btn->SetLabel(game_name.Prepend(_(" Game : "))); } }
void NetPlayDialog::OnChangeGame(wxCommandEvent&) { ChangeGameDialog cgd(this, m_game_list); cgd.ShowModal(); wxString game_name = cgd.GetChosenGameName(); if (game_name.empty()) return; m_selected_game = WxStrToStr(game_name); netplay_server->ChangeGame(m_selected_game); m_game_btn->SetLabel(game_name.Prepend(_(" Game : "))); }
void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) { std::string str_addr = WxStrToStr(addrbox->GetValue()); std::string str_val = WxStrToStr(valbox->GetValue()); u32 addr; u32 val; if (!TryParse(std::string("0x") + str_addr, &addr)) { PanicAlertT("Invalid Address: %s", str_addr.c_str()); return; } if (!TryParse(std::string("0x") + str_val, &val)) { PanicAlertT("Invalid Value: %s", str_val.c_str()); return; } Memory::Write_U32(val, addr); memview->Refresh(); }
void NetPlayDiag::OnChat(wxCommandEvent&) { wxString s = m_chat_msg_text->GetValue(); if (s.Length()) { if (s.Length() > 2000) s.erase(2000); netplay_client->SendChatMessage(WxStrToStr(s)); m_chat_text->AppendText(s.Prepend(" >> ").Append('\n')); m_chat_msg_text->Clear(); } }
void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event) { std::string nand_path = SConfig::GetInstance().m_NANDPath = WxStrToStr(m_nand_root_dirpicker->GetPath()); File::SetUserPath(D_WIIROOT_IDX, nand_path); m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path)); SConfig::GetInstance().m_SYSCONF->UpdateLocation(); main_frame->UpdateWiiMenuChoice(); }
void CMemcardManager::OnPageChange(wxCommandEvent& event) { int slot = SLOT_B; switch (event.GetId()) { case ID_NEXTPAGE_A: slot = SLOT_A; case ID_NEXTPAGE_B: if (!m_PrevPage[slot]->IsEnabled()) { m_PrevPage[slot]->Enable(); m_MemcardList[slot]->prevPage = true; } page[slot]++; if (page[slot] == maxPages) { m_NextPage[slot]->Disable(); m_MemcardList[slot]->nextPage = false; } ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot); break; case ID_PREVPAGE_A: slot = SLOT_A; case ID_PREVPAGE_B: if (!m_NextPage[slot]->IsEnabled()) { m_NextPage[slot]->Enable(); m_MemcardList[slot]->nextPage = true; } page[slot]--; if (!page[slot]) { m_PrevPage[slot]->Disable(); m_MemcardList[slot]->prevPage = false; } ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot); break; } }
void CMemcardManager::ChangePath(int slot) { int slot2 = (slot == SLOT_A) ? SLOT_B : SLOT_A; page[slot] = FIRSTPAGE; if (mcmSettings.usePages && m_PrevPage[slot]->IsEnabled()) { m_PrevPage[slot]->Disable(); m_MemcardList[slot]->prevPage = false; } if (!m_MemcardPath[SLOT_A]->GetPath().CmpNoCase(m_MemcardPath[SLOT_B]->GetPath())) { if (m_MemcardPath[slot]->GetPath().length()) PanicAlertT("Memcard already opened"); } else { if (m_MemcardPath[slot]->GetPath().length() && ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot)) { if (memoryCard[slot2]) { mcmSettings.twoCardsLoaded = true; } m_SaveImport[slot]->Enable(); m_SaveExport[slot]->Enable(); m_Delete[slot]->Enable(); } else { if (memoryCard[slot]) { delete memoryCard[slot]; memoryCard[slot] = nullptr; } mcmSettings.twoCardsLoaded = false; m_MemcardPath[slot]->SetPath(wxEmptyString); m_MemcardList[slot]->ClearAll(); t_Status[slot]->SetLabel(wxEmptyString); m_SaveImport[slot]->Disable(); m_SaveExport[slot]->Disable(); m_Delete[slot]->Disable(); if (mcmSettings.usePages) { m_PrevPage[slot]->Disable(); m_NextPage[slot]->Disable(); } } } m_CopyFrom[SLOT_A]->Enable(mcmSettings.twoCardsLoaded); m_CopyFrom[SLOT_B]->Enable(mcmSettings.twoCardsLoaded); }
void CWatchTable::SetValue(int row, int col, const wxString& strNewVal) { u32 newVal = 0; if (col == 0 || TryParse("0x" + WxStrToStr(strNewVal), &newVal)) { if (row > 0) { switch (col) { case 0: { SetWatchName(row, std::string(WxStrToStr(strNewVal))); break; } case 1: { if (row > (int)PowerPC::watches.GetWatches().size()) { AddWatchAddr(row, newVal); row = (int)PowerPC::watches.GetWatches().size(); } else { UpdateWatchAddr(row, newVal); } break; } case 2: { SetWatchValue(row, newVal); break; } default: break; } } } }
void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event)) { delete m_afterinit; m_afterinit = nullptr; if (!BatchMode) main_frame->UpdateGameList(); if (playMovie && movieFile != wxEmptyString) { if (Movie::PlayInput(WxStrToStr(movieFile))) { if (LoadFile && FileToLoad != wxEmptyString) { main_frame->BootGame(WxStrToStr(FileToLoad)); } else { main_frame->BootGame(std::string("")); } } } // First check if we have an exec command line. else if (LoadFile && FileToLoad != wxEmptyString) { main_frame->BootGame(WxStrToStr(FileToLoad)); } // If we have selected Automatic Start, start the default ISO, // or if no default ISO exists, start the last loaded ISO else if (main_frame->g_pCodeWindow) { if (main_frame->g_pCodeWindow->AutomaticStart()) { main_frame->BootGame(""); } } }
void CPatchAddEdit::SavePatchData(wxCommandEvent& event) { if (!UpdateTempEntryData(itCurEntry)) return; if (selection == -1) { PatchEngine::Patch newPatch; newPatch.name = WxStrToStr(EditPatchName->GetValue()); newPatch.entries = tempEntries; newPatch.active = true; onFrame->push_back(newPatch); } else { onFrame->at(selection).name = WxStrToStr(EditPatchName->GetValue()); onFrame->at(selection).entries = tempEntries; } AcceptAndClose(); event.Skip(); }
void CRegisterView::OnMouseDownR(wxGridEvent& event) { // popup menu int row = event.GetRow(); int col = event.GetCol(); wxString strNewVal = GetValueByRowCol(row, col); TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress); wxMenu menu; menu.Append(IDM_WATCHADDRESS, _("Add to &watch")); menu.Append(IDM_VIEWMEMORY, _("View &memory")); PopupMenu(&menu); }
void GamepadPage::SetDevice(wxCommandEvent&) { controller->default_device.FromString(WxStrToStr(device_cbox->GetValue())); // show user what it was validated as device_cbox->SetValue(StrToWxStr(controller->default_device.ToString())); // this will set all the controls to this default device controller->UpdateDefaultDevice(); // update references std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock); controller->UpdateReferences(g_controller_interface); }
void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event) { std::string nand_path = SConfig::GetInstance().m_NANDPath = WxStrToStr(m_nand_root_dirpicker->GetPath()); File::SetUserPath(D_WIIROOT_IDX, nand_path); m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path)); DiscIO::CNANDContentManager::Access().ClearCache(); wxCommandEvent update_event{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, GetId()}; update_event.SetEventObject(this); AddPendingEvent(update_event); }
void CMemcardManager::OnMenuChange(wxCommandEvent& event) { int _id = event.GetId(); switch (_id) { case ID_MEMCARDPATH_A: case ID_MEMCARDPATH_B: DefaultMemcard[_id - ID_MEMCARDPATH_A] = WxStrToStr(m_MemcardPath[_id - ID_MEMCARDPATH_A]->GetPath()); return; case ID_USEPAGES: mcmSettings.usePages = !mcmSettings.usePages; if (!mcmSettings.usePages) { m_PrevPage[SLOT_A]->Disable(); m_PrevPage[SLOT_B]->Disable(); m_NextPage[SLOT_A]->Disable(); m_NextPage[SLOT_B]->Disable(); m_MemcardList[SLOT_A]->prevPage = m_MemcardList[SLOT_B]->prevPage = false; page[SLOT_A] = page[SLOT_B] = FIRSTPAGE; } break; case NUMBER_OF_COLUMN: for (int i = COLUMN_GAMECODE; i <= NUMBER_OF_COLUMN; i++) { mcmSettings.column[i] = !mcmSettings.column[i]; } break; default: mcmSettings.column[_id] = !mcmSettings.column[_id]; break; } if (memoryCard[SLOT_A]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_A]->GetPath()), SLOT_A); if (memoryCard[SLOT_B]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_B]->GetPath()), SLOT_B); }
NetPlaySetupFrame::~NetPlaySetupFrame() { IniFile inifile; const std::string dolphin_ini = File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini"; inifile.Load(dolphin_ini); IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay"); std::string travChoice = "traversal"; if (m_direct_traversal->GetSelection() == 1) { netplay_section.Set("TraversalChoice", travChoice); } else { travChoice = "direct"; netplay_section.Set("TraversalChoice", travChoice); } netplay_section.Set("Nickname", WxStrToStr(m_nickname_text->GetValue())); if (m_direct_traversal->GetCurrentSelection() == 0) { netplay_section.Set("Address", WxStrToStr(m_connect_ip_text->GetValue())); } else { netplay_section.Set("HostCode", WxStrToStr(m_connect_ip_text->GetValue())); } netplay_section.Set("ConnectPort", WxStrToStr(m_connect_port_text->GetValue())); netplay_section.Set("HostPort", WxStrToStr(m_host_port_text->GetValue())); netplay_section.Set("ListenPort", m_traversal_listen_port_enabled->IsChecked() ? m_traversal_listen_port->GetValue() : 0); inifile.Save(dolphin_ini); main_frame->g_NetPlaySetupDiag = nullptr; }
void GamepadPage::GetProfilePath(std::string& path) { const wxString& name = profile_cbox->GetValue(); if (false == name.empty()) { // TODO: check for dumb characters maybe path = File::GetUserPath(D_CONFIG_IDX); path += PROFILES_PATH; path += m_plugin.profile_name; path += '/'; path += WxStrToStr(profile_cbox->GetValue()); path += ".ini"; } }
// update gui void NetPlayDiag::OnThread(wxCommandEvent& event) { // player list m_playerids.clear(); std::string tmps; netplay_client->GetPlayerList(tmps, m_playerids); const int selection = m_player_lbox->GetSelection(); m_player_lbox->Clear(); std::istringstream ss(tmps); while (std::getline(ss, tmps)) m_player_lbox->Append(StrToWxStr(tmps)); m_player_lbox->SetSelection(selection); switch (event.GetId()) { case NP_GUI_EVT_CHANGE_GAME : // update selected game :/ { m_selected_game.assign(WxStrToStr(event.GetString())); m_game_btn->SetLabel(event.GetString().Prepend(_(" Game : "))); } break; case NP_GUI_EVT_START_GAME : // client start game :/ { netplay_client->StartGame(FindGame()); } break; case NP_GUI_EVT_STOP_GAME : // client stop game { netplay_client->StopGame(); } break; } // chat messages while (chat_msgs.Size()) { std::string s; chat_msgs.Pop(s); //PanicAlert("message: %s", s.c_str()); m_chat_text->AppendText(StrToWxStr(s).Append('\n')); } }
void CWatchView::OnPopupMenu(wxCommandEvent& event) { // FIXME: This is terrible. Generate events instead. CFrame* cframe = wxGetApp().GetCFrame(); CCodeWindow* code_window = cframe->m_code_window; CWatchWindow* watch_window = code_window->GetPanel<CWatchWindow>(); CMemoryWindow* memory_window = code_window->GetPanel<CMemoryWindow>(); CBreakPointWindow* breakpoint_window = code_window->GetPanel<CBreakPointWindow>(); switch (event.GetId()) { case IDM_DELETEWATCH: { wxString strNewVal = GetValueByRowCol(m_selectedRow, 1); if (TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress)) { PowerPC::debug_interface.UnsetWatch(m_selectedAddress); if (watch_window) watch_window->NotifyUpdate(); Refresh(); } break; } case IDM_ADDMEMCHECK: { TMemCheck MemCheck; MemCheck.start_address = m_selectedAddress; MemCheck.end_address = m_selectedAddress; MemCheck.is_ranged = false; MemCheck.is_break_on_read = true; MemCheck.is_break_on_write = true; MemCheck.log_on_hit = true; MemCheck.break_on_hit = true; PowerPC::memchecks.Add(MemCheck); if (breakpoint_window) breakpoint_window->NotifyUpdate(); Refresh(); break; } case IDM_VIEWMEMORY: if (memory_window) memory_window->JumpToAddress(m_selectedAddress); Refresh(); break; } event.Skip(); }
void GamepadPage::DeleteProfile(wxCommandEvent&) { std::string fname; GamepadPage::GetProfilePath(fname); const char* const fnamecstr = fname.c_str(); if (File::Exists(fnamecstr) && AskYesNoT("Are you sure you want to delete \"%s\"?", WxStrToStr(profile_cbox->GetValue()).c_str())) { File::Delete(fnamecstr); m_config_dialog->UpdateProfileComboBox(); } }
void DSPDebuggerLLE::OnAddrBoxChange(wxCommandEvent& event) { wxString txt = m_addr_txtctrl->GetValue(); auto text = StripSpaces(WxStrToStr(txt)); if (text.size()) { u32 addr; sscanf(text.c_str(), "%04x", &addr); if (JumpToAddress(addr)) m_addr_txtctrl->SetBackgroundColour(*wxWHITE); else m_addr_txtctrl->SetBackgroundColour(*wxRED); } event.Skip(); }
void DSPDebuggerLLE::OnAddrBoxChange(wxCommandEvent& event) { wxTextCtrl* pAddrCtrl = (wxTextCtrl*)m_Toolbar->FindControl(ID_ADDRBOX); wxString txt = pAddrCtrl->GetValue(); auto text = StripSpaces(WxStrToStr(txt)); if (text.size()) { u32 addr; sscanf(text.c_str(), "%04x", &addr); if (JumpToAddress(addr)) pAddrCtrl->SetBackgroundColour(*wxWHITE); else pAddrCtrl->SetBackgroundColour(*wxRED); } event.Skip(); }
void CWatchView::OnPopupMenu(wxCommandEvent& event) { CFrame* main_frame = static_cast<CFrame*>(GetGrandParent()->GetParent()); CCodeWindow* code_window = main_frame->g_pCodeWindow; CWatchWindow* watch_window = code_window->m_WatchWindow; CMemoryWindow* memory_window = code_window->m_MemoryWindow; CBreakPointWindow* breakpoint_window = code_window->m_BreakpointWindow; wxString strNewVal; TMemCheck MemCheck; switch (event.GetId()) { case IDM_DELETEWATCH: strNewVal = GetValueByRowCol(m_selectedRow, 1); if (TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress)) { PowerPC::watches.Remove(m_selectedAddress); if (watch_window) watch_window->NotifyUpdate(); Refresh(); } break; case IDM_ADDMEMCHECK: MemCheck.StartAddress = m_selectedAddress; MemCheck.EndAddress = m_selectedAddress; MemCheck.bRange = false; MemCheck.OnRead = true; MemCheck.OnWrite = true; MemCheck.Log = true; MemCheck.Break = true; PowerPC::memchecks.Add(MemCheck); if (breakpoint_window) breakpoint_window->NotifyUpdate(); Refresh(); break; case IDM_VIEWMEMORY: if (memory_window) memory_window->JumpToAddress(m_selectedAddress); Refresh(); break; } event.Skip(); }
void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event) { if (!GetToolBar()) return; wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX); wxString txt = pAddrCtrl->GetValue(); std::string text(WxStrToStr(txt)); text = StripSpaces(text); if (text.size() == 8) { u32 addr; sscanf(text.c_str(), "%08x", &addr); JumpToAddress(addr); } event.Skip(1); }
void CreateCodeDialog::PressOK(wxCommandEvent& ev) { const wxString code_name = m_textctrl_name->GetValue(); if (code_name.empty()) { WxUtils::ShowErrorDialog(_("You must enter a name.")); return; } long code_value; int base = m_checkbox_use_hex->IsChecked() ? 16 : 10; if (!m_textctrl_value->GetValue().ToLong(&code_value, base)) { WxUtils::ShowErrorDialog(_("Invalid value.")); return; } //wxString full_code = textctrl_code->GetValue(); //full_code += ' '; //full_code += wxString::Format("0x%08x", code_value); // create the new code ActionReplay::ARCode new_cheat; new_cheat.active = false; new_cheat.name = WxStrToStr(code_name); const ActionReplay::AREntry new_entry(m_code_address, code_value); new_cheat.ops.push_back(new_entry); // pretty hacky - add the code to the gameini { CISOProperties isoprops(SConfig::GetInstance().m_LastFilename, this); // add the code to the isoproperties arcode list arCodes.push_back(new_cheat); // save the gameini isoprops.SaveGameConfig(); isoprops.ActionReplayList_Load(); // loads the new arcodes //ActionReplay::UpdateActiveList(); } // Propagate back to the parent frame to update the cheat list. GetEventHandler()->AddPendingEvent(wxCommandEvent(UPDATE_CHEAT_LIST_EVENT)); Close(); }