From 2bb7942b2582e4a0c011a147e13844bb5e51fe1e Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Sun, 12 Apr 2020 18:49:10 +0300 Subject: [PATCH] Update "Debug" menu to match Windows version --- Qt/mainwindow.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++----- Qt/mainwindow.h | 4 +++ 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 1dffb82a21..62d4c1a12b 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -260,6 +260,11 @@ void MainWindow::runonloadAct() g_Config.bAutoRun = !g_Config.bAutoRun; } +void MainWindow::breakonloadAct() +{ + g_Config.bAutoRun = !g_Config.bAutoRun; +} + void MainWindow::lmapAct() { QFileDialog dialog(0,"Load .MAP"); @@ -295,6 +300,41 @@ void MainWindow::smapAct() } } +void MainWindow::lsymAct() +{ + QFileDialog dialog(0,"Load .SYM"); + dialog.setFileMode(QFileDialog::ExistingFile); + QStringList filters; + filters << "Symbols (*.sym)" << "|All files (*.*)"; + dialog.setNameFilters(filters); + dialog.setAcceptMode(QFileDialog::AcceptOpen); + QStringList fileNames; + if (dialog.exec()) + fileNames = dialog.selectedFiles(); + + if (fileNames.count() > 0) + { + QString fileName = QFileInfo(fileNames[0]).absoluteFilePath(); + g_symbolMap->LoadNocashSym(fileName.toStdString().c_str()); + } +} + +void MainWindow::ssymAct() +{ + QFileDialog dialog(0,"Save .SYM"); + dialog.setFileMode(QFileDialog::AnyFile); + dialog.setAcceptMode(QFileDialog::AcceptSave); + QStringList filters; + filters << "Save .SYM (*.sym)" << "|All files (*.*)"; + dialog.setNameFilters(filters); + QStringList fileNames; + if (dialog.exec()) + { + fileNames = dialog.selectedFiles(); + g_symbolMap->SaveNocashSym(fileNames[0].toStdString().c_str()); + } +} + void MainWindow::resetTableAct() { g_symbolMap->Clear(); @@ -495,20 +535,31 @@ void MainWindow::createMenus() ->addEventChecked(&g_Config.bAutoRun); // Debug - MenuTree* debugMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("De&bug")); - debugMenu->add(new MenuAction(this, SLOT(lmapAct()), QT_TR_NOOP("Load Map File..."))) + MenuTree* debugMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Debug")); + debugMenu->add(new MenuAction(this, SLOT(breakonloadAct()), QT_TR_NOOP("Break on load"))) + ->addEventChecked(&g_Config.bAutoRun); + debugMenu->add(new MenuAction(this, SLOT(ignoreIllegalAct()), QT_TR_NOOP("&Ignore illegal reads/writes"))) + ->addEventChecked(&g_Config.bIgnoreBadMemAccess); + debugMenu->addSeparator(); + debugMenu->add(new MenuAction(this, SLOT(lmapAct()), QT_TR_NOOP("&Load MAP file..."))) ->addDisableState(UISTATE_MENU); - debugMenu->add(new MenuAction(this, SLOT(smapAct()), QT_TR_NOOP("Save Map File..."))) + debugMenu->add(new MenuAction(this, SLOT(smapAct()), QT_TR_NOOP("&Save MAP file..."))) ->addDisableState(UISTATE_MENU); - debugMenu->add(new MenuAction(this, SLOT(resetTableAct()),QT_TR_NOOP("Reset Symbol Table"))) + debugMenu->add(new MenuAction(this, SLOT(lmapAct()), QT_TR_NOOP("Lo&ad SYM file..."))) + ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(smapAct()), QT_TR_NOOP("Sav&e SYM file..."))) + ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(resetTableAct()),QT_TR_NOOP("Reset s&ymbol table"))) ->addDisableState(UISTATE_MENU); debugMenu->addSeparator(); - debugMenu->add(new MenuAction(this, SLOT(dumpNextAct()), QT_TR_NOOP("Dump next frame to log"))) + debugMenu->add(new MenuAction(this, SLOT(takeScreen()), QT_TR_NOOP("&Take screenshot"), Qt::Key_F12)) ->addDisableState(UISTATE_MENU); - debugMenu->add(new MenuAction(this, SLOT(takeScreen()), QT_TR_NOOP("Take Screenshot"), Qt::Key_F12)) + debugMenu->add(new MenuAction(this, SLOT(dumpNextAct()), QT_TR_NOOP("D&ump next frame to log"))) ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(statsAct()), QT_TR_NOOP("Show debu&g statistics"))) + ->addEventChecked(&g_Config.bShowDebugStats); debugMenu->addSeparator(); - debugMenu->add(new MenuAction(this, SLOT(consoleAct()), QT_TR_NOOP("Log Console"))) + debugMenu->add(new MenuAction(this, SLOT(consoleAct()), QT_TR_NOOP("&Log console"), Qt::CTRL + Qt::Key_L)) ->addDisableState(UISTATE_MENU); // Game settings diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index ddeb5c4bb6..0d4700fc5f 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -83,8 +83,12 @@ private slots: void runonloadAct(); // Debug + void breakonloadAct(); + void ignoreIllegalAct() { g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess; } void lmapAct(); void smapAct(); + void lsymAct(); + void ssymAct(); void resetTableAct(); void dumpNextAct(); void takeScreen() { g_TakeScreenshot = true; }