diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index 31e0c6766e..c702748003 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -112,7 +112,7 @@ struct ARAddr // ---------------------- // AR Remote Functions -void ApplyCodes(const std::vector& codes) +void ApplyCodes(std::span codes) { if (!Config::Get(Config::MAIN_ENABLE_CHEATS)) return; @@ -132,7 +132,7 @@ void SetSyncedCodesAsActive() s_active_codes = s_synced_codes; } -void UpdateSyncedCodes(const std::vector& codes) +void UpdateSyncedCodes(std::span codes) { s_synced_codes.clear(); s_synced_codes.reserve(codes.size()); @@ -141,7 +141,7 @@ void UpdateSyncedCodes(const std::vector& codes) s_synced_codes.shrink_to_fit(); } -std::vector ApplyAndReturnCodes(const std::vector& codes) +std::vector ApplyAndReturnCodes(std::span codes) { if (Config::Get(Config::MAIN_ENABLE_CHEATS)) { @@ -250,7 +250,7 @@ std::vector LoadCodes(const IniFile& global_ini, const IniFile& local_in return codes; } -void SaveCodes(IniFile* local_ini, const std::vector& codes) +void SaveCodes(IniFile* local_ini, std::span codes) { std::vector lines; std::vector enabled_lines; diff --git a/Source/Core/Core/ActionReplay.h b/Source/Core/Core/ActionReplay.h index 13b6294d30..1c7fb61fa9 100644 --- a/Source/Core/Core/ActionReplay.h +++ b/Source/Core/Core/ActionReplay.h @@ -3,8 +3,8 @@ #pragma once +#include #include -#include #include #include @@ -37,15 +37,15 @@ struct ARCode void RunAllActive(); -void ApplyCodes(const std::vector& codes); +void ApplyCodes(std::span codes); void SetSyncedCodesAsActive(); -void UpdateSyncedCodes(const std::vector& codes); -std::vector ApplyAndReturnCodes(const std::vector& codes); +void UpdateSyncedCodes(std::span codes); +std::vector ApplyAndReturnCodes(std::span codes); void AddCode(ARCode new_code); void LoadAndApplyCodes(const IniFile& global_ini, const IniFile& local_ini); std::vector LoadCodes(const IniFile& global_ini, const IniFile& local_ini); -void SaveCodes(IniFile* local_ini, const std::vector& codes); +void SaveCodes(IniFile* local_ini, std::span codes); using EncryptedLine = std::string; std::variant DeserializeLine(const std::string& line); diff --git a/Source/Core/Core/GeckoCode.cpp b/Source/Core/Core/GeckoCode.cpp index 45b176cbd2..be5ce914db 100644 --- a/Source/Core/Core/GeckoCode.cpp +++ b/Source/Core/Core/GeckoCode.cpp @@ -66,7 +66,7 @@ static std::vector s_active_codes; static std::vector s_synced_codes; static std::mutex s_active_codes_lock; -void SetActiveCodes(const std::vector& gcodes) +void SetActiveCodes(std::span gcodes) { std::lock_guard lk(s_active_codes_lock); @@ -89,7 +89,7 @@ void SetSyncedCodesAsActive() s_active_codes = s_synced_codes; } -void UpdateSyncedCodes(const std::vector& gcodes) +void UpdateSyncedCodes(std::span gcodes) { s_synced_codes.clear(); s_synced_codes.reserve(gcodes.size()); @@ -98,7 +98,7 @@ void UpdateSyncedCodes(const std::vector& gcodes) s_synced_codes.shrink_to_fit(); } -std::vector SetAndReturnActiveCodes(const std::vector& gcodes) +std::vector SetAndReturnActiveCodes(std::span gcodes) { std::lock_guard lk(s_active_codes_lock); diff --git a/Source/Core/Core/GeckoCode.h b/Source/Core/Core/GeckoCode.h index 6f2f8dff4a..fffb83303c 100644 --- a/Source/Core/Core/GeckoCode.h +++ b/Source/Core/Core/GeckoCode.h @@ -3,6 +3,7 @@ #pragma once +#include #include #include @@ -58,10 +59,10 @@ constexpr u32 HLE_TRAMPOLINE_ADDRESS = INSTALLER_END_ADDRESS - 4; // preserve the emulation performance. constexpr u32 MAGIC_GAMEID = 0xD01F1BAD; -void SetActiveCodes(const std::vector& gcodes); +void SetActiveCodes(std::span gcodes); void SetSyncedCodesAsActive(); -void UpdateSyncedCodes(const std::vector& gcodes); -std::vector SetAndReturnActiveCodes(const std::vector& gcodes); +void UpdateSyncedCodes(std::span gcodes); +std::vector SetAndReturnActiveCodes(std::span gcodes); void RunCodeHandler(); void Shutdown(); void DoState(PointerWrap&);