mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-04 23:29:17 +00:00
code handler update add switch dialog
This commit is contained in:
parent
942be0e269
commit
1550565855
7 changed files with 63 additions and 11 deletions
|
@ -31,7 +31,7 @@ const std::string& GetScmDescStr()
|
|||
}
|
||||
const std::string& GetScmRevStr()
|
||||
{
|
||||
static const std::string scm_rev_str = std::string("Dolphin MPN [") + SCM_DESC_STR + "]";
|
||||
static const std::string scm_rev_str = std::string("Dolphin MPN (") + SCM_DESC_STR + ")";
|
||||
return scm_rev_str;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ extern const Info<bool> MAIN_CPU_THREAD;
|
|||
extern const Info<bool> MAIN_SYNC_ON_SKIP_IDLE;
|
||||
extern const Info<std::string> MAIN_DEFAULT_ISO;
|
||||
extern const Info<bool> MAIN_ENABLE_CHEATS;
|
||||
extern const Info<bool> MAIN_CODE_HANDLER;
|
||||
extern const Info<int> MAIN_GC_LANGUAGE;
|
||||
extern const Info<bool> MAIN_OVERRIDE_REGION_SETTINGS;
|
||||
extern const Info<bool> MAIN_DPL2_DECODER;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "Common/NandPaths.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Version.h"
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "Core/AchievementManager.h"
|
||||
#include "Core/Boot/Boot.h"
|
||||
|
@ -86,6 +87,12 @@ SConfig::~SConfig()
|
|||
SaveSettings();
|
||||
}
|
||||
|
||||
namespace Config
|
||||
{
|
||||
// Initialize the configuration option
|
||||
const Info<bool> MAIN_CODE_HANDLER{{System::Main, "CodeHandler", "UseMPN"}, false};
|
||||
}
|
||||
|
||||
void SConfig::SaveSettings()
|
||||
{
|
||||
NOTICE_LOG_FMT(BOOT, "Saving settings to {}", File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
@ -34,6 +35,12 @@ struct Partition;
|
|||
class Volume;
|
||||
} // namespace DiscIO
|
||||
|
||||
namespace Config
|
||||
{
|
||||
// Define the configuration option
|
||||
extern const Info<bool> MAIN_CODE_HANDLER;
|
||||
}
|
||||
|
||||
namespace IOS::ES
|
||||
{
|
||||
class TMDReader;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "Core/PowerPC/MMU.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/System.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Config/MainSettings.h"
|
||||
|
||||
namespace Gecko
|
||||
{
|
||||
|
@ -116,21 +118,26 @@ std::vector<GeckoCode> SetAndReturnActiveCodes(std::span<const GeckoCode> gcodes
|
|||
return s_active_codes;
|
||||
}
|
||||
|
||||
const char* GetGeckoCodeHandlerPath()
|
||||
{
|
||||
return Config::Get(Config::MAIN_CODE_HANDLER) ?
|
||||
GECKO_CODE_HANDLER_MPN : GECKO_CODE_HANDLER;
|
||||
}
|
||||
|
||||
// Requires s_active_codes_lock
|
||||
// NOTE: Refer to "codehandleronly.s" from Gecko OS.
|
||||
static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
|
||||
{
|
||||
std::string data;
|
||||
if (!File::ReadFileToString(File::GetSysDirectory() + GECKO_CODE_HANDLER, data))
|
||||
if (!File::ReadFileToString(File::GetSysDirectory() + GetGeckoCodeHandlerPath(), data))
|
||||
{
|
||||
ERROR_LOG_FMT(ACTIONREPLAY,
|
||||
"Could not enable cheats because " GECKO_CODE_HANDLER " was missing.");
|
||||
ERROR_LOG_FMT(ACTIONREPLAY, "Could not enable cheats because the selected codehandler was missing.");
|
||||
return Installation::Failed;
|
||||
}
|
||||
|
||||
if (data.size() > INSTALLER_END_ADDRESS - INSTALLER_BASE_ADDRESS - CODE_SIZE)
|
||||
{
|
||||
ERROR_LOG_FMT(ACTIONREPLAY, GECKO_CODE_HANDLER " is too big. The file may be corrupt.");
|
||||
ERROR_LOG_FMT(ACTIONREPLAY, "The codehandler is too big. The file may be corrupt.");
|
||||
return Installation::Failed;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,15 +67,15 @@ void GeneralPane::CreateLayout()
|
|||
m_main_layout = new QVBoxLayout;
|
||||
// Create layout here
|
||||
CreateBasic();
|
||||
|
||||
CreateFallbackRegion();
|
||||
|
||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||
CreateAnalytics();
|
||||
#endif
|
||||
|
||||
CreateCheats();
|
||||
m_main_layout->addStretch(1);
|
||||
setLayout(m_main_layout);
|
||||
|
||||
}
|
||||
|
||||
void GeneralPane::OnEmulationStateChanged(Core::State state)
|
||||
|
@ -100,6 +100,7 @@ void GeneralPane::ConnectLayout()
|
|||
{
|
||||
connect(m_checkbox_dualcore, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||
connect(m_checkbox_cheats, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||
connect(m_combobox_codehandler, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &GeneralPane::OnCodeHandlerChanged);
|
||||
connect(m_checkbox_override_region_settings, &QCheckBox::stateChanged, this,
|
||||
&GeneralPane::OnSaveConfig);
|
||||
connect(m_checkbox_auto_disc_change, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||
|
@ -136,9 +137,6 @@ void GeneralPane::CreateBasic()
|
|||
m_checkbox_dualcore = new QCheckBox(tr("Enable Dual Core (speedup)"));
|
||||
basic_group_layout->addWidget(m_checkbox_dualcore);
|
||||
|
||||
m_checkbox_cheats = new QCheckBox(tr("Enable Cheats"));
|
||||
basic_group_layout->addWidget(m_checkbox_cheats);
|
||||
|
||||
m_checkbox_override_region_settings = new QCheckBox(tr("Allow Mismatched Region Settings"));
|
||||
basic_group_layout->addWidget(m_checkbox_override_region_settings);
|
||||
|
||||
|
@ -213,6 +211,28 @@ void GeneralPane::CreateAnalytics()
|
|||
}
|
||||
#endif
|
||||
|
||||
void GeneralPane::CreateCheats()
|
||||
{
|
||||
auto* cheats_group = new QGroupBox(tr("Cheats Settings"));
|
||||
auto* cheats_group_layout = new QVBoxLayout;
|
||||
cheats_group->setLayout(cheats_group_layout);
|
||||
m_main_layout->addWidget(cheats_group);
|
||||
|
||||
m_checkbox_cheats = new QCheckBox(tr("Enable Cheats"));
|
||||
cheats_group_layout->addWidget(m_checkbox_cheats);
|
||||
|
||||
// Add dropdown for code handler selection
|
||||
auto* code_handler_layout = new QFormLayout();
|
||||
auto* code_handler_label = new QLabel(tr("Code Handler:"));
|
||||
m_combobox_codehandler = new QComboBox();
|
||||
m_combobox_codehandler->addItem(tr("Dolphin (Stock)"), QVariant(false));
|
||||
m_combobox_codehandler->addItem(tr("MPN (Extended)"), QVariant(true));
|
||||
|
||||
code_handler_layout->addRow(code_handler_label, m_combobox_codehandler);
|
||||
|
||||
cheats_group_layout->addLayout(code_handler_layout);
|
||||
}
|
||||
|
||||
void GeneralPane::LoadConfig()
|
||||
{
|
||||
const QSignalBlocker blocker(this);
|
||||
|
@ -225,6 +245,7 @@ void GeneralPane::LoadConfig()
|
|||
#endif
|
||||
SignalBlocking(m_checkbox_dualcore)->setChecked(Config::Get(Config::MAIN_CPU_THREAD));
|
||||
SignalBlocking(m_checkbox_cheats)->setChecked(Settings::Instance().GetCheatsEnabled());
|
||||
SignalBlocking(m_combobox_codehandler)->setCurrentIndex(Config::Get(Config::MAIN_CODE_HANDLER) ? 1 : 0);
|
||||
SignalBlocking(m_checkbox_override_region_settings)
|
||||
->setChecked(Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS));
|
||||
SignalBlocking(m_checkbox_auto_disc_change)
|
||||
|
@ -340,3 +361,10 @@ void GeneralPane::GenerateNewIdentity()
|
|||
message_box.exec();
|
||||
}
|
||||
#endif
|
||||
|
||||
void GeneralPane::OnCodeHandlerChanged(int index)
|
||||
{
|
||||
bool use_mpn = m_combobox_codehandler->itemData(index).toBool();
|
||||
Config::SetBaseOrCurrent(Config::MAIN_CODE_HANDLER, use_mpn); // Ensure correct usage
|
||||
Config::Save();
|
||||
}
|
||||
|
|
|
@ -30,10 +30,11 @@ private:
|
|||
void CreateBasic();
|
||||
//void CreateAutoUpdate();
|
||||
void CreateFallbackRegion();
|
||||
|
||||
void LoadConfig();
|
||||
void OnSaveConfig();
|
||||
void OnEmulationStateChanged(Core::State state);
|
||||
void CreateCheats();
|
||||
void OnCodeHandlerChanged(int index);
|
||||
|
||||
// Widgets
|
||||
QVBoxLayout* m_main_layout;
|
||||
|
@ -44,6 +45,7 @@ private:
|
|||
QCheckBox* m_checkbox_cheats;
|
||||
QCheckBox* m_checkbox_override_region_settings;
|
||||
QCheckBox* m_checkbox_auto_disc_change;
|
||||
QComboBox* m_combobox_codehandler;
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
QCheckBox* m_checkbox_discord_presence;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue