Disable Debug Mode in hardcore mode

Debug Mode gives players direct read and write access to memory, which could be used to completely manipulate RetroAchievements logic and therefore is not allowed in hardcore mode.
This commit is contained in:
LillyJadeKatrin 2023-06-07 21:54:49 -04:00
commit cb2fa9a1f2
11 changed files with 47 additions and 8 deletions

View file

@ -738,4 +738,15 @@ bool IsDefaultGCIFolderPathConfigured(ExpansionInterface::Slot slot)
{
return Config::Get(GetInfoForGCIPath(slot)).empty();
}
bool IsDebuggingEnabled()
{
#ifdef USE_RETRO_ACHIEVEMENTS
return Config::Get(::Config::MAIN_ENABLE_DEBUGGING) &&
!::Config::Get(::Config::RA_HARDCORE_ENABLED);
#else // USE_RETRO_ACHIEVEMENTS
return Config::Get(::Config::MAIN_ENABLE_DEBUGGING);
#endif // USE_RETRO_ACHIEVEMENTS
}
} // namespace Config

View file

@ -378,4 +378,5 @@ std::string GetGCIFolderPath(ExpansionInterface::Slot slot, std::optional<DiscIO
std::string GetGCIFolderPath(std::string configured_folder, ExpansionInterface::Slot slot,
std::optional<DiscIO::Region> region);
bool IsDefaultGCIFolderPathConfigured(ExpansionInterface::Slot slot);
bool IsDebuggingEnabled();
} // namespace Config

View file

@ -219,7 +219,7 @@ TryReplaceFunctionResult TryReplaceFunction(u32 address)
bool IsEnabled(HookFlag flag)
{
return flag != HLE::HookFlag::Debug || Config::Get(Config::MAIN_ENABLE_DEBUGGING) ||
return flag != HLE::HookFlag::Debug || Config::IsDebuggingEnabled() ||
Core::System::GetInstance().GetPowerPC().GetMode() == PowerPC::CoreMode::Interpreter;
}

View file

@ -236,7 +236,7 @@ void Interpreter::Run()
core_timing.Advance();
// we have to check exceptions at branches apparently (or maybe just rfi?)
if (Config::Get(Config::MAIN_ENABLE_DEBUGGING))
if (Config::IsDebuggingEnabled())
{
#ifdef SHOW_HISTORY
s_pc_block_vec.push_back(m_ppc_state.pc);

View file

@ -44,7 +44,7 @@ void Jit64AsmRoutineManager::Regenerate()
void Jit64AsmRoutineManager::Generate()
{
const bool enable_debugging = Config::Get(Config::MAIN_ENABLE_DEBUGGING);
const bool enable_debugging = Config::IsDebuggingEnabled();
enter_code = AlignCode16();
// We need to own the beginning of RSP, so we do an extra stack adjustment

View file

@ -30,7 +30,7 @@ void JitArm64::GenerateAsm()
{
const Common::ScopedJITPageWriteAndNoExecute enable_jit_page_writes;
const bool enable_debugging = Config::Get(Config::MAIN_ENABLE_DEBUGGING);
const bool enable_debugging = Config::IsDebuggingEnabled();
// This value is all of the callee saved registers that we are required to save.
// According to the AACPS64 we need to save R19 ~ R30 and Q8 ~ Q15.