mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
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::vector<GeckoCode> s_synced_codes;
|
||||||
static std::mutex s_active_codes_lock;
|
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);
|
std::lock_guard lk(s_active_codes_lock);
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ void SetSyncedCodesAsActive()
|
|||||||
s_active_codes = s_synced_codes;
|
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.clear();
|
||||||
s_synced_codes.reserve(gcodes.size());
|
s_synced_codes.reserve(gcodes.size());
|
||||||
@ -98,7 +98,7 @@ void UpdateSyncedCodes(const std::vector<GeckoCode>& gcodes)
|
|||||||
s_synced_codes.shrink_to_fit();
|
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);
|
std::lock_guard lk(s_active_codes_lock);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -58,10 +59,10 @@ constexpr u32 HLE_TRAMPOLINE_ADDRESS = INSTALLER_END_ADDRESS - 4;
|
|||||||
// preserve the emulation performance.
|
// preserve the emulation performance.
|
||||||
constexpr u32 MAGIC_GAMEID = 0xD01F1BAD;
|
constexpr u32 MAGIC_GAMEID = 0xD01F1BAD;
|
||||||
|
|
||||||
void SetActiveCodes(const std::vector<GeckoCode>& gcodes);
|
void SetActiveCodes(std::span<const GeckoCode> gcodes);
|
||||||
void SetSyncedCodesAsActive();
|
void SetSyncedCodesAsActive();
|
||||||
void UpdateSyncedCodes(const std::vector<GeckoCode>& gcodes);
|
void UpdateSyncedCodes(std::span<const GeckoCode> gcodes);
|
||||||
std::vector<GeckoCode> SetAndReturnActiveCodes(const std::vector<GeckoCode>& gcodes);
|
std::vector<GeckoCode> SetAndReturnActiveCodes(std::span<const GeckoCode> gcodes);
|
||||||
void RunCodeHandler();
|
void RunCodeHandler();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void DoState(PointerWrap&);
|
void DoState(PointerWrap&);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user