Core/GeckoCode: Make use of std::span where applicable
Generifies the interface a little by not strictly requiring the use of std::vector.
This commit is contained in:
parent
07cf8c5668
commit
adb4c0492d
|
@ -66,7 +66,7 @@ static std::vector<GeckoCode> s_active_codes;
|
|||
static std::vector<GeckoCode> s_synced_codes;
|
||||
static std::mutex s_active_codes_lock;
|
||||
|
||||
void SetActiveCodes(const std::vector<GeckoCode>& gcodes)
|
||||
void SetActiveCodes(std::span<const GeckoCode> 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<GeckoCode>& gcodes)
|
||||
void UpdateSyncedCodes(std::span<const GeckoCode> gcodes)
|
||||
{
|
||||
s_synced_codes.clear();
|
||||
s_synced_codes.reserve(gcodes.size());
|
||||
|
@ -98,7 +98,7 @@ void UpdateSyncedCodes(const std::vector<GeckoCode>& gcodes)
|
|||
s_synced_codes.shrink_to_fit();
|
||||
}
|
||||
|
||||
std::vector<GeckoCode> SetAndReturnActiveCodes(const std::vector<GeckoCode>& gcodes)
|
||||
std::vector<GeckoCode> SetAndReturnActiveCodes(std::span<const GeckoCode> gcodes)
|
||||
{
|
||||
std::lock_guard lk(s_active_codes_lock);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -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<GeckoCode>& gcodes);
|
||||
void SetActiveCodes(std::span<const GeckoCode> gcodes);
|
||||
void SetSyncedCodesAsActive();
|
||||
void UpdateSyncedCodes(const std::vector<GeckoCode>& gcodes);
|
||||
std::vector<GeckoCode> SetAndReturnActiveCodes(const std::vector<GeckoCode>& gcodes);
|
||||
void UpdateSyncedCodes(std::span<const GeckoCode> gcodes);
|
||||
std::vector<GeckoCode> SetAndReturnActiveCodes(std::span<const GeckoCode> gcodes);
|
||||
void RunCodeHandler();
|
||||
void Shutdown();
|
||||
void DoState(PointerWrap&);
|
||||
|
|
Loading…
Reference in New Issue