diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index 1062a02140..57530ec900 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -12,13 +12,13 @@ #include -#include "Common/Assert.h" #include "Common/BitUtils.h" #include "Common/CommonPaths.h" #include "Common/Config/Config.h" #include "Common/FileUtil.h" +#include "Common/HttpRequest.h" #include "Common/IOFile.h" -#include "Common/Image.h" +#include "Common/JsonUtil.h" #include "Common/Logging/Log.h" #include "Common/ScopeGuard.h" #include "Common/StringUtil.h" @@ -33,7 +33,6 @@ #include "Core/GeckoCode.h" #include "Core/HW/Memmap.h" #include "Core/HW/VideoInterface.h" -#include "Core/Host.h" #include "Core/PatchEngine.h" #include "Core/PowerPC/MMU.h" #include "Core/System.h" @@ -414,7 +413,7 @@ bool AchievementManager::IsHardcoreModeActive() const } template -void AchievementManager::FilterApprovedIni(std::vector& codes, const std::string& game_id, +void AchievementManager::FilterApprovedIni(std::vector& codes, std::string_view game_id, u16 revision) const { if (codes.empty()) @@ -443,7 +442,7 @@ void AchievementManager::FilterApprovedIni(std::vector& codes, const std::str } template -bool AchievementManager::ShouldCodeBeActivated(const T& code, const std::string& game_id, +bool AchievementManager::ShouldCodeBeActivated(const T& code, std::string_view game_id, u16 revision) const { if (!code.enabled) @@ -470,8 +469,7 @@ bool AchievementManager::ShouldCodeBeActivated(const T& code, const std::string& } template -bool AchievementManager::IsApprovedCode(const T& code, const std::string& game_id, - u16 revision) const +bool AchievementManager::IsApprovedCode(const T& code, std::string_view game_id, u16 revision) const { // Approved codes list failed to hash if (!m_ini_root->is()) @@ -536,42 +534,42 @@ Common::SHA1::Digest AchievementManager::GetCodeHash(const ActionReplay::ARCode& } void AchievementManager::FilterApprovedPatches(std::vector& patches, - const std::string& game_id, u16 revision) const + std::string_view game_id, u16 revision) const { FilterApprovedIni(patches, game_id, revision); } void AchievementManager::FilterApprovedGeckoCodes(std::vector& codes, - const std::string& game_id, u16 revision) const + std::string_view game_id, u16 revision) const { FilterApprovedIni(codes, game_id, revision); } void AchievementManager::FilterApprovedARCodes(std::vector& codes, - const std::string& game_id, u16 revision) const + std::string_view game_id, u16 revision) const { FilterApprovedIni(codes, game_id, revision); } bool AchievementManager::ShouldGeckoCodeBeActivated(const Gecko::GeckoCode& code, - const std::string& game_id, u16 revision) const + std::string_view game_id, u16 revision) const { return ShouldCodeBeActivated(code, game_id, revision); } bool AchievementManager::ShouldARCodeBeActivated(const ActionReplay::ARCode& code, - const std::string& game_id, u16 revision) const + std::string_view game_id, u16 revision) const { return ShouldCodeBeActivated(code, game_id, revision); } -bool AchievementManager::IsApprovedGeckoCode(const Gecko::GeckoCode& code, - const std::string& game_id, u16 revision) const +bool AchievementManager::IsApprovedGeckoCode(const Gecko::GeckoCode& code, std::string_view game_id, + u16 revision) const { return IsApprovedCode(code, game_id, revision); } bool AchievementManager::IsApprovedARCode(const ActionReplay::ARCode& code, - const std::string& game_id, u16 revision) const + std::string_view game_id, u16 revision) const { return IsApprovedCode(code, game_id, revision); } diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h index 337f12fd08..b616dded44 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -9,17 +9,17 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include +#include + #include #include #include @@ -28,10 +28,7 @@ #include "Common/CommonTypes.h" #include "Common/Config/Config.h" -#include "Common/Event.h" #include "Common/HookableEvent.h" -#include "Common/HttpRequest.h" -#include "Common/JsonUtil.h" #include "Common/Lazy.h" #include "Common/WorkQueueThread.h" #include "DiscIO/Volume.h" @@ -43,7 +40,6 @@ namespace Core { -class CPUThreadGuard; class System; } // namespace Core @@ -77,9 +73,6 @@ public: using RichPresence = std::array; using Badge = VideoCommon::CustomTextureData::ArraySlice::Level; static constexpr size_t MAX_DISPLAYED_LBOARDS = 4; - // This is hardcoded to 24MiB because rcheevos currently hardcodes it to 24MiB. - static constexpr u32 MEM1_SIZE = 0x01800000; - static constexpr u32 MEM2_START = 0x10000000; static constexpr std::string_view DEFAULT_PLAYER_BADGE_FILENAME = "achievements_player.png"; static constexpr std::string_view DEFAULT_GAME_BADGE_FILENAME = "achievements_game.png"; @@ -144,19 +137,19 @@ public: std::recursive_mutex& GetLock(); bool IsHardcoreModeActive() const; - void FilterApprovedPatches(std::vector& patches, const std::string& game_id, + void FilterApprovedPatches(std::vector& patches, std::string_view game_id, u16 revision) const; - void FilterApprovedGeckoCodes(std::vector& codes, const std::string& game_id, + void FilterApprovedGeckoCodes(std::vector& codes, std::string_view game_id, u16 revision) const; - void FilterApprovedARCodes(std::vector& codes, const std::string& game_id, + void FilterApprovedARCodes(std::vector& codes, std::string_view game_id, u16 revision) const; - bool ShouldGeckoCodeBeActivated(const Gecko::GeckoCode& code, const std::string& game_id, + bool ShouldGeckoCodeBeActivated(const Gecko::GeckoCode& code, std::string_view game_id, u16 revision) const; - bool ShouldARCodeBeActivated(const ActionReplay::ARCode& code, const std::string& game_id, + bool ShouldARCodeBeActivated(const ActionReplay::ARCode& code, std::string_view game_id, u16 revision) const; - bool IsApprovedGeckoCode(const Gecko::GeckoCode& code, const std::string& game_id, + bool IsApprovedGeckoCode(const Gecko::GeckoCode& code, std::string_view game_id, u16 revision) const; - bool IsApprovedARCode(const ActionReplay::ARCode& code, const std::string& game_id, + bool IsApprovedARCode(const ActionReplay::ARCode& code, std::string_view game_id, u16 revision) const; void SetSpectatorMode(); @@ -223,11 +216,11 @@ private: void SetHardcoreMode(); template - void FilterApprovedIni(std::vector& codes, const std::string& game_id, u16 revision) const; + void FilterApprovedIni(std::vector& codes, std::string_view game_id, u16 revision) const; template - bool ShouldCodeBeActivated(const T& code, const std::string& game_id, u16 revision) const; + bool ShouldCodeBeActivated(const T& code, std::string_view game_id, u16 revision) const; template - bool IsApprovedCode(const T& code, const std::string& game_id, u16 revision) const; + bool IsApprovedCode(const T& code, std::string_view game_id, u16 revision) const; Common::SHA1::Digest GetCodeHash(const PatchEngine::Patch& patch) const; Common::SHA1::Digest GetCodeHash(const Gecko::GeckoCode& code) const; Common::SHA1::Digest GetCodeHash(const ActionReplay::ARCode& code) const; @@ -326,14 +319,14 @@ public: constexpr bool IsHardcoreModeActive() { return false; } - constexpr bool ShouldGeckoCodeBeActivated(const Gecko::GeckoCode& code, - const std::string& game_id, u16 revision) + constexpr bool ShouldGeckoCodeBeActivated(const Gecko::GeckoCode& code, std::string_view game_id, + u16 revision) { return code.enabled; } - constexpr bool ShouldARCodeBeActivated(const ActionReplay::ARCode& code, - const std::string& game_id, u16 revision) + constexpr bool ShouldARCodeBeActivated(const ActionReplay::ARCode& code, std::string_view game_id, + u16 revision) { return code.enabled; }