2013-11-20 01:50:16 +00:00
// Qt Desktop UI: works on Linux, Windows and Mac OSX
2021-03-03 04:42:55 +00:00
# include "ppsspp_config.h"
2013-01-13 23:29:42 +00:00
# include "mainwindow.h"
2013-11-20 01:50:16 +00:00
# include <QApplication>
# include <QDesktopServices>
# include <QDesktopWidget>
2022-12-06 15:17:35 +00:00
# include <QFile>
2013-11-20 01:50:16 +00:00
# include <QFileDialog>
# include <QMessageBox>
2020-10-04 08:10:55 +00:00
# include "Common/System/Display.h"
2020-10-04 08:30:18 +00:00
# include "Common/System/NativeApp.h"
# include "Common/System/System.h"
2021-05-09 17:06:02 +00:00
# include "Common/File/Path.h"
2013-01-13 23:29:42 +00:00
# include "Core/MIPS/MIPSDebugInterface.h"
2013-02-10 15:36:06 +00:00
# include "Core/Debugger/SymbolMap.h"
2020-04-18 18:08:20 +00:00
# include "Core/HLE/sceUmd.h"
2013-01-13 23:29:42 +00:00
# include "Core/SaveState.h"
# include "Core/System.h"
2013-02-01 01:08:01 +00:00
# include "GPU/GPUInterface.h"
2013-11-05 06:00:13 +00:00
# include "UI/GamepadEmu.h"
2013-01-13 23:29:42 +00:00
2014-09-24 21:24:23 +00:00
MainWindow : : MainWindow ( QWidget * parent , bool fullscreen ) :
2013-01-15 16:16:07 +00:00
QMainWindow ( parent ) ,
2013-11-20 14:06:40 +00:00
currentLanguage ( " en " ) ,
2013-01-13 23:29:42 +00:00
nextState ( CORE_POWERDOWN ) ,
2018-06-03 18:27:26 +00:00
lastUIState ( UISTATE_MENU )
2013-01-13 23:29:42 +00:00
{
2022-12-06 15:17:35 +00:00
# if defined(ASSETS_DIR)
if ( QFile : : exists ( ASSETS_DIR " icon_regular_72.png " ) )
setWindowIcon ( QIcon ( ASSETS_DIR " icon_regular_72.png " ) ) ;
else
setWindowIcon ( QIcon ( qApp - > applicationDirPath ( ) + " /assets/icon_regular_72.png " ) ) ;
# else
2020-01-05 11:21:19 +00:00
setWindowIcon ( QIcon ( qApp - > applicationDirPath ( ) + " /assets/icon_regular_72.png " ) ) ;
2022-12-06 15:17:35 +00:00
# endif
2020-01-05 11:21:19 +00:00
2014-07-10 12:41:26 +00:00
SetGameTitle ( " " ) ;
2013-11-26 15:45:38 +00:00
emugl = new MainUI ( this ) ;
2013-11-22 06:15:10 +00:00
2013-11-19 04:02:24 +00:00
setCentralWidget ( emugl ) ;
2013-11-22 06:15:10 +00:00
createMenus ( ) ;
updateMenus ( ) ;
2018-06-09 23:28:15 +00:00
SetFullScreen ( fullscreen ) ;
2013-01-15 16:16:07 +00:00
2013-11-26 15:45:38 +00:00
QObject : : connect ( emugl , SIGNAL ( doubleClick ( ) ) , this , SLOT ( fullscrAct ( ) ) ) ;
QObject : : connect ( emugl , SIGNAL ( newFrame ( ) ) , this , SLOT ( newFrame ( ) ) ) ;
2013-01-13 23:29:42 +00:00
}
2013-02-19 20:59:53 +00:00
2013-07-07 07:47:50 +00:00
inline float clamp1 ( float x ) {
if ( x > 1.0f ) return 1.0f ;
if ( x < - 1.0f ) return - 1.0f ;
return x ;
}
2013-11-26 15:45:38 +00:00
void MainWindow : : newFrame ( )
2013-01-13 23:29:42 +00:00
{
2014-06-24 14:34:13 +00:00
if ( lastUIState ! = GetUIState ( ) ) {
lastUIState = GetUIState ( ) ;
2022-05-28 22:47:12 +00:00
if ( lastUIState = = UISTATE_INGAME & & g_Config . UseFullScreen ( ) & & ! QApplication : : overrideCursor ( ) & & ! g_Config . bShowTouchControls )
2013-11-04 12:30:38 +00:00
QApplication : : setOverrideCursor ( QCursor ( Qt : : BlankCursor ) ) ;
2022-05-28 22:47:12 +00:00
if ( lastUIState ! = UISTATE_INGAME & & g_Config . UseFullScreen ( ) & & QApplication : : overrideCursor ( ) )
2013-11-04 12:30:38 +00:00
QApplication : : restoreOverrideCursor ( ) ;
2013-11-19 10:18:11 +00:00
updateMenus ( ) ;
2013-04-20 10:43:55 +00:00
}
2018-01-31 17:35:48 +00:00
2022-05-28 22:47:12 +00:00
if ( g_Config . UseFullScreen ( ) ! = isFullScreen ( ) )
SetFullScreen ( g_Config . UseFullScreen ( ) ) ;
2020-10-10 14:26:07 +00:00
2018-01-31 17:35:48 +00:00
std : : unique_lock < std : : mutex > lock ( msgMutex_ ) ;
while ( ! msgQueue_ . empty ( ) ) {
MainWindowMsg msg = msgQueue_ . front ( ) ;
msgQueue_ . pop ( ) ;
switch ( msg ) {
case MainWindowMsg : : BOOT_DONE :
bootDone ( ) ;
break ;
2018-03-03 07:52:39 +00:00
case MainWindowMsg : : WINDOW_TITLE_CHANGED :
std : : unique_lock < std : : mutex > lock ( titleMutex_ ) ;
setWindowTitle ( QString : : fromUtf8 ( newWindowTitle_ . c_str ( ) ) ) ;
break ;
2018-01-31 17:35:48 +00:00
}
}
2013-02-10 15:36:06 +00:00
}
2020-04-17 23:46:11 +00:00
void MainWindow : : updateMenuGroupInt ( QActionGroup * group , int value ) {
foreach ( QAction * action , group - > actions ( ) ) {
action - > setChecked ( action - > data ( ) . toInt ( ) = = value ) ;
2020-04-12 17:12:42 +00:00
}
2020-04-17 23:46:11 +00:00
}
2020-04-12 17:12:42 +00:00
2020-04-17 23:46:11 +00:00
void MainWindow : : updateMenus ( )
{
updateMenuGroupInt ( saveStateGroup , g_Config . iCurrentStateSlot ) ;
updateMenuGroupInt ( displayRotationGroup , g_Config . iInternalScreenRotation ) ;
updateMenuGroupInt ( renderingResolutionGroup , g_Config . iInternalResolution ) ;
updateMenuGroupInt ( frameSkippingGroup , g_Config . iFrameSkip ) ;
updateMenuGroupInt ( frameSkippingTypeGroup , g_Config . iFrameSkipType ) ;
updateMenuGroupInt ( textureFilteringGroup , g_Config . iTexFiltering ) ;
2023-04-05 07:32:39 +00:00
updateMenuGroupInt ( screenScalingFilterGroup , g_Config . iDisplayFilter ) ;
2020-04-17 23:46:11 +00:00
updateMenuGroupInt ( textureScalingLevelGroup , g_Config . iTexScalingLevel ) ;
updateMenuGroupInt ( textureScalingTypeGroup , g_Config . iTexScalingType ) ;
2020-04-12 16:26:44 +00:00
2020-04-12 15:17:36 +00:00
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 ) {
2013-11-19 04:02:24 +00:00
action - > setChecked ( true ) ;
break ;
}
}
2013-11-22 04:05:36 +00:00
emit updateMenu ( ) ;
2013-02-19 20:59:53 +00:00
}
2013-01-13 23:29:42 +00:00
2018-01-31 17:35:48 +00:00
void MainWindow : : bootDone ( )
2013-02-19 20:59:53 +00:00
{
if ( nextState = = CORE_RUNNING )
2013-11-22 04:05:36 +00:00
runAct ( ) ;
2013-11-19 10:18:11 +00:00
updateMenus ( ) ;
2013-01-13 23:29:42 +00:00
}
2018-01-31 17:35:48 +00:00
/* SIGNALS */
2020-04-12 17:12:42 +00:00
void MainWindow : : loadAct ( )
2013-01-13 23:29:42 +00:00
{
2023-08-09 18:34:43 +00:00
QString filename = QFileDialog : : getOpenFileName ( NULL , " Load File " , g_Config . currentDirectory . c_str ( ) , " PSP ROMs (*.pbp *.elf *.iso *.cso *.chd *.prx) " ) ;
2013-02-19 20:59:53 +00:00
if ( QFile : : exists ( filename ) )
2013-01-13 23:29:42 +00:00
{
2013-02-19 20:59:53 +00:00
QFileInfo info ( filename ) ;
2021-05-29 22:20:41 +00:00
g_Config . currentDirectory = Path ( info . absolutePath ( ) . toStdString ( ) ) ;
2023-09-30 09:21:22 +00:00
System_PostUIMessage ( UIMessage : : REQUEST_GAME_BOOT , filename . toStdString ( ) . c_str ( ) ) ;
2013-01-13 23:29:42 +00:00
}
}
2013-11-22 04:05:36 +00:00
void MainWindow : : closeAct ( )
2013-01-13 23:29:42 +00:00
{
2018-06-03 17:46:17 +00:00
updateMenus ( ) ;
2013-02-19 20:59:53 +00:00
2023-09-30 09:21:22 +00:00
System_PostUIMessage ( UIMessage : : REQUEST_GAME_STOP ) ;
2013-02-12 00:36:16 +00:00
SetGameTitle ( " " ) ;
2013-01-13 23:29:42 +00:00
}
2020-04-12 17:12:42 +00:00
void MainWindow : : openmsAct ( )
{
QString confighome = getenv ( " XDG_CONFIG_HOME " ) ;
2020-04-18 18:08:20 +00:00
QString memorystick = confighome + " /ppsspp " ;
2020-04-12 17:12:42 +00:00
QDesktopServices : : openUrl ( QUrl ( memorystick ) ) ;
}
2024-01-19 12:44:49 +00:00
static void SaveStateActionFinished ( SaveState : : Status status , std : : string_view message , void * userdata )
2013-01-13 23:29:42 +00:00
{
// TODO: Improve messaging?
2018-06-15 00:52:44 +00:00
if ( status = = SaveState : : Status : : FAILURE )
2013-01-13 23:29:42 +00:00
{
QMessageBox msgBox ;
msgBox . setWindowTitle ( " Load Save State " ) ;
2013-01-15 16:16:07 +00:00
msgBox . setText ( " Savestate failure. Please try again later " ) ;
2013-01-13 23:29:42 +00:00
msgBox . exec ( ) ;
return ;
}
}
2013-11-22 04:05:36 +00:00
void MainWindow : : qlstateAct ( )
2013-02-19 20:59:53 +00:00
{
2021-05-15 06:00:22 +00:00
Path gamePath = PSP_CoreParameter ( ) . fileToStart ;
2015-09-23 17:29:39 +00:00
SaveState : : LoadSlot ( gamePath , 0 , SaveStateActionFinished , this ) ;
2013-02-19 20:59:53 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : qsstateAct ( )
2013-02-19 20:59:53 +00:00
{
2021-05-15 06:00:22 +00:00
Path gamePath = PSP_CoreParameter ( ) . fileToStart ;
2015-09-23 17:29:39 +00:00
SaveState : : SaveSlot ( gamePath , 0 , SaveStateActionFinished , this ) ;
2013-02-19 20:59:53 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : lstateAct ( )
2013-01-13 23:29:42 +00:00
{
QFileDialog dialog ( 0 , " Load state " ) ;
dialog . setFileMode ( QFileDialog : : ExistingFile ) ;
QStringList filters ;
filters < < " Save States (*.ppst) " < < " |All files (*.*) " ;
dialog . setNameFilters ( filters ) ;
dialog . setAcceptMode ( QFileDialog : : AcceptOpen ) ;
if ( dialog . exec ( ) )
{
2013-02-19 20:59:53 +00:00
QStringList fileNames = dialog . selectedFiles ( ) ;
2021-05-09 13:25:12 +00:00
SaveState : : Load ( Path ( fileNames [ 0 ] . toStdString ( ) ) , - 1 , SaveStateActionFinished , this ) ;
2013-01-13 23:29:42 +00:00
}
}
2013-11-22 04:05:36 +00:00
void MainWindow : : sstateAct ( )
2013-01-13 23:29:42 +00:00
{
QFileDialog dialog ( 0 , " Save state " ) ;
dialog . setFileMode ( QFileDialog : : AnyFile ) ;
dialog . setAcceptMode ( QFileDialog : : AcceptSave ) ;
QStringList filters ;
filters < < " Save States (*.ppst) " < < " |All files (*.*) " ;
dialog . setNameFilters ( filters ) ;
if ( dialog . exec ( ) )
{
2013-02-19 20:59:53 +00:00
QStringList fileNames = dialog . selectedFiles ( ) ;
2021-05-09 13:25:12 +00:00
SaveState : : Save ( Path ( fileNames [ 0 ] . toStdString ( ) ) , - 1 , SaveStateActionFinished , this ) ;
2013-01-13 23:29:42 +00:00
}
}
2020-04-16 14:14:56 +00:00
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 ;
}
2013-11-22 04:05:36 +00:00
void MainWindow : : exitAct ( )
2013-01-13 23:29:42 +00:00
{
2013-11-22 04:05:36 +00:00
closeAct ( ) ;
2013-02-19 20:59:53 +00:00
QApplication : : exit ( 0 ) ;
2013-01-13 23:29:42 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : runAct ( )
2013-01-13 23:29:42 +00:00
{
2023-09-30 09:21:22 +00:00
System_PostUIMessage ( UIMessage : : REQUEST_GAME_RUN ) ;
2013-01-13 23:29:42 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : pauseAct ( )
2013-01-13 23:29:42 +00:00
{
2023-09-30 09:21:22 +00:00
System_PostUIMessage ( UIMessage : : REQUEST_GAME_PAUSE ) ;
2013-01-13 23:29:42 +00:00
}
2020-04-16 16:49:18 +00:00
void MainWindow : : stopAct ( )
{
Core_Stop ( ) ;
2023-09-30 09:21:22 +00:00
System_PostUIMessage ( UIMessage : : REQUEST_GAME_STOP ) ;
2020-04-16 16:49:18 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : resetAct ( )
2013-01-13 23:29:42 +00:00
{
2018-06-03 17:46:17 +00:00
updateMenus ( ) ;
2023-09-30 09:21:22 +00:00
System_PostUIMessage ( UIMessage : : REQUEST_GAME_RESET ) ;
2013-01-13 23:29:42 +00:00
}
2020-04-18 18:08:20 +00:00
void MainWindow : : switchUMDAct ( )
{
2023-08-09 18:34:43 +00:00
QString filename = QFileDialog : : getOpenFileName ( NULL , " Switch UMD " , g_Config . currentDirectory . c_str ( ) , " PSP ROMs (*.pbp *.elf *.iso *.cso *.chd *.prx) " ) ;
2020-04-18 18:08:20 +00:00
if ( QFile : : exists ( filename ) )
{
QFileInfo info ( filename ) ;
2021-05-29 22:20:41 +00:00
g_Config . currentDirectory = Path ( info . absolutePath ( ) . toStdString ( ) ) ;
2021-05-09 17:06:02 +00:00
__UmdReplace ( Path ( filename . toStdString ( ) ) ) ;
2020-04-18 18:08:20 +00:00
}
}
2020-04-12 15:49:10 +00:00
void MainWindow : : breakonloadAct ( )
{
g_Config . bAutoRun = ! g_Config . bAutoRun ;
}
2013-11-22 04:05:36 +00:00
void MainWindow : : lmapAct ( )
2013-01-13 23:29:42 +00:00
{
2013-02-10 15:36:06 +00:00
QFileDialog dialog ( 0 , " Load .MAP " ) ;
dialog . setFileMode ( QFileDialog : : ExistingFile ) ;
QStringList filters ;
filters < < " Maps (*.map) " < < " |All files (*.*) " ;
dialog . setNameFilters ( filters ) ;
dialog . setAcceptMode ( QFileDialog : : AcceptOpen ) ;
QStringList fileNames ;
if ( dialog . exec ( ) )
fileNames = dialog . selectedFiles ( ) ;
2014-08-26 19:16:06 +00:00
if ( fileNames . count ( ) > 0 )
{
QString fileName = QFileInfo ( fileNames [ 0 ] ) . absoluteFilePath ( ) ;
2021-05-09 13:25:12 +00:00
g_symbolMap - > LoadSymbolMap ( Path ( fileName . toStdString ( ) ) ) ;
2013-02-10 15:36:06 +00:00
}
2013-01-13 23:29:42 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : smapAct ( )
2013-01-13 23:29:42 +00:00
{
2013-02-10 15:36:06 +00:00
QFileDialog dialog ( 0 , " Save .MAP " ) ;
dialog . setFileMode ( QFileDialog : : AnyFile ) ;
dialog . setAcceptMode ( QFileDialog : : AcceptSave ) ;
QStringList filters ;
filters < < " Save .MAP (*.map) " < < " |All files (*.*) " ;
dialog . setNameFilters ( filters ) ;
QStringList fileNames ;
if ( dialog . exec ( ) )
{
fileNames = dialog . selectedFiles ( ) ;
2021-05-09 13:25:12 +00:00
g_symbolMap - > SaveSymbolMap ( Path ( fileNames [ 0 ] . toStdString ( ) ) ) ;
2013-02-10 15:36:06 +00:00
}
2013-01-13 23:29:42 +00:00
}
2020-04-12 15:49:10 +00:00
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 ( ) ;
2021-05-09 13:25:12 +00:00
g_symbolMap - > LoadNocashSym ( Path ( fileName . toStdString ( ) ) ) ;
2020-04-12 15:49:10 +00:00
}
}
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 ( ) ;
2021-05-09 13:25:12 +00:00
g_symbolMap - > SaveNocashSym ( Path ( fileNames [ 0 ] . toStdString ( ) ) ) ;
2020-04-12 15:49:10 +00:00
}
}
2013-11-22 04:05:36 +00:00
void MainWindow : : resetTableAct ( )
2013-01-13 23:29:42 +00:00
{
2015-11-01 00:09:15 +00:00
g_symbolMap - > Clear ( ) ;
2013-02-19 20:59:53 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : dumpNextAct ( )
2013-02-19 20:59:53 +00:00
{
gpu - > DumpNextFrame ( ) ;
2013-01-13 23:29:42 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : consoleAct ( )
2013-02-19 20:59:53 +00:00
{
2024-07-21 10:20:23 +00:00
# if PPSSPP_PLATFORM(WINDOWS)
2013-02-19 20:59:53 +00:00
LogManager : : GetInstance ( ) - > GetConsoleListener ( ) - > Show ( LogManager : : GetInstance ( ) - > GetConsoleListener ( ) - > Hidden ( ) ) ;
2024-07-21 10:20:23 +00:00
# endif
2013-02-19 20:59:53 +00:00
}
2014-09-23 20:27:18 +00:00
void MainWindow : : raiseTopMost ( )
{
setWindowState ( ( windowState ( ) & ~ Qt : : WindowMinimized ) | Qt : : WindowActive ) ;
2020-01-05 07:46:27 +00:00
raise ( ) ;
2018-06-09 23:28:15 +00:00
activateWindow ( ) ;
2014-09-23 20:27:18 +00:00
}
2018-06-09 23:28:15 +00:00
void MainWindow : : SetFullScreen ( bool fullscreen ) {
if ( fullscreen ) {
2020-01-05 07:46:27 +00:00
# if !PPSSPP_PLATFORM(MAC)
2013-11-21 03:48:16 +00:00
menuBar ( ) - > hide ( ) ;
2020-01-05 07:46:27 +00:00
2013-11-20 14:06:40 +00:00
emugl - > setFixedSize ( QWIDGETSIZE_MAX , QWIDGETSIZE_MAX ) ;
2020-01-05 07:46:27 +00:00
// TODO: Shouldn't this be physicalSize()?
2018-06-09 23:28:15 +00:00
emugl - > resizeGL ( emugl - > size ( ) . width ( ) , emugl - > size ( ) . height ( ) ) ;
// TODO: Won't showFullScreen do this for us?
2013-11-21 03:24:33 +00:00
setMaximumSize ( QWIDGETSIZE_MAX , QWIDGETSIZE_MAX ) ;
2013-11-28 03:27:10 +00:00
setFixedSize ( QWIDGETSIZE_MAX , QWIDGETSIZE_MAX ) ;
2020-01-05 07:46:27 +00:00
# endif
2013-02-01 01:08:01 +00:00
showFullScreen ( ) ;
2023-02-25 12:09:44 +00:00
InitPadLayout ( g_display . dp_xres , g_display . dp_yres ) ;
2018-06-09 23:28:15 +00:00
2014-06-24 14:34:13 +00:00
if ( GetUIState ( ) = = UISTATE_INGAME & & ! g_Config . bShowTouchControls )
2013-11-04 12:30:38 +00:00
QApplication : : setOverrideCursor ( QCursor ( Qt : : BlankCursor ) ) ;
2018-06-09 23:28:15 +00:00
} else {
2020-01-05 07:46:27 +00:00
# if !PPSSPP_PLATFORM(MAC)
2018-06-09 23:28:15 +00:00
menuBar ( ) - > show ( ) ;
updateMenus ( ) ;
2020-01-05 07:46:27 +00:00
# endif
2018-06-09 23:28:15 +00:00
showNormal ( ) ;
SetWindowScale ( - 1 ) ;
2023-02-25 12:09:44 +00:00
InitPadLayout ( g_display . dp_xres , g_display . dp_yres ) ;
2013-11-04 12:30:38 +00:00
2018-06-09 23:28:15 +00:00
if ( GetUIState ( ) = = UISTATE_INGAME & & QApplication : : overrideCursor ( ) )
QApplication : : restoreOverrideCursor ( ) ;
2020-10-10 14:26:07 +00:00
QDesktopWidget * desktop = QApplication : : desktop ( ) ;
int screenNum = QProcessEnvironment : : systemEnvironment ( ) . value ( " SDL_VIDEO_FULLSCREEN_HEAD " , " 0 " ) . toInt ( ) ;
// Move window to the center of selected screen
QRect rect = desktop - > screenGeometry ( screenNum ) ;
move ( ( rect . width ( ) - frameGeometry ( ) . width ( ) ) / 4 , ( rect . height ( ) - frameGeometry ( ) . height ( ) ) / 4 ) ;
2013-01-13 23:29:42 +00:00
}
2018-06-09 23:28:15 +00:00
}
void MainWindow : : fullscrAct ( )
{
// Toggle the current state.
g_Config . bFullScreen = ! isFullScreen ( ) ;
2022-05-28 22:47:12 +00:00
g_Config . iForceFullScreen = - 1 ;
2018-06-09 23:28:15 +00:00
SetFullScreen ( g_Config . bFullScreen ) ;
2014-09-24 21:24:23 +00:00
QTimer : : singleShot ( 1000 , this , SLOT ( raiseTopMost ( ) ) ) ;
2013-01-13 23:29:42 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : websiteAct ( )
2013-01-13 23:29:42 +00:00
{
2017-11-14 11:50:27 +00:00
QDesktopServices : : openUrl ( QUrl ( " https://www.ppsspp.org/ " ) ) ;
2013-01-13 23:29:42 +00:00
}
2014-07-10 12:41:26 +00:00
void MainWindow : : forumAct ( )
{
2017-11-14 11:50:27 +00:00
QDesktopServices : : openUrl ( QUrl ( " https://forums.ppsspp.org/ " ) ) ;
2014-07-10 12:41:26 +00:00
}
2020-04-12 14:03:47 +00:00
void MainWindow : : goldAct ( )
{
2023-01-28 23:25:00 +00:00
QDesktopServices : : openUrl ( QUrl ( " https://www.ppsspp.org/buygold " ) ) ;
2020-04-12 14:03:47 +00:00
}
2020-01-05 07:46:27 +00:00
void MainWindow : : gitAct ( )
2017-02-05 13:16:22 +00:00
{
QDesktopServices : : openUrl ( QUrl ( " https://github.com/hrydgard/ppsspp/ " ) ) ;
}
2020-04-12 14:03:47 +00:00
void MainWindow : : discordAct ( )
{
QDesktopServices : : openUrl ( QUrl ( " https://discord.gg/5NJB6dD " ) ) ;
}
2013-11-22 04:05:36 +00:00
void MainWindow : : aboutAct ( )
2013-01-13 23:29:42 +00:00
{
2016-10-12 18:58:50 +00:00
QMessageBox : : about ( this , " About " , QString ( " PPSSPP Qt %1 \n \n "
2014-07-10 12:41:26 +00:00
" PSP emulator and debugger \n \n "
" Copyright (c) by Henrik Rydg \xc3 \xa5 rd and the PPSSPP Project 2012- \n "
" Qt port maintained by xSacha \n \n "
" Additional credits: \n "
" PSPSDK by #pspdev (freenode) \n "
" CISO decompression code by BOOSTER \n "
" zlib by Jean-loup Gailly (compression) and Mark Adler (decompression) \n "
" Qt project by Digia \n \n "
" All trademarks are property of their respective owners. \n "
2016-10-12 18:58:50 +00:00
" 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 ) ) ;
2013-01-13 23:29:42 +00:00
}
2013-02-19 20:59:53 +00:00
/* Private functions */
2016-05-21 16:22:14 +00:00
void MainWindow : : SetWindowScale ( int zoom ) {
2013-11-21 03:48:16 +00:00
if ( isFullScreen ( ) )
2013-11-22 04:05:36 +00:00
fullscrAct ( ) ;
2013-02-19 20:59:53 +00:00
2016-05-21 16:22:14 +00:00
int width , height ;
2016-05-21 17:43:24 +00:00
if ( zoom = = - 1 & & ( g_Config . iWindowWidth < = 0 | | g_Config . iWindowHeight < = 0 ) ) {
// Default to zoom level 2.
zoom = 2 ;
}
2016-05-21 16:22:14 +00:00
if ( zoom = = - 1 ) {
// Take the last setting.
width = g_Config . iWindowWidth ;
height = g_Config . iWindowHeight ;
} else {
// Update to the specified factor. Let's clamp first.
if ( zoom < 1 )
zoom = 1 ;
2018-06-09 23:35:13 +00:00
if ( zoom > 10 )
zoom = 10 ;
2016-05-21 16:22:14 +00:00
width = ( g_Config . IsPortrait ( ) ? 272 : 480 ) * zoom ;
height = ( g_Config . IsPortrait ( ) ? 480 : 272 ) * zoom ;
}
2013-02-19 20:59:53 +00:00
2016-05-21 16:22:14 +00:00
g_Config . iWindowWidth = width ;
g_Config . iWindowHeight = height ;
2020-01-05 07:46:27 +00:00
# if !PPSSPP_PLATFORM(MAC)
2016-05-21 16:22:14 +00:00
emugl - > setFixedSize ( g_Config . iWindowWidth , g_Config . iWindowHeight ) ;
2020-01-05 07:46:27 +00:00
// TODO: Shouldn't this be scaled size?
2018-06-09 23:28:15 +00:00
emugl - > resizeGL ( g_Config . iWindowWidth , g_Config . iWindowHeight ) ;
2016-05-21 16:22:14 +00:00
setFixedSize ( sizeHint ( ) ) ;
2020-01-05 07:46:27 +00:00
# else
resize ( g_Config . iWindowWidth , g_Config . iWindowHeight ) ;
# endif
2020-11-06 09:53:57 +00:00
updateMenus ( ) ;
2013-02-03 23:45:37 +00:00
}
2013-02-06 17:49:20 +00:00
2013-02-19 20:59:53 +00:00
void MainWindow : : SetGameTitle ( QString text )
2013-02-06 17:49:20 +00:00
{
2016-10-12 18:58:50 +00:00
QString title = QString ( " PPSSPP %1 " ) . arg ( PPSSPP_GIT_VERSION ) ;
2013-02-19 20:59:53 +00:00
if ( text ! = " " )
title + = QString ( " - %1 " ) . arg ( text ) ;
setWindowTitle ( title ) ;
2013-02-06 17:49:20 +00:00
}
2013-11-22 04:05:36 +00:00
void MainWindow : : loadLanguage ( const QString & language , bool translate )
2013-02-06 17:49:20 +00:00
{
if ( currentLanguage ! = language )
{
2014-07-10 12:41:26 +00:00
QLocale : : setDefault ( QLocale ( language ) ) ;
2013-11-19 09:32:31 +00:00
QApplication : : removeTranslator ( & translator ) ;
2014-07-10 12:41:26 +00:00
currentLanguage = language ;
2013-11-19 09:32:31 +00:00
if ( translator . load ( QString ( " :/languages/ppsspp_%1.qm " ) . arg ( language ) ) ) {
QApplication : : installTranslator ( & translator ) ;
}
2014-07-10 12:41:26 +00:00
if ( translate )
emit retranslate ( ) ;
2013-02-06 17:49:20 +00:00
}
}
2013-11-19 10:18:11 +00:00
void MainWindow : : createMenus ( )
2013-02-06 17:49:20 +00:00
{
2013-11-19 04:02:24 +00:00
// File
2013-11-22 04:05:36 +00:00
MenuTree * fileMenu = new MenuTree ( this , menuBar ( ) , QT_TR_NOOP ( " &File " ) ) ;
2020-04-12 22:48:19 +00:00
fileMenu - > add ( new MenuAction ( this , SLOT ( loadAct ( ) ) , QT_TR_NOOP ( " &Load... " ) , QKeySequence : : Open ) )
2013-11-22 04:05:36 +00:00
- > addEnableState ( UISTATE_MENU ) ;
2013-11-19 11:02:43 +00:00
fileMenu - > addSeparator ( ) ;
2020-04-16 14:14:56 +00:00
fileMenu - > add ( new MenuAction ( this , SLOT ( openmsAct ( ) ) , QT_TR_NOOP ( " Open &Memory Stick " ) ) )
2020-04-12 17:12:42 +00:00
- > 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 < int > ( ) < < 0 < < 1 < < 2 < < 3 < < 4 ) ;
fileMenu - > add ( new MenuAction ( this , SLOT ( qlstateAct ( ) ) , QT_TR_NOOP ( " L&oad state " ) , Qt : : Key_F4 ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2020-04-12 17:12:42 +00:00
fileMenu - > add ( new MenuAction ( this , SLOT ( qsstateAct ( ) ) , QT_TR_NOOP ( " S&ave state " ) , Qt : : Key_F2 ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2020-04-12 17:12:42 +00:00
fileMenu - > add ( new MenuAction ( this , SLOT ( lstateAct ( ) ) , QT_TR_NOOP ( " &Load state file... " ) ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2020-04-12 17:12:42 +00:00
fileMenu - > add ( new MenuAction ( this , SLOT ( sstateAct ( ) ) , QT_TR_NOOP ( " &Save state file... " ) ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2020-04-16 14:14:56 +00:00
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 ) ;
recordMenu - > addSeparator ( ) ;
recordMenu - > add ( new MenuAction ( this , SLOT ( recordAudioAct ( ) ) , QT_TR_NOOP ( " Record &audio " ) ) )
- > addEventChecked ( & g_Config . bDumpAudio ) ;
2013-11-19 11:02:43 +00:00
fileMenu - > addSeparator ( ) ;
2020-04-12 22:48:19 +00:00
fileMenu - > add ( new MenuAction ( this , SLOT ( exitAct ( ) ) , QT_TR_NOOP ( " E&xit " ) , QKeySequence : : Quit ) ) ;
2013-11-19 04:02:24 +00:00
// Emulation
2013-11-22 04:05:36 +00:00
MenuTree * emuMenu = new MenuTree ( this , menuBar ( ) , QT_TR_NOOP ( " &Emulation " ) ) ;
2020-04-16 16:49:18 +00:00
emuMenu - > add ( new MenuAction ( this , SLOT ( pauseAct ( ) ) , QT_TR_NOOP ( " &Pause " ) ) )
- > addEnableState ( UISTATE_INGAME ) ;
emuMenu - > add ( new MenuAction ( this , SLOT ( stopAct ( ) ) , QT_TR_NOOP ( " &Stop " ) , Qt : : CTRL + Qt : : Key_W ) )
2013-11-22 04:05:36 +00:00
- > addEnableState ( UISTATE_INGAME ) ;
2020-04-16 16:49:18 +00:00
emuMenu - > add ( new MenuAction ( this , SLOT ( resetAct ( ) ) , QT_TR_NOOP ( " R&eset " ) , Qt : : CTRL + Qt : : Key_B ) )
2013-11-22 04:05:36 +00:00
- > addEnableState ( UISTATE_INGAME ) ;
2020-04-18 18:08:20 +00:00
emuMenu - > add ( new MenuAction ( this , SLOT ( switchUMDAct ( ) ) , QT_TR_NOOP ( " Switch UMD " ) , Qt : : CTRL + Qt : : Key_U ) )
- > addEnableState ( UISTATE_INGAME ) ;
2020-04-12 16:26:44 +00:00
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 < int > ( ) < < 1 < < 2 < < 3 < < 4 ) ;
2013-11-19 04:02:24 +00:00
// Debug
2020-04-12 15:49:10 +00:00
MenuTree * debugMenu = new MenuTree ( this , menuBar ( ) , QT_TR_NOOP ( " &Debug " ) ) ;
debugMenu - > add ( new MenuAction ( this , SLOT ( breakonloadAct ( ) ) , QT_TR_NOOP ( " Break on load " ) ) )
2020-04-13 11:40:47 +00:00
- > addEventUnchecked ( & g_Config . bAutoRun ) ;
2020-04-12 15:49:10 +00:00
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... " ) ) )
- > addDisableState ( UISTATE_MENU ) ;
2020-04-12 22:48:19 +00:00
debugMenu - > add ( new MenuAction ( this , SLOT ( lsymAct ( ) ) , QT_TR_NOOP ( " Lo&ad SYM file... " ) ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2020-04-12 22:48:19 +00:00
debugMenu - > add ( new MenuAction ( this , SLOT ( ssymAct ( ) ) , QT_TR_NOOP ( " Sav&e SYM file... " ) ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2020-04-12 15:49:10 +00:00
debugMenu - > add ( new MenuAction ( this , SLOT ( resetTableAct ( ) ) , QT_TR_NOOP ( " Reset s&ymbol table " ) ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2013-11-19 11:02:43 +00:00
debugMenu - > addSeparator ( ) ;
2020-04-12 15:49:10 +00:00
debugMenu - > add ( new MenuAction ( this , SLOT ( takeScreen ( ) ) , QT_TR_NOOP ( " &Take screenshot " ) , Qt : : Key_F12 ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2020-04-12 15:49:10 +00:00
debugMenu - > add ( new MenuAction ( this , SLOT ( dumpNextAct ( ) ) , QT_TR_NOOP ( " D&ump next frame to log " ) ) )
2013-12-07 18:57:06 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2013-11-19 11:02:43 +00:00
debugMenu - > addSeparator ( ) ;
2020-04-12 15:49:10 +00:00
debugMenu - > add ( new MenuAction ( this , SLOT ( consoleAct ( ) ) , QT_TR_NOOP ( " &Log console " ) , Qt : : CTRL + Qt : : Key_L ) )
2013-11-22 04:05:36 +00:00
- > addDisableState ( UISTATE_MENU ) ;
2013-11-19 04:02:24 +00:00
2020-04-12 15:17:36 +00:00
// Game settings
MenuTree * gameSettingsMenu = new MenuTree ( this , menuBar ( ) , QT_TR_NOOP ( " &Game settings " ) ) ;
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... " ) ) ) ;
2022-11-27 16:32:34 +00:00
gameSettingsMenu - > add ( new MenuAction ( this , SLOT ( displayLayoutEditorAct ( ) ) , QT_TR_NOOP ( " Display layout & effects... " ) ) ) ;
2020-04-12 15:17:36 +00:00
gameSettingsMenu - > add ( new MenuAction ( this , SLOT ( moreSettingsAct ( ) ) , QT_TR_NOOP ( " &More settings... " ) ) ) ;
gameSettingsMenu - > addSeparator ( ) ;
2013-11-26 07:03:31 +00:00
# if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
2020-04-12 15:17:36 +00:00
gameSettingsMenu - > add ( new MenuAction ( this , SLOT ( fullscrAct ( ) ) , QT_TR_NOOP ( " &Fullscreen " ) , Qt : : Key_F11 ) )
2013-11-26 07:03:31 +00:00
# else
2020-04-12 15:17:36 +00:00
gameSettingsMenu - > add ( new MenuAction ( this , SLOT ( fullscrAct ( ) ) , QT_TR_NOOP ( " Fu&llscreen " ) , QKeySequence : : FullScreen ) )
2013-11-26 07:03:31 +00:00
# endif
2013-11-22 04:05:36 +00:00
- > addEventChecked ( & g_Config . bFullScreen ) ;
2022-11-06 19:01:03 +00:00
gameSettingsMenu - > add ( new MenuAction ( this , SLOT ( bufferRenderAct ( ) ) , QT_TR_NOOP ( " &Skip buffer effects " ) ) )
- > addEventChecked ( & g_Config . bSkipBufferEffects ) ;
2020-04-12 15:17:36 +00:00
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 < int > ( ) < < 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 " ,
2020-11-06 09:53:57 +00:00
QList < int > ( ) < < 1 < < 2 < < 3 < < 4 < < 5 < < 6 < < 7 < < 8 < < 9 < < 10 ) ;
2020-04-12 15:17:36 +00:00
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 < int > ( ) < < 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 < int > ( ) < < 0 < < 1 ) ;
MenuTree * textureFilteringMenu = new MenuTree ( this , gameSettingsMenu , QT_TR_NOOP ( " Te&xture filtering " ) ) ;
textureFilteringGroup = new MenuActionGroup ( this , textureFilteringMenu , SLOT ( textureFilteringGroup_triggered ( QAction * ) ) ,
2021-10-06 02:27:39 +00:00
QStringList ( ) < < " &Auto " < < " &Nearest " < < " &Linear " < < " Auto Max &Quality " ,
2020-04-12 15:17:36 +00:00
QList < int > ( ) < < 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 < int > ( ) < < 0 < < 1 ) ;
MenuTree * textureScalingMenu = new MenuTree ( this , gameSettingsMenu , QT_TR_NOOP ( " &Texture scaling " ) ) ;
textureScalingLevelGroup = new MenuActionGroup ( this , textureScalingMenu , SLOT ( textureScalingLevelGroup_triggered ( QAction * ) ) ,
2021-10-06 02:27:39 +00:00
QStringList ( ) < < " &Off " < < " &2x " < < " &3x " < < " &4x " < < " &5x " ,
QList < int > ( ) < < 1 < < 2 < < 3 < < 4 < < 5 ) ;
2020-04-12 15:17:36 +00:00
textureScalingMenu - > addSeparator ( ) ;
textureScalingTypeGroup = new MenuActionGroup ( this , textureScalingMenu , SLOT ( textureScalingTypeGroup_triggered ( QAction * ) ) ,
QStringList ( ) < < " &xBRZ " < < " &Hybrid " < < " &Bicubic " < < " H&ybrid + bicubic " ,
QList < int > ( ) < < 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 - > 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 ) ;
2020-04-15 15:16:14 +00:00
gameSettingsMenu - > addSeparator ( ) ;
2021-09-15 12:32:54 +00:00
gameSettingsMenu - > add ( new MenuAction ( this , SLOT ( chatAct ( ) ) , QT_TR_NOOP ( " Open chat " ) , Qt : : CTRL + Qt : : Key_C ) )
- > SetEnabledFunc ( [ = ] ( ) {
return g_Config . bEnableNetworkChat & & GetUIState ( ) = = UISTATE_INGAME ;
} ) ;
2020-01-05 07:46:27 +00:00
2013-11-19 04:02:24 +00:00
// Help
2013-11-22 04:05:36 +00:00
MenuTree * helpMenu = new MenuTree ( this , menuBar ( ) , QT_TR_NOOP ( " &Help " ) ) ;
2020-04-12 14:03:47 +00:00
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... " ) ) ) ;
2013-11-19 09:32:31 +00:00
2013-11-22 04:05:36 +00:00
retranslate ( ) ;
2013-02-06 17:49:20 +00:00
}