From dde656ddc661dc8c2837c4ad78107be4dcdc801c Mon Sep 17 00:00:00 2001 From: Sacha Date: Tue, 15 Jan 2013 01:13:53 +1000 Subject: [PATCH] Improve Qt build. Fix for pandora build. Only show controls overlay by default for mobile platforms (Qt). --- Common/ArmEmitter.h | 1 + Common/Log.h | 2 +- Core/Config.cpp | 7 ++- Core/Core.cpp | 4 +- Qt/Core.pro | 2 - Qt/EmuThread.cpp | 12 ++-- Qt/EmuThread.h | 4 +- Qt/PPSSPP.pro | 150 +++++++++++++++++++++----------------------- Qt/Settings.pri | 4 +- Qt/mainwindow.cpp | 12 +--- Qt/qtapp.cpp | 32 +++------- 11 files changed, 104 insertions(+), 126 deletions(-) diff --git a/Common/ArmEmitter.h b/Common/ArmEmitter.h index bf9222f22e..aa1aef6faa 100644 --- a/Common/ArmEmitter.h +++ b/Common/ArmEmitter.h @@ -26,6 +26,7 @@ #include #endif +#undef R0 #undef _SP namespace ArmGen diff --git a/Common/Log.h b/Common/Log.h index ab10b9125f..b027fc2962 100644 --- a/Common/Log.h +++ b/Common/Log.h @@ -23,7 +23,7 @@ #define INFO_LEVEL 4 // General information. #define DEBUG_LEVEL 5 // Detailed debugging - might make things slow. -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(PANDORA) #include #endif diff --git a/Core/Config.cpp b/Core/Config.cpp index ba7a49e48c..778e18793b 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -73,7 +73,12 @@ void CConfig::Load(const char *iniFileName) IniFile::Section *control = iniFile.GetOrCreateSection("Control"); control->Get("ShowStick", &bShowAnalogStick, false); - control->Get("ShowTouchControls", &bShowTouchControls, true); + control->Get("ShowTouchControls", &bShowTouchControls, +#ifdef USING_GLES2 + true); +#else + false); +#endif // Ephemeral settings bDrawWireframe = false; diff --git a/Core/Core.cpp b/Core/Core.cpp index 0515304daa..5fab683bea 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -84,7 +84,7 @@ void Core_Run() #if defined(_DEBUG) host->UpdateDisassembly(); #endif -#ifndef LINUX +#if !defined(USING_QT_UI) || defined(USING_GLES2) while (true) #endif { @@ -103,7 +103,7 @@ reswitch: if (coreState == CORE_POWERDOWN) return; if (coreState != CORE_STEPPING) -#ifdef LINUX +#if defined(USING_QT_UI) && !defined(USING_GLES2) return; #else goto reswitch; diff --git a/Qt/Core.pro b/Qt/Core.pro index 0e109043cf..f82865ed40 100755 --- a/Qt/Core.pro +++ b/Qt/Core.pro @@ -256,5 +256,3 @@ HEADERS += ../Core/CPU.h \ ../ext/libkirk/AES.h \ ../ext/libkirk/SHA1.h \ ../ext/libkirk/kirk_engine.h - - diff --git a/Qt/EmuThread.cpp b/Qt/EmuThread.cpp index d3afcb9c59..1bb550c2aa 100644 --- a/Qt/EmuThread.cpp +++ b/Qt/EmuThread.cpp @@ -19,14 +19,13 @@ #include "qtemugl.h" -char fileToStart[MAX_PATH]; +QString fileToStart; QtEmuGL* glWindow; -void EmuThread_Start(const char *filename, QtEmuGL* w) +void EmuThread_Start(QString filename, QtEmuGL* w) { //_dbg_clear_(); - strncpy(fileToStart, filename, sizeof(fileToStart) - 1); - fileToStart[sizeof(fileToStart) - 1] = 0; + fileToStart = filename; glWindow = w; w->start_rendering(); @@ -40,8 +39,7 @@ void EmuThread_Stop() host->UpdateUI(); } - -char *GetCurrentFilename() +QString GetCurrentFilename() { return fileToStart; } @@ -72,7 +70,7 @@ void EmuThread::run() INFO_LOG(BOOT, "Starting up hardware."); CoreParameter coreParameter; - coreParameter.fileToStart = fileToStart; + coreParameter.fileToStart = fileToStart.toStdString(); coreParameter.enableSound = true; coreParameter.gpuCore = GPU_GLES; coreParameter.cpuCore = (CPUCore)g_Config.iCpuCore; diff --git a/Qt/EmuThread.h b/Qt/EmuThread.h index e21c511434..cb14b792a4 100644 --- a/Qt/EmuThread.h +++ b/Qt/EmuThread.h @@ -21,7 +21,7 @@ private: bool running; }; -void EmuThread_Start(const char *filename, QtEmuGL* glWindow); +void EmuThread_Start(QString filename, QtEmuGL* glWindow); void EmuThread_Stop(); -char *GetCurrentFilename(); +QString GetCurrentFilename(); diff --git a/Qt/PPSSPP.pro b/Qt/PPSSPP.pro index ae5cb8abd0..4534470940 100755 --- a/Qt/PPSSPP.pro +++ b/Qt/PPSSPP.pro @@ -1,77 +1,73 @@ -TARGET = PPSSPPQt -QT += core gui opengl - -include(Settings.pri) -linux { - CONFIG += mobility - MOBILITY += multimedia -} -else { - QT += multimedia -} - -# Libs -symbian: LIBS += -lCore.lib -lCommon.lib -lNative.lib -lcone -leikcore -lavkon -lezlib - -blackberry: LIBS += -L. -lCore -lCommon -lNative -lscreen -lsocket -lstdc++ - -win32: LIBS += -L. -lCore -lCommon -lNative -lwinmm -lws2_32 -lkernel32 -luser32 -lgdi32 -lshell32 -lcomctl32 -ldsound -lxinput - -linux: LIBS += -L. -lCore -lCommon -lNative - -# Main -SOURCES += ../native/base/QtMain.cpp -linux { - SOURCES += mainwindow.cpp \ - debugger_disasm.cpp \ - EmuThread.cpp\ - qtapp.cpp \ - qtemugl.cpp \ - ctrldisasmview.cpp \ - ctrlregisterlist.cpp \ - controls.cpp -} -HEADERS += ../native/base/QtMain.h -linux { - HEADERS += mainwindow.h \ - debugger_disasm.h \ - EmuThread.h \ - qtapp.h \ - qtemugl.h \ - ctrldisasmview.h \ - ctrlregisterlist.h \ - ctrldisasmview.h \ - ctrlregisterlist.h \ - controls.h -} - -# Native -SOURCES += ../android/jni/NativeApp.cpp \ - ../android/jni/EmuScreen.cpp \ - ../android/jni/MenuScreens.cpp \ - ../android/jni/GamepadEmu.cpp \ - ../android/jni/UIShader.cpp \ - ../android/jni/ui_atlas.cpp - -INCLUDEPATH += .. ../Common ../native - -# Packaging -symbian { - vendorinfo = "%{\"Qtness\"}" ":\"Qtness\"" - packageheader = "$${LITERAL_HASH}{\"PPSSPP\"}, (0xE0095B1D), 0, 0, 5, TYPE=SA" - my_deployment.pkg_prerules = packageheader vendorinfo - assets.sources = ../android/assets/ui_atlas.zim ../android/assets/ppge_atlas.zim - assets.path = E:/PPSSPP - DEPLOYMENT += my_deployment assets - ICON = ../assets/icon.svg -# 268MB maximum - TARGET.EPOCHEAPSIZE = 0x40000 0x10000000 - TARGET.EPOCSTACKSIZE = 0x10000 -} - -linux { - FORMS += mainwindow.ui \ - debugger_disasm.ui \ - controls.ui -} - +TARGET = PPSSPPQt +QT += core gui opengl + +include(Settings.pri) +linux { + CONFIG += mobility + MOBILITY += multimedia +} +else { + QT += multimedia +} + +# Libs +symbian: LIBS += -lCore.lib -lCommon.lib -lNative.lib -lcone -leikcore -lavkon -lezlib + +blackberry: LIBS += -L. -lCore -lCommon -lNative -lscreen -lsocket -lstdc++ + +win32: LIBS += -L. -lCore -lCommon -lNative -lwinmm -lws2_32 -lkernel32 -luser32 -lgdi32 -lshell32 -lcomctl32 -ldsound -lxinput + +linux: LIBS += -L. -lCore -lCommon -lNative + +# Main +SOURCES += ../native/base/QtMain.cpp +HEADERS += ../native/base/QtMain.h + +# Native +SOURCES += ../android/jni/NativeApp.cpp \ + ../android/jni/EmuScreen.cpp \ + ../android/jni/MenuScreens.cpp \ + ../android/jni/GamepadEmu.cpp \ + ../android/jni/UIShader.cpp \ + ../android/jni/ui_atlas.cpp + +INCLUDEPATH += .. ../Common ../native + +linux:!mobile_platform { + SOURCES += mainwindow.cpp \ + debugger_disasm.cpp \ + EmuThread.cpp\ + qtapp.cpp \ + qtemugl.cpp \ + ctrldisasmview.cpp \ + ctrlregisterlist.cpp \ + controls.cpp + HEADERS += mainwindow.h \ + debugger_disasm.h \ + EmuThread.h \ + qtapp.h \ + qtemugl.h \ + ctrldisasmview.h \ + ctrlregisterlist.h \ + controls.h +} + +# Packaging +symbian { + vendorinfo = "%{\"Qtness\"}" ":\"Qtness\"" + packageheader = "$${LITERAL_HASH}{\"PPSSPP\"}, (0xE0095B1D), 0, 0, 5, TYPE=SA" + my_deployment.pkg_prerules = packageheader vendorinfo + assets.sources = ../android/assets/ui_atlas.zim ../android/assets/ppge_atlas.zim + assets.path = E:/PPSSPP + DEPLOYMENT += my_deployment assets + ICON = ../assets/icon.svg +# 268MB maximum + TARGET.EPOCHEAPSIZE = 0x40000 0x10000000 + TARGET.EPOCSTACKSIZE = 0x10000 +} + +linux:!mobile_platform { + FORMS += mainwindow.ui \ + debugger_disasm.ui \ + controls.ui +} diff --git a/Qt/Settings.pri b/Qt/Settings.pri index a73ee46d07..46f527a450 100644 --- a/Qt/Settings.pri +++ b/Qt/Settings.pri @@ -31,6 +31,4 @@ symbian: { DEFINES += SYMBIAN CONFIG += 4.6.3 } -linux: { - DEFINES += LINUX -} + diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index e0cd3c9232..2b4b97bfc2 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -213,15 +213,9 @@ void MainWindow::SetNextState(CoreState state) void MainWindow::BrowseAndBoot(void) { - QFileDialog dialog(0,"Load File"); - dialog.setFileMode(QFileDialog::ExistingFile); - dialog.setNameFilter("PSP (*.pbp *.elf *.iso *.cso *.prx)"); - QStringList fileNames; - if (dialog.exec()) - { - fileNames = dialog.selectedFiles(); - EmuThread_Start(fileNames.at(0).toAscii(), w); - } + QString filename = QFileDialog::getOpenFileName(NULL, "Load File", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.prx)"); + if (QFile::exists(filename)) + EmuThread_Start(filename, w); } void MainWindow::Boot() diff --git a/Qt/qtapp.cpp b/Qt/qtapp.cpp index ce8e2c7376..67176ba2dd 100644 --- a/Qt/qtapp.cpp +++ b/Qt/qtapp.cpp @@ -1,3 +1,5 @@ +#include + #include "qtapp.h" #include "EmuThread.h" #include "Core/Debugger/SymbolMap.h" @@ -31,7 +33,7 @@ void QtApp::SetWindowTitle(const char *message) void QtApp::InitSound(PMixer *mixer) { - NativeSetMixer(mixer); +// NativeSetMixer(mixer); } void QtApp::UpdateSound() @@ -40,7 +42,7 @@ void QtApp::UpdateSound() void QtApp::ShutdownSound() { - NativeSetMixer(0); +// NativeSetMixer(0); } void QtApp::UpdateUI() @@ -94,30 +96,16 @@ void QtApp::BootDone() bool QtApp::AttemptLoadSymbolMap() { - char filename[256]; - strcpy(filename, GetCurrentFilename()); - int len = strlen(filename); - int ptpos = len-1; - while (filename[ptpos]!='.' && ptpos>len-8) - ptpos--; - filename[ptpos+1] = 'm'; - filename[ptpos+2] = 'a'; - filename[ptpos+3] = 'p'; - return symbolMap.LoadSymbolMap(filename); + QFileInfo currentFile(GetCurrentFilename()); + QString ret = currentFile.baseName() + ".map"; + return symbolMap.LoadSymbolMap(ret.toAscii().constData()); } void QtApp::PrepareShutdown() { - char filename[256]; - strcpy(filename, GetCurrentFilename()); - int len = strlen(filename); - int ptpos = len-1; - while (filename[ptpos]!='.' && ptpos>len-8) - ptpos--; - filename[ptpos+1] = 'm'; - filename[ptpos+2] = 'a'; - filename[ptpos+3] = 'p'; - symbolMap.SaveSymbolMap(filename); + QFileInfo currentFile(GetCurrentFilename()); + QString ret = currentFile.baseName() + ".map"; + symbolMap.SaveSymbolMap(ret.toAscii().constData()); } void QtApp::AddSymbol(std::string name, u32 addr, u32 size, int type=0)