Skip to content

Commit

Permalink
DolphinWX: Move creation of debugger menu items into CFrame
Browse files Browse the repository at this point in the history
Unifies the creation of all the menus into the main frame class.
Now it isn't spread out across the main frame and the code window.

This doesn't alter the placement of the handling functions, as this would
involve unrelated changes, since it would require modifying where
window-related variables are placed. This will be amended in a follow up
changeset.
  • Loading branch information
lioncash committed Oct 10, 2016
1 parent 6420a1c commit 6a67b57
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 179 deletions.
108 changes: 2 additions & 106 deletions Source/Core/DolphinWX/Debugger/CodeWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,110 +459,6 @@ void CCodeWindow::UpdateCallstack()
callstack->Append(StrToWxStr("invalid callstack"));
}

// Create CPU Mode menus
void CCodeWindow::CreateMenu(const SConfig& core_startup_parameter, wxMenuBar* pMenuBar)
{
// CPU Mode
wxMenu* pCoreMenu = new wxMenu;

wxMenuItem* interpreter = pCoreMenu->Append(
IDM_INTERPRETER, _("&Interpreter Core"),
_("This is necessary to get break points"
" and stepping to work as explained in the Developer Documentation. But it can be very"
" slow, perhaps slower than 1 fps."),
wxITEM_CHECK);
interpreter->Check(core_startup_parameter.iCPUCore == PowerPC::CORE_INTERPRETER);
pCoreMenu->AppendSeparator();

pCoreMenu->Append(IDM_JIT_NO_BLOCK_LINKING, _("&JIT Block Linking Off"),
_("Provide safer execution by not linking the JIT blocks."), wxITEM_CHECK);

pCoreMenu->Append(IDM_JIT_NO_BLOCK_CACHE, _("&Disable JIT Cache"),
_("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from "
"crashing.\n[This option must be selected before a game is started.]"),
wxITEM_CHECK);
pCoreMenu->Append(IDM_CLEAR_CODE_CACHE, _("&Clear JIT Cache"));

pCoreMenu->AppendSeparator();
pCoreMenu->Append(IDM_LOG_INSTRUCTIONS, _("&Log JIT Instruction Coverage"));
pCoreMenu->Append(IDM_SEARCH_INSTRUCTION, _("&Search for an Instruction"));

pCoreMenu->AppendSeparator();
pCoreMenu->Append(IDM_JIT_OFF, _("&JIT Off (JIT Core)"),
_("Turn off all JIT functions, but still use the JIT core from Jit.cpp"),
wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_LS_OFF, _("&JIT LoadStore Off"), wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_LSLBZX_OFF, _(" &JIT LoadStore lbzx Off"), wxEmptyString,
wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_LSLXZ_OFF, _(" &JIT LoadStore lXz Off"), wxEmptyString,
wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_LSLWZ_OFF, _("&JIT LoadStore lwz Off"), wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_LSF_OFF, _("&JIT LoadStore Floating Off"), wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_LSP_OFF, _("&JIT LoadStore Paired Off"), wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_FP_OFF, _("&JIT FloatingPoint Off"), wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_I_OFF, _("&JIT Integer Off"), wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_P_OFF, _("&JIT Paired Off"), wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JIT_SR_OFF, _("&JIT SystemRegisters Off"), wxEmptyString, wxITEM_CHECK);

pMenuBar->Append(pCoreMenu, _("&JIT"));

// Debug Menu
wxMenu* pDebugMenu = new wxMenu;

pDebugMenu->Append(IDM_STEP, _("Step &Into\tF11"));
pDebugMenu->Append(IDM_STEPOVER, _("Step &Over\tF10"));
pDebugMenu->Append(IDM_STEPOUT, _("Step O&ut\tSHIFT+F11"));
pDebugMenu->Append(IDM_TOGGLE_BREAKPOINT, _("Toggle &Breakpoint\tF9"));
pDebugMenu->AppendSeparator();

wxMenu* pPerspectives = new wxMenu;
Parent->m_SavedPerspectives = new wxMenu;
pDebugMenu->AppendSubMenu(pPerspectives, _("Perspectives"), _("Edit Perspectives"));
pPerspectives->Append(IDM_SAVE_PERSPECTIVE, _("Save Perspectives"),
_("Save currently-toggled perspectives"));
pPerspectives->Append(IDM_EDIT_PERSPECTIVES, _("Edit Perspectives"),
_("Toggle editing of perspectives"), wxITEM_CHECK);
pPerspectives->AppendSeparator();
pPerspectives->Append(IDM_ADD_PERSPECTIVE, _("Create New Perspective"));
pPerspectives->AppendSubMenu(Parent->m_SavedPerspectives, _("Saved Perspectives"));
Parent->PopulateSavedPerspectives();
pPerspectives->AppendSeparator();
wxMenu* pAddPane = new wxMenu;
pPerspectives->AppendSubMenu(pAddPane, _("Add New Pane To"));
pAddPane->Append(IDM_PERSPECTIVES_ADD_PANE_TOP, _("Top"));
pAddPane->Append(IDM_PERSPECTIVES_ADD_PANE_BOTTOM, _("Bottom"));
pAddPane->Append(IDM_PERSPECTIVES_ADD_PANE_LEFT, _("Left"));
pAddPane->Append(IDM_PERSPECTIVES_ADD_PANE_RIGHT, _("Right"));
pAddPane->Append(IDM_PERSPECTIVES_ADD_PANE_CENTER, _("Center"));
pPerspectives->Append(IDM_TAB_SPLIT, _("Tab Split"), "", wxITEM_CHECK);
pPerspectives->Append(IDM_NO_DOCKING, _("Disable Docking"),
"Disable docking of perspective panes to main window", wxITEM_CHECK);

pMenuBar->Append(pDebugMenu, _("&Debug"));

CreateMenuSymbols(pMenuBar);
}

