ENABLE_QT_GUI

This commit is contained in:
DanielSvoboda 2024-08-28 15:45:35 -03:00
parent 13ea39b515
commit 47089e4300
4 changed files with 21 additions and 17 deletions

View File

@ -1,11 +1,9 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#ifdef ENABLE_QT_GUI
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include "common/logging/log.h"
#include "common/path_util.h"
#ifdef ENABLE_QT_GUI
#include <QFile> #include <QFile>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
@ -13,7 +11,8 @@
#include <QListView> #include <QListView>
#include <QMessageBox> #include <QMessageBox>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#endif #include "common/logging/log.h"
#include "common/path_util.h"
#include "memory_patcher.h" #include "memory_patcher.h"
namespace MemoryPatcher { namespace MemoryPatcher {
@ -23,7 +22,6 @@ u64 g_eboot_image_size;
std::string g_game_serial; std::string g_game_serial;
std::vector<patchInfo> pending_patches; std::vector<patchInfo> pending_patches;
#ifdef ENABLE_QT_GUI
QString toHex(unsigned long long value, size_t byteSize) { QString toHex(unsigned long long value, size_t byteSize) {
std::stringstream ss; std::stringstream ss;
ss << std::hex << std::setfill('0') << std::setw(byteSize * 2) << value; ss << std::hex << std::setfill('0') << std::setw(byteSize * 2) << value;
@ -89,12 +87,10 @@ QString convertValueToHex(const QString& type, const QString& valueStr) {
} }
return result; return result;
} }
#endif
void OnGameLoaded() { void OnGameLoaded() {
// We use the QT headers for the xml and json parsing, this define is only true on QT builds // We use the QT headers for the xml and json parsing, this define is only true on QT builds
#ifdef ENABLE_QT_GUI
QString patchDir = QString patchDir =
QString::fromStdString(Common::FS::GetUserPath(Common::FS::PathType::PatchesDir).string()); QString::fromStdString(Common::FS::GetUserPath(Common::FS::PathType::PatchesDir).string());
QString repositories[] = {"GoldHEN", "shadPS4"}; QString repositories[] = {"GoldHEN", "shadPS4"};
@ -237,8 +233,6 @@ void OnGameLoaded() {
} else { } else {
LOG_INFO(Loader, "Patches loaded successfully"); LOG_INFO(Loader, "Patches loaded successfully");
} }
#endif
ApplyPendingPatches(); ApplyPendingPatches();
} }
} }
@ -352,4 +346,6 @@ uintptr_t PatternScan(const std::string& signature) {
return 0; return 0;
} }
} // namespace MemoryPatcher } // namespace MemoryPatcher
#endif

View File

