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 01/19] 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 02/19] 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 03/19] 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 04/19] 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 05/19] 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 06/19] 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 fe5b06cc17eccd81630f47044dd4911a6ca32c40 Mon Sep 17 00:00:00 2001 From: NR74W <62298614+NR74W@users.noreply.github.com> Date: Mon, 13 Apr 2020 03:32:03 +0200 Subject: [PATCH 07/19] Add option to prevent Mipmaps from being dumped --- Core/TextureReplacer.cpp | 5 +++++ Core/TextureReplacer.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index 1c1270d894..7ad5ac246e 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -80,6 +80,7 @@ bool TextureReplacer::LoadIni() { allowVideo_ = false; ignoreAddress_ = false; reduceHash_ = false; + disallowMipmap_ = false; if (File::Exists(basePath_ + INI_FILENAME)) { IniFile ini; @@ -128,6 +129,7 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, bool isOverride) { options->Get("ignoreAddress", &ignoreAddress_, ignoreAddress_); // Multiplies sizeInRAM/bytesPerLine in XXHASH by 0.5. options->Get("reduceHash", &reduceHash_, reduceHash_); + options->Get("disallowMipmap", &disallowMipmap_, disallowMipmap_); if (reduceHash_ && hash_ == ReplacedTextureHash::QUICK) { reduceHash_ = false; ERROR_LOG(G3D, "Texture Replacement: reduceHash option requires safer hash, use xxh32 or xxh64 instead."); @@ -411,6 +413,9 @@ void TextureReplacer::NotifyTextureDecoded(const ReplacedTextureDecodeInfo &repl if (ignoreAddress_) { cachekey = cachekey & 0xFFFFFFFFULL; } + if (disallowMipmap_ && level > 0) { + return; + } std::string hashfile = LookupHashFile(cachekey, replacedInfo.hash, level); const std::string filename = basePath_ + hashfile; diff --git a/Core/TextureReplacer.h b/Core/TextureReplacer.h index 35e3c22a1a..5035251cd5 100644 --- a/Core/TextureReplacer.h +++ b/Core/TextureReplacer.h @@ -203,6 +203,7 @@ protected: bool allowVideo_ = false; bool ignoreAddress_ = false; bool reduceHash_ = false; + bool disallowMipmap_ = false; std::string gameID_; std::string basePath_; ReplacedTextureHash hash_ = ReplacedTextureHash::QUICK; From 68406b97b012e023cab690e7ae0eb506188c7621 Mon Sep 17 00:00:00 2001 From: jlx78520 Date: Mon, 13 Apr 2020 12:10:10 +0300 Subject: [PATCH 08/19] #8714 Unified resolution scaling for all platforms. --- UI/GameSettingsScreen.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index d0ced2f2e5..c597a68394 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -314,11 +314,7 @@ void GameSettingsScreen::CreateViews() { #endif graphicsSettings->Add(new ItemHeader(gr->T("Performance"))); -#ifndef MOBILE_DEVICE static const char *internalResolutions[] = { "Auto (1:1)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP", "6x PSP", "7x PSP", "8x PSP", "9x PSP", "10x PSP" }; -#else - static const char *internalResolutions[] = { "Auto (1:1)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; -#endif resolutionChoice_ = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iInternalResolution, gr->T("Rendering Resolution"), internalResolutions, 0, ARRAY_SIZE(internalResolutions), gr->GetName(), screenManager())); resolutionChoice_->OnChoice.Handle(this, &GameSettingsScreen::OnResolutionChange); resolutionChoice_->SetEnabledFunc([] { 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 09/19] 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 221eec5899e13ae668f6d9119199ae2667dc19de Mon Sep 17 00:00:00 2001 From: NR74W <62298614+NR74W@users.noreply.github.com> Date: Mon, 13 Apr 2020 16:29:07 +0200 Subject: [PATCH 10/19] Update TextureReplacer.cpp Correction. --- Core/TextureReplacer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index 7ad5ac246e..ac5a9a62f0 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -80,7 +80,8 @@ bool TextureReplacer::LoadIni() { allowVideo_ = false; ignoreAddress_ = false; reduceHash_ = false; - disallowMipmap_ = false; + // Prevents dumping the mipmaps. + ignoreMipmap_ = false; if (File::Exists(basePath_ + INI_FILENAME)) { IniFile ini; @@ -129,7 +130,7 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, bool isOverride) { options->Get("ignoreAddress", &ignoreAddress_, ignoreAddress_); // Multiplies sizeInRAM/bytesPerLine in XXHASH by 0.5. options->Get("reduceHash", &reduceHash_, reduceHash_); - options->Get("disallowMipmap", &disallowMipmap_, disallowMipmap_); + options->Get("ignoreMipmap", &ignoreMipmap_, ignoreMipmap_); if (reduceHash_ && hash_ == ReplacedTextureHash::QUICK) { reduceHash_ = false; ERROR_LOG(G3D, "Texture Replacement: reduceHash option requires safer hash, use xxh32 or xxh64 instead."); @@ -413,7 +414,7 @@ void TextureReplacer::NotifyTextureDecoded(const ReplacedTextureDecodeInfo &repl if (ignoreAddress_) { cachekey = cachekey & 0xFFFFFFFFULL; } - if (disallowMipmap_ && level > 0) { + if (ignoreMipmap_ && level > 0) { return; } From 113c5f3b5fc5c89bdbe7625a2b21b6275c5cc486 Mon Sep 17 00:00:00 2001 From: NR74W <62298614+NR74W@users.noreply.github.com> Date: Mon, 13 Apr 2020 16:29:17 +0200 Subject: [PATCH 11/19] Update TextureReplacer.h Correction. --- Core/TextureReplacer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/TextureReplacer.h b/Core/TextureReplacer.h index 5035251cd5..a79d7b6c31 100644 --- a/Core/TextureReplacer.h +++ b/Core/TextureReplacer.h @@ -203,7 +203,7 @@ protected: bool allowVideo_ = false; bool ignoreAddress_ = false; bool reduceHash_ = false; - bool disallowMipmap_ = false; + bool ignoreMipmap_ = false; std::string gameID_; std::string basePath_; ReplacedTextureHash hash_ = ReplacedTextureHash::QUICK; 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 12/19] 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) From c70bf66634828aef875716587b80563c671af48a Mon Sep 17 00:00:00 2001 From: iota97 Date: Tue, 24 Mar 2020 15:43:19 +0100 Subject: [PATCH 13/19] Auto rotate over a square --- UI/EmuScreen.cpp | 9 +++++---- UI/GamepadEmu.cpp | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 2bdb212a3f..b150a4b098 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1186,12 +1186,13 @@ void EmuScreen::update() { if (autoRotatingAnalogCW_) { const float now = time_now_d(); - __CtrlSetAnalogX(cos(now*-g_Config.fAnalogAutoRotSpeed), 0); - __CtrlSetAnalogY(sin(now*-g_Config.fAnalogAutoRotSpeed), 0); + // Clamp to a square + __CtrlSetAnalogX(std::min(1.0f, std::max(-1.0f, 1.42f*cosf(now*-g_Config.fAnalogAutoRotSpeed))), 0); + __CtrlSetAnalogY(std::min(1.0f, std::max(-1.0f, 1.42f*sinf(now*-g_Config.fAnalogAutoRotSpeed))), 0); } else if (autoRotatingAnalogCCW_) { const float now = time_now_d(); - __CtrlSetAnalogX(cos(now*g_Config.fAnalogAutoRotSpeed), 0); - __CtrlSetAnalogY(sin(now*g_Config.fAnalogAutoRotSpeed), 0); + __CtrlSetAnalogX(std::min(1.0f, std::max(-1.0f, 1.42f*cosf(now*g_Config.fAnalogAutoRotSpeed))), 0); + __CtrlSetAnalogY(std::min(1.0f, std::max(-1.0f, 1.42f*sinf(now*g_Config.fAnalogAutoRotSpeed))), 0); } // This is here to support the iOS on screen back button. diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index 312f488b57..4ea9a6d7a7 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -202,8 +202,9 @@ void AnalogRotationButton::Update() { if (autoRotating_) { float speed = clockWise_ ? -g_Config.fAnalogAutoRotSpeed : g_Config.fAnalogAutoRotSpeed; - __CtrlSetAnalogX(cos(now*speed), 0); - __CtrlSetAnalogY(sin(now*speed), 0); + // Clamp to a square + __CtrlSetAnalogX(std::min(1.0f, std::max(-1.0f, 1.42f*cosf(now*speed))), 0); + __CtrlSetAnalogY(std::min(1.0f, std::max(-1.0f, 1.42f*sinf(now*speed))), 0); } } From 13f5d3f73fe480c52341cc4f9b38efec4c672678 Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:16:14 +0300 Subject: [PATCH 14/19] Add "Enable chat" menu point to Linux version --- Qt/mainwindow.cpp | 2 ++ Qt/mainwindow.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 33c814a89b..31f72c2a63 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -657,6 +657,8 @@ void MainWindow::createMenus() gameSettingsMenu->addSeparator(); gameSettingsMenu->add(new MenuAction(this, SLOT(cheatsAct()), QT_TR_NOOP("Enable &cheats"), Qt::CTRL + Qt::Key_T)) ->addEventChecked(&g_Config.bEnableCheats); + gameSettingsMenu->addSeparator(); + gameSettingsMenu->add(new MenuAction(this, SLOT(chatAct()), QT_TR_NOOP("Enable chat"), Qt::CTRL + Qt::Key_C)); // Help MenuTree* helpMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Help")); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 60f6ea57e7..2da0f8e37a 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -173,6 +173,9 @@ private slots: // Cheats void cheatsAct() { g_Config.bEnableCheats = !g_Config.bEnableCheats; } + // Chat + void chatAct() { NativeMessageReceived("chat screen", ""); } + void fullscrAct(); void raiseTopMost(); void statsAct() { From d036717e083e5b660343216bf911d83b71a28dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 16 Apr 2020 10:07:55 +0200 Subject: [PATCH 15/19] TextureReplacer: Generate a default value in the ini files for ignoreMipmap. --- Core/TextureReplacer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index ac5a9a62f0..1d66d5b9d5 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -693,6 +693,8 @@ bool TextureReplacer::GenerateIni(const std::string &gameID, std::string *genera fs << "[options]\n"; fs << "version = 1\n"; fs << "hash = quick\n"; + fs << "ignoreMipmap = false\n"; + fs << "\n"; fs << "[games]\n"; fs << "# Used to make it easier to install, and override settings for other regions.\n"; fs << "# Files still have to be copied to each TEXTURES folder."; From 40e8c9163a6c697b8ac8ca0bc9c0fbccc30ece6c Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Thu, 16 Apr 2020 17:14:56 +0300 Subject: [PATCH 16/19] Add "Record" menu group to Linux version --- Qt/mainwindow.cpp | 35 ++++++++++++++++++++++++++++++++++- Qt/mainwindow.h | 4 ++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 31f72c2a63..820bdd4cc5 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -253,6 +253,26 @@ void MainWindow::sstateAct() } } +void MainWindow::recordDisplayAct() +{ + g_Config.bDumpFrames = !g_Config.bDumpFrames; +} + +void MainWindow::useLosslessVideoCodecAct() +{ + g_Config.bUseFFV1 = !g_Config.bUseFFV1; +} + +void MainWindow::useOutputBufferAct() +{ + g_Config.bDumpVideoOutput = !g_Config.bDumpVideoOutput; +} + +void MainWindow::recordAudioAct() +{ + g_Config.bDumpAudio = !g_Config.bDumpAudio; +} + void MainWindow::exitAct() { closeAct(); @@ -527,7 +547,7 @@ void MainWindow::createMenus() fileMenu->add(new MenuAction(this, SLOT(closeAct()), QT_TR_NOOP("&Close"), QKeySequence::Close)) ->addDisableState(UISTATE_MENU); fileMenu->addSeparator(); - fileMenu->add(new MenuAction(this, SLOT(openmsAct()), QT_TR_NOOP("Open &Memory stick"))) + 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")); @@ -542,6 +562,19 @@ void MainWindow::createMenus() ->addDisableState(UISTATE_MENU); fileMenu->add(new MenuAction(this, SLOT(sstateAct()), QT_TR_NOOP("&Save state file..."))) ->addDisableState(UISTATE_MENU); + MenuTree* recordMenu = new MenuTree(this, fileMenu, QT_TR_NOOP("&Record")); + recordMenu->add(new MenuAction(this, SLOT(recordDisplayAct()), QT_TR_NOOP("Record &display"))) + ->addEventChecked(&g_Config.bDumpFrames); + recordMenu->add(new MenuAction(this, SLOT(useLosslessVideoCodecAct()), QT_TR_NOOP("&Use lossless video codec (FFV1)"))) + ->addEventChecked(&g_Config.bUseFFV1); + recordMenu->add(new MenuAction(this, SLOT(useOutputBufferAct()), QT_TR_NOOP("Use output buffer for video"))) + ->addEventChecked(&g_Config.bDumpVideoOutput); + /*recordGroup = new MenuActionGroup(this, recordMenu, SLOT(recordGroup_triggered(QAction *)), + QStringList() << "Record &display" << "&Use lossless video codec (FFV1)" << "Use output buffer for video", + QList() << 0 << 1 << 2);*/ + recordMenu->addSeparator(); + recordMenu->add(new MenuAction(this, SLOT(recordAudioAct()), QT_TR_NOOP("Record &audio"))) + ->addEventChecked(&g_Config.bDumpAudio); fileMenu->addSeparator(); fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), QKeySequence::Quit)); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 2da0f8e37a..be05d319be 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -82,6 +82,10 @@ private slots: void qsstateAct(); void lstateAct(); void sstateAct(); + void recordDisplayAct(); + void useLosslessVideoCodecAct(); + void useOutputBufferAct(); + void recordAudioAct(); void exitAct(); // Emulation From 9ec3ea8550f236d8ec3eaba017c141ae88c447bd Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Thu, 16 Apr 2020 17:17:18 +0300 Subject: [PATCH 17/19] Remove leftovers --- Qt/mainwindow.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 820bdd4cc5..569c634d48 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -569,9 +569,6 @@ void MainWindow::createMenus() ->addEventChecked(&g_Config.bUseFFV1); recordMenu->add(new MenuAction(this, SLOT(useOutputBufferAct()), QT_TR_NOOP("Use output buffer for video"))) ->addEventChecked(&g_Config.bDumpVideoOutput); - /*recordGroup = new MenuActionGroup(this, recordMenu, SLOT(recordGroup_triggered(QAction *)), - QStringList() << "Record &display" << "&Use lossless video codec (FFV1)" << "Use output buffer for video", - QList() << 0 << 1 << 2);*/ recordMenu->addSeparator(); recordMenu->add(new MenuAction(this, SLOT(recordAudioAct()), QT_TR_NOOP("Record &audio"))) ->addEventChecked(&g_Config.bDumpAudio); From cd4dd73a8aa783ccb5186bdde321355b5ff34e43 Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Thu, 16 Apr 2020 19:49:18 +0300 Subject: [PATCH 18/19] Update more Linux version menu points to correspond to Windows ones --- Qt/mainwindow.cpp | 18 +++++++++++------- Qt/mainwindow.h | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 569c634d48..5d0d6beed8 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -27,7 +27,7 @@ MainWindow::MainWindow(QWidget *parent, bool fullscreen) : // Move window to the center of selected screen QRect rect = desktop->screenGeometry(screenNum); - move((rect.width()-frameGeometry().width()) / 4, (rect.height()-frameGeometry().height()) / 4); + move((rect.width() - frameGeometry().width()) / 4, (rect.height() - frameGeometry().height()) / 4); setWindowIcon(QIcon(qApp->applicationDirPath() + "/assets/icon_regular_72.png")); @@ -289,6 +289,12 @@ void MainWindow::pauseAct() NativeMessageReceived("pause", ""); } +void MainWindow::stopAct() +{ + Core_Stop(); + NativeMessageReceived("stop", ""); +} + void MainWindow::resetAct() { updateMenus(); @@ -544,8 +550,6 @@ void MainWindow::createMenus() MenuTree* fileMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&File")); 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); fileMenu->addSeparator(); fileMenu->add(new MenuAction(this, SLOT(openmsAct()), QT_TR_NOOP("Open &Memory Stick"))) ->addEnableState(UISTATE_MENU); @@ -577,11 +581,11 @@ void MainWindow::createMenus() // Emulation MenuTree* emuMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Emulation")); - emuMenu->add(new MenuAction(this, SLOT(runAct()), QT_TR_NOOP("&Run"), Qt::Key_F7)) - ->addEnableStepping()->addEnableState(UISTATE_PAUSEMENU); - emuMenu->add(new MenuAction(this, SLOT(pauseAct()), QT_TR_NOOP("&Pause"), Qt::Key_F8)) + emuMenu->add(new MenuAction(this, SLOT(pauseAct()), QT_TR_NOOP("&Pause"))) ->addEnableState(UISTATE_INGAME); - emuMenu->add(new MenuAction(this, SLOT(resetAct()), QT_TR_NOOP("Re&set"))) + emuMenu->add(new MenuAction(this, SLOT(stopAct()), QT_TR_NOOP("&Stop"), Qt::CTRL + Qt::Key_W)) + ->addEnableState(UISTATE_INGAME); + emuMenu->add(new MenuAction(this, SLOT(resetAct()), QT_TR_NOOP("R&eset"), Qt::CTRL + Qt::Key_B)) ->addEnableState(UISTATE_INGAME); MenuTree* displayRotationMenu = new MenuTree(this, emuMenu, QT_TR_NOOP("Display rotation")); displayRotationGroup = new MenuActionGroup(this, displayRotationMenu, SLOT(displayRotationGroup_triggered(QAction *)), diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index be05d319be..49112cd10d 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -91,6 +91,7 @@ private slots: // Emulation void runAct(); void pauseAct(); + void stopAct(); void resetAct(); void displayRotationGroup_triggered(QAction *action) { g_Config.iInternalScreenRotation = action->data().toInt(); } From e999444b2360abfc008f49b25e3e935091633fe1 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Sun, 12 Apr 2020 15:08:46 +0200 Subject: [PATCH 19/19] Implement PPSSPP specific cheats: 0xA0 vibration cheat(Xinput) Syntax is: 0xA0NNLLLL 0x00MMRRRR where NN/MM is time vibration lasts LLLL/RRRR is the vibration power 0xA1 read value for the vibration(Xinput) from game memory Syntax is: 0xA1000000 0xNNNNNNNN where NNNNNNNN is the address that stores following values at offset: 0xNNNNNNNN + 0x0 Left Vibration power, 0xNNNNNNNN + 0x2 Right Vibration Power 0xNNNNNNNN + 0x4 Left Vibration time 0xNNNNNNNN + 0x6 Right Vibration time Left some room for other PPSSPP specific cheats(0xA2-0xAF) --- Core/CwCheat.cpp | 55 +++++++++++++++++++++++++++++++++++++++ Core/CwCheat.h | 1 - Core/HLE/sceCtrl.cpp | 33 +++++++++++++++++++++++ Core/HLE/sceCtrl.h | 10 +++++++ Windows/XinputDevice.cpp | 56 ++++++++++++++++++++++++++++++++++++++-- Windows/XinputDevice.h | 7 +++-- 6 files changed, 157 insertions(+), 5 deletions(-) diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index 886b0acbb1..72be17f059 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -26,6 +26,8 @@ std::string gameTitle; std::string activeCheatFile; static CWCheatEngine *cheatEngine; static bool cheatsEnabled; +using namespace SceCtrl; + void hleCheat(u64 userdata, int cyclesLate); static inline std::string TrimString(const std::string &s) { @@ -412,6 +414,8 @@ enum class CheatOp { MultiWrite, CopyBytesFrom, + Vibration, + VibrationFromMemory, Delay, Assert, @@ -460,6 +464,12 @@ struct CheatOperation { int count; int type; } pointerCommands; + struct { + uint16_t vibrL; + uint16_t vibrR; + uint8_t vibrLTime; + uint8_t vibrRTime; + } vibrationValues; }; }; @@ -591,6 +601,25 @@ CheatOperation CWCheatEngine::InterpretNextCwCheat(const CheatCode &cheat, size_ } return { CheatOp::Invalid }; + case 0xA: // PPSSPP specific cheats + switch (line1.part1 >> 24 & 0xF) { + case 0x0: // 0x0 sets gamepad vibration by cheat parameters + { + CheatOperation op = { CheatOp::Vibration }; + op.vibrationValues.vibrL = line1.part1 & 0x0000FFFF; + op.vibrationValues.vibrR = line1.part2 & 0x0000FFFF; + op.vibrationValues.vibrLTime = (line1.part1 >> 16) & 0x000000FF; + op.vibrationValues.vibrRTime = (line1.part2 >> 16) & 0x000000FF; + return op; + } + case 0x1: // 0x1 reads value for gamepad vibration from memory + addr = line1.part2; + return { CheatOp::VibrationFromMemory, addr }; + // Place for other PPSSPP specific cheats + default: + return { CheatOp::Invalid }; + } + case 0xB: // Delay command. return { CheatOp::Delay, 0, 0, arg }; @@ -859,6 +888,32 @@ void CWCheatEngine::ExecuteOp(const CheatOperation &op, const CheatCode &cheat, } break; + case CheatOp::Vibration: + if (op.vibrationValues.vibrL > 0) { + SetLeftVibration(op.vibrationValues.vibrL); + SetVibrationLeftDropout(op.vibrationValues.vibrLTime); + } + if (op.vibrationValues.vibrR > 0) { + SetRightVibration(op.vibrationValues.vibrR); + SetVibrationRightDropout(op.vibrationValues.vibrRTime); + } + break; + + case CheatOp::VibrationFromMemory: + if (Memory::IsValidAddress(op.addr) && Memory::IsValidAddress(op.addr + 0x4)) { + uint16_t checkLeftVibration = Memory::Read_U16(op.addr); + uint16_t checkRightVibration = Memory::Read_U16(op.addr + 0x2); + if (checkLeftVibration > 0) { + SetLeftVibration(checkLeftVibration); + SetVibrationLeftDropout(Memory::Read_U8(op.addr + 0x4)); + } + if (checkRightVibration > 0) { + SetRightVibration(checkRightVibration); + SetVibrationRightDropout(Memory::Read_U8(op.addr + 0x6)); + } + } + break; + case CheatOp::Delay: // TODO: Not supported. break; diff --git a/Core/CwCheat.h b/Core/CwCheat.h index 882093db3d..a4a6ba47c2 100644 --- a/Core/CwCheat.h +++ b/Core/CwCheat.h @@ -44,7 +44,6 @@ public: void CreateCheatFile(); void Run(); bool HasCheats(); - void InvalidateICache(u32 addr, int size); private: u32 GetAddress(u32 value); diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index 79888ebea5..17ab7084cd 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -87,6 +87,12 @@ static std::mutex ctrlMutex; static int ctrlTimer = -1; +static u16 leftVibration = 0; +static u16 rightVibration = 0; +// The higher the dropout, the longer Vibration will run +static u8 vibrationLeftDropout = 160; +static u8 vibrationRightDropout = 160; + // STATE END ////////////////////////////////////////////////////////////////////////// @@ -288,6 +294,10 @@ static void __CtrlVblank() { emuRapidFireFrames++; + // Reduce gamepad Vibration by set % each frame + leftVibration *= (float)vibrationLeftDropout / 256.0f; + rightVibration *= (float)vibrationRightDropout / 256.0f; + // This always runs, so make sure we're in vblank mode. if (ctrlCycle == 0) __CtrlDoSample(); @@ -563,3 +573,26 @@ void Register_sceCtrl_driver() { RegisterModule("sceCtrl_driver", ARRAY_SIZE(sceCtrl), sceCtrl); } + +u16 sceCtrlGetRightVibration() { + return rightVibration; +} + +u16 sceCtrlGetLeftVibration() { + return leftVibration; +} + +namespace SceCtrl { + void SetRightVibration(u16 rVibration) { + rightVibration = rVibration; + } + void SetLeftVibration(u16 lVibration) { + leftVibration = lVibration; + } + void SetVibrationRightDropout(u8 vibrationRDropout) { + vibrationRightDropout = vibrationRDropout; + } + void SetVibrationLeftDropout(u8 vibrationLDropout) { + vibrationLeftDropout = vibrationLDropout; + } +} diff --git a/Core/HLE/sceCtrl.h b/Core/HLE/sceCtrl.h index 0c2d757dde..039b4e7404 100644 --- a/Core/HLE/sceCtrl.h +++ b/Core/HLE/sceCtrl.h @@ -87,3 +87,13 @@ void __CtrlPeekAnalog(int stick, float *x, float *y); u32 __CtrlReadLatch(); void Register_sceCtrl_driver(); + +u16 sceCtrlGetRightVibration(); +u16 sceCtrlGetLeftVibration(); + +namespace SceCtrl { + void SetLeftVibration(u16 lVibration); + void SetRightVibration(u16 rVibration); + void SetVibrationLeftDropout(u8 vibrationLDropout); + void SetVibrationRightDropout(u8 vibrationRDropout); +}; diff --git a/Windows/XinputDevice.cpp b/Windows/XinputDevice.cpp index c297533a18..7da92f221c 100644 --- a/Windows/XinputDevice.cpp +++ b/Windows/XinputDevice.cpp @@ -11,17 +11,23 @@ #include "input/input_state.h" #include "input/keycodes.h" #include "XinputDevice.h" +#include "Core/Core.h" +#include "Core/HLE/sceCtrl.h" +#include "Common/Timer.h" // Utilities to dynamically load XInput. Adapted from SDL. #if !PPSSPP_PLATFORM(UWP) typedef DWORD (WINAPI *XInputGetState_t) (DWORD dwUserIndex, XINPUT_STATE* pState); +typedef DWORD (WINAPI *XInputSetState_t) (DWORD dwUserIndex, XINPUT_VIBRATION* pVibration); static XInputGetState_t PPSSPP_XInputGetState = NULL; +static XInputSetState_t PPSSPP_XInputSetState = NULL; static DWORD PPSSPP_XInputVersion = 0; static HMODULE s_pXInputDLL = 0; static int s_XInputDLLRefCount = 0; +static int newVibrationTime = 0; static void UnloadXInputDLL(); @@ -65,6 +71,17 @@ static int LoadXInputDLL() { return -1; } + /* Let's try the name first, then fall back to a non-Ex version (xinput9_1_0.dll doesn't have Ex) */ + PPSSPP_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetStateEx"); + if (!PPSSPP_XInputSetState) { + PPSSPP_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState"); + } + + if (!PPSSPP_XInputSetState) { + UnloadXInputDLL(); + return -1; + } + return 0; } @@ -81,6 +98,7 @@ static void UnloadXInputDLL() { static int LoadXInputDLL() { return 0; } static void UnloadXInputDLL() {} #define PPSSPP_XInputGetState XInputGetState +#define PPSSPP_XInputSetState XInputSetState #endif #ifndef XUSER_MAX_COUNT @@ -231,11 +249,13 @@ int XinputDevice::UpdateState() { for (int i = 0; i < XUSER_MAX_COUNT; i++) { XINPUT_STATE state; ZeroMemory(&state, sizeof(XINPUT_STATE)); + XINPUT_VIBRATION vibration; + ZeroMemory(&vibration, sizeof(XINPUT_VIBRATION)); if (check_delay[i]-- > 0) continue; DWORD dwResult = PPSSPP_XInputGetState(i, &state); if (dwResult == ERROR_SUCCESS) { - UpdatePad(i, state); + UpdatePad(i, state, vibration); anySuccess = true; } else { check_delay[i] = 30; @@ -247,13 +267,14 @@ int XinputDevice::UpdateState() { return anySuccess ? UPDATESTATE_SKIP_PAD : 0; } -void XinputDevice::UpdatePad(int pad, const XINPUT_STATE &state) { +void XinputDevice::UpdatePad(int pad, const XINPUT_STATE &state, XINPUT_VIBRATION &vibration) { static bool notified = false; if (!notified) { notified = true; KeyMap::NotifyPadConnected("Xbox 360 Pad"); } ApplyButtons(pad, state); + ApplyVibration(pad, vibration); const float STICK_DEADZONE = g_Config.fXInputAnalogDeadzone; const int STICK_INV_MODE = g_Config.iXInputAnalogInverseMode; @@ -338,3 +359,34 @@ void XinputDevice::ApplyButtons(int pad, const XINPUT_STATE &state) { } } } + + +void XinputDevice::ApplyVibration(int pad, XINPUT_VIBRATION &vibration) { + if (PSP_IsInited()) { + newVibrationTime = Common::Timer::GetTimeMs() >> 6; + // We have to run PPSSPP_XInputSetState at time intervals + // since it bugs otherwise with very high unthrottle speeds + // and freezes at constant vibration or no vibration at all. + if (abs(newVibrationTime - prevVibrationTime) >= 1) { + if (GetUIState() == UISTATE_INGAME) { + vibration.wLeftMotorSpeed = sceCtrlGetLeftVibration(); // use any value between 0-65535 here + vibration.wRightMotorSpeed = sceCtrlGetRightVibration(); // use any value between 0-65535 here + } else { + vibration.wLeftMotorSpeed = 0; + vibration.wRightMotorSpeed = 0; + } + + if ((prevVibration[pad].wLeftMotorSpeed != vibration.wLeftMotorSpeed || prevVibration[pad].wRightMotorSpeed != vibration.wRightMotorSpeed)) { + PPSSPP_XInputSetState(pad, &vibration); + prevVibration[pad] = vibration; + } + prevVibrationTime = newVibrationTime; + } + } else { + DWORD dwResult = PPSSPP_XInputSetState(pad, &vibration); + if (dwResult != ERROR_SUCCESS) { + check_delay[pad] = 30; + } + } +} + diff --git a/Windows/XinputDevice.h b/Windows/XinputDevice.h index 4d0510498e..40cb973b25 100644 --- a/Windows/XinputDevice.h +++ b/Windows/XinputDevice.h @@ -2,7 +2,7 @@ #include "InputDevice.h" #include "Xinput.h" - +#include "Core/HLE/sceCtrl.h" class XinputDevice final : public InputDevice { public: @@ -11,9 +11,12 @@ public: virtual int UpdateState() override; private: - void UpdatePad(int pad, const XINPUT_STATE &state); + void UpdatePad(int pad, const XINPUT_STATE &state, XINPUT_VIBRATION &vibration); void ApplyButtons(int pad, const XINPUT_STATE &state); + void ApplyVibration(int pad, XINPUT_VIBRATION &vibration); int check_delay[4]{}; XINPUT_STATE prevState[4]{}; + XINPUT_VIBRATION prevVibration[4]{}; + int prevVibrationTime = 0; u32 prevButtons[4]{}; };