From 8d8bc98e970bbcaabb34cfe71d1f390ff174ecb3 Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Sun, 12 Apr 2020 17:03:47 +0300 Subject: [PATCH 1/8] Update "Help" menu to match Windows version --- Qt/mainwindow.cpp | 21 +++++++++++++++++---- Qt/mainwindow.h | 2 ++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 8b59c683ea..c0473478a3 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -351,11 +351,21 @@ void MainWindow::forumAct() QDesktopServices::openUrl(QUrl("https://forums.ppsspp.org/")); } +void MainWindow::goldAct() +{ + QDesktopServices::openUrl(QUrl("https://central.ppsspp.org/buygold")); +} + void MainWindow::gitAct() { QDesktopServices::openUrl(QUrl("https://github.com/hrydgard/ppsspp/")); } +void MainWindow::discordAct() +{ + QDesktopServices::openUrl(QUrl("https://discord.gg/5NJB6dD")); +} + void MainWindow::aboutAct() { QMessageBox::about(this, "About", QString("PPSSPP Qt %1\n\n" @@ -598,10 +608,13 @@ void MainWindow::createMenus() // Help MenuTree* helpMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Help")); - helpMenu->add(new MenuAction(this, SLOT(websiteAct()), QT_TR_NOOP("Official &website"), QKeySequence::HelpContents)); - helpMenu->add(new MenuAction(this, SLOT(forumAct()), QT_TR_NOOP("Official &forum"))); - helpMenu->add(new MenuAction(this, SLOT(gitAct()), QT_TR_NOOP("&GitHub"))); - helpMenu->add(new MenuAction(this, SLOT(aboutAct()), QT_TR_NOOP("&About PPSSPP..."), QKeySequence::WhatsThis)); + helpMenu->add(new MenuAction(this, SLOT(websiteAct()), QT_TR_NOOP("Visit www.&ppsspp.org"))); + helpMenu->add(new MenuAction(this, SLOT(forumAct()), QT_TR_NOOP("PPSSPP &forums"))); + helpMenu->add(new MenuAction(this, SLOT(goldAct()), QT_TR_NOOP("Buy &Gold"))); + helpMenu->add(new MenuAction(this, SLOT(gitAct()), QT_TR_NOOP("Git&Hub"))); + helpMenu->add(new MenuAction(this, SLOT(discordAct()), QT_TR_NOOP("Discord"))); + helpMenu->addSeparator(); + helpMenu->add(new MenuAction(this, SLOT(aboutAct()), QT_TR_NOOP("&About PPSSPP..."))); retranslate(); } diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 8023fe408d..fc776d7796 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -147,7 +147,9 @@ private slots: // Help void websiteAct(); void forumAct(); + void goldAct(); void gitAct(); + void discordAct(); void aboutAct(); // Others From fe5fe8267651b0a35fc7f696c93b242aaf181b03 Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Sun, 12 Apr 2020 18:17:36 +0300 Subject: [PATCH 2/8] Update "Options" menu to match Windows version --- Qt/mainwindow.cpp | 239 ++++++++++++++++++++++------------------------ Qt/mainwindow.h | 53 +++++----- 2 files changed, 141 insertions(+), 151 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index c0473478a3..1dffb82a21 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -80,14 +80,7 @@ void MainWindow::newFrame() void MainWindow::updateMenus() { - foreach(QAction * action, anisotropicGroup->actions()) { - if (g_Config.iAnisotropyLevel == action->data().toInt()) { - action->setChecked(true); - break; - } - } - - foreach(QAction * action, screenGroup->actions()) { + foreach(QAction * action, windowGroup->actions()) { int width = (g_Config.IsPortrait() ? 272 : 480) * action->data().toInt(); int height = (g_Config.IsPortrait() ? 480 : 272) * action->data().toInt(); if (g_Config.iWindowWidth == width && g_Config.iWindowHeight == height) { @@ -96,32 +89,57 @@ void MainWindow::updateMenus() } } - foreach(QAction * action, displayLayoutGroup->actions()) { - if (g_Config.iSmallDisplayZoomType == action->data().toInt()) { + foreach(QAction * action, renderingResolutionGroup->actions()) { + if (g_Config.iInternalResolution == action->data().toInt()) { action->setChecked(true); break; } } - int defaultLevel = LogManager::GetInstance()->GetLogLevel(LogTypes::COMMON); - foreach(QAction * action, defaultLogGroup->actions()) { - if (defaultLevel == action->data().toInt()) { + foreach(QAction * action, renderingModeGroup->actions()) { + if (g_Config.iRenderingMode == action->data().toInt()) { action->setChecked(true); break; } } - int g3dLevel = LogManager::GetInstance()->GetLogLevel(LogTypes::G3D); - foreach(QAction * action, g3dLogGroup->actions()) { - if (g3dLevel == action->data().toInt()) { + foreach(QAction * action, frameSkippingGroup->actions()) { + if (g_Config.iFrameSkip == action->data().toInt()) { action->setChecked(true); break; } } - int hleLevel = LogManager::GetInstance()->GetLogLevel(LogTypes::HLE); - foreach(QAction * action, hleLogGroup->actions()) { - if (hleLevel == action->data().toInt()) { + foreach(QAction * action, frameSkippingTypeGroup->actions()) { + if (g_Config.iFrameSkipType == action->data().toInt()) { + action->setChecked(true); + break; + } + } + + foreach(QAction * action, textureFilteringGroup->actions()) { + if (g_Config.iTexFiltering == action->data().toInt()) { + action->setChecked(true); + break; + } + } + + foreach(QAction * action, screenScalingFilterGroup->actions()) { + if (g_Config.iBufFilter == action->data().toInt()) { + action->setChecked(true); + break; + } + } + + foreach(QAction * action, textureScalingLevelGroup->actions()) { + if (g_Config.iTexScalingLevel == action->data().toInt()) { + action->setChecked(true); + break; + } + } + + foreach(QAction * action, textureScalingTypeGroup->actions()) { + if (g_Config.iTexScalingType == action->data().toInt()) { action->setChecked(true); break; } @@ -493,118 +511,87 @@ void MainWindow::createMenus() debugMenu->add(new MenuAction(this, SLOT(consoleAct()), QT_TR_NOOP("Log Console"))) ->addDisableState(UISTATE_MENU); - // Options - MenuTree* optionsMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Options")); - // - Core - MenuTree* coreMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Core")); - coreMenu->add(new MenuAction(this, SLOT(vertexDynarecAct()), QT_TR_NOOP("&Vertex Decoder Dynarec"))) - ->addEventChecked(&g_Config.bVertexDecoderJit); - coreMenu->add(new MenuAction(this, SLOT(fastmemAct()), QT_TR_NOOP("Fast &Memory (unstable)"))) - ->addEventChecked(&g_Config.bFastMemory); - coreMenu->add(new MenuAction(this, SLOT(ignoreIllegalAct()), QT_TR_NOOP("&Ignore Illegal reads/writes"))) - ->addEventChecked(&g_Config.bIgnoreBadMemAccess); - // - Video - MenuTree* videoMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Video")); - // - Anisotropic Filtering - MenuTree* anisotropicMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Anisotropic Filtering")); - anisotropicGroup = new MenuActionGroup(this, anisotropicMenu, SLOT(anisotropicGroup_triggered(QAction *)), - QStringList() << "Off" << "2x" << "4x" << "8x" << "16x", - QList() << 0 << 1 << 2 << 3 << 4); - videoMenu->add(new MenuAction(this, SLOT(bufferRenderAct()), QT_TR_NOOP("&Buffered Rendering"))) - ->addEventChecked(&g_Config.iRenderingMode); - videoMenu->add(new MenuAction(this, SLOT(linearAct()), QT_TR_NOOP("&Linear Filtering"))) - ->addEventChecked(&g_Config.iTexFiltering); - videoMenu->addSeparator(); - // - Screen Size - MenuTree* screenMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Screen Size")); - screenGroup = new MenuActionGroup(this, screenMenu, SLOT(screenGroup_triggered(QAction *)), - QStringList() << "1x" << "2x" << "3x" << "4x" << "5x" << "6x" << "7x" << "8x" << "9x" << "10x", - QList() << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10, - QList() << Qt::CTRL + Qt::Key_1 << Qt::CTRL + Qt::Key_2 << Qt::CTRL + Qt::Key_3 << Qt::CTRL + Qt::Key_4 << Qt::CTRL + Qt::Key_5 - << Qt::CTRL + Qt::Key_6 << Qt::CTRL + Qt::Key_7 << Qt::CTRL + Qt::Key_8 << Qt::CTRL + Qt::Key_9 << Qt::CTRL + Qt::Key_0); - - MenuTree* displayLayoutMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Display Layout Options")); - displayLayoutGroup = new MenuActionGroup(this, displayLayoutMenu, SLOT(displayLayoutGroup_triggered(QAction *)), - QStringList() << "Stretched" << "Partialy stretched" << "Auto Scaling" << "Manual Scaling", - QList() << 0 << 1 << 2 << 3); - videoMenu->addSeparator(); - videoMenu->add(new MenuAction(this, SLOT(transformAct()), QT_TR_NOOP("&Hardware Transform"), Qt::Key_F6)) - ->addEventChecked(&g_Config.bHardwareTransform); - videoMenu->add(new MenuAction(this, SLOT(vertexCacheAct()), QT_TR_NOOP("&Vertex Cache"))) - ->addEventChecked(&g_Config.bVertexCache); - videoMenu->add(new MenuAction(this, SLOT(frameskipAct()), QT_TR_NOOP("&Frameskip"))) - ->addEventChecked(&g_Config.iFrameSkip); - videoMenu->add(new MenuAction(this, SLOT(frameskipTypeAct()), QT_TR_NOOP("&FrameSkipType"))) - ->addEventChecked(&g_Config.iFrameSkipType); - optionsMenu->add(new MenuAction(this, SLOT(audioAct()), QT_TR_NOOP("&Audio"))) - ->addEventChecked(&g_Config.bEnableSound); - optionsMenu->addSeparator(); + // Game settings + MenuTree* gameSettingsMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Game settings")); + gameSettingsMenu->add(new MenuAction(this, SLOT(keepOnTopAct()), QT_TR_NOOP("&Keep PPSSPP on top"))) + ->addEventChecked(&g_Config.bTopMost); + gameSettingsMenu->add(new MenuAction(this, SLOT(pauseWhenNotFocusedAct()), QT_TR_NOOP("&Pause when not focused"))) + ->addEventChecked(&g_Config.bPauseOnLostFocus); + gameSettingsMenu->add(new MenuAction(this, SLOT(languageAct()), QT_TR_NOOP("La&nguage..."))); + gameSettingsMenu->add(new MenuAction(this, SLOT(controlMappingAct()), QT_TR_NOOP("C&ontrol mapping..."))); + gameSettingsMenu->add(new MenuAction(this, SLOT(displayLayoutEditorAct()), QT_TR_NOOP("Display layout editor..."))); + gameSettingsMenu->add(new MenuAction(this, SLOT(moreSettingsAct()), QT_TR_NOOP("&More settings..."))); + gameSettingsMenu->addSeparator(); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - optionsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("&Fullscreen"), Qt::Key_F11)) + gameSettingsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("&Fullscreen"), Qt::Key_F11)) #else - optionsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("&Fullscreen"), QKeySequence::FullScreen)) + gameSettingsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("Fu&llscreen"), QKeySequence::FullScreen)) #endif ->addEventChecked(&g_Config.bFullScreen); - optionsMenu->add(new MenuAction(this, SLOT(statsAct()), QT_TR_NOOP("&Show debug statistics"))) - ->addEventChecked(&g_Config.bShowDebugStats); - optionsMenu->add(new MenuAction(this, SLOT(showFPSAct()), QT_TR_NOOP("&Show FPS"))) + gameSettingsMenu->add(new MenuAction(this, SLOT(VSyncAct()), QT_TR_NOOP("VS&ync"))) + ->addEventChecked(&g_Config.bVSync); + MenuTree* postprocessingShaderMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Postprocessin&g shader")); + postprocessingShaderGroup = new MenuActionGroup(this, postprocessingShaderMenu, SLOT(postprocessingShaderGroup_triggered(QAction *)), + QStringList() << "Off" << "FXAA Antialiasing" << "CRT scanlines" << "Natural Colors" << "Natural Colors (no blur)" << "Vignette" << "Grayscale" << "Bloom" << "Sharpen" << "Inverse Colors" << "Scanlines (CRT)" << "Cartoon" << "4xHQ GLSL" << "AA-Color" << "Spline36 Upscaler" << "5xBR" << "5xBR-lv2" << "Video Smoothing AA" << "Super Sampling AA (Gauss)", + QList() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18); + MenuTree* renderingResolutionMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Rendering resolution")); + renderingResolutionGroup = new MenuActionGroup(this, renderingResolutionMenu, SLOT(renderingResolutionGroup_triggered(QAction *)), + QStringList() << "&Auto" << "&1x" << "&2x" << "&3x" << "&4x" << "&5x" << "&6x" << "&7x" << "&8x" << "&9x" << "1&0x", + QList() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10); + // - Window Size + MenuTree* windowMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Window size")); + windowGroup = new MenuActionGroup(this, windowMenu, SLOT(windowGroup_triggered(QAction *)), + QStringList() << "&1x" << "&2x" << "&3x" << "&4x" << "&5x" << "&6x" << "&7x" << "&8x" << "&9x" << "1&0x", + QList() << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10); + + MenuTree* renderingModeMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Rendering m&ode")); + renderingModeGroup = new MenuActionGroup(this, renderingModeMenu, SLOT(renderingModeGroup_triggered(QAction *)), + QStringList() << "&Skip buffered effects (non-buffered, faster)" << "&Buffered rendering", + QList() << 0 << 1); + MenuTree* frameSkippingMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Frame skipping")); + frameSkippingMenu->add(new MenuAction(this, SLOT(autoframeskipAct()), QT_TR_NOOP("&Auto"))) + ->addEventChecked(&g_Config.bAutoFrameSkip); + frameSkippingMenu->addSeparator(); + frameSkippingGroup = new MenuActionGroup(this, frameSkippingMenu, SLOT(frameSkippinGroup_triggered(QAction *)), + QStringList() << "&Off" << "&1" << "&2" << "&3" << "&4" << "&5" << "&6" << "&7" << "&8", + QList() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8); + MenuTree* frameSkippingTypeMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Frame skipping type")); + frameSkippingTypeGroup = new MenuActionGroup(this, frameSkippingTypeMenu, SLOT(frameSkippingTypeGroup_triggered(QAction *)), + QStringList() << "Skip number of frames" << "Skip percent of FPS", + QList() << 0 << 1); + MenuTree* textureFilteringMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Te&xture filtering")); + textureFilteringGroup = new MenuActionGroup(this, textureFilteringMenu, SLOT(textureFilteringGroup_triggered(QAction *)), + QStringList() << "&Auto" << "&Nearest" << "&Linear" << "Linear on &FMV", + QList() << 1 << 2 << 3 << 4); + MenuTree* screenScalingFilterMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Scr&een scaling filter")); + screenScalingFilterGroup = new MenuActionGroup(this, screenScalingFilterMenu, SLOT(screenScalingFilterGroup_triggered(QAction *)), + QStringList() << "&Linear" << "&Nearest", + QList() << 0 << 1); + + MenuTree* textureScalingMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Texture scaling")); + textureScalingLevelGroup = new MenuActionGroup(this, textureScalingMenu, SLOT(textureScalingLevelGroup_triggered(QAction *)), + QStringList() << "&Off" << "&Auto" << "&2x" << "&3x" << "&4x" << "&5x", + QList() << 1 << 2 << 3 << 4 << 5 << 6); + textureScalingMenu->addSeparator(); + textureScalingTypeGroup = new MenuActionGroup(this, textureScalingMenu, SLOT(textureScalingTypeGroup_triggered(QAction *)), + QStringList() << "&xBRZ" << "&Hybrid" << "&Bicubic" << "H&ybrid + bicubic", + QList() << 0 << 1 << 2 << 3); + textureScalingMenu->addSeparator(); + textureScalingMenu->add(new MenuAction(this, SLOT(deposterizeAct()), QT_TR_NOOP("&Deposterize"))) + ->addEventChecked(&g_Config.bTexDeposterize); + + gameSettingsMenu->add(new MenuAction(this, SLOT(transformAct()), QT_TR_NOOP("&Hardware transform"))) + ->addEventChecked(&g_Config.bHardwareTransform); + gameSettingsMenu->add(new MenuAction(this, SLOT(vertexCacheAct()), QT_TR_NOOP("&Vertex cache"))) + ->addEventChecked(&g_Config.bVertexCache); + gameSettingsMenu->add(new MenuAction(this, SLOT(showFPSAct()), QT_TR_NOOP("&Show FPS counter"))) ->addEventChecked(&g_Config.iShowFPSCounter); - optionsMenu->addSeparator(); - // - Log Levels - MenuTree* levelsMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("Lo&g levels")); - QMenu* defaultLogMenu = levelsMenu->addMenu("Default"); - defaultLogGroup = new MenuActionGroup(this, defaultLogMenu, SLOT(defaultLogGroup_triggered(QAction *)), - QStringList() << "Debug" << "Warning" << "Info" << "Error", - QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); - QMenu* g3dLogMenu = levelsMenu->addMenu("G3D"); - g3dLogGroup = new MenuActionGroup(this, g3dLogMenu, SLOT(g3dLogGroup_triggered(QAction *)), - QStringList() << "Debug" << "Warning" << "Info" << "Error", - QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); - QMenu* hleLogMenu = levelsMenu->addMenu("HLE"); - hleLogGroup = new MenuActionGroup(this, hleLogMenu, SLOT(hleLogGroup_triggered(QAction *)), - QStringList() << "Debug" << "Warning" << "Info" << "Error", - QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); - optionsMenu->addSeparator(); - // - Language - MenuTree* langMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Language")); - QActionGroup* langGroup = new QActionGroup(this); - QStringList fileNames = QDir(":/languages").entryList(QStringList("ppsspp_*.qm")); - - if (fileNames.size() == 0) - { - QAction *action = new QAction("No translations", this); - action->setDisabled(true); - langGroup->addAction(action); - } else { - connect(langGroup, SIGNAL(triggered(QAction *)), this, SLOT(langChanged(QAction *))); - bool found = false; - QString currentLocale = g_Config.sLanguageIni.c_str(); - QString currentLang = currentLocale.split('_').first(); - for (int i = 0; i < fileNames.size(); ++i) - { - QString locale = fileNames[i]; - locale.truncate(locale.lastIndexOf('.')); - locale.remove(0, locale.indexOf('_') + 1); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) - QString language = QLocale(locale).nativeLanguageName(); -#else - QString language = QLocale::languageToString(QLocale(locale).language()); -#endif - QAction *action = new MenuAction(this, langGroup, locale, language); - std::string testLang = g_Config.sLanguageIni; - if (currentLocale == locale || currentLang == locale) { - action->setChecked(true); - loadLanguage(locale, false); - found = true; - } - - if (!found && locale == "en") { - action->setChecked(true); - } - } - } - langMenu->addActions(langGroup->actions()); + gameSettingsMenu->addSeparator(); + gameSettingsMenu->add(new MenuAction(this, SLOT(audioAct()), QT_TR_NOOP("Enable s&ound"))) + ->addEventChecked(&g_Config.bEnableSound); + gameSettingsMenu->addSeparator(); + gameSettingsMenu->add(new MenuAction(this, SLOT(cheatsAct()), QT_TR_NOOP("Enable &cheats"), Qt::CTRL + Qt::Key_T)) + ->addEventChecked(&g_Config.bEnableCheats); // Help MenuTree* helpMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Help")); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index fc776d7796..ddeb5c4bb6 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -90,14 +90,13 @@ private slots: void takeScreen() { g_TakeScreenshot = true; } void consoleAct(); - // Options - // Core - void vertexDynarecAct() { g_Config.bVertexDecoderJit = !g_Config.bVertexDecoderJit; } - void fastmemAct() { g_Config.bFastMemory = !g_Config.bFastMemory; } - void ignoreIllegalAct() { g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess; } - - // Video - void anisotropicGroup_triggered(QAction *action) { g_Config.iAnisotropyLevel = action->data().toInt(); } + // Game settings + void keepOnTopAct() { g_Config.bTopMost = !g_Config.bTopMost; } + void pauseWhenNotFocusedAct() { g_Config.bPauseOnLostFocus = !g_Config.bPauseOnLostFocus; } + void languageAct() { NativeMessageReceived("language screen", ""); } + void controlMappingAct() { NativeMessageReceived("control mapping", ""); } + void displayLayoutEditorAct() { NativeMessageReceived("display layout editor", ""); } + void moreSettingsAct() { NativeMessageReceived("settings", ""); } void bufferRenderAct() { g_Config.iRenderingMode = !g_Config.iRenderingMode; @@ -105,12 +104,23 @@ private slots: } void linearAct() { g_Config.iTexFiltering = (g_Config.iTexFiltering != 0) ? 0 : 3; } - void screenGroup_triggered(QAction *action) { SetWindowScale(action->data().toInt()); } + void postprocessingShaderGroup_triggered(QAction *action) { g_Config.sPostShaderName = action->data().toInt(); } + void renderingResolutionGroup_triggered(QAction *action) { g_Config.iInternalResolution = action->data().toInt(); } + void windowGroup_triggered(QAction *action) { SetWindowScale(action->data().toInt()); } void displayLayoutGroup_triggered(QAction *action) { g_Config.iSmallDisplayZoomType = action->data().toInt(); NativeMessageReceived("gpu_resized", ""); } + void renderingModeGroup_triggered(QAction *action) { g_Config.iRenderingMode = action->data().toInt(); } + void autoframeskipAct() { g_Config.bAutoFrameSkip = !g_Config.bAutoFrameSkip; } + void frameSkippingGroup_triggered(QAction *action) { g_Config.iFrameSkip = action->data().toInt(); } + void frameSkippingTypeGroup_triggered(QAction *action) { g_Config.iFrameSkipType = action->data().toInt(); } + void textureFilteringGroup_triggered(QAction *action) { g_Config.iTexFiltering = action->data().toInt(); } + void screenScalingFilterGroup_triggered(QAction *action) { g_Config.iBufFilter = action->data().toInt(); } + void textureScalingLevelGroup_triggered(QAction *action) { g_Config.iTexScalingLevel = action->data().toInt(); } + void textureScalingTypeGroup_triggered(QAction *action) { g_Config.iTexScalingType = action->data().toInt(); } + void deposterizeAct() { g_Config.bTexDeposterize = !g_Config.bTexDeposterize; } void transformAct() { g_Config.bHardwareTransform = !g_Config.bHardwareTransform; NativeMessageReceived("gpu_resized", ""); @@ -122,28 +132,18 @@ private slots: // Sound void audioAct() { g_Config.bEnableSound = !g_Config.bEnableSound; } + // Cheats + void cheatsAct() { g_Config.bEnableCheats = !g_Config.bEnableCheats; } + void fullscrAct(); void raiseTopMost(); void statsAct() { g_Config.bShowDebugStats = !g_Config.bShowDebugStats; NativeMessageReceived("clear jit", ""); } + void VSyncAct() { g_Config.bVSync = !g_Config.bVSync; } void showFPSAct() { g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter; } - // Logs - void defaultLogGroup_triggered(QAction * action) { - LogTypes::LOG_LEVELS level = (LogTypes::LOG_LEVELS)action->data().toInt(); - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) - { - LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i; - if(type == LogTypes::G3D || type == LogTypes::HLE) - continue; - LogManager::GetInstance()->SetLogLevel(type, level); - } - } - void g3dLogGroup_triggered(QAction * action) { LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, (LogTypes::LOG_LEVELS)action->data().toInt()); } - void hleLogGroup_triggered(QAction * action) { LogManager::GetInstance()->SetLogLevel(LogTypes::HLE, (LogTypes::LOG_LEVELS)action->data().toInt()); } - // Help void websiteAct(); void forumAct(); @@ -169,8 +169,11 @@ private: CoreState nextState; GlobalUIState lastUIState; - QActionGroup *anisotropicGroup, *screenGroup, *displayLayoutGroup, - *defaultLogGroup, *g3dLogGroup, *hleLogGroup; + QActionGroup *windowGroup, *postprocessingShaderGroup, + *textureScalingLevelGroup, *textureScalingTypeGroup, + *screenScalingFilterGroup, *textureFilteringGroup, + *frameSkippingTypeGroup, *frameSkippingGroup, + *renderingModeGroup, *renderingResolutionGroup; std::queue msgQueue_; std::mutex msgMutex_; 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 3/8] 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; } From c3dbd2b2629b2c53df85dbca92984f910e1eada7 Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Sun, 12 Apr 2020 19:26:44 +0300 Subject: [PATCH 4/8] Update "Emulation" menu to match Windows version --- Qt/mainwindow.cpp | 19 +++++++++++-------- Qt/mainwindow.h | 5 +++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 62d4c1a12b..7103290f1d 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -80,6 +80,13 @@ void MainWindow::newFrame() void MainWindow::updateMenus() { + foreach(QAction * action, displayRotationGroup->actions()) { + if (g_Config.iInternalScreenRotation == action->data().toInt()) { + action->setChecked(true); + break; + } + } + foreach(QAction * action, windowGroup->actions()) { int width = (g_Config.IsPortrait() ? 272 : 480) * action->data().toInt(); int height = (g_Config.IsPortrait() ? 480 : 272) * action->data().toInt(); @@ -255,11 +262,6 @@ void MainWindow::resetAct() NativeMessageReceived("reset", ""); } -void MainWindow::runonloadAct() -{ - g_Config.bAutoRun = !g_Config.bAutoRun; -} - void MainWindow::breakonloadAct() { g_Config.bAutoRun = !g_Config.bAutoRun; @@ -530,9 +532,10 @@ void MainWindow::createMenus() ->addEnableState(UISTATE_INGAME); emuMenu->add(new MenuAction(this, SLOT(resetAct()), QT_TR_NOOP("Re&set"))) ->addEnableState(UISTATE_INGAME); - emuMenu->addSeparator(); - emuMenu->add(new MenuAction(this, SLOT(runonloadAct()), QT_TR_NOOP("Run on &load"))) - ->addEventChecked(&g_Config.bAutoRun); + MenuTree* displayRotationMenu = new MenuTree(this, emuMenu, QT_TR_NOOP("Display rotation")); + displayRotationGroup = new MenuActionGroup(this, displayRotationMenu, SLOT(displayRotationGroup_triggered(QAction *)), + QStringList() << "Landscape" << "Portrait" << "Landscape reversed" << "Portrait reversed", + QList() << 1 << 2 << 3 << 4); // Debug MenuTree* debugMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Debug")); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 0d4700fc5f..95df4e9b11 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -80,7 +80,7 @@ private slots: void runAct(); void pauseAct(); void resetAct(); - void runonloadAct(); + void displayRotationGroup_triggered(QAction *action) { g_Config.iInternalScreenRotation = action->data().toInt(); } // Debug void breakonloadAct(); @@ -177,7 +177,8 @@ private: *textureScalingLevelGroup, *textureScalingTypeGroup, *screenScalingFilterGroup, *textureFilteringGroup, *frameSkippingTypeGroup, *frameSkippingGroup, - *renderingModeGroup, *renderingResolutionGroup; + *renderingModeGroup, *renderingResolutionGroup, + *displayRotationGroup; std::queue msgQueue_; std::mutex msgMutex_; From b0dabc6a4054018bda6943ea5c82a26d218d57ae Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Sun, 12 Apr 2020 20:12:42 +0300 Subject: [PATCH 5/8] Update "File" menu to match Windows version --- Qt/mainwindow.cpp | 35 ++++++++++++++++++++++++++++------- Qt/mainwindow.h | 6 ++++-- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 7103290f1d..19aae31082 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -80,6 +80,13 @@ void MainWindow::newFrame() void MainWindow::updateMenus() { + foreach(QAction * action, saveStateGroup->actions()) { + if (g_Config.iCurrentStateSlot == action->data().toInt()) { + action->setChecked(true); + break; + } + } + foreach(QAction * action, displayRotationGroup->actions()) { if (g_Config.iInternalScreenRotation == action->data().toInt()) { action->setChecked(true); @@ -165,7 +172,7 @@ void MainWindow::bootDone() } /* SIGNALS */ -void MainWindow::openAct() +void MainWindow::loadAct() { QString filename = QFileDialog::getOpenFileName(NULL, "Load File", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.prx)"); if (QFile::exists(filename)) @@ -184,6 +191,13 @@ void MainWindow::closeAct() SetGameTitle(""); } +void MainWindow::openmsAct() +{ + QString confighome = getenv("XDG_CONFIG_HOME"); + QString memorystick = confighome + "/ppsspp/PSP"; + QDesktopServices::openUrl(QUrl(memorystick)); +} + void SaveStateActionFinished(SaveState::Status status, const std::string &message, void *userdata) { // TODO: Improve messaging? @@ -508,21 +522,28 @@ void MainWindow::createMenus() { // File MenuTree* fileMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&File")); - fileMenu->add(new MenuAction(this, SLOT(openAct()), QT_TR_NOOP("&Open..."), QKeySequence::Open)) + fileMenu->add(new MenuAction(this, SLOT(loadAct()), QT_TR_NOOP("&Load..."))) ->addEnableState(UISTATE_MENU); fileMenu->add(new MenuAction(this, SLOT(closeAct()), QT_TR_NOOP("&Close"), QKeySequence::Close)) ->addDisableState(UISTATE_MENU); fileMenu->addSeparator(); - fileMenu->add(new MenuAction(this, SLOT(qlstateAct()), QT_TR_NOOP("Quickload State"), Qt::Key_F4)) + fileMenu->add(new MenuAction(this, SLOT(openmsAct()), QT_TR_NOOP("Open &Memory stick"))) + ->addEnableState(UISTATE_MENU); + fileMenu->addSeparator(); + MenuTree* savestateMenu = new MenuTree(this, fileMenu, QT_TR_NOOP("Saves&tate slot")); + saveStateGroup = new MenuActionGroup(this, savestateMenu, SLOT(saveStateGroup_triggered(QAction *)), + QStringList() << "1" << "2" << "3" << "4" << "5", + QList() << 0 << 1 << 2 << 3 << 4); + fileMenu->add(new MenuAction(this, SLOT(qlstateAct()), QT_TR_NOOP("L&oad state"), Qt::Key_F4)) ->addDisableState(UISTATE_MENU); - fileMenu->add(new MenuAction(this, SLOT(qsstateAct()), QT_TR_NOOP("Quicksave State"), Qt::Key_F2)) + fileMenu->add(new MenuAction(this, SLOT(qsstateAct()), QT_TR_NOOP("S&ave state"), Qt::Key_F2)) ->addDisableState(UISTATE_MENU); - fileMenu->add(new MenuAction(this, SLOT(lstateAct()), QT_TR_NOOP("&Load State File..."))) + fileMenu->add(new MenuAction(this, SLOT(lstateAct()), QT_TR_NOOP("&Load state file..."))) ->addDisableState(UISTATE_MENU); - fileMenu->add(new MenuAction(this, SLOT(sstateAct()), QT_TR_NOOP("&Save State File..."))) + fileMenu->add(new MenuAction(this, SLOT(sstateAct()), QT_TR_NOOP("&Save state file..."))) ->addDisableState(UISTATE_MENU); fileMenu->addSeparator(); - fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), QKeySequence::Quit)); + fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), Qt::ALT + Qt::Key_F4)); // Emulation MenuTree* emuMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Emulation")); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 95df4e9b11..6d2b1755cc 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -68,8 +68,10 @@ public slots: private slots: // File - void openAct(); + void loadAct(); void closeAct(); + void openmsAct(); + void saveStateGroup_triggered(QAction *action) { g_Config.iCurrentStateSlot = action->data().toInt(); } void qlstateAct(); void qsstateAct(); void lstateAct(); @@ -178,7 +180,7 @@ private: *screenScalingFilterGroup, *textureFilteringGroup, *frameSkippingTypeGroup, *frameSkippingGroup, *renderingModeGroup, *renderingResolutionGroup, - *displayRotationGroup; + *displayRotationGroup, *saveStateGroup; std::queue msgQueue_; std::mutex msgMutex_; From 7545d4456e739cdee1c7e5aeda61e17f97277f93 Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Mon, 13 Apr 2020 01:48:19 +0300 Subject: [PATCH 6/8] Fixes (stage 1) --- Core/Config.cpp | 2 +- Qt/mainwindow.cpp | 18 ++++------------- Qt/mainwindow.h | 51 +++++++++++++++++++++++++++++++++++------------ 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 4096e3ca41..1f7b23e36a 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -423,7 +423,7 @@ static ConfigSetting generalSettings[] = { ConfigSetting("FirstRun", &g_Config.bFirstRun, true), ConfigSetting("RunCount", &g_Config.iRunCount, 0), ConfigSetting("Enable Logging", &g_Config.bEnableLogging, true), - ConfigSetting("AutoRun", &g_Config.bAutoRun, true), + ConfigSetting("AutoRun", &g_Config.bAutoRun, false), ConfigSetting("Browse", &g_Config.bBrowse, false), ConfigSetting("IgnoreBadMemAccess", &g_Config.bIgnoreBadMemAccess, true, true), ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""), diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 19aae31082..ab75707238 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -522,7 +522,7 @@ void MainWindow::createMenus() { // File MenuTree* fileMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&File")); - fileMenu->add(new MenuAction(this, SLOT(loadAct()), QT_TR_NOOP("&Load..."))) + fileMenu->add(new MenuAction(this, SLOT(loadAct()), QT_TR_NOOP("&Load..."), QKeySequence::Open)) ->addEnableState(UISTATE_MENU); fileMenu->add(new MenuAction(this, SLOT(closeAct()), QT_TR_NOOP("&Close"), QKeySequence::Close)) ->addDisableState(UISTATE_MENU); @@ -543,7 +543,7 @@ void MainWindow::createMenus() fileMenu->add(new MenuAction(this, SLOT(sstateAct()), QT_TR_NOOP("&Save state file..."))) ->addDisableState(UISTATE_MENU); fileMenu->addSeparator(); - fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), Qt::ALT + Qt::Key_F4)); + fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), QKeySequence::Quit)); // Emulation MenuTree* emuMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Emulation")); @@ -569,9 +569,9 @@ void MainWindow::createMenus() ->addDisableState(UISTATE_MENU); debugMenu->add(new MenuAction(this, SLOT(smapAct()), QT_TR_NOOP("&Save MAP file..."))) ->addDisableState(UISTATE_MENU); - debugMenu->add(new MenuAction(this, SLOT(lmapAct()), QT_TR_NOOP("Lo&ad SYM file..."))) + debugMenu->add(new MenuAction(this, SLOT(lsymAct()), QT_TR_NOOP("Lo&ad SYM file..."))) ->addDisableState(UISTATE_MENU); - debugMenu->add(new MenuAction(this, SLOT(smapAct()), QT_TR_NOOP("Sav&e SYM file..."))) + debugMenu->add(new MenuAction(this, SLOT(ssymAct()), 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); @@ -588,10 +588,6 @@ void MainWindow::createMenus() // Game settings MenuTree* gameSettingsMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Game settings")); - gameSettingsMenu->add(new MenuAction(this, SLOT(keepOnTopAct()), QT_TR_NOOP("&Keep PPSSPP on top"))) - ->addEventChecked(&g_Config.bTopMost); - gameSettingsMenu->add(new MenuAction(this, SLOT(pauseWhenNotFocusedAct()), QT_TR_NOOP("&Pause when not focused"))) - ->addEventChecked(&g_Config.bPauseOnLostFocus); gameSettingsMenu->add(new MenuAction(this, SLOT(languageAct()), QT_TR_NOOP("La&nguage..."))); gameSettingsMenu->add(new MenuAction(this, SLOT(controlMappingAct()), QT_TR_NOOP("C&ontrol mapping..."))); gameSettingsMenu->add(new MenuAction(this, SLOT(displayLayoutEditorAct()), QT_TR_NOOP("Display layout editor..."))); @@ -603,12 +599,6 @@ void MainWindow::createMenus() gameSettingsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("Fu&llscreen"), QKeySequence::FullScreen)) #endif ->addEventChecked(&g_Config.bFullScreen); - gameSettingsMenu->add(new MenuAction(this, SLOT(VSyncAct()), QT_TR_NOOP("VS&ync"))) - ->addEventChecked(&g_Config.bVSync); - MenuTree* postprocessingShaderMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Postprocessin&g shader")); - postprocessingShaderGroup = new MenuActionGroup(this, postprocessingShaderMenu, SLOT(postprocessingShaderGroup_triggered(QAction *)), - QStringList() << "Off" << "FXAA Antialiasing" << "CRT scanlines" << "Natural Colors" << "Natural Colors (no blur)" << "Vignette" << "Grayscale" << "Bloom" << "Sharpen" << "Inverse Colors" << "Scanlines (CRT)" << "Cartoon" << "4xHQ GLSL" << "AA-Color" << "Spline36 Upscaler" << "5xBR" << "5xBR-lv2" << "Video Smoothing AA" << "Super Sampling AA (Gauss)", - QList() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18); MenuTree* renderingResolutionMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Rendering resolution")); renderingResolutionGroup = new MenuActionGroup(this, renderingResolutionMenu, SLOT(renderingResolutionGroup_triggered(QAction *)), QStringList() << "&Auto" << "&1x" << "&2x" << "&3x" << "&4x" << "&5x" << "&6x" << "&7x" << "&8x" << "&9x" << "1&0x", diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 6d2b1755cc..d35e9e0a5d 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -97,8 +97,6 @@ private slots: void consoleAct(); // Game settings - void keepOnTopAct() { g_Config.bTopMost = !g_Config.bTopMost; } - void pauseWhenNotFocusedAct() { g_Config.bPauseOnLostFocus = !g_Config.bPauseOnLostFocus; } void languageAct() { NativeMessageReceived("language screen", ""); } void controlMappingAct() { NativeMessageReceived("control mapping", ""); } void displayLayoutEditorAct() { NativeMessageReceived("display layout editor", ""); } @@ -110,23 +108,47 @@ private slots: } void linearAct() { g_Config.iTexFiltering = (g_Config.iTexFiltering != 0) ? 0 : 3; } - void postprocessingShaderGroup_triggered(QAction *action) { g_Config.sPostShaderName = action->data().toInt(); } - void renderingResolutionGroup_triggered(QAction *action) { g_Config.iInternalResolution = action->data().toInt(); } + void renderingResolutionGroup_triggered(QAction *action) { + g_Config.iInternalResolution = action->data().toInt(); + NativeMessageReceived("gpu_resized", ""); + if (g_Config.iTexScalingLevel == TEXSCALING_AUTO) { + NativeMessageReceived("gpu_clearCache", ""); + } + } void windowGroup_triggered(QAction *action) { SetWindowScale(action->data().toInt()); } void displayLayoutGroup_triggered(QAction *action) { g_Config.iSmallDisplayZoomType = action->data().toInt(); NativeMessageReceived("gpu_resized", ""); } - void renderingModeGroup_triggered(QAction *action) { g_Config.iRenderingMode = action->data().toInt(); } - void autoframeskipAct() { g_Config.bAutoFrameSkip = !g_Config.bAutoFrameSkip; } + void renderingModeGroup_triggered(QAction *action) { + g_Config.iRenderingMode = action->data().toInt(); + g_Config.bAutoFrameSkip = false; + NativeMessageReceived("gpu_resized", ""); + } + void autoframeskipAct() { + g_Config.bAutoFrameSkip = !g_Config.bAutoFrameSkip; + if (g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) { + g_Config.iRenderingMode = FB_BUFFERED_MODE; + NativeMessageReceived("gpu_resized", ""); + } + } void frameSkippingGroup_triggered(QAction *action) { g_Config.iFrameSkip = action->data().toInt(); } void frameSkippingTypeGroup_triggered(QAction *action) { g_Config.iFrameSkipType = action->data().toInt(); } void textureFilteringGroup_triggered(QAction *action) { g_Config.iTexFiltering = action->data().toInt(); } void screenScalingFilterGroup_triggered(QAction *action) { g_Config.iBufFilter = action->data().toInt(); } - void textureScalingLevelGroup_triggered(QAction *action) { g_Config.iTexScalingLevel = action->data().toInt(); } - void textureScalingTypeGroup_triggered(QAction *action) { g_Config.iTexScalingType = action->data().toInt(); } - void deposterizeAct() { g_Config.bTexDeposterize = !g_Config.bTexDeposterize; } + void textureScalingLevelGroup_triggered(QAction *action) { + g_Config.iTexScalingLevel = action->data().toInt(); + NativeMessageReceived("gpu_clearCache", ""); + } + void textureScalingTypeGroup_triggered(QAction *action) { + g_Config.iTexScalingType = action->data().toInt(); + NativeMessageReceived("gpu_clearCache", ""); + } + void deposterizeAct() { + g_Config.bTexDeposterize = !g_Config.bTexDeposterize; + NativeMessageReceived("gpu_clearCache", ""); + } void transformAct() { g_Config.bHardwareTransform = !g_Config.bHardwareTransform; NativeMessageReceived("gpu_resized", ""); @@ -136,7 +158,11 @@ private slots: void frameskipTypeAct() { g_Config.iFrameSkipType = !g_Config.iFrameSkipType; } // Sound - void audioAct() { g_Config.bEnableSound = !g_Config.bEnableSound; } + void audioAct() { + g_Config.bEnableSound = !g_Config.bEnableSound; + if (PSP_IsInited() && !IsAudioInitialised()) + Audio_Init(); + } // Cheats void cheatsAct() { g_Config.bEnableCheats = !g_Config.bEnableCheats; } @@ -147,8 +173,7 @@ private slots: g_Config.bShowDebugStats = !g_Config.bShowDebugStats; NativeMessageReceived("clear jit", ""); } - void VSyncAct() { g_Config.bVSync = !g_Config.bVSync; } - void showFPSAct() { g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter; } + void showFPSAct() { g_Config.iShowFPSCounter = g_Config.iShowFPSCounter ? 0 : 3; } // 3 = both speed and FPS // Help void websiteAct(); @@ -175,7 +200,7 @@ private: CoreState nextState; GlobalUIState lastUIState; - QActionGroup *windowGroup, *postprocessingShaderGroup, + QActionGroup *windowGroup, *textureScalingLevelGroup, *textureScalingTypeGroup, *screenScalingFilterGroup, *textureFilteringGroup, *frameSkippingTypeGroup, *frameSkippingGroup, From 90447a7fba5069b78e4558b840e99f860d29a5ea Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Mon, 13 Apr 2020 14:40:47 +0300 Subject: [PATCH 7/8] Fixes (stage 2) --- Core/Config.cpp | 2 +- Qt/mainwindow.cpp | 2 +- Qt/mainwindow.h | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 1f7b23e36a..4096e3ca41 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -423,7 +423,7 @@ static ConfigSetting generalSettings[] = { ConfigSetting("FirstRun", &g_Config.bFirstRun, true), ConfigSetting("RunCount", &g_Config.iRunCount, 0), ConfigSetting("Enable Logging", &g_Config.bEnableLogging, true), - ConfigSetting("AutoRun", &g_Config.bAutoRun, false), + ConfigSetting("AutoRun", &g_Config.bAutoRun, true), ConfigSetting("Browse", &g_Config.bBrowse, false), ConfigSetting("IgnoreBadMemAccess", &g_Config.bIgnoreBadMemAccess, true, true), ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""), diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index ab75707238..33c814a89b 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -561,7 +561,7 @@ void MainWindow::createMenus() // Debug 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); + ->addEventUnchecked(&g_Config.bAutoRun); debugMenu->add(new MenuAction(this, SLOT(ignoreIllegalAct()), QT_TR_NOOP("&Ignore illegal reads/writes"))) ->addEventChecked(&g_Config.bIgnoreBadMemAccess); debugMenu->addSeparator(); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index d35e9e0a5d..1841345591 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -113,7 +113,7 @@ private slots: NativeMessageReceived("gpu_resized", ""); if (g_Config.iTexScalingLevel == TEXSCALING_AUTO) { NativeMessageReceived("gpu_clearCache", ""); - } + } } void windowGroup_triggered(QAction *action) { SetWindowScale(action->data().toInt()); } @@ -131,7 +131,7 @@ private slots: if (g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) { g_Config.iRenderingMode = FB_BUFFERED_MODE; NativeMessageReceived("gpu_resized", ""); - } + } } void frameSkippingGroup_triggered(QAction *action) { g_Config.iFrameSkip = action->data().toInt(); } void frameSkippingTypeGroup_triggered(QAction *action) { g_Config.iFrameSkipType = action->data().toInt(); } @@ -233,7 +233,7 @@ public: } // Add to QActionGroup MenuAction(QWidget* parent, QActionGroup* group, QVariant data, QString text, QKeySequence key = 0) : - QAction(parent), _eventCheck(0), _stateEnable(-1), _stateDisable(-1), _enableStepping(false) + QAction(parent), _eventCheck(0), _eventUncheck(0), _stateEnable(-1), _stateDisable(-1), _enableStepping(false) { this->setCheckable(true); this->setData(data); @@ -254,6 +254,11 @@ public: this->setCheckable(true); _eventCheck = (bool*)event; } + // Event which causes it to be unchecked + void addEventUnchecked(bool* event) { + this->setCheckable(true); + _eventUncheck = event; + } // UI State which causes it to be enabled void addEnableState(int state) { _stateEnable = state; @@ -272,6 +277,8 @@ public slots: void update() { if (_eventCheck) setChecked(*_eventCheck); + if (_eventUncheck) + setChecked(false); if (_stateEnable >= 0) setEnabled(GetUIState() == _stateEnable); if (_stateDisable >= 0) @@ -282,6 +289,7 @@ public slots: private: const char *_text; bool *_eventCheck; + bool *_eventUncheck; int _stateEnable, _stateDisable; bool _enableStepping; }; From bce7177520271ef071e809d5d22d9f4b42e9c286 Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Tue, 14 Apr 2020 04:24:30 +0300 Subject: [PATCH 8/8] Fixes (stage 3) --- Qt/mainwindow.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 1841345591..60f6ea57e7 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -19,6 +19,12 @@ extern bool g_TakeScreenshot; class MenuAction; class MenuTree; +enum { + FB_NON_BUFFERED_MODE = 0, + FB_BUFFERED_MODE = 1, + TEXSCALING_AUTO = 0, +}; + // hacky, should probably use qt signals or something, but whatever.. enum class MainWindowMsg { BOOT_DONE, @@ -221,7 +227,7 @@ class MenuAction : public QAction public: // Add to QMenu MenuAction(QWidget* parent, const char *callback, const char *text, QKeySequence key = 0) : - QAction(parent), _text(text), _eventCheck(0), _stateEnable(-1), _stateDisable(-1), _enableStepping(false) + QAction(parent), _text(text), _eventCheck(0), _eventUncheck(0), _stateEnable(-1), _stateDisable(-1), _enableStepping(false) { if (key != (QKeySequence)0) { this->setShortcut(key); @@ -278,7 +284,7 @@ public slots: if (_eventCheck) setChecked(*_eventCheck); if (_eventUncheck) - setChecked(false); + setChecked(!*_eventUncheck); if (_stateEnable >= 0) setEnabled(GetUIState() == _stateEnable); if (_stateDisable >= 0)