@ -5,7 +5,9 @@
#include "common/alignment.h" #include "common/alignment.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#ifdef ENABLE_QT_GUI
#include "common/memory_patcher.h" #include "common/memory_patcher.h"
#endif
#include "common/string_util.h" #include "common/string_util.h"
#include "core/aerolib/aerolib.h" #include "core/aerolib/aerolib.h"
#include "core/cpu_patches.h" #include "core/cpu_patches.h"
@ -194,6 +196,7 @@ void Module::LoadModuleToMemory(u32& max_tls_index) {
const VAddr entry_addr = base_virtual_addr + elf.GetElfEntry(); const VAddr entry_addr = base_virtual_addr + elf.GetElfEntry();
LOG_INFO(Core_Linker, "program entry addr ..........: {:#018x}", entry_addr); LOG_INFO(Core_Linker, "program entry addr ..........: {:#018x}", entry_addr);
#ifdef ENABLE_QT_GUI
if (MemoryPatcher::g_eboot_address == 0) { if (MemoryPatcher::g_eboot_address == 0) {
if (name == "eboot") { if (name == "eboot") {
MemoryPatcher::g_eboot_address = base_virtual_addr; MemoryPatcher::g_eboot_address = base_virtual_addr;
@ -201,6 +204,7 @@ void Module::LoadModuleToMemory(u32& max_tls_index) {
MemoryPatcher::OnGameLoaded(); MemoryPatcher::OnGameLoaded();
} }
} }
#endif
} }
void Module::LoadDynamicInfo() { void Module::LoadDynamicInfo() {

View File

@ -7,7 +7,9 @@
#include "common/debug.h" #include "common/debug.h"
#include "common/logging/backend.h" #include "common/logging/backend.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#ifdef ENABLE_QT_GUI
#include "common/memory_patcher.h" #include "common/memory_patcher.h"
#endif
#include "common/ntapi.h" #include "common/ntapi.h"
#include "common/path_util.h" #include "common/path_util.h"
#include "common/polyfill_thread.h" #include "common/polyfill_thread.h"
@ -94,7 +96,9 @@ void Emulator::Run(const std::filesystem::path& file) {
auto* param_sfo = Common::Singleton<PSF>::Instance(); auto* param_sfo = Common::Singleton<PSF>::Instance();
param_sfo->open(sce_sys_folder.string() + "/param.sfo", {}); param_sfo->open(sce_sys_folder.string() + "/param.sfo", {});
id = std::string(param_sfo->GetString("CONTENT_ID"), 7, 9); id = std::string(param_sfo->GetString("CONTENT_ID"), 7, 9);
#ifdef ENABLE_QT_GUI
MemoryPatcher::g_game_serial = id; MemoryPatcher::g_game_serial = id;
#endif
title = param_sfo->GetString("TITLE"); title = param_sfo->GetString("TITLE");
LOG_INFO(Loader, "Game id: {} Title: {}", id, title); LOG_INFO(Loader, "Game id: {} Title: {}", id, title);
u32 fw_version = param_sfo->GetInteger("SYSTEM_VER"); u32 fw_version = param_sfo->GetInteger("SYSTEM_VER");

View File

@ -16,7 +16,7 @@
<message> <message>
<location filename="../about_dialog.ui" line="78"/> <location filename="../about_dialog.ui" line="78"/>
<source>shadPS4 is an experimental open-source emulator for the PlayStation 4.</source> <source>shadPS4 is an experimental open-source emulator for the PlayStation 4.</source>
<translation>shadPS4 è un emulatore sperimentale open source per Playstation 4.</translation> <translation>shadPS4 è un emulatore sperimentale open source per PlayStation 4.</translation>
</message> </message>
<message> <message>
<location filename="../about_dialog.ui" line="99"/> <location filename="../about_dialog.ui" line="99"/>
@ -181,7 +181,7 @@
<message> <message>
<location filename="../main_window_ui.h" line="318"/> <location filename="../main_window_ui.h" line="318"/>
<source>Install application from a .pkg file</source> <source>Install application from a .pkg file</source>
<translation>Installa applicaazione da un .pkg file</translation> <translation>Installa applicazione da un file .pkg file</translation>
</message> </message>
<message> <message>
<location filename="../main_window_ui.h" line="320"/> <location filename="../main_window_ui.h" line="320"/>
@ -375,7 +375,7 @@
<message> <message>
<location filename="../settings_dialog.ui" line="77"/> <location filename="../settings_dialog.ui" line="77"/>
<source>System</source> <source>System</source>
<translation>Systema</translation> <translation>Sistema</translation>
</message> </message>
<message> <message>
<location filename="../settings_dialog.ui" line="83"/> <location filename="../settings_dialog.ui" line="83"/>
@ -460,7 +460,7 @@
<message> <message>
<location filename="../settings_dialog.ui" line="462"/> <location filename="../settings_dialog.ui" line="462"/>
<source>Enable Shaders Dumping</source> <source>Enable Shaders Dumping</source>
<translation>Abilita Scaricamento Shader</translation> <translation>Abilita Dump Shader</translation>
</message> </message>
<message> <message>
<location filename="../settings_dialog.ui" line="469"/> <location filename="../settings_dialog.ui" line="469"/>
@ -470,7 +470,7 @@
<message> <message>
<location filename="../settings_dialog.ui" line="476"/> <location filename="../settings_dialog.ui" line="476"/>
<source>Enable PM4 Dumping</source> <source>Enable PM4 Dumping</source>
<translation>Abilita Scaricamento PM4</translation> <translation>Abilita Dump PM4</translation>
</message> </message>
<message> <message>
<location filename="../settings_dialog.ui" line="517"/> <location filename="../settings_dialog.ui" line="517"/>
@ -480,7 +480,7 @@
<message> <message>
<location filename="../settings_dialog.ui" line="537"/> <location filename="../settings_dialog.ui" line="537"/>
<source>Enable Debug Dumping</source> <source>Enable Debug Dumping</source>
<translation>Abilita Scaricamento Debug</translation> <translation>Abilita Dump Debug</translation>
</message> </message>
<message> <message>
<location filename="../settings_dialog.ui" line="560"/> <location filename="../settings_dialog.ui" line="560"/>