From 603a6d93f4e2f310fe507000ac1d64d3eac614ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Miko=C5=82ajczyk?= Date: Tue, 12 Feb 2013 01:36:16 +0100 Subject: [PATCH 1/2] Minor code cleanup --- Qt/mainwindow.cpp | 73 +++++++++++++++++++++-------------------------- Qt/mainwindow.h | 6 ++-- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 734a0ee449..f6c28d24da 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -38,18 +38,15 @@ MainWindow::MainWindow(QWidget *parent) : gamePadDlg = new GamePadDialog(&input_state, this); #endif - SetPlaying(0); - host = new QtHost(this); - w = ui->widget; - w->init(&input_state); - w->resize(pixel_xres, pixel_yres); - w->setMinimumSize(pixel_xres, pixel_yres); - w->setMaximumSize(pixel_xres, pixel_yres); - QObject::connect( w, SIGNAL(doubleClick()), this, SLOT(on_action_OptionsFullScreen_triggered()) ); + emugl = ui->widget; + emugl->init(&input_state); + emugl->resize(pixel_xres, pixel_yres); + emugl->setMinimumSize(pixel_xres, pixel_yres); + emugl->setMaximumSize(pixel_xres, pixel_yres); + QObject::connect( emugl, SIGNAL(doubleClick()), this, SLOT(on_action_OptionsFullScreen_triggered()) ); createLanguageMenu(); - UpdateMenus(); int zoom = g_Config.iWindowZoom; @@ -57,19 +54,20 @@ MainWindow::MainWindow(QWidget *parent) : if (zoom > 4) zoom = 4; SetZoom(zoom); - EmuThread_Start(w); + EmuThread_Start(emugl); if (!fileToStart.isNull()) { - SetPlaying(fileToStart); - //Update(); + SetGameTitle(fileToStart); UpdateMenus(); EmuThread_StartGame(fileToStart); - } - if (!fileToStart.isNull() && stateToLoad != NULL) - SaveState::Load(stateToLoad); + if (stateToLoad != NULL) + SaveState::Load(stateToLoad); + } + else + SetGameTitle(""); } MainWindow::~MainWindow() @@ -164,26 +162,11 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co g_Config.memCardDirectory = std::string(getenv("HOME"))+"/.ppsspp/"; g_Config.flashDirectory = g_Config.memCardDirectory+"/flash/"; - LogManager::Init(); if (fileToLog != NULL) - LogManager::GetInstance()->ChangeFileLog(fileToLog); - //LogManager::GetInstance()->GetConsoleListener()->Open(hideLog, 150, 120, "PPSSPP Debug Console"); - LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, LogTypes::LERROR); -} + LogManager::GetInstance()->ChangeFileLog(fileToLog); -void MainWindow::SetPlaying(QString text) -{ - if (text == 0) - { - QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR); - setWindowTitle(title); - } - else - { - QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR) + "-" + text; - setWindowTitle(title); - } + LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, LogTypes::LERROR); } void MainWindow::SetNextState(CoreState state) @@ -191,6 +174,15 @@ void MainWindow::SetNextState(CoreState state) nextState = state; } +void MainWindow::SetGameTitle(QString text) +{ + QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR); + if (text != "") + title += QString(" - %1").arg(text); + + setWindowTitle(title); +} + void MainWindow::BrowseAndBoot(void) { QString filename = QFileDialog::getOpenFileName(NULL, "Load File", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.prx)"); @@ -261,6 +253,9 @@ void MainWindow::UpdateMenus() ui->action_CPUInterpreter->setEnabled(enable); ui->action_CPUFastInterpreter->setEnabled(enable); ui->action_EmulationStop->setEnabled(!enable); + ui->action_DebugDumpFrame->setEnabled(!enable); + ui->action_DebugDisassembly->setEnabled(!enable); + ui->action_DebugMemoryView->setEnabled(!enable); ui->action_OptionsScreen1x->setChecked(0 == (g_Config.iWindowZoom - 1)); ui->action_OptionsScreen2x->setChecked(1 == (g_Config.iWindowZoom - 1)); @@ -292,9 +287,9 @@ void MainWindow::SetZoom(float zoom) { dp_xres = pixel_xres; dp_yres = pixel_yres; - w->resize(pixel_xres, pixel_yres); - w->setMinimumSize(pixel_xres, pixel_yres); - w->setMaximumSize(pixel_xres, pixel_yres); + emugl->resize(pixel_xres, pixel_yres); + emugl->setMinimumSize(pixel_xres, pixel_yres); + emugl->setMaximumSize(pixel_xres, pixel_yres); ui->centralwidget->setFixedSize(pixel_xres, pixel_yres); ui->centralwidget->resize(pixel_xres, pixel_yres); @@ -339,8 +334,7 @@ void MainWindow::on_action_EmulationStop_triggered() memoryWindow->close(); EmuThread_StopGame(); - SetPlaying(0); - Update(); + SetGameTitle(""); UpdateMenus(); } @@ -596,8 +590,8 @@ void MainWindow::on_action_OptionsFullScreen_triggered() ui->statusbar->setVisible(false); // Remove constraint - w->setMinimumSize(0, 0); - w->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + emugl->setMinimumSize(0, 0); + emugl->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); ui->centralwidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); @@ -853,7 +847,6 @@ void MainWindow::createLanguageMenu() locale.truncate(locale.lastIndexOf('.')); locale.remove(0, locale.indexOf('_') + 1); - //QString language = QLocale::languageToString(QLocale(locale).language()); QString language = QLocale(locale).nativeLanguageName(); QAction *action = new QAction(language, this); action->setCheckable(true); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index d6de1f44e6..01b089c25d 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -29,7 +29,7 @@ public: void Create(int argc, const char *argv[], const char *savegame_directory, const char *external_directory, const char *installID); void BrowseAndBoot(); void SetNextState(CoreState state); - void SetPlaying(QString text); + void SetGameTitle(QString text); Debugger_Disasm* GetDialogDisasm() { return dialogDisasm; } Debugger_Memory* GetDialogMemory() { return memoryWindow; } @@ -163,9 +163,9 @@ private: QString currentLanguage; QString languagePath; - Ui::MainWindow *ui; + Ui::MainWindow *ui; - QtEmuGL* w; + QtEmuGL* emugl; CoreState nextState; InputState input_state; From 41aed1a09493dc5866345051d27404ab57794439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Miko=C5=82ajczyk?= Date: Tue, 12 Feb 2013 01:40:53 +0100 Subject: [PATCH 2/2] Qt: add AA, AF, show FPS to options --- Qt/languages/ppsspp_en.ts | 180 ++++++++++++++++++++++--------------- Qt/languages/ppsspp_fr.ts | 180 ++++++++++++++++++++++--------------- Qt/languages/ppsspp_pl.ts | 182 +++++++++++++++++++++++--------------- Qt/mainwindow.cpp | 48 ++++++++++ Qt/mainwindow.h | 14 +++ Qt/mainwindow.ui | 75 ++++++++++++++++ 6 files changed, 468 insertions(+), 211 deletions(-) diff --git a/Qt/languages/ppsspp_en.ts b/Qt/languages/ppsspp_en.ts index 67ab652ee1..c37a1fe9fe 100644 --- a/Qt/languages/ppsspp_en.ts +++ b/Qt/languages/ppsspp_en.ts @@ -6,7 +6,7 @@ Controls - Control window title + Controls window title @@ -539,318 +539,358 @@ - + + Anisotropic filtering + + + + &Help - + &Open... - + &Close - + - - + Quickload state - + F4 - + Quicksave state - + F2 - + &Load State File... - + &Save State File... - + E&xit - + &Run - + F7 - + &Pause - + F8 - + R&eset - + &Interpreter - + &Slightly Faster Interpreter - + &Dynarec - + Load &Map File... - + &Save Map File... - + &Reset Symbol Table - + &Disassembly - + Ctrl+D - + &Log Console - + Ctrl+L - + Memory &View... - + Ctrl+M - + Keyboard &Controls - + &Toggle Full Screen - + F12 - + &Buffered Rendering - + F5 - + &Hardware Transform - + F6 - + &Linear Filtering - + &Wireframe (experimental) - + &Display Raw Framebuffer - + &Show Debug Statistics - + Screen &1x - + Ctrl+1 - + Screen &2x - + Ctrl+2 - + Screen &3x - + Ctrl+3 - + Screen &4x - + Ctrl+4 - + &Fast Memory (dynarec, unstable) - + &Ignore illegal reads/writes - + &Go to http://www.ppsspp.org/ - + &About PPSSPP... - + &Use VBO - - - + + + Debug - - - + + + Warning - - - + + + Error - - - + + + Info - + GamePad Controls - + &Run on load - + D&ump next frame to log - + &Vertex Cache - + Memory View Texture... + + + Simple 2xAA + + + + + Off + + + + + 2x + + + + + 4x + + + + + 8x + + + + + 16x + + + + + Show FPS counter + + No translations diff --git a/Qt/languages/ppsspp_fr.ts b/Qt/languages/ppsspp_fr.ts index 945bbb1e20..3eca7f7754 100644 --- a/Qt/languages/ppsspp_fr.ts +++ b/Qt/languages/ppsspp_fr.ts @@ -6,7 +6,7 @@ Controls - Control window title + Controls window title @@ -539,318 +539,358 @@ Langue - + + Anisotropic filtering + + + + &Help &Aide - + &Open... &Ouvrir... - + &Close &Fermer - + - - + Quickload state - + F4 - + Quicksave state - + F2 - + &Load State File... - + &Save State File... - + E&xit &Quitter - + &Run - + F7 - + &Pause - + F8 - + R&eset - + &Interpreter - + &Slightly Faster Interpreter - + &Dynarec - + Load &Map File... - + &Save Map File... - + &Reset Symbol Table - + &Disassembly - + Ctrl+D - + &Log Console - + Ctrl+L - + Memory &View... - + Ctrl+M - + Keyboard &Controls - + &Toggle Full Screen - + F12 - + &Buffered Rendering - + F5 - + &Hardware Transform - + F6 - + &Linear Filtering - + &Wireframe (experimental) - + &Display Raw Framebuffer - + &Show Debug Statistics - + Screen &1x - + Ctrl+1 - + Screen &2x - + Ctrl+2 - + Screen &3x - + Ctrl+3 - + Screen &4x - + Ctrl+4 - + &Fast Memory (dynarec, unstable) - + &Ignore illegal reads/writes - + &Go to http://www.ppsspp.org/ - + &About PPSSPP... - + &Use VBO - - - + + + Debug - - - + + + Warning - - - + + + Error - - - + + + Info - + GamePad Controls - + &Run on load - + D&ump next frame to log - + &Vertex Cache - + Memory View Texture... + + + Simple 2xAA + + + + + Off + + + + + 2x + + + + + 4x + + + + + 8x + + + + + 16x + + + + + Show FPS counter + + No translations diff --git a/Qt/languages/ppsspp_pl.ts b/Qt/languages/ppsspp_pl.ts index ee2a848380..5da591151b 100644 --- a/Qt/languages/ppsspp_pl.ts +++ b/Qt/languages/ppsspp_pl.ts @@ -6,8 +6,8 @@ Controls - Control window title - Układ klawiszy + Controls window title + Układ klawiszy @@ -539,318 +539,358 @@ Język - + + Anisotropic filtering + Filtrowanie anizotropowe + + + &Help Pomo&c - + &Open... &Otwórz... - + &Close &Zamknij - + - - + Quickload state Wczytaj stan - + F4 F4 - + Quicksave state Zapisz stan - + F2 F2 - + &Load State File... &Wczytaj plik stanu... - + &Save State File... &Zapisz plik stanu... - + E&xit Wyj&dź - + &Run &Uruchom - + F7 F7 - + &Pause &Pauza - + F8 F8 - + R&eset &Reset - + &Interpreter &Interpreter - + &Slightly Faster Interpreter &Szybszy interpreter - + &Dynarec R&ekompilacja (Dynarec) - + Load &Map File... &Wczytaj plik mapy... - + &Save Map File... &Zapisz plik mapy... - + &Reset Symbol Table Zresetuj &tablicę symboli - + &Disassembly &Deasembler - + Ctrl+D Ctrl+D - + &Log Console &Konsola logowania - + Ctrl+L Ctrl+L - + Memory &View... Widok &pamięci... - + Ctrl+M Ctrl+M - + Keyboard &Controls Ustawienia &klawiatury - + &Toggle Full Screen &Pełny ekran - + F12 F12 - + &Buffered Rendering &Buforowane renderowanie - + F5 F5 - + &Hardware Transform Sprzętowa &transformacja - + F6 F6 - + &Linear Filtering Filtrowanie &liniowe - + &Wireframe (experimental) &Widok siatki (eksperymentalny) - + &Display Raw Framebuffer Wyświetl &surowy framebuffer - + &Show Debug Statistics Pokaż statystyki &emulacji - + Screen &1x &1x - + Ctrl+1 Ctrl+1 - + Screen &2x &2x - + Ctrl+2 Ctrl+2 - + Screen &3x &3x - + Ctrl+3 Ctrl+3 - + Screen &4x &4x - + Ctrl+4 Ctrl+4 - + &Fast Memory (dynarec, unstable) S&zybka pamięć (wymagany Dynarec, niestabilne) - + &Ignore illegal reads/writes &Ignoruj nieprawidłowe odczyty/zapisy - + &Go to http://www.ppsspp.org/ &Idź do http://www.ppsspp.org - + &About PPSSPP... &O PPSSPP... - + &Use VBO Użyj &VBO - - - + + + Debug Debug - - - + + + Warning Ostrzeżenia - - - + + + Error Błędy - - - + + + Info Info - + GamePad Controls Ustawienia pada - + &Run on load Uruchom po &załadowaniu - + D&ump next frame to log Z&rzuć następną ramkę do logu - + &Vertex Cache &Cache wierzchołków - + Memory View Texture... + + + Simple 2xAA + Prosty antyaliasing 2x + + + + Off + Wyłączone + + + + 2x + 2x + + + + 4x + 4x + + + + 8x + 8x + + + + 16x + 16x + + + + Show FPS counter + Pokaż licznik FPS + No translations diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index f6c28d24da..dbe4a29abf 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -237,6 +237,12 @@ void MainWindow::UpdateMenus() ui->action_EmulationRunLoad->setChecked(g_Config.bAutoRun); ui->action_OptionsUseVBO->setChecked(g_Config.bUseVBO); ui->action_OptionsVertexCache->setChecked(g_Config.bVertexCache); + ui->action_AFOff->setChecked(g_Config.iAnisotropyLevel == 0); + ui->action_AF2x->setChecked(g_Config.iAnisotropyLevel == 2); + ui->action_AF4x->setChecked(g_Config.iAnisotropyLevel == 4); + ui->action_AF8x->setChecked(g_Config.iAnisotropyLevel == 8); + ui->action_AF16x->setChecked(g_Config.iAnisotropyLevel == 16); + ui->action_Show_FPS_counter->setChecked(g_Config.bShowFPSCounter); bool enable = !Core_IsStepping() ? false : true; ui->action_EmulationRun->setEnabled(g_State.bEmuThreadStarted ? enable : false); @@ -939,3 +945,45 @@ void MainWindow::on_action_OptionsUseVBO_triggered() g_Config.bUseVBO = !g_Config.bUseVBO; UpdateMenus(); } + +void MainWindow::on_action_Simple_2xAA_triggered() +{ + g_Config.SSAntiAliasing = !g_Config.SSAntiAliasing; + UpdateMenus(); +} + +void MainWindow::on_action_AFOff_triggered() +{ + g_Config.iAnisotropyLevel = 0; + UpdateMenus(); +} + +void MainWindow::on_action_AF2x_triggered() +{ + g_Config.iAnisotropyLevel = 2; + UpdateMenus(); +} + +void MainWindow::on_action_AF4x_triggered() +{ + g_Config.iAnisotropyLevel = 4; + UpdateMenus(); +} + +void MainWindow::on_action_AF8x_triggered() +{ + g_Config.iAnisotropyLevel = 8; + UpdateMenus(); +} + +void MainWindow::on_action_AF16x_triggered() +{ + g_Config.iAnisotropyLevel = 16; + UpdateMenus(); +} + +void MainWindow::on_action_Show_FPS_counter_triggered() +{ + g_Config.bShowFPSCounter = !g_Config.bShowFPSCounter; + UpdateMenus(); +} diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 01b089c25d..81603a641f 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -153,6 +153,20 @@ private slots: void on_action_OptionsUseVBO_triggered(); + void on_action_Simple_2xAA_triggered(); + + void on_action_AFOff_triggered(); + + void on_action_AF2x_triggered(); + + void on_action_AF4x_triggered(); + + void on_action_AF8x_triggered(); + + void on_action_AF16x_triggered(); + + void on_action_Show_FPS_counter_triggered(); + private: void loadLanguage(const QString &language); void createLanguageMenu(); diff --git a/Qt/mainwindow.ui b/Qt/mainwindow.ui index 67e1d79d4e..78eeedfad9 100644 --- a/Qt/mainwindow.ui +++ b/Qt/mainwindow.ui @@ -144,6 +144,16 @@ Language + + + Anisotropic filtering + + + + + + + @@ -151,12 +161,15 @@ + + + @@ -462,6 +475,9 @@ + + true + &Use VBO @@ -578,6 +594,9 @@ + + true + &Vertex Cache @@ -587,6 +606,62 @@ Memory View Texture... + + + true + + + Simple 2xAA + + + + + true + + + Off + + + + + true + + + 2x + + + + + true + + + 4x + + + + + true + + + 8x + + + + + true + + + 16x + + + + + true + + + Show FPS counter + +