Disable memory patches in hardcore mode
Memory patches would be an easy way to manipulate the memory needed to calculate achievement logic, so they must be disabled. Riivolution patches that do not affect memory are allowed, as they will be hashed with the game file.
This commit is contained in:
parent
cb2fa9a1f2
commit
1a19a92943
|
@ -16,6 +16,7 @@
|
|||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/OSThread.h"
|
||||
|
@ -29,6 +30,10 @@
|
|||
void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, Common::Debug::MemoryPatch& patch,
|
||||
bool store_existing_value)
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||
return;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
if (patch.value.empty())
|
||||
return;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "Core/ActionReplay.h"
|
||||
#include "Core/CheatCodes.h"
|
||||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/Config/SessionSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
@ -232,6 +233,10 @@ void LoadPatches()
|
|||
|
||||
static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector<Patch>& patches)
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||
return;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
for (const Patch& patch : patches)
|
||||
{
|
||||
if (patch.enabled)
|
||||
|
@ -273,6 +278,10 @@ static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector<Pa
|
|||
static void ApplyMemoryPatches(const Core::CPUThreadGuard& guard,
|
||||
std::span<const std::size_t> memory_patch_indices)
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||
return;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
std::lock_guard lock(s_on_frame_memory_mutex);
|
||||
for (std::size_t index : memory_patch_indices)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "Common/FileUtil.h"
|
||||
#include "Common/IOFile.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/FS/FileSystem.h"
|
||||
|
@ -522,6 +523,11 @@ static bool MemoryMatchesAt(const Core::CPUThreadGuard& guard, u32 offset,
|
|||
static void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, u32 offset,
|
||||
const std::vector<u8>& value, const std::vector<u8>& original)
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
if (::Config::Get(::Config::RA_HARDCORE_ENABLED))
|
||||
return;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
if (value.empty())
|
||||
return;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "Core/ConfigManager.h"
|
||||
#include "Core/PatchEngine.h"
|
||||
|
||||
#include "DolphinQt/Config/HardcoreWarningWidget.h"
|
||||
#include "DolphinQt/Config/NewPatchDialog.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
|
||||
|
@ -40,23 +41,38 @@ PatchesWidget::PatchesWidget(const UICommon::GameFile& game)
|
|||
|
||||
void PatchesWidget::CreateWidgets()
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
m_hc_warning = new HardcoreWarningWidget(this);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
m_list = new QListWidget;
|
||||
m_add_button = new QPushButton(tr("&Add..."));
|
||||
m_edit_button = new QPushButton();
|
||||
m_remove_button = new QPushButton(tr("&Remove"));
|
||||
|
||||
auto* layout = new QGridLayout;
|
||||
auto* grid_layout = new QGridLayout;
|
||||
|
||||
layout->addWidget(m_list, 0, 0, 1, -1);
|
||||
layout->addWidget(m_add_button, 1, 0);
|
||||
layout->addWidget(m_edit_button, 1, 2);
|
||||
layout->addWidget(m_remove_button, 1, 1);
|
||||
grid_layout->addWidget(m_list, 0, 0, 1, -1);
|
||||
grid_layout->addWidget(m_add_button, 1, 0);
|
||||
grid_layout->addWidget(m_edit_button, 1, 2);
|
||||
grid_layout->addWidget(m_remove_button, 1, 1);
|
||||
|
||||
auto* layout = new QVBoxLayout;
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
layout->addWidget(m_hc_warning);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
layout->addLayout(grid_layout);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void PatchesWidget::ConnectWidgets()
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
connect(m_hc_warning, &HardcoreWarningWidget::OpenAchievementSettings, this,
|
||||
&PatchesWidget::OpenAchievementSettings);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
connect(m_list, &QListWidget::itemSelectionChanged, this, &PatchesWidget::UpdateActions);
|
||||
connect(m_list, &QListWidget::itemChanged, this, &PatchesWidget::OnItemChanged);
|
||||
connect(m_remove_button, &QPushButton::clicked, this, &PatchesWidget::OnRemove);
|
||||
|
|
|
@ -9,12 +9,11 @@
|
|||
#include <QWidget>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/PatchEngine.h"
|
||||
|
||||
namespace PatchEngine
|
||||
{
|
||||
struct Patch;
|
||||
}
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
class HardcoreWarningWidget;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
class QPushButton;
|
||||
|
@ -26,9 +25,15 @@ class GameFile;
|
|||
|
||||
class PatchesWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PatchesWidget(const UICommon::GameFile& game);
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
signals:
|
||||
void OpenAchievementSettings();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
|
@ -41,6 +46,9 @@ private:
|
|||
void OnRemove();
|
||||
void OnEdit();
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
HardcoreWarningWidget* m_hc_warning;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
QListWidget* m_list;
|
||||
QPushButton* m_add_button;
|
||||
QPushButton* m_edit_button;
|
||||
|
|
|
@ -51,6 +51,10 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga
|
|||
&PropertiesDialog::OpenGeneralSettings);
|
||||
|
||||
connect(ar, &ARCodeWidget::OpenGeneralSettings, this, &PropertiesDialog::OpenGeneralSettings);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
connect(patches, &PatchesWidget::OpenAchievementSettings, this,
|
||||
&PropertiesDialog::OpenAchievementSettings);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
connect(graphics_mod_list, &GraphicsModListWidget::OpenGraphicsSettings, this,
|
||||
&PropertiesDialog::OpenGraphicsSettings);
|
||||
|
|
|
@ -19,4 +19,7 @@ public:
|
|||
signals:
|
||||
void OpenGeneralSettings();
|
||||
void OpenGraphicsSettings();
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
void OpenAchievementSettings();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
};
|
||||
|
|
|
@ -552,6 +552,10 @@ void GameList::OpenProperties()
|
|||
connect(properties, &PropertiesDialog::OpenGeneralSettings, this, &GameList::OpenGeneralSettings);
|
||||
connect(properties, &PropertiesDialog::OpenGraphicsSettings, this,
|
||||
&GameList::OpenGraphicsSettings);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
connect(properties, &PropertiesDialog::OpenAchievementSettings, this,
|
||||
&GameList::OpenAchievementSettings);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
SetQWidgetWindowDecorations(properties);
|
||||
properties->show();
|
||||
|
|
|
@ -56,6 +56,9 @@ signals:
|
|||
void SelectionChanged(std::shared_ptr<const UICommon::GameFile> game_file);
|
||||
void OpenGeneralSettings();
|
||||
void OpenGraphicsSettings();
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
void OpenAchievementSettings();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
private:
|
||||
void ShowHeaderContextMenu(const QPoint& pos);
|
||||
|
|
|
@ -246,6 +246,11 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
|
|||
connect(m_cheats_manager, &CheatsManager::OpenGeneralSettings, this,
|
||||
&MainWindow::ShowGeneralWindow);
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
connect(m_game_list, &GameList::OpenAchievementSettings, this,
|
||||
&MainWindow::ShowAchievementSettings);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
InitCoreCallbacks();
|
||||
|
||||
NetPlayInit();
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "DiscIO/GameModDescriptor.h"
|
||||
#include "DiscIO/RiivolutionParser.h"
|
||||
#include "DiscIO/RiivolutionPatcher.h"
|
||||
#include "DolphinQt/Config/HardcoreWarningWidget.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
|
||||
struct GuiRiivolutionPatchIndex
|
||||
|
@ -48,6 +49,7 @@ RiivolutionBootWidget::RiivolutionBootWidget(std::string game_id, std::optional<
|
|||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
CreateWidgets();
|
||||
ConnectWidgets();
|
||||
LoadMatchingXMLs();
|
||||
|
||||
resize(QSize(400, 600));
|
||||
|
@ -57,6 +59,9 @@ RiivolutionBootWidget::~RiivolutionBootWidget() = default;
|
|||
|
||||
void RiivolutionBootWidget::CreateWidgets()
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
m_hc_warning = new HardcoreWarningWidget(this);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
auto* open_xml_button = new QPushButton(tr("Open Riivolution XML..."));
|
||||
auto* boot_game_button = new QPushButton(tr("Start"));
|
||||
boot_game_button->setDefault(true);
|
||||
|
@ -79,6 +84,9 @@ void RiivolutionBootWidget::CreateWidgets()
|
|||
button_layout->addWidget(boot_game_button, 0, Qt::AlignRight);
|
||||
|
||||
auto* layout = new QVBoxLayout();
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
layout->addWidget(m_hc_warning);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
layout->addWidget(scroll_area);
|
||||
layout->addLayout(button_layout);
|
||||
setLayout(layout);
|
||||
|
@ -88,6 +96,16 @@ void RiivolutionBootWidget::CreateWidgets()
|
|||
connect(save_preset_button, &QPushButton::clicked, this, &RiivolutionBootWidget::SaveAsPreset);
|
||||
}
|
||||
|
||||
void RiivolutionBootWidget::ConnectWidgets()
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
connect(m_hc_warning, &HardcoreWarningWidget::OpenAchievementSettings, this,
|
||||
&RiivolutionBootWidget::OpenAchievementSettings);
|
||||
connect(m_hc_warning, &HardcoreWarningWidget::OpenAchievementSettings, this,
|
||||
&RiivolutionBootWidget::reject);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
}
|
||||
|
||||
void RiivolutionBootWidget::LoadMatchingXMLs()
|
||||
{
|
||||
const std::string& riivolution_dir = File::GetUserPath(D_RIIVOLUTION_IDX);
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
#include "Common/CommonTypes.h"
|
||||
#include "DiscIO/RiivolutionParser.h"
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
class HardcoreWarningWidget;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
class QPushButton;
|
||||
class QVBoxLayout;
|
||||
|
||||
|
@ -26,8 +29,14 @@ public:
|
|||
bool ShouldBoot() const { return m_should_boot; }
|
||||
std::vector<DiscIO::Riivolution::Patch>& GetPatches() { return m_patches; }
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
signals:
|
||||
void OpenAchievementSettings();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
|
||||
void LoadMatchingXMLs();
|
||||
void OpenXML();
|
||||
|
@ -38,6 +47,9 @@ private:
|
|||
void BootGame();
|
||||
void SaveAsPreset();
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
HardcoreWarningWidget* m_hc_warning;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
std::string m_game_id;
|
||||
std::optional<u16> m_revision;
|
||||
std::optional<u8> m_disc_number;
|
||||
|
|
Loading…
Reference in New Issue