Merge branch 'master' into TemporaryHackishBranch

# Conflicts:
#	Core/CwCheat.cpp
#	UI/GameSettingsScreen.cpp
This commit is contained in:
LunaMoo committed 2020-04-17 16:27:45 +02:00
commit 35ce143075
8 files changed
+380 -209

No files matched your search

+15 -15
View File
@@ -446,10 +446,6 @@ struct CheatOperation {
uint32_t addr;
int sz;
uint32_t val;
uint16_t vibrL;
uint16_t vibrR;
uint8_t vibrLTime;
uint8_t vibrRTime;
union {
struct {
@@ -610,20 +606,24 @@ CheatOperation CWCheatEngine::InterpretNextCwCheat(const CheatCode &cheat, size_
}
return { CheatOp::Invalid };
case 0xA: // Vibration command(PPSSPP specific)
// 0xA1 reads vibration from memory
if (((line1.part1 >> 24) & 0xFF) == 0xA1) {
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 };
} else { // 0xA0 sets 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;
// Place for other PPSSPP specific cheats
default:
return { CheatOp::Invalid };
}
return { CheatOp::Invalid };
case 0xB: // Delay command.
return { CheatOp::Delay, 0, 0, arg };
+8
View File
@@ -80,6 +80,8 @@ bool TextureReplacer::LoadIni() {
allowVideo_ = false;
ignoreAddress_ = false;
reduceHash_ = false;
// Prevents dumping the mipmaps.
ignoreMipmap_ = false;
if (File::Exists(basePath_ + INI_FILENAME)) {
IniFile ini;
@@ -128,6 +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("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.");
@@ -411,6 +414,9 @@ void TextureReplacer::NotifyTextureDecoded(const ReplacedTextureDecodeInfo &repl
if (ignoreAddress_) {
cachekey = cachekey & 0xFFFFFFFFULL;
}
if (ignoreMipmap_ && level > 0) {
return;
}
std::string hashfile = LookupHashFile(cachekey, replacedInfo.hash, level);
const std::string filename = basePath_ + hashfile;
@@ -687,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.";
+1
View File
@@ -203,6 +203,7 @@ protected:
bool allowVideo_ = false;
bool ignoreAddress_ = false;
bool reduceHash_ = false;
bool ignoreMipmap_ = false;
std::string gameID_;
std::string basePath_;
ReplacedTextureHash hash_ = ReplacedTextureHash::QUICK;
+257 -156
View File
@@ -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"));
@@ -80,14 +80,21 @@ void MainWindow::newFrame()
void MainWindow::updateMenus()
{
foreach(QAction * action, anisotropicGroup->actions()) {
if (g_Config.iAnisotropyLevel == action->data().toInt()) {
foreach(QAction * action, saveStateGroup->actions()) {
if (g_Config.iCurrentStateSlot == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, screenGroup->actions()) {
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();
if (g_Config.iWindowWidth == width && g_Config.iWindowHeight == height) {
@@ -96,32 +103,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;
}
@@ -140,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))
@@ -159,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?
@@ -214,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();
@@ -230,6 +289,12 @@ void MainWindow::pauseAct()
NativeMessageReceived("pause", "");
}
void MainWindow::stopAct()
{
Core_Stop();
NativeMessageReceived("stop", "");
}
void MainWindow::resetAct()
{
updateMenus();
@@ -237,7 +302,7 @@ void MainWindow::resetAct()
NativeMessageReceived("reset", "");
}
void MainWindow::runonloadAct()
void MainWindow::breakonloadAct()
{
g_Config.bAutoRun = !g_Config.bAutoRun;
}
@@ -277,6 +342,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();
@@ -351,11 +451,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"
@@ -438,170 +548,161 @@ 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..."), 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(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<int>() << 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);
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);
fileMenu->addSeparator();
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"));
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->addSeparator();
emuMenu->add(new MenuAction(this, SLOT(runonloadAct()), QT_TR_NOOP("Run on &load")))
->addEventChecked(&g_Config.bAutoRun);
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 *)),
QStringList() << "Landscape" << "Portrait" << "Landscape reversed" << "Portrait reversed",
QList<int>() << 1 << 2 << 3 << 4);
// 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...")))
->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(resetTableAct()),QT_TR_NOOP("Reset Symbol Table")))
->addDisableState(UISTATE_MENU);
debugMenu->addSeparator();
debugMenu->add(new MenuAction(this, SLOT(dumpNextAct()), QT_TR_NOOP("Dump next frame to log")))
->addDisableState(UISTATE_MENU);
debugMenu->add(new MenuAction(this, SLOT(takeScreen()), QT_TR_NOOP("Take Screenshot"), Qt::Key_F12))
->addDisableState(UISTATE_MENU);
debugMenu->addSeparator();
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")))
MenuTree* debugMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Debug"));
debugMenu->add(new MenuAction(this, SLOT(breakonloadAct()), QT_TR_NOOP("Break on load")))
->addEventUnchecked(&g_Config.bAutoRun);
debugMenu->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<int>() << 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<int>() << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10,
QList<int>() << 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);
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);
debugMenu->add(new MenuAction(this, SLOT(lsymAct()), QT_TR_NOOP("Lo&ad SYM file...")))
->addDisableState(UISTATE_MENU);
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);
debugMenu->addSeparator();
debugMenu->add(new MenuAction(this, SLOT(takeScreen()), QT_TR_NOOP("&Take screenshot"), Qt::Key_F12))
->addDisableState(UISTATE_MENU);
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"), Qt::CTRL + Qt::Key_L))
->addDisableState(UISTATE_MENU);
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<int>() << 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(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")))
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",
QList<int>() << 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<int>() << 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<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 *)),
QStringList() << "&Auto" << "&Nearest" << "&Linear" << "Linear on &FMV",
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 *)),
QStringList() << "&Off" << "&Auto" << "&2x" << "&3x" << "&4x" << "&5x",
QList<int>() << 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<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->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<int>() << 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<int>() << 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<int>() << 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);
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"));
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();
}
+90 -31
View File
@@ -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,
@@ -68,36 +74,44 @@ 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();
void sstateAct();
void recordDisplayAct();
void useLosslessVideoCodecAct();
void useOutputBufferAct();
void recordAudioAct();
void exitAct();
// Emulation
void runAct();
void pauseAct();
void stopAct();
void resetAct();
void runonloadAct();
void displayRotationGroup_triggered(QAction *action) { g_Config.iInternalScreenRotation = action->data().toInt(); }
// 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; }
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 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 +119,47 @@ private slots:
}
void linearAct() { g_Config.iTexFiltering = (g_Config.iTexFiltering != 0) ? 0 : 3; }
void screenGroup_triggered(QAction *action) { SetWindowScale(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();
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();
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", "");
@@ -120,7 +169,17 @@ 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; }
// Chat
void chatAct() { NativeMessageReceived("chat screen", ""); }
void fullscrAct();
void raiseTopMost();
@@ -128,26 +187,14 @@ private slots:
g_Config.bShowDebugStats = !g_Config.bShowDebugStats;
NativeMessageReceived("clear jit", "");
}
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()); }
void showFPSAct() { g_Config.iShowFPSCounter = g_Config.iShowFPSCounter ? 0 : 3; } // 3 = both speed and FPS
// Help
void websiteAct();
void forumAct();
void goldAct();
void gitAct();
void discordAct();
void aboutAct();
// Others
@@ -167,8 +214,12 @@ private:
CoreState nextState;
GlobalUIState lastUIState;
QActionGroup *anisotropicGroup, *screenGroup, *displayLayoutGroup,
*defaultLogGroup, *g3dLogGroup, *hleLogGroup;
QActionGroup *windowGroup,
*textureScalingLevelGroup, *textureScalingTypeGroup,
*screenScalingFilterGroup, *textureFilteringGroup,
*frameSkippingTypeGroup, *frameSkippingGroup,
*renderingModeGroup, *renderingResolutionGroup,
*displayRotationGroup, *saveStateGroup;
std::queue<MainWindowMsg> msgQueue_;
std::mutex msgMutex_;
@@ -184,7 +235,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);
@@ -196,7 +247,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);
@@ -217,6 +268,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;
@@ -235,6 +291,8 @@ public slots:
void update() {
if (_eventCheck)
setChecked(*_eventCheck);
if (_eventUncheck)
setChecked(!*_eventUncheck);
if (_stateEnable >= 0)
setEnabled(GetUIState() == _stateEnable);
if (_stateDisable >= 0)
@@ -245,6 +303,7 @@ public slots:
private:
const char *_text;
bool *_eventCheck;
bool *_eventUncheck;
int _stateEnable, _stateDisable;
bool _enableStepping;
};
+5 -4
View File
@@ -1209,12 +1209,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.
+1 -1
View File
@@ -319,7 +319,7 @@ void GameSettingsScreen::CreateViews() {
#ifndef MOBILE_DEVICE
PopupSliderChoice *internalResolutions = graphicsSettings->Add(new PopupSliderChoice(&g_Config.iInternalResolution, 0, 32, gr->T("Rendering Resolution", "Rendering Resolution"), 1, screenManager(), gr->T("* PSP res, 0:Auto")));
#else
PopupSliderChoice *internalResolutions = graphicsSettings->Add(new PopupSliderChoice(&g_Config.iInternalResolution, 0, 8, gr->T("Rendering Resolution", "Rendering Resolution"), 1, screenManager(), gr->T("* PSP res, 0:Auto")));
PopupSliderChoice *internalResolutions = graphicsSettings->Add(new PopupSliderChoice(&g_Config.iInternalResolution, 0, 16, gr->T("Rendering Resolution", "Rendering Resolution"), 1, screenManager(), gr->T("* PSP res, 0:Auto")));
#endif
internalResolutions->SetFormat("%ix");
internalResolutions->SetZeroLabel(gr->T("Auto (1:1)"));
+3 -2
View File
@@ -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);
}
}