void CCodeWindow::CreateMenuOptions(wxMenu* pMenu)
{
wxMenuItem* boottopause =
pMenu->Append(IDM_BOOT_TO_PAUSE, _("Boot to Pause"),
_("Start the game directly instead of booting to pause"), wxITEM_CHECK);
boottopause->Check(bBootToPause);

wxMenuItem* automaticstart = pMenu->Append(
IDM_AUTOMATIC_START, _("&Automatic Start"),
_("Automatically load the Default ISO when Dolphin starts, or the last game you loaded,"
" if you have not given it an elf file with the --elf command line. [This can be"
" convenient if you are bug-testing with a certain game and want to rebuild"
" and retry it several times, either with changes to Dolphin or if you are"
" developing a homebrew game.]"),
wxITEM_CHECK);
automaticstart->Check(bAutomaticStart);

pMenu->Append(IDM_FONT_PICKER, _("&Font..."));
}

// CPU Mode and JIT Menu
void CCodeWindow::OnCPUMode(wxCommandEvent& event)
{
Expand All @@ -572,10 +468,10 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event)
PowerPC::SetMode(UseInterpreter() ? PowerPC::MODE_INTERPRETER : PowerPC::MODE_JIT);
break;
case IDM_BOOT_TO_PAUSE:
bBootToPause = !bBootToPause;
SConfig::GetInstance().bBootToPause = event.IsChecked();
return;
case IDM_AUTOMATIC_START:
bAutomaticStart = !bAutomaticStart;
SConfig::GetInstance().bAutomaticStart = event.IsChecked();
return;
case IDM_JIT_OFF:
SConfig::GetInstance().bJITOff = event.IsChecked();
Expand Down
5 changes: 0 additions & 5 deletions Source/Core/DolphinWX/Debugger/CodeWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ class CCodeWindow : public wxPanel

void Repopulate();
void NotifyMapLoaded();
void CreateMenu(const SConfig& _LocalCoreStartupParameter, wxMenuBar* pMenuBar);
void CreateMenuOptions(wxMenu* pMenu);
void CreateMenuSymbols(wxMenuBar* pMenuBar);
void PopulateToolbar(wxToolBar* toolBar);
void UpdateButtonStates();
void OpenPages();
Expand Down Expand Up @@ -130,8 +127,6 @@ class CCodeWindow : public wxPanel
}

// Settings
bool bAutomaticStart;
bool bBootToPause;
bool bShowOnStart[IDM_DEBUG_WINDOW_LIST_END - IDM_DEBUG_WINDOW_LIST_START];
int iNbAffiliation[IDM_DEBUG_WINDOW_LIST_END - IDM_DEBUG_WINDOW_LIST_START];

Expand Down
68 changes: 4 additions & 64 deletions Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ void CCodeWindow::Load()
// The font to override DebuggerFont with
std::string fontDesc;

auto& config_instance = SConfig::GetInstance();

IniFile::Section* general = ini.GetOrCreateSection("General");
general->Get("DebuggerFont", &fontDesc);
general->Get("AutomaticStart", &bAutomaticStart, false);
general->Get("BootToPause", &bBootToPause, true);
general->Get("AutomaticStart", &config_instance.bAutomaticStart, false);
general->Get("BootToPause", &config_instance.bBootToPause, true);

