CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Qt/mainwindow.cpp
Views: 1401
// Qt Desktop UI: works on Linux, Windows and Mac OSX1#include "ppsspp_config.h"2#include "mainwindow.h"34#include <QApplication>5#include <QDesktopServices>6#include <QDesktopWidget>7#include <QFile>8#include <QFileDialog>9#include <QMessageBox>1011#include "Common/System/Display.h"12#include "Common/System/NativeApp.h"13#include "Common/System/System.h"14#include "Common/File/Path.h"15#include "Core/MIPS/MIPSDebugInterface.h"16#include "Core/Debugger/SymbolMap.h"17#include "Core/HLE/sceUmd.h"18#include "Core/SaveState.h"19#include "Core/System.h"20#include "GPU/GPUInterface.h"21#include "UI/GamepadEmu.h"2223MainWindow::MainWindow(QWidget *parent, bool fullscreen) :24QMainWindow(parent),25currentLanguage("en"),26nextState(CORE_POWERDOWN),27lastUIState(UISTATE_MENU)28{29#if defined(ASSETS_DIR)30if (QFile::exists(ASSETS_DIR "icon_regular_72.png"))31setWindowIcon(QIcon(ASSETS_DIR "icon_regular_72.png"));32else33setWindowIcon(QIcon(qApp->applicationDirPath() + "/assets/icon_regular_72.png"));34#else35setWindowIcon(QIcon(qApp->applicationDirPath() + "/assets/icon_regular_72.png"));36#endif3738SetGameTitle("");39emugl = new MainUI(this);4041setCentralWidget(emugl);42createMenus();43updateMenus();4445SetFullScreen(fullscreen);4647QObject::connect(emugl, SIGNAL(doubleClick()), this, SLOT(fullscrAct()));48QObject::connect(emugl, SIGNAL(newFrame()), this, SLOT(newFrame()));49}5051inline float clamp1(float x) {52if (x > 1.0f) return 1.0f;53if (x < -1.0f) return -1.0f;54return x;55}5657void MainWindow::newFrame()58{59if (lastUIState != GetUIState()) {60lastUIState = GetUIState();61if (lastUIState == UISTATE_INGAME && g_Config.UseFullScreen() && !QApplication::overrideCursor() && !g_Config.bShowTouchControls)62QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));63if (lastUIState != UISTATE_INGAME && g_Config.UseFullScreen() && QApplication::overrideCursor())64QApplication::restoreOverrideCursor();6566updateMenus();67}6869if (g_Config.UseFullScreen() != isFullScreen())70SetFullScreen(g_Config.UseFullScreen());7172std::unique_lock<std::mutex> lock(msgMutex_);73while (!msgQueue_.empty()) {74MainWindowMsg msg = msgQueue_.front();75msgQueue_.pop();76switch (msg) {77case MainWindowMsg::BOOT_DONE:78bootDone();79break;80case MainWindowMsg::WINDOW_TITLE_CHANGED:81std::unique_lock<std::mutex> lock(titleMutex_);82setWindowTitle(QString::fromUtf8(newWindowTitle_.c_str()));83break;84}85}86}8788void MainWindow::updateMenuGroupInt(QActionGroup *group, int value) {89foreach (QAction *action, group->actions()) {90action->setChecked(action->data().toInt() == value);91}92}9394void MainWindow::updateMenus()95{96updateMenuGroupInt(saveStateGroup, g_Config.iCurrentStateSlot);97updateMenuGroupInt(displayRotationGroup, g_Config.iInternalScreenRotation);98updateMenuGroupInt(renderingResolutionGroup, g_Config.iInternalResolution);99updateMenuGroupInt(frameSkippingGroup, g_Config.iFrameSkip);100updateMenuGroupInt(frameSkippingTypeGroup, g_Config.iFrameSkipType);101updateMenuGroupInt(textureFilteringGroup, g_Config.iTexFiltering);102updateMenuGroupInt(screenScalingFilterGroup, g_Config.iDisplayFilter);103updateMenuGroupInt(textureScalingLevelGroup, g_Config.iTexScalingLevel);104updateMenuGroupInt(textureScalingTypeGroup, g_Config.iTexScalingType);105106foreach(QAction * action, windowGroup->actions()) {107int width = (g_Config.IsPortrait() ? 272 : 480) * action->data().toInt();108int height = (g_Config.IsPortrait() ? 480 : 272) * action->data().toInt();109if (g_Config.iWindowWidth == width && g_Config.iWindowHeight == height) {110action->setChecked(true);111break;112}113}114emit updateMenu();115}116117void MainWindow::bootDone()118{119if (nextState == CORE_RUNNING)120runAct();121updateMenus();122}123124/* SIGNALS */125void MainWindow::loadAct()126{127QString filename = QFileDialog::getOpenFileName(NULL, "Load File", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.chd *.prx)");128if (QFile::exists(filename))129{130QFileInfo info(filename);131g_Config.currentDirectory = Path(info.absolutePath().toStdString());132System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, filename.toStdString().c_str());133}134}135136void MainWindow::closeAct()137{138updateMenus();139140System_PostUIMessage(UIMessage::REQUEST_GAME_STOP);141SetGameTitle("");142}143144void MainWindow::openmsAct()145{146QString confighome = getenv("XDG_CONFIG_HOME");147QString memorystick = confighome + "/ppsspp";148QDesktopServices::openUrl(QUrl(memorystick));149}150151static void SaveStateActionFinished(SaveState::Status status, std::string_view message, void *userdata)152{153// TODO: Improve messaging?154if (status == SaveState::Status::FAILURE)155{156QMessageBox msgBox;157msgBox.setWindowTitle("Load Save State");158msgBox.setText("Savestate failure. Please try again later");159msgBox.exec();160return;161}162}163164void MainWindow::qlstateAct()165{166Path gamePath = PSP_CoreParameter().fileToStart;167SaveState::LoadSlot(gamePath, 0, SaveStateActionFinished, this);168}169170void MainWindow::qsstateAct()171{172Path gamePath = PSP_CoreParameter().fileToStart;173SaveState::SaveSlot(gamePath, 0, SaveStateActionFinished, this);174}175176void MainWindow::lstateAct()177{178QFileDialog dialog(0,"Load state");179dialog.setFileMode(QFileDialog::ExistingFile);180QStringList filters;181filters << "Save States (*.ppst)" << "|All files (*.*)";182dialog.setNameFilters(filters);183dialog.setAcceptMode(QFileDialog::AcceptOpen);184if (dialog.exec())185{186QStringList fileNames = dialog.selectedFiles();187SaveState::Load(Path(fileNames[0].toStdString()), -1, SaveStateActionFinished, this);188}189}190191void MainWindow::sstateAct()192{193QFileDialog dialog(0,"Save state");194dialog.setFileMode(QFileDialog::AnyFile);195dialog.setAcceptMode(QFileDialog::AcceptSave);196QStringList filters;197filters << "Save States (*.ppst)" << "|All files (*.*)";198dialog.setNameFilters(filters);199if (dialog.exec())200{201QStringList fileNames = dialog.selectedFiles();202SaveState::Save(Path(fileNames[0].toStdString()), -1, SaveStateActionFinished, this);203}204}205206void MainWindow::recordDisplayAct()207{208g_Config.bDumpFrames = !g_Config.bDumpFrames;209}210211void MainWindow::useLosslessVideoCodecAct()212{213g_Config.bUseFFV1 = !g_Config.bUseFFV1;214}215216void MainWindow::useOutputBufferAct()217{218g_Config.bDumpVideoOutput = !g_Config.bDumpVideoOutput;219}220221void MainWindow::recordAudioAct()222{223g_Config.bDumpAudio = !g_Config.bDumpAudio;224}225226void MainWindow::exitAct()227{228closeAct();229QApplication::exit(0);230}231232void MainWindow::runAct()233{234System_PostUIMessage(UIMessage::REQUEST_GAME_RUN);235}236237void MainWindow::pauseAct()238{239System_PostUIMessage(UIMessage::REQUEST_GAME_PAUSE);240}241242void MainWindow::stopAct()243{244Core_Stop();245System_PostUIMessage(UIMessage::REQUEST_GAME_STOP);246}247248void MainWindow::resetAct()249{250updateMenus();251System_PostUIMessage(UIMessage::REQUEST_GAME_RESET);252}253254void MainWindow::switchUMDAct()255{256QString filename = QFileDialog::getOpenFileName(NULL, "Switch UMD", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.chd *.prx)");257if (QFile::exists(filename))258{259QFileInfo info(filename);260g_Config.currentDirectory = Path(info.absolutePath().toStdString());261__UmdReplace(Path(filename.toStdString()));262}263}264265void MainWindow::breakonloadAct()266{267g_Config.bAutoRun = !g_Config.bAutoRun;268}269270void MainWindow::lmapAct()271{272QFileDialog dialog(0,"Load .MAP");273dialog.setFileMode(QFileDialog::ExistingFile);274QStringList filters;275filters << "Maps (*.map)" << "|All files (*.*)";276dialog.setNameFilters(filters);277dialog.setAcceptMode(QFileDialog::AcceptOpen);278QStringList fileNames;279if (dialog.exec())280fileNames = dialog.selectedFiles();281282if (fileNames.count() > 0)283{284QString fileName = QFileInfo(fileNames[0]).absoluteFilePath();285g_symbolMap->LoadSymbolMap(Path(fileName.toStdString()));286}287}288289void MainWindow::smapAct()290{291QFileDialog dialog(0,"Save .MAP");292dialog.setFileMode(QFileDialog::AnyFile);293dialog.setAcceptMode(QFileDialog::AcceptSave);294QStringList filters;295filters << "Save .MAP (*.map)" << "|All files (*.*)";296dialog.setNameFilters(filters);297QStringList fileNames;298if (dialog.exec())299{300fileNames = dialog.selectedFiles();301g_symbolMap->SaveSymbolMap(Path(fileNames[0].toStdString()));302}303}304305void MainWindow::lsymAct()306{307QFileDialog dialog(0,"Load .SYM");308dialog.setFileMode(QFileDialog::ExistingFile);309QStringList filters;310filters << "Symbols (*.sym)" << "|All files (*.*)";311dialog.setNameFilters(filters);312dialog.setAcceptMode(QFileDialog::AcceptOpen);313QStringList fileNames;314if (dialog.exec())315fileNames = dialog.selectedFiles();316317if (fileNames.count() > 0)318{319QString fileName = QFileInfo(fileNames[0]).absoluteFilePath();320g_symbolMap->LoadNocashSym(Path(fileName.toStdString()));321}322}323324void MainWindow::ssymAct()325{326QFileDialog dialog(0,"Save .SYM");327dialog.setFileMode(QFileDialog::AnyFile);328dialog.setAcceptMode(QFileDialog::AcceptSave);329QStringList filters;330filters << "Save .SYM (*.sym)" << "|All files (*.*)";331dialog.setNameFilters(filters);332QStringList fileNames;333if (dialog.exec())334{335fileNames = dialog.selectedFiles();336g_symbolMap->SaveNocashSym(Path(fileNames[0].toStdString()));337}338}339340void MainWindow::resetTableAct()341{342g_symbolMap->Clear();343}344345void MainWindow::dumpNextAct()346{347gpu->DumpNextFrame();348}349350void MainWindow::consoleAct()351{352#if PPSSPP_PLATFORM(WINDOWS)353LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden());354#endif355}356357void MainWindow::raiseTopMost()358{359setWindowState( (windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);360raise();361activateWindow();362}363364void MainWindow::SetFullScreen(bool fullscreen) {365if (fullscreen) {366#if !PPSSPP_PLATFORM(MAC)367menuBar()->hide();368369emugl->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);370// TODO: Shouldn't this be physicalSize()?371emugl->resizeGL(emugl->size().width(), emugl->size().height());372// TODO: Won't showFullScreen do this for us?373setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);374setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);375#endif376377showFullScreen();378InitPadLayout(g_display.dp_xres, g_display.dp_yres);379380if (GetUIState() == UISTATE_INGAME && !g_Config.bShowTouchControls)381QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));382} else {383#if !PPSSPP_PLATFORM(MAC)384menuBar()->show();385updateMenus();386#endif387388showNormal();389SetWindowScale(-1);390InitPadLayout(g_display.dp_xres, g_display.dp_yres);391392if (GetUIState() == UISTATE_INGAME && QApplication::overrideCursor())393QApplication::restoreOverrideCursor();394395QDesktopWidget *desktop = QApplication::desktop();396int screenNum = QProcessEnvironment::systemEnvironment().value("SDL_VIDEO_FULLSCREEN_HEAD", "0").toInt();397398// Move window to the center of selected screen399QRect rect = desktop->screenGeometry(screenNum);400move((rect.width() - frameGeometry().width()) / 4, (rect.height() - frameGeometry().height()) / 4);401}402}403404void MainWindow::fullscrAct()405{406// Toggle the current state.407g_Config.bFullScreen = !isFullScreen();408g_Config.iForceFullScreen = -1;409SetFullScreen(g_Config.bFullScreen);410411QTimer::singleShot(1000, this, SLOT(raiseTopMost()));412}413414void MainWindow::websiteAct()415{416QDesktopServices::openUrl(QUrl("https://www.ppsspp.org/"));417}418419void MainWindow::forumAct()420{421QDesktopServices::openUrl(QUrl("https://forums.ppsspp.org/"));422}423424void MainWindow::goldAct()425{426QDesktopServices::openUrl(QUrl("https://www.ppsspp.org/buygold"));427}428429void MainWindow::gitAct()430{431QDesktopServices::openUrl(QUrl("https://github.com/hrydgard/ppsspp/"));432}433434void MainWindow::discordAct()435{436QDesktopServices::openUrl(QUrl("https://discord.gg/5NJB6dD"));437}438439void MainWindow::aboutAct()440{441QMessageBox::about(this, "About", QString("PPSSPP Qt %1\n\n"442"PSP emulator and debugger\n\n"443"Copyright (c) by Henrik Rydg\xc3\xa5rd and the PPSSPP Project 2012-\n"444"Qt port maintained by xSacha\n\n"445"Additional credits:\n"446" PSPSDK by #pspdev (freenode)\n"447" CISO decompression code by BOOSTER\n"448" zlib by Jean-loup Gailly (compression) and Mark Adler (decompression)\n"449" Qt project by Digia\n\n"450"All trademarks are property of their respective owners.\n"451"The emulator is for educational and development purposes only and it may not be used to play games you do not legally own.").arg(PPSSPP_GIT_VERSION));452}453454/* Private functions */455void MainWindow::SetWindowScale(int zoom) {456if (isFullScreen())457fullscrAct();458459int width, height;460if (zoom == -1 && (g_Config.iWindowWidth <= 0 || g_Config.iWindowHeight <= 0)) {461// Default to zoom level 2.462zoom = 2;463}464if (zoom == -1) {465// Take the last setting.466width = g_Config.iWindowWidth;467height = g_Config.iWindowHeight;468} else {469// Update to the specified factor. Let's clamp first.470if (zoom < 1)471zoom = 1;472if (zoom > 10)473zoom = 10;474475width = (g_Config.IsPortrait() ? 272 : 480) * zoom;476height = (g_Config.IsPortrait() ? 480 : 272) * zoom;477}478479g_Config.iWindowWidth = width;480g_Config.iWindowHeight = height;481482#if !PPSSPP_PLATFORM(MAC)483emugl->setFixedSize(g_Config.iWindowWidth, g_Config.iWindowHeight);484// TODO: Shouldn't this be scaled size?485emugl->resizeGL(g_Config.iWindowWidth, g_Config.iWindowHeight);486setFixedSize(sizeHint());487#else488resize(g_Config.iWindowWidth, g_Config.iWindowHeight);489#endif490updateMenus();491}492493void MainWindow::SetGameTitle(QString text)494{495QString title = QString("PPSSPP %1").arg(PPSSPP_GIT_VERSION);496if (text != "")497title += QString(" - %1").arg(text);498499setWindowTitle(title);500}501502void MainWindow::loadLanguage(const QString& language, bool translate)503{504if (currentLanguage != language)505{506QLocale::setDefault(QLocale(language));507QApplication::removeTranslator(&translator);508509currentLanguage = language;510if (translator.load(QString(":/languages/ppsspp_%1.qm").arg(language))) {511QApplication::installTranslator(&translator);512}513if (translate)514emit retranslate();515}516}517518void MainWindow::createMenus()519{520// File521MenuTree* fileMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&File"));522fileMenu->add(new MenuAction(this, SLOT(loadAct()), QT_TR_NOOP("&Load..."), QKeySequence::Open))523->addEnableState(UISTATE_MENU);524fileMenu->addSeparator();525fileMenu->add(new MenuAction(this, SLOT(openmsAct()), QT_TR_NOOP("Open &Memory Stick")))526->addEnableState(UISTATE_MENU);527fileMenu->addSeparator();528MenuTree* savestateMenu = new MenuTree(this, fileMenu, QT_TR_NOOP("Saves&tate slot"));529saveStateGroup = new MenuActionGroup(this, savestateMenu, SLOT(saveStateGroup_triggered(QAction *)),530QStringList() << "1" << "2" << "3" << "4" << "5",531QList<int>() << 0 << 1 << 2 << 3 << 4);532fileMenu->add(new MenuAction(this, SLOT(qlstateAct()), QT_TR_NOOP("L&oad state"), Qt::Key_F4))533->addDisableState(UISTATE_MENU);534fileMenu->add(new MenuAction(this, SLOT(qsstateAct()), QT_TR_NOOP("S&ave state"), Qt::Key_F2))535->addDisableState(UISTATE_MENU);536fileMenu->add(new MenuAction(this, SLOT(lstateAct()), QT_TR_NOOP("&Load state file...")))537->addDisableState(UISTATE_MENU);538fileMenu->add(new MenuAction(this, SLOT(sstateAct()), QT_TR_NOOP("&Save state file...")))539->addDisableState(UISTATE_MENU);540MenuTree* recordMenu = new MenuTree(this, fileMenu, QT_TR_NOOP("&Record"));541recordMenu->add(new MenuAction(this, SLOT(recordDisplayAct()), QT_TR_NOOP("Record &display")))542->addEventChecked(&g_Config.bDumpFrames);543recordMenu->add(new MenuAction(this, SLOT(useLosslessVideoCodecAct()), QT_TR_NOOP("&Use lossless video codec (FFV1)")))544->addEventChecked(&g_Config.bUseFFV1);545recordMenu->add(new MenuAction(this, SLOT(useOutputBufferAct()), QT_TR_NOOP("Use output buffer for video")))546->addEventChecked(&g_Config.bDumpVideoOutput);547recordMenu->addSeparator();548recordMenu->add(new MenuAction(this, SLOT(recordAudioAct()), QT_TR_NOOP("Record &audio")))549->addEventChecked(&g_Config.bDumpAudio);550fileMenu->addSeparator();551fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), QKeySequence::Quit));552553// Emulation554MenuTree* emuMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Emulation"));555emuMenu->add(new MenuAction(this, SLOT(pauseAct()), QT_TR_NOOP("&Pause")))556->addEnableState(UISTATE_INGAME);557emuMenu->add(new MenuAction(this, SLOT(stopAct()), QT_TR_NOOP("&Stop"), Qt::CTRL + Qt::Key_W))558->addEnableState(UISTATE_INGAME);559emuMenu->add(new MenuAction(this, SLOT(resetAct()), QT_TR_NOOP("R&eset"), Qt::CTRL + Qt::Key_B))560->addEnableState(UISTATE_INGAME);561emuMenu->add(new MenuAction(this, SLOT(switchUMDAct()), QT_TR_NOOP("Switch UMD"), Qt::CTRL + Qt::Key_U))562->addEnableState(UISTATE_INGAME);563MenuTree* displayRotationMenu = new MenuTree(this, emuMenu, QT_TR_NOOP("Display rotation"));564displayRotationGroup = new MenuActionGroup(this, displayRotationMenu, SLOT(displayRotationGroup_triggered(QAction *)),565QStringList() << "Landscape" << "Portrait" << "Landscape reversed" << "Portrait reversed",566QList<int>() << 1 << 2 << 3 << 4);567568// Debug569MenuTree* debugMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Debug"));570debugMenu->add(new MenuAction(this, SLOT(breakonloadAct()), QT_TR_NOOP("Break on load")))571->addEventUnchecked(&g_Config.bAutoRun);572debugMenu->add(new MenuAction(this, SLOT(ignoreIllegalAct()), QT_TR_NOOP("&Ignore illegal reads/writes")))573->addEventChecked(&g_Config.bIgnoreBadMemAccess);574debugMenu->addSeparator();575debugMenu->add(new MenuAction(this, SLOT(lmapAct()), QT_TR_NOOP("&Load MAP file...")))576->addDisableState(UISTATE_MENU);577debugMenu->add(new MenuAction(this, SLOT(smapAct()), QT_TR_NOOP("&Save MAP file...")))578->addDisableState(UISTATE_MENU);579debugMenu->add(new MenuAction(this, SLOT(lsymAct()), QT_TR_NOOP("Lo&ad SYM file...")))580->addDisableState(UISTATE_MENU);581debugMenu->add(new MenuAction(this, SLOT(ssymAct()), QT_TR_NOOP("Sav&e SYM file...")))582->addDisableState(UISTATE_MENU);583debugMenu->add(new MenuAction(this, SLOT(resetTableAct()),QT_TR_NOOP("Reset s&ymbol table")))584->addDisableState(UISTATE_MENU);585debugMenu->addSeparator();586debugMenu->add(new MenuAction(this, SLOT(takeScreen()), QT_TR_NOOP("&Take screenshot"), Qt::Key_F12))587->addDisableState(UISTATE_MENU);588debugMenu->add(new MenuAction(this, SLOT(dumpNextAct()), QT_TR_NOOP("D&ump next frame to log")))589->addDisableState(UISTATE_MENU);590debugMenu->addSeparator();591debugMenu->add(new MenuAction(this, SLOT(consoleAct()), QT_TR_NOOP("&Log console"), Qt::CTRL + Qt::Key_L))592->addDisableState(UISTATE_MENU);593594// Game settings595MenuTree* gameSettingsMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Game settings"));596gameSettingsMenu->add(new MenuAction(this, SLOT(languageAct()), QT_TR_NOOP("La&nguage...")));597gameSettingsMenu->add(new MenuAction(this, SLOT(controlMappingAct()), QT_TR_NOOP("C&ontrol mapping...")));598gameSettingsMenu->add(new MenuAction(this, SLOT(displayLayoutEditorAct()), QT_TR_NOOP("Display layout & effects...")));599gameSettingsMenu->add(new MenuAction(this, SLOT(moreSettingsAct()), QT_TR_NOOP("&More settings...")));600gameSettingsMenu->addSeparator();601#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)602gameSettingsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("&Fullscreen"), Qt::Key_F11))603#else604gameSettingsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("Fu&llscreen"), QKeySequence::FullScreen))605#endif606->addEventChecked(&g_Config.bFullScreen);607gameSettingsMenu->add(new MenuAction(this, SLOT(bufferRenderAct()), QT_TR_NOOP("&Skip buffer effects")))608->addEventChecked(&g_Config.bSkipBufferEffects);609610MenuTree* renderingResolutionMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Rendering resolution"));611renderingResolutionGroup = new MenuActionGroup(this, renderingResolutionMenu, SLOT(renderingResolutionGroup_triggered(QAction *)),612QStringList() << "&Auto" << "&1x" << "&2x" << "&3x" << "&4x" << "&5x" << "&6x" << "&7x" << "&8x" << "&9x" << "1&0x",613QList<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10);614// - Window Size615MenuTree* windowMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Window size"));616windowGroup = new MenuActionGroup(this, windowMenu, SLOT(windowGroup_triggered(QAction *)),617QStringList() << "&1x" << "&2x" << "&3x" << "&4x" << "&5x" << "&6x" << "&7x" << "&8x" << "&9x" << "1&0x",618QList<int>() << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10);619620MenuTree* frameSkippingMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Frame skipping"));621frameSkippingMenu->add(new MenuAction(this, SLOT(autoframeskipAct()), QT_TR_NOOP("&Auto")))622->addEventChecked(&g_Config.bAutoFrameSkip);623frameSkippingMenu->addSeparator();624frameSkippingGroup = new MenuActionGroup(this, frameSkippingMenu, SLOT(frameSkippinGroup_triggered(QAction *)),625QStringList() << "&Off" << "&1" << "&2" << "&3" << "&4" << "&5" << "&6" << "&7" << "&8",626QList<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8);627MenuTree* frameSkippingTypeMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Frame skipping type"));628frameSkippingTypeGroup = new MenuActionGroup(this, frameSkippingTypeMenu, SLOT(frameSkippingTypeGroup_triggered(QAction *)),629QStringList() << "Skip number of frames" << "Skip percent of FPS",630QList<int>() << 0 << 1);631MenuTree* textureFilteringMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Te&xture filtering"));632textureFilteringGroup = new MenuActionGroup(this, textureFilteringMenu, SLOT(textureFilteringGroup_triggered(QAction *)),633QStringList() << "&Auto" << "&Nearest" << "&Linear" << "Auto Max &Quality",634QList<int>() << 1 << 2 << 3 << 4);635MenuTree* screenScalingFilterMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Scr&een scaling filter"));636screenScalingFilterGroup = new MenuActionGroup(this, screenScalingFilterMenu, SLOT(screenScalingFilterGroup_triggered(QAction *)),637QStringList() << "&Linear" << "&Nearest",638QList<int>() << 0 << 1);639640MenuTree* textureScalingMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Texture scaling"));641textureScalingLevelGroup = new MenuActionGroup(this, textureScalingMenu, SLOT(textureScalingLevelGroup_triggered(QAction *)),642QStringList() << "&Off" << "&2x" << "&3x" << "&4x" << "&5x",643QList<int>() << 1 << 2 << 3 << 4 << 5);644textureScalingMenu->addSeparator();645textureScalingTypeGroup = new MenuActionGroup(this, textureScalingMenu, SLOT(textureScalingTypeGroup_triggered(QAction *)),646QStringList() << "&xBRZ" << "&Hybrid" << "&Bicubic" << "H&ybrid + bicubic",647QList<int>() << 0 << 1 << 2 << 3);648textureScalingMenu->addSeparator();649textureScalingMenu->add(new MenuAction(this, SLOT(deposterizeAct()), QT_TR_NOOP("&Deposterize")))650->addEventChecked(&g_Config.bTexDeposterize);651652gameSettingsMenu->add(new MenuAction(this, SLOT(transformAct()), QT_TR_NOOP("&Hardware transform")))653->addEventChecked(&g_Config.bHardwareTransform);654gameSettingsMenu->addSeparator();655gameSettingsMenu->add(new MenuAction(this, SLOT(audioAct()), QT_TR_NOOP("Enable s&ound")))656->addEventChecked(&g_Config.bEnableSound);657gameSettingsMenu->addSeparator();658gameSettingsMenu->add(new MenuAction(this, SLOT(cheatsAct()), QT_TR_NOOP("Enable &cheats"), Qt::CTRL + Qt::Key_T))659->addEventChecked(&g_Config.bEnableCheats);660gameSettingsMenu->addSeparator();661gameSettingsMenu->add(new MenuAction(this, SLOT(chatAct()), QT_TR_NOOP("Open chat"), Qt::CTRL + Qt::Key_C))662->SetEnabledFunc([=]() {663return g_Config.bEnableNetworkChat && GetUIState() == UISTATE_INGAME;664});665666// Help667MenuTree* helpMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Help"));668helpMenu->add(new MenuAction(this, SLOT(websiteAct()), QT_TR_NOOP("Visit www.&ppsspp.org")));669helpMenu->add(new MenuAction(this, SLOT(forumAct()), QT_TR_NOOP("PPSSPP &forums")));670helpMenu->add(new MenuAction(this, SLOT(goldAct()), QT_TR_NOOP("Buy &Gold")));671helpMenu->add(new MenuAction(this, SLOT(gitAct()), QT_TR_NOOP("Git&Hub")));672helpMenu->add(new MenuAction(this, SLOT(discordAct()), QT_TR_NOOP("Discord")));673helpMenu->addSeparator();674helpMenu->add(new MenuAction(this, SLOT(aboutAct()), QT_TR_NOOP("&About PPSSPP...")));675676retranslate();677}678679680