mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #12832 from JosJuice/retro-achievements-less-ifdefs
Use a stub AchivementManager when USE_RETRO_ACHIEVEMENTS isn't defined
This commit is contained in:
commit
81b6bfaa1e
@ -5,19 +5,25 @@
|
|||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <chrono>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <rcheevos/include/rc_api_runtime.h>
|
#include <rcheevos/include/rc_api_runtime.h>
|
||||||
#include <rcheevos/include/rc_api_user.h>
|
#include <rcheevos/include/rc_api_user.h>
|
||||||
#include <rcheevos/include/rc_client.h>
|
#include <rcheevos/include/rc_client.h>
|
||||||
#include <rcheevos/include/rc_runtime.h>
|
#include <rcheevos/include/rc_runtime.h>
|
||||||
|
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Event.h"
|
#include "Common/Event.h"
|
||||||
#include "Common/HttpRequest.h"
|
#include "Common/HttpRequest.h"
|
||||||
#include "Common/WorkQueueThread.h"
|
#include "Common/WorkQueueThread.h"
|
||||||
@ -206,4 +212,31 @@ private:
|
|||||||
std::recursive_mutex m_filereader_lock;
|
std::recursive_mutex m_filereader_lock;
|
||||||
}; // class AchievementManager
|
}; // class AchievementManager
|
||||||
|
|
||||||
|
#else // USE_RETRO_ACHIEVEMENTS
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace DiscIO
|
||||||
|
{
|
||||||
|
class Volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AchievementManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static AchievementManager& GetInstance()
|
||||||
|
{
|
||||||
|
static AchievementManager s_instance;
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool IsHardcoreModeActive() { return false; }
|
||||||
|
|
||||||
|
constexpr void LoadGame(const std::string&, const DiscIO::Volume*) {}
|
||||||
|
|
||||||
|
constexpr void DoFrame() {}
|
||||||
|
|
||||||
|
constexpr void CloseGame() {}
|
||||||
|
};
|
||||||
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
#endif // USE_RETRO_ACHIEVEMENTS
|
||||||
|
@ -575,9 +575,7 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
|||||||
SetupGCMemory(system, guard);
|
SetupGCMemory(system, guard);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
AchievementManager::GetInstance().LoadGame(executable.path, nullptr);
|
AchievementManager::GetInstance().LoadGame(executable.path, nullptr);
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
if (!executable.reader->LoadIntoMemory(system))
|
if (!executable.reader->LoadIntoMemory(system))
|
||||||
{
|
{
|
||||||
|
@ -166,9 +166,7 @@ bool BootCore(Core::System& system, std::unique_ptr<BootParameters> boot,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
AchievementManager::GetInstance().CloseGame();
|
AchievementManager::GetInstance().CloseGame();
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
const bool load_ipl = !system.IsWii() && !Config::Get(Config::MAIN_SKIP_IPL) &&
|
const bool load_ipl = !system.IsWii() && !Config::Get(Config::MAIN_SKIP_IPL) &&
|
||||||
std::holds_alternative<BootParameters::Disc>(boot->parameters);
|
std::holds_alternative<BootParameters::Disc>(boot->parameters);
|
||||||
|
@ -207,10 +207,8 @@ Cheats::NewSearch(const Core::CPUThreadGuard& guard,
|
|||||||
PowerPC::RequestedAddressSpace address_space, bool aligned,
|
PowerPC::RequestedAddressSpace address_space, bool aligned,
|
||||||
const std::function<bool(const T& value)>& validator)
|
const std::function<bool(const T& value)>& validator)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
|
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
auto& system = guard.GetSystem();
|
auto& system = guard.GetSystem();
|
||||||
std::vector<Cheats::SearchResult<T>> results;
|
std::vector<Cheats::SearchResult<T>> results;
|
||||||
const Core::State core_state = Core::GetState(system);
|
const Core::State core_state = Core::GetState(system);
|
||||||
@ -262,10 +260,8 @@ Cheats::NextSearch(const Core::CPUThreadGuard& guard,
|
|||||||
PowerPC::RequestedAddressSpace address_space,
|
PowerPC::RequestedAddressSpace address_space,
|
||||||
const std::function<bool(const T& new_value, const T& old_value)>& validator)
|
const std::function<bool(const T& new_value, const T& old_value)>& validator)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
|
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
auto& system = guard.GetSystem();
|
auto& system = guard.GetSystem();
|
||||||
std::vector<Cheats::SearchResult<T>> results;
|
std::vector<Cheats::SearchResult<T>> results;
|
||||||
const Core::State core_state = Core::GetState(system);
|
const Core::State core_state = Core::GetState(system);
|
||||||
@ -429,10 +425,8 @@ MakeCompareFunctionForLastValue(Cheats::CompareType op)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
Cheats::SearchErrorCode Cheats::CheatSearchSession<T>::RunSearch(const Core::CPUThreadGuard& guard)
|
Cheats::SearchErrorCode Cheats::CheatSearchSession<T>::RunSearch(const Core::CPUThreadGuard& guard)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
|
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
Common::Result<SearchErrorCode, std::vector<SearchResult<T>>> result =
|
Common::Result<SearchErrorCode, std::vector<SearchResult<T>>> result =
|
||||||
Cheats::SearchErrorCode::InvalidParameters;
|
Cheats::SearchErrorCode::InvalidParameters;
|
||||||
if (m_filter_type == FilterType::CompareAgainstSpecificValue)
|
if (m_filter_type == FilterType::CompareAgainstSpecificValue)
|
||||||
|
@ -100,10 +100,8 @@ enum class SearchErrorCode
|
|||||||
// currently off in the emulated game.
|
// currently off in the emulated game.
|
||||||
VirtualAddressesCurrentlyNotAccessible,
|
VirtualAddressesCurrentlyNotAccessible,
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
// Cheats and memory reading are disabled in RetroAchievements hardcore mode.
|
// Cheats and memory reading are disabled in RetroAchievements hardcore mode.
|
||||||
DisabledInHardcoreMode,
|
DisabledInHardcoreMode,
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns the corresponding DataType enum for the value currently held by the given SearchValue.
|
// Returns the corresponding DataType enum for the value currently held by the given SearchValue.
|
||||||
|
@ -749,22 +749,14 @@ bool IsDefaultGCIFolderPathConfigured(ExpansionInterface::Slot slot)
|
|||||||
|
|
||||||
bool AreCheatsEnabled()
|
bool AreCheatsEnabled()
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
return Config::Get(::Config::MAIN_ENABLE_CHEATS) &&
|
return Config::Get(::Config::MAIN_ENABLE_CHEATS) &&
|
||||||
!AchievementManager::GetInstance().IsHardcoreModeActive();
|
!AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||||
#else // USE_RETRO_ACHIEVEMENTS
|
|
||||||
return Config::Get(::Config::MAIN_ENABLE_CHEATS);
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsDebuggingEnabled()
|
bool IsDebuggingEnabled()
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
return Config::Get(::Config::MAIN_ENABLE_DEBUGGING) &&
|
return Config::Get(::Config::MAIN_ENABLE_DEBUGGING) &&
|
||||||
!AchievementManager::GetInstance().IsHardcoreModeActive();
|
!AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||||
#else // USE_RETRO_ACHIEVEMENTS
|
|
||||||
return Config::Get(::Config::MAIN_ENABLE_DEBUGGING);
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Config
|
} // namespace Config
|
||||||
|
@ -169,11 +169,6 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
|
|||||||
if (!was_changed)
|
if (!was_changed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (game_id != "00000000")
|
|
||||||
AchievementManager::GetInstance().CloseGame();
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
if (game_id == "00000000")
|
if (game_id == "00000000")
|
||||||
{
|
{
|
||||||
m_title_name.clear();
|
m_title_name.clear();
|
||||||
@ -181,6 +176,8 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AchievementManager::GetInstance().CloseGame();
|
||||||
|
|
||||||
const Core::TitleDatabase title_database;
|
const Core::TitleDatabase title_database;
|
||||||
auto& system = Core::System::GetInstance();
|
auto& system = Core::System::GetInstance();
|
||||||
const DiscIO::Language language = GetLanguageAdjustedForRegion(system.IsWii(), region);
|
const DiscIO::Language language = GetLanguageAdjustedForRegion(system.IsWii(), region);
|
||||||
|
@ -287,9 +287,7 @@ void Stop(Core::System& system) // - Hammertime!
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
AchievementManager::GetInstance().CloseGame();
|
AchievementManager::GetInstance().CloseGame();
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
s_is_stopping = true;
|
s_is_stopping = true;
|
||||||
|
|
||||||
@ -908,9 +906,7 @@ void Callback_NewField(Core::System& system)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
AchievementManager::GetInstance().DoFrame();
|
AchievementManager::GetInstance().DoFrame();
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateTitle(Core::System& system)
|
void UpdateTitle(Core::System& system)
|
||||||
@ -1048,13 +1044,11 @@ void HostDispatchJobs(Core::System& system)
|
|||||||
// NOTE: Host Thread
|
// NOTE: Host Thread
|
||||||
void DoFrameStep(Core::System& system)
|
void DoFrameStep(Core::System& system)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
{
|
{
|
||||||
OSD::AddMessage("Frame stepping is disabled in RetroAchievements hardcore mode");
|
OSD::AddMessage("Frame stepping is disabled in RetroAchievements hardcore mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (GetState(system) == State::Paused)
|
if (GetState(system) == State::Paused)
|
||||||
{
|
{
|
||||||
// if already paused, frame advance for 1 frame
|
// if already paused, frame advance for 1 frame
|
||||||
|
@ -138,7 +138,6 @@ void CoreTimingManager::RefreshConfig()
|
|||||||
|
|
||||||
m_max_variance = std::chrono::duration_cast<DT>(DT_ms(Config::Get(Config::MAIN_TIMING_VARIANCE)));
|
m_max_variance = std::chrono::duration_cast<DT>(DT_ms(Config::Get(Config::MAIN_TIMING_VARIANCE)));
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive() &&
|
if (AchievementManager::GetInstance().IsHardcoreModeActive() &&
|
||||||
Config::Get(Config::MAIN_EMULATION_SPEED) < 1.0f &&
|
Config::Get(Config::MAIN_EMULATION_SPEED) < 1.0f &&
|
||||||
Config::Get(Config::MAIN_EMULATION_SPEED) > 0.0f)
|
Config::Get(Config::MAIN_EMULATION_SPEED) > 0.0f)
|
||||||
@ -147,7 +146,6 @@ void CoreTimingManager::RefreshConfig()
|
|||||||
m_emulation_speed = 1.0f;
|
m_emulation_speed = 1.0f;
|
||||||
OSD::AddMessage("Minimum speed is 100% in Hardcore Mode");
|
OSD::AddMessage("Minimum speed is 100% in Hardcore Mode");
|
||||||
}
|
}
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
m_emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
|
m_emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,9 @@
|
|||||||
void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, Common::Debug::MemoryPatch& patch,
|
void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, Common::Debug::MemoryPatch& patch,
|
||||||
bool store_existing_value)
|
bool store_existing_value)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
return;
|
return;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (patch.value.empty())
|
if (patch.value.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -46,11 +46,7 @@ void Config::Refresh()
|
|||||||
}
|
}
|
||||||
|
|
||||||
camera_config.control_type = ::Config::Get(::Config::FL1_CONTROL_TYPE);
|
camera_config.control_type = ::Config::Get(::Config::FL1_CONTROL_TYPE);
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
enabled = ::Config::Get(::Config::FREE_LOOK_ENABLED) &&
|
enabled = ::Config::Get(::Config::FREE_LOOK_ENABLED) &&
|
||||||
!AchievementManager::GetInstance().IsHardcoreModeActive();
|
!AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||||
#else // USE_RETRO_ACHIEVEMENTS
|
|
||||||
enabled = ::Config::Get(::Config::FREE_LOOK_ENABLED);
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
}
|
}
|
||||||
} // namespace FreeLook
|
} // namespace FreeLook
|
||||||
|
@ -398,9 +398,7 @@ void DVDInterface::SetDisc(std::unique_ptr<DiscIO::VolumeDisc> disc,
|
|||||||
m_auto_disc_change_index = 0;
|
m_auto_disc_change_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
AchievementManager::GetInstance().LoadGame("", disc.get());
|
AchievementManager::GetInstance().LoadGame("", disc.get());
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
// Assume that inserting a disc requires having an empty disc before
|
// Assume that inserting a disc requires having an empty disc before
|
||||||
if (had_disc != has_disc)
|
if (had_disc != has_disc)
|
||||||
|
@ -478,11 +478,9 @@ bool ESDevice::LaunchPPCTitle(u64 title_id)
|
|||||||
if (!Core::IsRunningAndStarted())
|
if (!Core::IsRunningAndStarted())
|
||||||
return BootstrapPPC();
|
return BootstrapPPC();
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS,
|
INFO_LOG_FMT(ACHIEVEMENTS,
|
||||||
"WAD and NAND formats not currently supported by Achievement Manager.");
|
"WAD and NAND formats not currently supported by Achievement Manager.");
|
||||||
AchievementManager::GetInstance().CloseGame();
|
AchievementManager::GetInstance().CloseGame();
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
core_timing.RemoveEvent(s_bootstrap_ppc_for_launch_event);
|
core_timing.RemoveEvent(s_bootstrap_ppc_for_launch_event);
|
||||||
core_timing.ScheduleEvent(ticks, s_bootstrap_ppc_for_launch_event);
|
core_timing.ScheduleEvent(ticks, s_bootstrap_ppc_for_launch_event);
|
||||||
|
@ -941,10 +941,8 @@ bool MovieManager::PlayInput(const std::string& movie_path,
|
|||||||
|
|
||||||
ReadHeader();
|
ReadHeader();
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
return false;
|
return false;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
m_total_frames = m_temp_header.frameCount;
|
m_total_frames = m_temp_header.frameCount;
|
||||||
m_total_lag_count = m_temp_header.lagCount;
|
m_total_lag_count = m_temp_header.lagCount;
|
||||||
|
@ -233,10 +233,9 @@ void LoadPatches()
|
|||||||
|
|
||||||
static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector<Patch>& patches)
|
static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector<Patch>& patches)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
return;
|
return;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
for (const Patch& patch : patches)
|
for (const Patch& patch : patches)
|
||||||
{
|
{
|
||||||
if (patch.enabled)
|
if (patch.enabled)
|
||||||
@ -278,10 +277,9 @@ static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector<Pa
|
|||||||
static void ApplyMemoryPatches(const Core::CPUThreadGuard& guard,
|
static void ApplyMemoryPatches(const Core::CPUThreadGuard& guard,
|
||||||
std::span<const std::size_t> memory_patch_indices)
|
std::span<const std::size_t> memory_patch_indices)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
return;
|
return;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
std::lock_guard lock(s_on_frame_memory_mutex);
|
std::lock_guard lock(s_on_frame_memory_mutex);
|
||||||
for (std::size_t index : memory_patch_indices)
|
for (std::size_t index : memory_patch_indices)
|
||||||
{
|
{
|
||||||
|
@ -212,13 +212,11 @@ void LoadFromBuffer(Core::System& system, std::vector<u8>& buffer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
{
|
{
|
||||||
OSD::AddMessage("Loading savestates is disabled in RetroAchievements hardcore mode");
|
OSD::AddMessage("Loading savestates is disabled in RetroAchievements hardcore mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
Core::RunOnCPUThread(
|
Core::RunOnCPUThread(
|
||||||
system,
|
system,
|
||||||
@ -865,13 +863,11 @@ void LoadAs(Core::System& system, const std::string& filename)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
{
|
{
|
||||||
OSD::AddMessage("Loading savestates is disabled in RetroAchievements hardcore mode");
|
OSD::AddMessage("Loading savestates is disabled in RetroAchievements hardcore mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
std::unique_lock lk(s_load_or_save_in_progress_mutex, std::try_to_lock);
|
std::unique_lock lk(s_load_or_save_in_progress_mutex, std::try_to_lock);
|
||||||
if (!lk)
|
if (!lk)
|
||||||
|
@ -524,10 +524,8 @@ static bool MemoryMatchesAt(const Core::CPUThreadGuard& guard, u32 offset,
|
|||||||
static void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, u32 offset,
|
static void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, u32 offset,
|
||||||
std::span<const u8> value, std::span<const u8> original)
|
std::span<const u8> value, std::span<const u8> original)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
return;
|
return;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
if (value.empty())
|
if (value.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -589,15 +589,12 @@ void HotkeyScheduler::Run()
|
|||||||
{
|
{
|
||||||
const bool new_value = !Config::Get(Config::FREE_LOOK_ENABLED);
|
const bool new_value = !Config::Get(Config::FREE_LOOK_ENABLED);
|
||||||
Config::SetCurrent(Config::FREE_LOOK_ENABLED, new_value);
|
Config::SetCurrent(Config::FREE_LOOK_ENABLED, new_value);
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||||
if (hardcore)
|
if (hardcore)
|
||||||
OSD::AddMessage("Free Look is Disabled in Hardcore Mode");
|
OSD::AddMessage("Free Look is Disabled in Hardcore Mode");
|
||||||
else
|
else
|
||||||
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
|
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
|
||||||
#else // USE_RETRO_ACHIEVEMENTS
|
|
||||||
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Savestates
|
// Savestates
|
||||||
|
@ -127,14 +127,9 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
|
|||||||
m_screenshot_action->setEnabled(running);
|
m_screenshot_action->setEnabled(running);
|
||||||
m_state_save_menu->setEnabled(running);
|
m_state_save_menu->setEnabled(running);
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||||
m_state_load_menu->setEnabled(running && !hardcore);
|
m_state_load_menu->setEnabled(running && !hardcore);
|
||||||
m_frame_advance_action->setEnabled(running && !hardcore);
|
m_frame_advance_action->setEnabled(running && !hardcore);
|
||||||
#else // USE_RETRO_ACHIEVEMENTS
|
|
||||||
m_state_load_menu->setEnabled(running);
|
|
||||||
m_frame_advance_action->setEnabled(running);
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
// Movie
|
// Movie
|
||||||
m_recording_read_only->setEnabled(running);
|
m_recording_read_only->setEnabled(running);
|
||||||
@ -144,11 +139,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
|
|||||||
m_recording_export->setEnabled(false);
|
m_recording_export->setEnabled(false);
|
||||||
}
|
}
|
||||||
m_recording_play->setEnabled(m_game_selected && !running);
|
m_recording_play->setEnabled(m_game_selected && !running);
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
m_recording_play->setEnabled(m_game_selected && !running && !hardcore);
|
m_recording_play->setEnabled(m_game_selected && !running && !hardcore);
|
||||||
#else // USE_RETRO_ACHIEVEMENTS
|
|
||||||
m_recording_play->setEnabled(m_game_selected && !running);
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
m_recording_start->setEnabled((m_game_selected || running) &&
|
m_recording_start->setEnabled((m_game_selected || running) &&
|
||||||
!Core::System::GetInstance().GetMovie().IsPlayingInput());
|
!Core::System::GetInstance().GetMovie().IsPlayingInput());
|
||||||
|
|
||||||
|
@ -550,10 +550,8 @@ void Settings::SetCheatsEnabled(bool enabled)
|
|||||||
|
|
||||||
void Settings::SetDebugModeEnabled(bool enabled)
|
void Settings::SetDebugModeEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||||
enabled = false;
|
enabled = false;
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
if (IsDebugModeEnabled() != enabled)
|
if (IsDebugModeEnabled() != enabled)
|
||||||
{
|
{
|
||||||
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_DEBUGGING, enabled);
|
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_DEBUGGING, enabled);
|
||||||
|
@ -84,14 +84,10 @@ void GeneralPane::CreateLayout()
|
|||||||
void GeneralPane::OnEmulationStateChanged(Core::State state)
|
void GeneralPane::OnEmulationStateChanged(Core::State state)
|
||||||
{
|
{
|
||||||
const bool running = state != Core::State::Uninitialized;
|
const bool running = state != Core::State::Uninitialized;
|
||||||
|
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||||
|
|
||||||
m_checkbox_dualcore->setEnabled(!running);
|
m_checkbox_dualcore->setEnabled(!running);
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
|
||||||
m_checkbox_cheats->setEnabled(!running && !hardcore);
|
m_checkbox_cheats->setEnabled(!running && !hardcore);
|
||||||
#else // USE_RETRO_ACHIEVEMENTS
|
|
||||||
m_checkbox_cheats->setEnabled(!running);
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
m_checkbox_override_region_settings->setEnabled(!running);
|
m_checkbox_override_region_settings->setEnabled(!running);
|
||||||
#ifdef USE_DISCORD_PRESENCE
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
m_checkbox_discord_presence->setEnabled(!running);
|
m_checkbox_discord_presence->setEnabled(!running);
|
||||||
|
@ -268,7 +268,6 @@ void InterfacePane::UpdateShowDebuggingCheckbox()
|
|||||||
static constexpr char TR_DISABLED_IN_HARDCORE_DESCRIPTION[] =
|
static constexpr char TR_DISABLED_IN_HARDCORE_DESCRIPTION[] =
|
||||||
QT_TR_NOOP("<dolphin_emphasis>Disabled in Hardcore Mode.</dolphin_emphasis>");
|
QT_TR_NOOP("<dolphin_emphasis>Disabled in Hardcore Mode.</dolphin_emphasis>");
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||||
SignalBlocking(m_checkbox_show_debugging_ui)->setEnabled(!hardcore);
|
SignalBlocking(m_checkbox_show_debugging_ui)->setEnabled(!hardcore);
|
||||||
if (hardcore)
|
if (hardcore)
|
||||||
@ -281,9 +280,6 @@ void InterfacePane::UpdateShowDebuggingCheckbox()
|
|||||||
{
|
{
|
||||||
m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION));
|
m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION));
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterfacePane::LoadUserStyle()
|
void InterfacePane::LoadUserStyle()
|
||||||
|
@ -331,9 +331,9 @@ void OnScreenUI::DrawDebugText()
|
|||||||
ImGui::TextUnformatted(profile_output.c_str());
|
ImGui::TextUnformatted(profile_output.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
void OnScreenUI::DrawChallengesAndLeaderboards()
|
void OnScreenUI::DrawChallengesAndLeaderboards()
|
||||||
{
|
{
|
||||||
|
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||||
std::lock_guard lg{AchievementManager::GetInstance().GetLock()};
|
std::lock_guard lg{AchievementManager::GetInstance().GetLock()};
|
||||||
const auto& challenge_icons = AchievementManager::GetInstance().GetChallengeIcons();
|
const auto& challenge_icons = AchievementManager::GetInstance().GetChallengeIcons();
|
||||||
const auto& leaderboard_progress = AchievementManager::GetInstance().GetActiveLeaderboards();
|
const auto& leaderboard_progress = AchievementManager::GetInstance().GetActiveLeaderboards();
|
||||||
@ -396,8 +396,8 @@ void OnScreenUI::DrawChallengesAndLeaderboards()
|
|||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
#endif // USE_RETRO_ACHIEVEMENTS
|
||||||
|
}
|
||||||
|
|
||||||
void OnScreenUI::Finalize()
|
void OnScreenUI::Finalize()
|
||||||
{
|
{
|
||||||
@ -406,9 +406,7 @@ void OnScreenUI::Finalize()
|
|||||||
g_perf_metrics.DrawImGuiStats(m_backbuffer_scale);
|
g_perf_metrics.DrawImGuiStats(m_backbuffer_scale);
|
||||||
DrawDebugText();
|
DrawDebugText();
|
||||||
OSD::DrawMessages();
|
OSD::DrawMessages();
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
DrawChallengesAndLeaderboards();
|
DrawChallengesAndLeaderboards();
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,9 +61,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawDebugText();
|
void DrawDebugText();
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
||||||
void DrawChallengesAndLeaderboards();
|
void DrawChallengesAndLeaderboards();
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
|
||||||
|
|
||||||
// ImGui resources.
|
// ImGui resources.
|
||||||
std::unique_ptr<NativeVertexFormat> m_imgui_vertex_format;
|
std::unique_ptr<NativeVertexFormat> m_imgui_vertex_format;
|
||||||
|
Loading…
Reference in New Issue
Block a user