if (!fontDesc.empty())
DebuggerFont.SetNativeFontInfoUserDesc(StrToWxStr(fontDesc));
Expand Down Expand Up @@ -115,68 +117,6 @@ void CCodeWindow::Save()
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
}

// Symbols, JIT, Profiler
// ----------------
void CCodeWindow::CreateMenuSymbols(wxMenuBar* pMenuBar)
{
wxMenu* pSymbolsMenu = new wxMenu;
pSymbolsMenu->Append(IDM_CLEAR_SYMBOLS, _("&Clear Symbols"),
_("Remove names from all functions and variables."));
pSymbolsMenu->Append(IDM_SCAN_FUNCTIONS, _("&Generate Symbol Map"),
_("Recognise standard functions from sys\\totaldb.dsy, and use generic zz_ "
"names for other functions."));
pSymbolsMenu->AppendSeparator();
pSymbolsMenu->Append(IDM_LOAD_MAP_FILE, _("&Load Symbol Map"),
_("Try to load this game's function names automatically - but doesn't check "
".map files stored on the disc image yet."));
pSymbolsMenu->Append(IDM_SAVEMAPFILE, _("&Save Symbol Map"),
_("Save the function names for each address to a .map file in your user "
"settings map folder, named after the title id."));
pSymbolsMenu->AppendSeparator();
pSymbolsMenu->Append(
IDM_LOAD_MAP_FILE_AS, _("Load &Other Map File..."),
_("Load any .map file containing the function names and addresses for this game."));
pSymbolsMenu->Append(
IDM_LOAD_BAD_MAP_FILE, _("Load &Bad Map File..."),
_("Try to load a .map file that might be from a slightly different version."));
pSymbolsMenu->Append(IDM_SAVE_MAP_FILE_AS, _("Save Symbol Map &As..."),
_("Save the function names and addresses for this game as a .map file. If "
"you want to open it in IDA pro, use the .idc script."));
pSymbolsMenu->AppendSeparator();
pSymbolsMenu->Append(
IDM_SAVE_MAP_FILE_WITH_CODES, _("Save Code"),
_("Save the entire disassembled code. This may take a several seconds"
" and may require between 50 and 100 MB of hard drive space. It will only save code"
" that are in the first 4 MB of memory, if you are debugging a game that load .rel"
" files with code to memory you may want to increase that to perhaps 8 MB, you can do"
" that from SymbolDB::SaveMap()."));

pSymbolsMenu->AppendSeparator();
pSymbolsMenu->Append(
IDM_CREATE_SIGNATURE_FILE, _("&Create Signature File..."),
_("Create a .dsy file that can be used to recognise these same functions in other games."));
pSymbolsMenu->Append(IDM_APPEND_SIGNATURE_FILE, _("Append to &Existing Signature File..."),
_("Add any named functions missing from a .dsy file, so it can also "
"recognise these additional functions in other games."));
pSymbolsMenu->Append(IDM_COMBINE_SIGNATURE_FILES, _("Combine Two Signature Files..."),
_("Make a new .dsy file which can recognise more functions, by combining "
"two existing files. The first input file has priority."));
pSymbolsMenu->Append(
IDM_USE_SIGNATURE_FILE, _("Apply Signat&ure File..."),
_("Must use Generate symbol map first! Recognise names of any standard library functions "
"used in multiple games, by loading them from a .dsy file."));
pSymbolsMenu->AppendSeparator();
pSymbolsMenu->Append(IDM_PATCH_HLE_FUNCTIONS, _("&Patch HLE Functions"));
pSymbolsMenu->Append(IDM_RENAME_SYMBOLS, _("&Rename Symbols from File..."));
pMenuBar->Append(pSymbolsMenu, _("&Symbols"));

wxMenu* pProfilerMenu = new wxMenu;
pProfilerMenu->Append(IDM_PROFILE_BLOCKS, _("&Profile Blocks"), wxEmptyString, wxITEM_CHECK);
pProfilerMenu->AppendSeparator();
pProfilerMenu->Append(IDM_WRITE_PROFILE, _("&Write to profile.txt, Show"));
pMenuBar->Append(pProfilerMenu, _("&Profiler"));
}

void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
{
switch (event.GetId())
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/DolphinWX/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ class CFrame : public CRenderFrame
wxMenu* CreateOptionsMenu();
wxMenu* CreateToolsMenu();
wxMenu* CreateViewMenu();
wxMenu* CreateJITMenu();
wxMenu* CreateDebugMenu();
wxMenu* CreateSymbolsMenu();
wxMenu* CreateProfilerMenu();
wxMenu* CreateHelpMenu();

// Utility
Expand Down

0 comments on commit 6a67b57

Please sign in to comment.