summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorSintendo <3380580+Sintendo@users.noreply.github.com>2026-02-01 09:20:46 +0100
committerSintendo <3380580+Sintendo@users.noreply.github.com>2026-03-23 23:55:09 +0100
commitf6a67aa6e722350db3fc778e4f881cb60090faa1 (patch)
treef35cbb126c72e04cc9032aa55453cfa0edcf7a97 /Source
parentc05b231015375a88ecb4c4eea69862c8c75b809c (diff)
Use more std::span arguments
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/Assembler/GekkoLexer.cpp2
-rw-r--r--Source/Core/Common/Assembler/GekkoLexer.h3
-rw-r--r--Source/Core/Common/Debug/Watches.cpp2
-rw-r--r--Source/Core/Common/Debug/Watches.h3
-rw-r--r--Source/Core/Common/HttpRequest.cpp4
-rw-r--r--Source/Core/Common/HttpRequest.h5
-rw-r--r--Source/Core/Common/Network.cpp6
-rw-r--r--Source/Core/Common/Network.h10
-rw-r--r--Source/Core/Core/Boot/DolReader.cpp2
-rw-r--r--Source/Core/Core/Boot/DolReader.h2
-rw-r--r--Source/Core/Core/CheatSearch.cpp4
-rw-r--r--Source/Core/Core/CheatSearch.h4
-rw-r--r--Source/Core/Core/Config/MainSettings.cpp2
-rw-r--r--Source/Core/Core/Config/MainSettings.h2
-rw-r--r--Source/Core/Core/DSP/DSPCodeUtil.cpp11
-rw-r--r--Source/Core/Core/DSP/DSPCodeUtil.h9
-rw-r--r--Source/Core/Core/DSP/DSPDisassembler.cpp5
-rw-r--r--Source/Core/Core/DSP/DSPDisassembler.h6
-rw-r--r--Source/Core/Core/Debugger/DebugInterface.h3
-rw-r--r--Source/Core/Core/Debugger/PPCDebugInterface.cpp2
-rw-r--r--Source/Core/Core/Debugger/PPCDebugInterface.h2
-rw-r--r--Source/Core/Core/FifoPlayer/FifoDataFile.cpp3
-rw-r--r--Source/Core/Core/FifoPlayer/FifoDataFile.h3
-rw-r--r--Source/Core/Core/GeckoCodeConfig.cpp2
-rw-r--r--Source/Core/Core/GeckoCodeConfig.h3
-rw-r--r--Source/Core/Core/HW/DVD/DVDInterface.cpp6
-rw-r--r--Source/Core/Core/HW/DVD/DVDInterface.h7
-rw-r--r--Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp11
-rw-r--r--Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h2
-rw-r--r--Source/Core/Core/HW/Memmap.cpp2
-rw-r--r--Source/Core/Core/HW/Memmap.h2
-rw-r--r--Source/Core/Core/HW/WiiSave.cpp4
-rw-r--r--Source/Core/Core/HW/WiiSaveStructs.h3
-rw-r--r--Source/Core/Core/Host.h3
-rw-r--r--Source/Core/Core/IOS/ES/ES.h8
-rw-r--r--Source/Core/Core/IOS/ES/NandUtils.cpp2
-rw-r--r--Source/Core/Core/IOS/ES/TitleInformation.cpp4
-rw-r--r--Source/Core/Core/IOS/ES/TitleManagement.cpp2
-rw-r--r--Source/Core/Core/IOS/WFS/WFSI.cpp4
-rw-r--r--Source/Core/Core/IOS/WFS/WFSI.h5
-rw-r--r--Source/Core/Core/NetPlayClient.h3
-rw-r--r--Source/Core/Core/NetPlayCommon.cpp2
-rw-r--r--Source/Core/Core/NetPlayCommon.h4
-rw-r--r--Source/Core/Core/PatchEngine.cpp2
-rw-r--r--Source/Core/Core/PatchEngine.h3
-rw-r--r--Source/Core/Core/State.cpp2
-rw-r--r--Source/Core/Core/WiiUtils.cpp4
-rw-r--r--Source/Core/DiscIO/DirectoryBlob.cpp10
-rw-r--r--Source/Core/DiscIO/DirectoryBlob.h9
-rw-r--r--Source/Core/DiscIO/DiscUtils.cpp3
-rw-r--r--Source/Core/DiscIO/DiscUtils.h4
-rw-r--r--Source/Core/DiscIO/NFSBlob.cpp4
-rw-r--r--Source/Core/DiscIO/NFSBlob.h5
-rw-r--r--Source/Core/DiscIO/RiivolutionParser.cpp4
-rw-r--r--Source/Core/DiscIO/Volume.cpp3
-rw-r--r--Source/Core/DiscIO/Volume.h4
-rw-r--r--Source/Core/DiscIO/VolumeVerifier.cpp2
-rw-r--r--Source/Core/DiscIO/VolumeVerifier.h2
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp3
-rw-r--r--Source/Core/DiscIO/VolumeWad.h3
-rw-r--r--Source/Core/DiscIO/WIABlob.cpp2
-rw-r--r--Source/Core/DiscIO/WIABlob.h2
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp4
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h6
-rw-r--r--Source/Core/DolphinQt/Config/VerifyWidget.cpp4
-rw-r--r--Source/Core/DolphinQt/Config/VerifyWidget.h1
-rw-r--r--Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp2
-rw-r--r--Source/Core/DolphinQt/Config/WiimoteControllersWidget.h3
-rw-r--r--Source/Core/DolphinQt/GBAHost.cpp2
-rw-r--r--Source/Core/DolphinQt/GBAHost.h4
-rw-r--r--Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp2
-rw-r--r--Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.h4
-rw-r--r--Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp2
-rw-r--r--Source/Core/DolphinQt/NetPlay/NetPlayDialog.h2
-rw-r--r--Source/Core/UICommon/NetPlayIndex.cpp8
-rw-r--r--Source/Core/UpdaterCommon/UpdaterCommon.cpp8
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.cpp2
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.h5
-rw-r--r--Source/UnitTests/Core/DSP/DSPAssemblyTest.cpp6
79 files changed, 164 insertions, 146 deletions
diff --git a/Source/Core/Common/Assembler/GekkoLexer.cpp b/Source/Core/Common/Assembler/GekkoLexer.cpp
index 4cfb1c6243..595df5cbf5 100644
--- a/Source/Core/Common/Assembler/GekkoLexer.cpp
+++ b/Source/Core/Common/Assembler/GekkoLexer.cpp
@@ -486,7 +486,7 @@ void Lexer::EatAndReset()
SetIdentifierMatchRule(IdentifierMatchRule::Typical);
}
-std::optional<std::string_view> Lexer::RunDfa(const std::vector<DfaNode>& dfa) const
+std::optional<std::string_view> Lexer::RunDfa(std::span<const DfaNode> dfa) const
{
size_t dfa_index = 0;
bool transition_found;
diff --git a/Source/Core/Common/Assembler/GekkoLexer.h b/Source/Core/Common/Assembler/GekkoLexer.h
index f20a951e97..f01ddcdc3b 100644
--- a/Source/Core/Common/Assembler/GekkoLexer.h
+++ b/Source/Core/Common/Assembler/GekkoLexer.h
@@ -7,6 +7,7 @@
#include <array>
#include <deque>
#include <optional>
+#include <span>
#include <string_view>
#include <vector>
@@ -166,7 +167,7 @@ public:
}
private:
- std::optional<std::string_view> RunDfa(const std::vector<DfaNode>& dfa) const;
+ std::optional<std::string_view> RunDfa(std::span<const DfaNode> dfa) const;
void SkipWs() const;
void FeedbackTokens() const;
bool IdentifierHeadExtra(char h) const;
diff --git a/Source/Core/Common/Debug/Watches.cpp b/Source/Core/Common/Debug/Watches.cpp
index 2ffad54b82..6d4b07cc5c 100644
--- a/Source/Core/Common/Debug/Watches.cpp
+++ b/Source/Core/Common/Debug/Watches.cpp
@@ -89,7 +89,7 @@ void Watches::RemoveWatch(std::size_t index)
m_watches.erase(m_watches.begin() + index);
}
-void Watches::LoadFromStrings(const std::vector<std::string>& watches)
+void Watches::LoadFromStrings(std::span<const std::string> watches)
{
for (const std::string& watch : watches)
{
diff --git a/Source/Core/Common/Debug/Watches.h b/Source/Core/Common/Debug/Watches.h
index fc16adb826..cf4ee2b179 100644
--- a/Source/Core/Common/Debug/Watches.h
+++ b/Source/Core/Common/Debug/Watches.h
@@ -4,6 +4,7 @@
#pragma once
#include <cstddef>
+#include <span>
#include <string>
#include <vector>
@@ -42,7 +43,7 @@ public:
void DisableWatch(std::size_t index);
bool HasEnabledWatch(u32 address) const;
void RemoveWatch(std::size_t index);
- void LoadFromStrings(const std::vector<std::string>& watches);
+ void LoadFromStrings(std::span<const std::string> watches);
std::vector<std::string> SaveToStrings() const;
void Clear();
diff --git a/Source/Core/Common/HttpRequest.cpp b/Source/Core/Common/HttpRequest.cpp
index d3860594e0..94a466434a 100644
--- a/Source/Core/Common/HttpRequest.cpp
+++ b/Source/Core/Common/HttpRequest.cpp
@@ -96,13 +96,13 @@ HttpRequest::Response HttpRequest::Get(const std::string& url, const Headers& he
return m_impl->Fetch(url, Impl::Method::GET, headers, nullptr, 0, codes);
}
-HttpRequest::Response HttpRequest::Post(const std::string& url, const std::vector<u8>& payload,
+HttpRequest::Response HttpRequest::Post(const std::string& url, std::span<const u8> payload,
const Headers& headers, AllowedReturnCodes codes)
{
return m_impl->Fetch(url, Impl::Method::POST, headers, payload.data(), payload.size(), codes);
}
-HttpRequest::Response HttpRequest::Post(const std::string& url, const std::string& payload,
+HttpRequest::Response HttpRequest::Post(const std::string& url, std::string_view payload,
const Headers& headers, AllowedReturnCodes codes)
{
return m_impl->Fetch(url, Impl::Method::POST, headers,
diff --git a/Source/Core/Common/HttpRequest.h b/Source/Core/Common/HttpRequest.h
index 4f1a9798d5..b92fa2f29f 100644
--- a/Source/Core/Common/HttpRequest.h
+++ b/Source/Core/Common/HttpRequest.h
@@ -10,6 +10,7 @@
#include <optional>
#include <span>
#include <string>
+#include <string_view>
#include <vector>
#include "Common/CommonTypes.h"
@@ -50,9 +51,9 @@ public:
std::string GetHeaderValue(std::string_view name) const;
Response Get(const std::string& url, const Headers& headers = {},
AllowedReturnCodes codes = AllowedReturnCodes::Ok_Only);
- Response Post(const std::string& url, const std::vector<u8>& payload, const Headers& headers = {},
+ Response Post(const std::string& url, std::span<const u8> payload, const Headers& headers = {},
AllowedReturnCodes codes = AllowedReturnCodes::Ok_Only);
- Response Post(const std::string& url, const std::string& payload, const Headers& headers = {},
+ Response Post(const std::string& url, std::string_view payload, const Headers& headers = {},
AllowedReturnCodes codes = AllowedReturnCodes::Ok_Only);
Response PostMultiform(const std::string& url, std::span<Multiform> multiform,
diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp
index d44d106da5..58994c635d 100644
--- a/Source/Core/Common/Network.cpp
+++ b/Source/Core/Common/Network.cpp
@@ -462,7 +462,7 @@ DHCPBody::DHCPBody(u32 transaction, const MACAddress& client_address, u32 new_ip
DHCPPacket::DHCPPacket() = default;
-DHCPPacket::DHCPPacket(const std::vector<u8>& data)
+DHCPPacket::DHCPPacket(std::span<const u8> data)
{
if (data.size() < DHCPBody::SIZE)
return;
@@ -489,7 +489,7 @@ DHCPPacket::DHCPPacket(const std::vector<u8>& data)
}
}
-void DHCPPacket::AddOption(u8 fnc, const std::vector<u8>& params)
+void DHCPPacket::AddOption(u8 fnc, std::span<const u8> params)
{
if (params.size() > 255)
return;
@@ -507,7 +507,7 @@ std::vector<u8> DHCPPacket::Build() const
{
result.insert(result.end(), opt.begin(), opt.end());
}
- const std::vector<u8> no_option = {255, 0, 0, 0};
+ constexpr auto no_option = std::to_array<u8>({255, 0, 0, 0});
result.insert(result.end(), no_option.begin(), no_option.end());
return result;
diff --git a/Source/Core/Common/Network.h b/Source/Core/Common/Network.h
index 5e0da6559e..3ae1211d03 100644
--- a/Source/Core/Common/Network.h
+++ b/Source/Core/Common/Network.h
@@ -4,7 +4,9 @@
#pragma once
#include <array>
+#include <initializer_list>
#include <optional>
+#include <span>
#include <string>
#include <string_view>
#include <type_traits>
@@ -183,8 +185,12 @@ static_assert(sizeof(DHCPBody) == DHCPBody::SIZE);
struct DHCPPacket
{
DHCPPacket();
- DHCPPacket(const std::vector<u8>& data);
- void AddOption(u8 fnc, const std::vector<u8>& params);
+ DHCPPacket(std::span<const u8> data);
+ void AddOption(u8 fnc, std::span<const u8> params);
+ void AddOption(u8 fnc, std::initializer_list<u8> params)
+ {
+ AddOption(fnc, {params.begin(), params.end()});
+ }
std::vector<u8> Build() const;
DHCPBody body;
diff --git a/Source/Core/Core/Boot/DolReader.cpp b/Source/Core/Core/Boot/DolReader.cpp
index c78cd36fcb..0ec828c519 100644
--- a/Source/Core/Core/Boot/DolReader.cpp
+++ b/Source/Core/Core/Boot/DolReader.cpp
@@ -31,7 +31,7 @@ DolReader::DolReader(const std::string& filename) : BootExecutableReader(filenam
DolReader::~DolReader() = default;
-bool DolReader::Initialize(const std::vector<u8>& buffer)
+bool DolReader::Initialize(std::span<const u8> buffer)
{
if (buffer.size() < sizeof(SDolHeader) || buffer.size() > UINT32_MAX)
return false;
diff --git a/Source/Core/Core/Boot/DolReader.h b/Source/Core/Core/Boot/DolReader.h
index 5ef8500610..badd52bc90 100644
--- a/Source/Core/Core/Boot/DolReader.h
+++ b/Source/Core/Core/Boot/DolReader.h
@@ -65,7 +65,7 @@ private:
bool m_is_ancast;
// Copy sections to internal buffers
- bool Initialize(const std::vector<u8>& buffer);
+ bool Initialize(std::span<const u8> buffer);
bool LoadAncastIntoMemory(Core::System& system) const;
};
diff --git a/Source/Core/Core/CheatSearch.cpp b/Source/Core/Core/CheatSearch.cpp
index 063a09a582..aba2199682 100644
--- a/Source/Core/Core/CheatSearch.cpp
+++ b/Source/Core/Core/CheatSearch.cpp
@@ -111,7 +111,7 @@ TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
template <typename T>
auto Cheats::NewSearch(const Core::CPUThreadGuard& guard,
- const std::vector<Cheats::MemoryRange>& memory_ranges,
+ std::span<const Cheats::MemoryRange> memory_ranges,
PowerPC::RequestedAddressSpace address_space, bool aligned,
const std::function<bool(const T& value)>& validator)
-> std::expected<std::vector<SearchResult<T>>, SearchErrorCode>
@@ -164,7 +164,7 @@ auto Cheats::NewSearch(const Core::CPUThreadGuard& guard,
template <typename T>
auto Cheats::NextSearch(
- const Core::CPUThreadGuard& guard, const std::vector<Cheats::SearchResult<T>>& previous_results,
+ const Core::CPUThreadGuard& guard, std::span<const Cheats::SearchResult<T>> previous_results,
PowerPC::RequestedAddressSpace address_space,
const std::function<bool(const T& new_value, const T& old_value)>& validator)
-> std::expected<std::vector<SearchResult<T>>, SearchErrorCode>
diff --git a/Source/Core/Core/CheatSearch.h b/Source/Core/Core/CheatSearch.h
index 7d1c089835..3c83484ab3 100644
--- a/Source/Core/Core/CheatSearch.h
+++ b/Source/Core/Core/CheatSearch.h
@@ -117,7 +117,7 @@ std::vector<u8> GetValueAsByteVector(const SearchValue& value);
// for which the given validator returns true.
template <typename T>
std::expected<std::vector<SearchResult<T>>, SearchErrorCode>
-NewSearch(const Core::CPUThreadGuard& guard, const std::vector<MemoryRange>& memory_ranges,
+NewSearch(const Core::CPUThreadGuard& guard, std::span<const MemoryRange> memory_ranges,
PowerPC::RequestedAddressSpace address_space, bool aligned,
const std::function<bool(const T& value)>& validator);
@@ -125,7 +125,7 @@ NewSearch(const Core::CPUThreadGuard& guard, const std::vector<MemoryRange>& mem
// which the given validator returns true.
template <typename T>
std::expected<std::vector<SearchResult<T>>, SearchErrorCode>
-NextSearch(const Core::CPUThreadGuard& guard, const std::vector<SearchResult<T>>& previous_results,
+NextSearch(const Core::CPUThreadGuard& guard, std::span<const SearchResult<T>> previous_results,
PowerPC::RequestedAddressSpace address_space,
const std::function<bool(const T& new_value, const T& old_value)>& validator);
diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp
index 147aeedf50..993c0778d8 100644
--- a/Source/Core/Core/Config/MainSettings.cpp
+++ b/Source/Core/Core/Config/MainSettings.cpp
@@ -367,7 +367,7 @@ std::vector<std::string> GetIsoPaths()
return paths;
}
-void SetIsoPaths(const std::vector<std::string>& paths)
+void SetIsoPaths(std::span<const std::string> paths)
{
size_t old_size = MathUtil::SaturatingCast<size_t>(Config::Get(Config::MAIN_ISO_PATH_COUNT));
size_t new_size = paths.size();
diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h
index a1baf26242..323a22894d 100644
--- a/Source/Core/Core/Config/MainSettings.h
+++ b/Source/Core/Core/Config/MainSettings.h
@@ -218,7 +218,7 @@ extern const Info<int> MAIN_GDB_PORT;
extern const Info<int> MAIN_ISO_PATH_COUNT;
extern const Info<std::string> MAIN_SKYLANDERS_PATH;
std::vector<std::string> GetIsoPaths();
-void SetIsoPaths(const std::vector<std::string>& paths);
+void SetIsoPaths(std::span<const std::string> paths);
// Main.GBA
diff --git a/Source/Core/Core/DSP/DSPCodeUtil.cpp b/Source/Core/Core/DSP/DSPCodeUtil.cpp
index 7b9b5d3b0a..33791aec58 100644
--- a/Source/Core/Core/DSP/DSPCodeUtil.cpp
+++ b/Source/Core/Core/DSP/DSPCodeUtil.cpp
@@ -4,6 +4,7 @@
#include "Core/DSP/DSPCodeUtil.h"
#include <algorithm>
+#include <span>
#include <string>
#include <vector>
@@ -35,7 +36,7 @@ bool Assemble(const std::string& text, std::vector<u16>& code, bool force)
return assembler.Assemble(text, code);
}
-bool Disassemble(const std::vector<u16>& code, bool line_numbers, std::string& text)
+bool Disassemble(std::span<const u16> code, bool line_numbers, std::string& text)
{
if (code.empty())
return false;
@@ -56,7 +57,7 @@ bool Disassemble(const std::vector<u16>& code, bool line_numbers, std::string& t
// NOTE: This code is called from DSPTool and UnitTests, which do not use the logging system.
// Thus, fmt::print is used instead of the log system.
-bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
+bool Compare(std::span<const u16> code1, std::span<const u16> code2)
{
if (code1.size() != code2.size())
fmt::print("Size difference! 1={} 2={}\n", code1.size(), code2.size());
@@ -106,7 +107,7 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
if (code2.size() != code1.size())
{
fmt::print("Extra code words:\n");
- const std::vector<u16>& longest = code1.size() > code2.size() ? code1 : code2;
+ const auto longest = code1.size() > code2.size() ? code1 : code2;
for (u16 i = min_size; i < longest.size(); i++)
{
u16 pc = i;
@@ -119,7 +120,7 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
return code1.size() == code2.size() && code1.size() == count_equal;
}
-std::string CodeToBinaryStringBE(const std::vector<u16>& code)
+std::string CodeToBinaryStringBE(std::span<const u16> code)
{
std::string str(code.size() * 2, '\0');
@@ -153,7 +154,7 @@ std::optional<std::vector<u16>> LoadBinary(const std::string& filename)
return std::make_optional(BinaryStringBEToCode(buffer));
}
-bool SaveBinary(const std::vector<u16>& code, const std::string& filename)
+bool SaveBinary(std::span<const u16> code, const std::string& filename)
{
const std::string buffer = CodeToBinaryStringBE(code);
diff --git a/Source/Core/Core/DSP/DSPCodeUtil.h b/Source/Core/Core/DSP/DSPCodeUtil.h
index 14cb673a0e..ca4785e18c 100644
--- a/Source/Core/Core/DSP/DSPCodeUtil.h
+++ b/Source/Core/Core/DSP/DSPCodeUtil.h
@@ -4,6 +4,7 @@
#pragma once
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -12,16 +13,16 @@
namespace DSP
{
bool Assemble(const std::string& text, std::vector<u16>& code, bool force = false);
-bool Disassemble(const std::vector<u16>& code, bool line_numbers, std::string& text);
-bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2);
+bool Disassemble(std::span<const u16> code, bool line_numbers, std::string& text);
+bool Compare(std::span<const u16> code1, std::span<const u16> code2);
// Big-endian, for writing straight to file using File::WriteStringToFile.
-std::string CodeToBinaryStringBE(const std::vector<u16>& code);
+std::string CodeToBinaryStringBE(std::span<const u16> code);
std::vector<u16> BinaryStringBEToCode(const std::string& str);
// Load code (big endian binary).
std::optional<std::vector<u16>> LoadBinary(const std::string& filename);
-bool SaveBinary(const std::vector<u16>& code, const std::string& filename);
+bool SaveBinary(std::span<const u16> code, const std::string& filename);
bool DumpDSPCode(const u8* code_be, size_t size_in_bytes, u32 crc);
} // namespace DSP
diff --git a/Source/Core/Core/DSP/DSPDisassembler.cpp b/Source/Core/Core/DSP/DSPDisassembler.cpp
index 75f235b38f..912b41d579 100644
--- a/Source/Core/Core/DSP/DSPDisassembler.cpp
+++ b/Source/Core/Core/DSP/DSPDisassembler.cpp
@@ -7,7 +7,6 @@
#include <limits>
#include <string>
#include <utility>
-#include <vector>
#include <fmt/format.h>
@@ -23,7 +22,7 @@ DSPDisassembler::DSPDisassembler(const AssemblerSettings& settings) : settings_(
{
}
-bool DSPDisassembler::Disassemble(const std::vector<u16>& code, std::string& text)
+bool DSPDisassembler::Disassemble(std::span<const u16> code, std::string& text)
{
if (code.size() > std::numeric_limits<u16>::max())
{
@@ -140,7 +139,7 @@ std::string DSPDisassembler::DisassembleParameters(const DSPOPCTemplate& opc, u1
return buf;
}
-bool DSPDisassembler::DisassembleOpcode(const std::vector<u16>& code, u16* pc, std::string& dest)
+bool DSPDisassembler::DisassembleOpcode(std::span<const u16> code, u16* pc, std::string& dest)
{
return DisassembleOpcode(code.data(), code.size(), pc, dest);
}
diff --git a/Source/Core/Core/DSP/DSPDisassembler.h b/Source/Core/Core/DSP/DSPDisassembler.h
index 294cc8df52..ca912c5c42 100644
--- a/Source/Core/Core/DSP/DSPDisassembler.h
+++ b/Source/Core/Core/DSP/DSPDisassembler.h
@@ -4,8 +4,8 @@
#pragma once
+#include <span>
#include <string>
-#include <vector>
#include "Common/CommonTypes.h"
@@ -32,11 +32,11 @@ class DSPDisassembler
public:
explicit DSPDisassembler(const AssemblerSettings& settings);
- bool Disassemble(const std::vector<u16>& code, std::string& text);
+ bool Disassemble(std::span<const u16> code, std::string& text);
// Disassembles the given opcode at pc and increases pc by the opcode's size.
// The PC is wrapped such that 0x0000 and 0x8000 both point to the start of the buffer.
- bool DisassembleOpcode(const std::vector<u16>& code, u16* pc, std::string& dest);
+ bool DisassembleOpcode(std::span<const u16> code, u16* pc, std::string& dest);
bool DisassembleOpcode(const u16* binbuf, size_t binbuf_size, u16* pc, std::string& dest);
private:
diff --git a/Source/Core/Core/Debugger/DebugInterface.h b/Source/Core/Core/Debugger/DebugInterface.h
index 607cbe8bba..6510dfcddf 100644
--- a/Source/Core/Core/Debugger/DebugInterface.h
+++ b/Source/Core/Core/Debugger/DebugInterface.h
@@ -5,6 +5,7 @@
#include <cstddef>
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -40,7 +41,7 @@ public:
virtual void DisableWatch(std::size_t index) = 0;
virtual bool HasEnabledWatch(u32 address) const = 0;
virtual void RemoveWatch(std::size_t index) = 0;
- virtual void LoadWatchesFromStrings(const std::vector<std::string>& watches) = 0;
+ virtual void LoadWatchesFromStrings(std::span<const std::string> watches) = 0;
virtual std::vector<std::string> SaveWatchesToStrings() const = 0;
virtual void ClearWatches() = 0;
diff --git a/Source/Core/Core/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Debugger/PPCDebugInterface.cpp
index fd105df2b4..bbb467c4ca 100644
--- a/Source/Core/Core/Debugger/PPCDebugInterface.cpp
+++ b/Source/Core/Core/Debugger/PPCDebugInterface.cpp
@@ -158,7 +158,7 @@ void PPCDebugInterface::RemoveWatch(std::size_t index)
return m_watches.RemoveWatch(index);
}
-void PPCDebugInterface::LoadWatchesFromStrings(const std::vector<std::string>& watches)
+void PPCDebugInterface::LoadWatchesFromStrings(std::span<const std::string> watches)
{
m_watches.LoadFromStrings(watches);
}
diff --git a/Source/Core/Core/Debugger/PPCDebugInterface.h b/Source/Core/Core/Debugger/PPCDebugInterface.h
index 61f0dedfb3..be116de9cc 100644
--- a/Source/Core/Core/Debugger/PPCDebugInterface.h
+++ b/Source/Core/Core/Debugger/PPCDebugInterface.h
@@ -65,7 +65,7 @@ public:
void DisableWatch(std::size_t index) override;
bool HasEnabledWatch(u32 address) const override;
void RemoveWatch(std::size_t index) override;
- void LoadWatchesFromStrings(const std::vector<std::string>& watches) override;
+ void LoadWatchesFromStrings(std::span<const std::string> watches) override;
std::vector<std::string> SaveWatchesToStrings() const override;
void ClearWatches() override;
diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
index 5c30081393..f795d5f08a 100644
--- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
@@ -389,8 +389,7 @@ bool FifoDataFile::GetFlag(u32 flag) const
return !!(m_Flags & flag);
}
-u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate>& memUpdates,
- File::IOFile& file)
+u64 FifoDataFile::WriteMemoryUpdates(std::span<const MemoryUpdate> memUpdates, File::IOFile& file)
{
// Add space for memory update list
u64 updateListOffset = file.Tell();
diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.h b/Source/Core/Core/FifoPlayer/FifoDataFile.h
index f0fd098eaa..6aff6d37ba 100644
--- a/Source/Core/Core/FifoPlayer/FifoDataFile.h
+++ b/Source/Core/Core/FifoPlayer/FifoDataFile.h
@@ -5,6 +5,7 @@
#include <array>
#include <memory>
+#include <span>
#include <string>
#include <vector>
@@ -92,7 +93,7 @@ private:
void SetFlag(u32 flag, bool set);
bool GetFlag(u32 flag) const;
- u64 WriteMemoryUpdates(const std::vector<MemoryUpdate>& memUpdates, File::IOFile& file);
+ u64 WriteMemoryUpdates(std::span<const MemoryUpdate> memUpdates, File::IOFile& file);
static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates,
std::vector<MemoryUpdate>& memUpdates, File::IOFile& file);
diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp
index 46e719b724..edc94ff10d 100644
--- a/Source/Core/Core/GeckoCodeConfig.cpp
+++ b/Source/Core/Core/GeckoCodeConfig.cpp
@@ -231,7 +231,7 @@ static void SaveGeckoCode(std::vector<std::string>& lines, const GeckoCode& gcod
lines.push_back('*' + note);
}
-void SaveCodes(Common::IniFile& inifile, const std::vector<GeckoCode>& gcodes)
+void SaveCodes(Common::IniFile& inifile, std::span<const GeckoCode> gcodes)
{
std::vector<std::string> lines;
std::vector<std::string> enabled_lines;
diff --git a/Source/Core/Core/GeckoCodeConfig.h b/Source/Core/Core/GeckoCodeConfig.h
index 8020d83c1e..860eb4dbee 100644
--- a/Source/Core/Core/GeckoCodeConfig.h
+++ b/Source/Core/Core/GeckoCodeConfig.h
@@ -5,6 +5,7 @@
#include <expected>
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -19,7 +20,7 @@ namespace Gecko
{
std::vector<GeckoCode> LoadCodes(const Common::IniFile& globalIni, const Common::IniFile& localIni);
std::expected<std::vector<GeckoCode>, int> DownloadCodes(std::string gametdb_id);
-void SaveCodes(Common::IniFile& inifile, const std::vector<GeckoCode>& gcodes);
+void SaveCodes(Common::IniFile& inifile, std::span<const GeckoCode> gcodes);
std::optional<GeckoCode::Code> DeserializeLine(const std::string& line);
} // namespace Gecko
diff --git a/Source/Core/Core/HW/DVD/DVDInterface.cpp b/Source/Core/Core/HW/DVD/DVDInterface.cpp
index 376aeb4add..e7b3401f96 100644
--- a/Source/Core/Core/HW/DVD/DVDInterface.cpp
+++ b/Source/Core/Core/HW/DVD/DVDInterface.cpp
@@ -133,7 +133,7 @@ void DVDInterface::DoState(PointerWrap& p)
}
size_t DVDInterface::ProcessDTKSamples(s16* target_samples, size_t target_block_count,
- const std::vector<u8>& audio_data)
+ std::span<const u8> audio_data)
{
const size_t block_count_to_process =
std::min(target_block_count, audio_data.size() / StreamADPCM::ONE_BLOCK_SIZE);
@@ -192,7 +192,7 @@ u32 DVDInterface::AdvanceDTK(u32 maximum_blocks, u32* blocks_to_process)
}
void DVDInterface::DTKStreamingCallback(DIInterruptType interrupt_type,
- const std::vector<u8>& audio_data, s64 cycles_late)
+ std::span<const u8> audio_data, s64 cycles_late)
{
auto& ai = m_system.GetAudioInterface();
@@ -1305,7 +1305,7 @@ void DVDInterface::SetDriveError(DriveError error)
}
void DVDInterface::FinishExecutingCommand(ReplyType reply_type, DIInterruptType interrupt_type,
- s64 cycles_late, const std::vector<u8>& data)
+ s64 cycles_late, std::span<const u8> data)
{
// The data parameter contains the requested data iff this was called from DVDThread, and is
// empty otherwise. DVDThread is the only source of ReplyType::NoReply and ReplyType::DTK.
diff --git a/Source/Core/Core/HW/DVD/DVDInterface.h b/Source/Core/Core/HW/DVD/DVDInterface.h
index 600edc5050..2e3c562e1d 100644
--- a/Source/Core/Core/HW/DVD/DVDInterface.h
+++ b/Source/Core/Core/HW/DVD/DVDInterface.h
@@ -6,6 +6,7 @@
#include <array>
#include <memory>
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -170,17 +171,17 @@ public:
// Used by DVDThread
void FinishExecutingCommand(ReplyType reply_type, DIInterruptType interrupt_type, s64 cycles_late,
- const std::vector<u8>& data = std::vector<u8>());
+ std::span<const u8> data = {});
// Used by IOS HLE
void SetInterruptEnabled(DIInterruptType interrupt, bool enabled);
void ClearInterrupt(DIInterruptType interrupt);
private:
- void DTKStreamingCallback(DIInterruptType interrupt_type, const std::vector<u8>& audio_data,
+ void DTKStreamingCallback(DIInterruptType interrupt_type, std::span<const u8> audio_data,
s64 cycles_late);
size_t ProcessDTKSamples(s16* target_samples, size_t target_block_count,
- const std::vector<u8>& audio_data);
+ const std::span<const u8> audio_data);
u32 AdvanceDTK(u32 maximum_blocks, u32* blocks_to_process);
void SetLidOpen();
diff --git a/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp b/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp
index ed9cd5b488..9a96c2bdb5 100644
--- a/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp
+++ b/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp
@@ -124,9 +124,9 @@ bool CEXIETHERNET::BuiltInBBAInterface::IsActivated()
return m_active;
}
-void CEXIETHERNET::BuiltInBBAInterface::WriteToQueue(const std::vector<u8>& data)
+void CEXIETHERNET::BuiltInBBAInterface::WriteToQueue(std::vector<u8> data)
{
- m_queue_data[m_queue_write] = data;
+ m_queue_data[m_queue_write] = std::move(data);
const u8 next_write_index = (m_queue_write + 1) & 15;
if (next_write_index != m_queue_read)
m_queue_write = next_write_index;
@@ -178,7 +178,7 @@ void CEXIETHERNET::BuiltInBBAInterface::PollData(std::size_t* datasize)
// Otherwise, enqueue it
const auto socket_data = TryGetDataFromSocket(&net_ref);
if (socket_data.has_value())
- WriteToQueue(*socket_data);
+ WriteToQueue(std::move(*socket_data));
}
else
{
@@ -220,7 +220,7 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleDHCP(const Common::UDPPacket& pack
const u8* router_ip_ptr = reinterpret_cast<const u8*>(&m_router_ip);
const std::vector<u8> ip_part(router_ip_ptr, router_ip_ptr + sizeof(m_router_ip));
- const std::vector<u8> timeout_24h = {0, 1, 0x51, 0x80};
+ constexpr auto timeout_24h = std::to_array<u8>({0, 1, 0x51, 0x80});
Common::DHCPPacket reply;
reply.body = Common::DHCPBody(request.transaction_id, m_current_mac, m_current_ip, m_router_ip);
@@ -666,8 +666,7 @@ bool CEXIETHERNET::BuiltInBBAInterface::SendFrame(const u8* frame, u32 size)
case IPPROTO_IGMP:
{
// Acknowledge IGMP packet
- const std::vector<u8> data(frame, frame + size);
- WriteToQueue(data);
+ WriteToQueue({frame, frame + size});
break;
}
diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h b/Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h
index 78b20f5a44..00d0fcb84e 100644
--- a/Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h
+++ b/Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h
@@ -463,7 +463,7 @@ private:
Common::Flag m_read_thread_shutdown;
static void ReadThreadHandler(BuiltInBBAInterface* self);
#endif
- void WriteToQueue(const std::vector<u8>& data);
+ void WriteToQueue(std::vector<u8> data);
bool WillQueueOverrun() const;
void PollData(std::size_t* datasize);
std::optional<std::vector<u8>> TryGetDataFromSocket(StackRef* ref);
diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp
index 60287424d5..e6d8fd56a5 100644
--- a/Source/Core/Core/HW/Memmap.cpp
+++ b/Source/Core/Core/HW/Memmap.cpp
@@ -369,7 +369,7 @@ bool MemoryManager::TryAddLargePageTableMapping(u32 logical_address, u32 transla
return CanCreateHostMappingForGuestPages(entries);
}
-bool MemoryManager::CanCreateHostMappingForGuestPages(const std::vector<u32>& entries) const
+bool MemoryManager::CanCreateHostMappingForGuestPages(std::span<const u32> entries) const
{
const u32 translated_address = entries[0];
if ((translated_address & (m_page_size - 1)) != 0)
diff --git a/Source/Core/Core/HW/Memmap.h b/Source/Core/Core/HW/Memmap.h
index 421fc32e0b..baa910cc70 100644
--- a/Source/Core/Core/HW/Memmap.h
+++ b/Source/Core/Core/HW/Memmap.h
@@ -289,7 +289,7 @@ private:
void TryAddLargePageTableMapping(u32 logical_address, u32 translated_address, bool writeable);
bool TryAddLargePageTableMapping(u32 logical_address, u32 translated_address,
std::map<u32, std::vector<u32>>& map);
- bool CanCreateHostMappingForGuestPages(const std::vector<u32>& entries) const;
+ bool CanCreateHostMappingForGuestPages(std::span<const u32> entries) const;
void AddHostPageTableMapping(u32 logical_address, u32 translated_address, bool writeable,
u32 logical_size);
void RemoveLargePageTableMapping(u32 logical_address);
diff --git a/Source/Core/Core/HW/WiiSave.cpp b/Source/Core/Core/HW/WiiSave.cpp
index 051a0a8936..1c3e676897 100644
--- a/Source/Core/Core/HW/WiiSave.cpp
+++ b/Source/Core/Core/HW/WiiSave.cpp
@@ -158,7 +158,7 @@ public:
bool WriteBkHeader(const BkHeader& bk_header) override { return true; }
- bool WriteFiles(const std::vector<SaveFile>& files) override
+ bool WriteFiles(std::span<const SaveFile> files) override
{
if (!m_uid || !m_gid)
return false;
@@ -390,7 +390,7 @@ public:
return m_file.Seek(sizeof(Header), File::SeekOrigin::Begin) && m_file.WriteArray(&bk_header, 1);
}
- bool WriteFiles(const std::vector<SaveFile>& files) override
+ bool WriteFiles(std::span<const SaveFile> files) override
{
if (!m_file.Seek(sizeof(Header) + sizeof(BkHeader), File::SeekOrigin::Begin))
return false;
diff --git a/Source/Core/Core/HW/WiiSaveStructs.h b/Source/Core/Core/HW/WiiSaveStructs.h
index e95ce0b6fa..dd4c18df50 100644
--- a/Source/Core/Core/HW/WiiSaveStructs.h
+++ b/Source/Core/Core/HW/WiiSaveStructs.h
@@ -10,6 +10,7 @@
#include <array>
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -108,6 +109,6 @@ public:
virtual std::optional<std::vector<SaveFile>> ReadFiles() = 0;
virtual bool WriteHeader(const Header& header) = 0;
virtual bool WriteBkHeader(const BkHeader& bk_header) = 0;
- virtual bool WriteFiles(const std::vector<SaveFile>& files) = 0;
+ virtual bool WriteFiles(std::span<const SaveFile> files) = 0;
};
} // namespace WiiSave
diff --git a/Source/Core/Core/Host.h b/Source/Core/Core/Host.h
index 2c19e99f4c..576395059c 100644
--- a/Source/Core/Core/Host.h
+++ b/Source/Core/Core/Host.h
@@ -4,6 +4,7 @@
#pragma once
#include <memory>
+#include <span>
#include <string>
#include <vector>
@@ -36,7 +37,7 @@ class GBAHostInterface
public:
virtual ~GBAHostInterface() = default;
virtual void GameChanged() = 0;
- virtual void FrameEnded(const std::vector<u32>& video_buffer) = 0;
+ virtual void FrameEnded(std::span<const u32> video_buffer) = 0;
};
enum class HostMessageID
diff --git a/Source/Core/Core/IOS/ES/ES.h b/Source/Core/Core/IOS/ES/ES.h
index e5c9f4f06a..ec6adb4856 100644
--- a/Source/Core/Core/IOS/ES/ES.h
+++ b/Source/Core/Core/IOS/ES/ES.h
@@ -4,7 +4,7 @@
#pragma once
#include <array>
-#include <map>
+#include <span>
#include <string>
#include <vector>
@@ -376,8 +376,8 @@ private:
IPCReply SeekContent(u32 uid, const IOCtlVRequest& request);
// Title information
- IPCReply GetTitleCount(const std::vector<u64>& titles, const IOCtlVRequest& request);
- IPCReply GetTitles(const std::vector<u64>& titles, const IOCtlVRequest& request);
+ IPCReply GetTitleCount(std::span<const u64> titles, const IOCtlVRequest& request);
+ IPCReply GetTitles(std::span<const u64> titles, const IOCtlVRequest& request);
IPCReply GetOwnedTitleCount(const IOCtlVRequest& request);
IPCReply GetOwnedTitles(const IOCtlVRequest& request);
IPCReply GetTitleCount(const IOCtlVRequest& request);
@@ -416,7 +416,7 @@ private:
void FinishInit();
- s32 WriteSystemFile(const std::string& path, const std::vector<u8>& data, Ticks ticks = {});
+ s32 WriteSystemFile(const std::string& path, std::span<const u8> data, Ticks ticks = {});
s32 WriteLaunchFile(const ES::TMDReader& tmd, Ticks ticks = {});
bool BootstrapPPC();
diff --git a/Source/Core/Core/IOS/ES/NandUtils.cpp b/Source/Core/Core/IOS/ES/NandUtils.cpp
index ee26f37e14..9215d93fd9 100644
--- a/Source/Core/Core/IOS/ES/NandUtils.cpp
+++ b/Source/Core/Core/IOS/ES/NandUtils.cpp
@@ -399,7 +399,7 @@ std::string ESCore::GetContentPath(const u64 title_id, const ES::Content& conten
return fmt::format("{}/{:08x}.app", Common::GetTitleContentPath(title_id), content.id);
}
-s32 ESDevice::WriteSystemFile(const std::string& path, const std::vector<u8>& data, Ticks ticks)
+s32 ESDevice::WriteSystemFile(const std::string& path, std::span<const u8> data, Ticks ticks)
{
auto& fs = GetEmulationKernel().GetFSCore();
const std::string tmp_path = "/tmp/" + PathToFileName(path);
diff --git a/Source/Core/Core/IOS/ES/TitleInformation.cpp b/Source/Core/Core/IOS/ES/TitleInformation.cpp
index 4e312505f7..88096c4f19 100644
--- a/Source/Core/Core/IOS/ES/TitleInformation.cpp
+++ b/Source/Core/Core/IOS/ES/TitleInformation.cpp
@@ -120,7 +120,7 @@ IPCReply ESDevice::GetTMDStoredContents(const IOCtlVRequest& request)
return GetStoredContents(tmd, request);
}
-IPCReply ESDevice::GetTitleCount(const std::vector<u64>& titles, const IOCtlVRequest& request)
+IPCReply ESDevice::GetTitleCount(std::span<const u64> titles, const IOCtlVRequest& request)
{
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != 4)
return IPCReply(ES_EINVAL);
@@ -132,7 +132,7 @@ IPCReply ESDevice::GetTitleCount(const std::vector<u64>& titles, const IOCtlVReq
return IPCReply(IPC_SUCCESS);
}
-IPCReply ESDevice::GetTitles(const std::vector<u64>& titles, const IOCtlVRequest& request)
+IPCReply ESDevice::GetTitles(std::span<const u64> titles, const IOCtlVRequest& request)
{
if (!request.HasNumberOfValidVectors(1, 1))
return IPCReply(ES_EINVAL);
diff --git a/Source/Core/Core/IOS/ES/TitleManagement.cpp b/Source/Core/Core/IOS/ES/TitleManagement.cpp
index eca3a43ac6..9750c5a0aa 100644
--- a/Source/Core/Core/IOS/ES/TitleManagement.cpp
+++ b/Source/Core/Core/IOS/ES/TitleManagement.cpp
@@ -372,7 +372,7 @@ IPCReply ESDevice::ImportContentData(Context& context, const IOCtlVRequest& requ
return IPCReply(m_core.ImportContentData(context, content_fd, data_start, data_size));
}
-static bool CheckIfContentHashMatches(const std::vector<u8>& content, const ES::Content& info)
+static bool CheckIfContentHashMatches(std::span<const u8> content, const ES::Content& info)
{
return Common::SHA1::CalculateDigest(content.data(), info.size) == info.sha1;
}
diff --git a/Source/Core/Core/IOS/WFS/WFSI.cpp b/Source/Core/Core/IOS/WFS/WFSI.cpp
index 566956832a..c037967d6a 100644
--- a/Source/Core/Core/IOS/WFS/WFSI.cpp
+++ b/Source/Core/Core/IOS/WFS/WFSI.cpp
@@ -43,7 +43,7 @@ void ARCUnpacker::Reset()
m_whole_file.clear();
}
-void ARCUnpacker::AddBytes(const std::vector<u8>& bytes)
+void ARCUnpacker::AddBytes(std::span<const u8> bytes)
{
m_whole_file.insert(m_whole_file.end(), bytes.begin(), bytes.end());
}
@@ -244,7 +244,7 @@ std::optional<IPCReply> WFSIDevice::IOCtl(const IOCtlRequest& request)
"IOCTL_WFSI_IMPORT_CONTENT_END";
INFO_LOG_FMT(IOS_WFS, "{}", ioctl_name);
- const auto callback = [this](const std::string& filename, const std::vector<u8>& bytes) {
+ const auto callback = [this](const std::string& filename, std::span<const u8> bytes) {
INFO_LOG_FMT(IOS_WFS, "Extract: {} ({} bytes)", filename, bytes.size());
const std::string path = WFS::NativePath(m_base_extract_path + '/' + filename);
diff --git a/Source/Core/Core/IOS/WFS/WFSI.h b/Source/Core/Core/IOS/WFS/WFSI.h
index 4ab92df39e..19d3565660 100644
--- a/Source/Core/Core/IOS/WFS/WFSI.h
+++ b/Source/Core/Core/IOS/WFS/WFSI.h
@@ -5,6 +5,7 @@
#include <functional>
#include <memory>
+#include <span>
#include <string>
#include <vector>
@@ -22,9 +23,9 @@ public:
ARCUnpacker() { Reset(); }
void Reset();
- void AddBytes(const std::vector<u8>& bytes);
+ void AddBytes(std::span<const u8> bytes);
- using WriteCallback = std::function<void(const std::string&, const std::vector<u8>&)>;
+ using WriteCallback = std::function<void(const std::string&, std::span<const u8>)>;
void Extract(const WriteCallback& callback);
private:
diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h
index d5675ee63e..0a0dd6267e 100644
--- a/Source/Core/Core/NetPlayClient.h
+++ b/Source/Core/Core/NetPlayClient.h
@@ -13,7 +13,6 @@
#include <string>
#include <thread>
#include <unordered_map>
-#include <utility>
#include <vector>
#include "Common/CommonTypes.h"
@@ -89,7 +88,7 @@ public:
virtual void OnIndexRefreshFailed(std::string error) = 0;
virtual void ShowChunkedProgressDialog(const std::string& title, u64 data_size,
- const std::vector<int>& players) = 0;
+ std::span<const int> players) = 0;
virtual void HideChunkedProgressDialog() = 0;
virtual void SetChunkedProgress(int pid, u64 progress) = 0;
diff --git a/Source/Core/Core/NetPlayCommon.cpp b/Source/Core/Core/NetPlayCommon.cpp
index 91a03dd63e..053a7533a9 100644
--- a/Source/Core/Core/NetPlayCommon.cpp
+++ b/Source/Core/Core/NetPlayCommon.cpp
@@ -116,7 +116,7 @@ bool CompressFolderIntoPacket(const std::string& folder_path, sf::Packet& packet
return CompressFolderIntoPacketInternal(File::ScanDirectoryTree(folder_path, true), packet);
}
-bool CompressBufferIntoPacket(const std::vector<u8>& in_buffer, sf::Packet& packet)
+bool CompressBufferIntoPacket(std::span<const u8> in_buffer, sf::Packet& packet)
{
const u64 size = in_buffer.size();
packet << size;
diff --git a/Source/Core/Core/NetPlayCommon.h b/Source/Core/Core/NetPlayCommon.h
index a777728ac2..0c95b49c2d 100644
--- a/Source/Core/Core/NetPlayCommon.h
+++ b/Source/Core/Core/NetPlayCommon.h
@@ -5,9 +5,9 @@
#include <SFML/Network/Packet.hpp>
-#include <array>
#include <chrono>
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -22,7 +22,7 @@ constexpr std::chrono::milliseconds PEER_TIMEOUT = 30s;
bool CompressFileIntoPacket(const std::string& file_path, sf::Packet& packet);
bool CompressFolderIntoPacket(const std::string& folder_path, sf::Packet& packet);
-bool CompressBufferIntoPacket(const std::vector<u8>& in_buffer, sf::Packet& packet);
+bool CompressBufferIntoPacket(std::span<const u8> in_buffer, sf::Packet& packet);
bool DecompressPacketIntoFile(sf::Packet& packet, const std::string& file_path);
bool DecompressPacketIntoFolder(sf::Packet& packet, const std::string& folder_path);
std::optional<std::vector<u8>> DecompressPacketIntoBuffer(sf::Packet& packet);
diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp
index 8ac96bb3f9..ca51b52a3a 100644
--- a/Source/Core/Core/PatchEngine.cpp
+++ b/Source/Core/Core/PatchEngine.cpp
@@ -149,7 +149,7 @@ void LoadPatchSection(const std::string& section, std::vector<Patch>* patches,
}
}
-void SavePatchSection(Common::IniFile* local_ini, const std::vector<Patch>& patches)
+void SavePatchSection(Common::IniFile* local_ini, std::span<const Patch> patches)
{
std::vector<std::string> lines;
std::vector<std::string> lines_enabled;
diff --git a/Source/Core/Core/PatchEngine.h b/Source/Core/Core/PatchEngine.h
index 32e4ec93db..7acff8689b 100644
--- a/Source/Core/Core/PatchEngine.h
+++ b/Source/Core/Core/PatchEngine.h
@@ -4,6 +4,7 @@
#pragma once
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -53,7 +54,7 @@ std::optional<PatchEntry> DeserializeLine(std::string line);
std::string SerializeLine(const PatchEntry& entry);
void LoadPatchSection(const std::string& section, std::vector<Patch>* patches,
const Common::IniFile& globalIni, const Common::IniFile& localIni);
-void SavePatchSection(Common::IniFile* local_ini, const std::vector<Patch>& patches);
+void SavePatchSection(Common::IniFile* local_ini, std::span<const Patch> patches);
void LoadPatches();
void AddMemoryPatch(std::size_t index);
diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp
index fa6544d61b..ffc54cad9b 100644
--- a/Source/Core/Core/State.cpp
+++ b/Source/Core/Core/State.cpp
@@ -267,7 +267,7 @@ struct SlotWithTimestamp
} // namespace
// Returns first slot number (1-based indexing) not in the vector.
-static std::optional<int> GetEmptySlot(const std::vector<SlotWithTimestamp>& used_slots)
+static std::optional<int> GetEmptySlot(std::span<const SlotWithTimestamp> used_slots)
{
for (int i = 1; i <= int(NUM_STATES); ++i)
{
diff --git a/Source/Core/Core/WiiUtils.cpp b/Source/Core/Core/WiiUtils.cpp
index 3ac5e222cf..8431b5de84 100644
--- a/Source/Core/Core/WiiUtils.cpp
+++ b/Source/Core/Core/WiiUtils.cpp
@@ -346,7 +346,7 @@ private:
};
Response GetSystemTitles();
- Response ParseTitlesResponse(const std::vector<u8>& response) const;
+ Response ParseTitlesResponse(std::span<const u8> response) const;
bool ShouldInstallTitle(const TitleInfo& title);
UpdateResult InstallTitleFromNUS(const std::string& prefix_url, const TitleInfo& title,
@@ -371,7 +371,7 @@ OnlineSystemUpdater::OnlineSystemUpdater(UpdateCallback update_callback, const s
}
OnlineSystemUpdater::Response
-OnlineSystemUpdater::ParseTitlesResponse(const std::vector<u8>& response) const
+OnlineSystemUpdater::ParseTitlesResponse(std::span<const u8> response) const
{
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_buffer(response.data(), response.size());
diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp
index 11acc8eb41..fe6c3880df 100644
--- a/Source/Core/DiscIO/DirectoryBlob.cpp
+++ b/Source/Core/DiscIO/DirectoryBlob.cpp
@@ -575,7 +575,7 @@ u64 DirectoryBlobReader::GetDataSize() const
return m_data_size;
}
-void DirectoryBlobReader::SetNonpartitionDiscHeaderFromFile(const std::vector<u8>& partition_header,
+void DirectoryBlobReader::SetNonpartitionDiscHeaderFromFile(std::span<const u8> partition_header,
const std::string& game_partition_root)
{
std::vector<u8> header_bin(WII_NONPARTITION_DISCHEADER_SIZE);
@@ -585,7 +585,7 @@ void DirectoryBlobReader::SetNonpartitionDiscHeaderFromFile(const std::vector<u8
SetNonpartitionDiscHeader(partition_header, std::move(header_bin));
}
-void DirectoryBlobReader::SetNonpartitionDiscHeader(const std::vector<u8>& partition_header,
+void DirectoryBlobReader::SetNonpartitionDiscHeader(std::span<const u8> partition_header,
std::vector<u8> header_bin)
{
const size_t header_bin_size = header_bin.size();
@@ -619,7 +619,7 @@ void DirectoryBlobReader::SetWiiRegionDataFromFile(const std::string& game_parti
SetWiiRegionData(wii_region_data, region_bin_path);
}
-void DirectoryBlobReader::SetWiiRegionData(const std::vector<u8>& wii_region_data,
+void DirectoryBlobReader::SetWiiRegionData(std::span<const u8> wii_region_data,
const std::string& log_path)
{
std::vector<u8> region_data(0x10, 0x00);
@@ -961,7 +961,7 @@ DirectoryBlobPartition::DirectoryBlobPartition(
}
void DirectoryBlobPartition::SetDiscType(std::optional<bool> is_wii,
- const std::vector<u8>& disc_header)
+ std::span<const u8> disc_header)
{
if (is_wii.has_value())
{
@@ -1108,7 +1108,7 @@ static void ConvertUTF8NamesToSHIFTJIS(std::vector<FSTBuilderNode>* fst)
}
}
-static u32 ComputeNameSize(const std::vector<FSTBuilderNode>& files)
+static u32 ComputeNameSize(std::span<const FSTBuilderNode> files)
{
u32 name_size = 0;
for (const FSTBuilderNode& entry : files)
diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h
index 01cb5d1606..9ee3e36fc6 100644
--- a/Source/Core/DiscIO/DirectoryBlob.h
+++ b/Source/Core/DiscIO/DirectoryBlob.h
@@ -200,7 +200,7 @@ public:
void SetKey(std::array<u8, VolumeWii::AES_KEY_SIZE> key) { m_key = key; }
private:
- void SetDiscType(std::optional<bool> is_wii, const std::vector<u8>& disc_header);
+ void SetDiscType(std::optional<bool> is_wii, std::span<const u8> disc_header);
void SetBI2FromFile(const std::string& bi2_path);
void SetBI2(std::vector<u8> bi2);
@@ -296,12 +296,11 @@ private:
bool EncryptPartitionData(u64 offset, u64 size, u8* buffer, u64 partition_data_offset,
u64 partition_data_decrypted_size);
- void SetNonpartitionDiscHeaderFromFile(const std::vector<u8>& partition_header,
+ void SetNonpartitionDiscHeaderFromFile(std::span<const u8> partition_header,
const std::string& game_partition_root);
- void SetNonpartitionDiscHeader(const std::vector<u8>& partition_header,
- std::vector<u8> header_bin);
+ void SetNonpartitionDiscHeader(std::span<const u8> partition_header, std::vector<u8> header_bin);
void SetWiiRegionDataFromFile(const std::string& game_partition_root);
- void SetWiiRegionData(const std::vector<u8>& wii_region_data, const std::string& log_path);
+ void SetWiiRegionData(std::span<const u8> wii_region_data, const std::string& log_path);
void SetPartitions(std::vector<PartitionWithType>&& partitions);
void SetPartitionHeader(DirectoryBlobPartition* partition, u64 partition_address);
diff --git a/Source/Core/DiscIO/DiscUtils.cpp b/Source/Core/DiscIO/DiscUtils.cpp
index a22b97a466..e068229e57 100644
--- a/Source/Core/DiscIO/DiscUtils.cpp
+++ b/Source/Core/DiscIO/DiscUtils.cpp
@@ -5,6 +5,7 @@
#include <algorithm>
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -155,7 +156,7 @@ static u64 GetBiggestReferencedOffset(const Volume& volume, const FileInfo& file
}
}
-u64 GetBiggestReferencedOffset(const Volume& volume, const std::vector<Partition>& partitions)
+u64 GetBiggestReferencedOffset(const Volume& volume, std::span<const Partition> partitions)
{
const u64 disc_header_size = volume.GetVolumeType() == Platform::GameCubeDisc ? 0x460 : 0x50000;
u64 biggest_offset = disc_header_size;
diff --git a/Source/Core/DiscIO/DiscUtils.h b/Source/Core/DiscIO/DiscUtils.h
index 805a1a476b..9a467b8ea6 100644
--- a/Source/Core/DiscIO/DiscUtils.h
+++ b/Source/Core/DiscIO/DiscUtils.h
@@ -4,8 +4,8 @@
#pragma once
#include <optional>
+#include <span>
#include <string>
-#include <vector>
#include "Common/CommonTypes.h"
#include "DiscIO/Blob.h"
@@ -84,7 +84,7 @@ std::optional<u64> GetFSTOffset(const Volume& volume, const Partition& partition
std::optional<u64> GetFSTSize(const Volume& volume, const Partition& partition);
u64 GetBiggestReferencedOffset(const Volume& volume);
-u64 GetBiggestReferencedOffset(const Volume& volume, const std::vector<Partition>& partitions);
+u64 GetBiggestReferencedOffset(const Volume& volume, std::span<const Partition> partitions);
bool IsGCZBlockSizeLegacyCompatible(int block_size, u64 file_size);
bool IsDiscImageBlockSizeValid(int block_size, BlobType format);
diff --git a/Source/Core/DiscIO/NFSBlob.cpp b/Source/Core/DiscIO/NFSBlob.cpp
index df6a65f321..6e13c70955 100644
--- a/Source/Core/DiscIO/NFSBlob.cpp
+++ b/Source/Core/DiscIO/NFSBlob.cpp
@@ -105,7 +105,7 @@ std::vector<File::DirectIOFile> NFSFileReader::OpenFiles(const std::string& dire
return files;
}
-u64 NFSFileReader::CalculateExpectedRawSize(const std::vector<NFSLBARange>& lba_ranges)
+u64 NFSFileReader::CalculateExpectedRawSize(std::span<const NFSLBARange> lba_ranges)
{
u64 total_blocks = 0;
for (const NFSLBARange& range : lba_ranges)
@@ -114,7 +114,7 @@ u64 NFSFileReader::CalculateExpectedRawSize(const std::vector<NFSLBARange>& lba_
return sizeof(NFSHeader) + total_blocks * BLOCK_SIZE;
}
-u64 NFSFileReader::CalculateExpectedDataSize(const std::vector<NFSLBARange>& lba_ranges)
+u64 NFSFileReader::CalculateExpectedDataSize(std::span<const NFSLBARange> lba_ranges)
{
u32 greatest_block_index = 0;
for (const NFSLBARange& range : lba_ranges)
diff --git a/Source/Core/DiscIO/NFSBlob.h b/Source/Core/DiscIO/NFSBlob.h
index dcbe6bf31a..0463e46891 100644
--- a/Source/Core/DiscIO/NFSBlob.h
+++ b/Source/Core/DiscIO/NFSBlob.h
@@ -6,6 +6,7 @@
#include <array>
#include <limits>
#include <memory>
+#include <span>
#include <string>
#include <vector>
@@ -68,8 +69,8 @@ private:
static std::vector<File::DirectIOFile> OpenFiles(const std::string& directory,
File::DirectIOFile first_file,
u64 expected_raw_size, u64* raw_size_out);
- static u64 CalculateExpectedRawSize(const std::vector<NFSLBARange>& lba_ranges);
- static u64 CalculateExpectedDataSize(const std::vector<NFSLBARange>& lba_ranges);
+ static u64 CalculateExpectedRawSize(std::span<const NFSLBARange> lba_ranges);
+ static u64 CalculateExpectedDataSize(std::span<const NFSLBARange> lba_ranges);
NFSFileReader(std::vector<NFSLBARange> lba_ranges, std::vector<File::DirectIOFile> files, Key key,
u64 raw_size);
diff --git a/Source/Core/DiscIO/RiivolutionParser.cpp b/Source/Core/DiscIO/RiivolutionParser.cpp
index c76274927a..079b86e5cc 100644
--- a/Source/Core/DiscIO/RiivolutionParser.cpp
+++ b/Source/Core/DiscIO/RiivolutionParser.cpp
@@ -218,9 +218,9 @@ std::optional<Disc> ParseString(std::string_view xml, std::string xml_path)
return disc;
}
-static bool CheckRegion(const std::vector<std::string>& xml_regions, std::string_view game_region)
+static bool CheckRegion(std::span<const std::string> xml_regions, std::string_view game_region)
{
- if (xml_regions.begin() == xml_regions.end())
+ if (xml_regions.empty())
return true;
for (const auto& region : xml_regions)
diff --git a/Source/Core/DiscIO/Volume.cpp b/Source/Core/DiscIO/Volume.cpp
index c1942b2aeb..cbed3acf55 100644
--- a/Source/Core/DiscIO/Volume.cpp
+++ b/Source/Core/DiscIO/Volume.cpp
@@ -8,7 +8,6 @@
#include <map>
#include <memory>
#include <optional>
-#include <ranges>
#include <span>
#include <string>
#include <type_traits>
@@ -93,7 +92,7 @@ void Volume::AddTMDToSyncHash(Common::SHA1::Context* context, const Partition& p
AddToSyncHash(context, content);
}
-std::map<Language, std::string> Volume::ReadWiiNames(const std::vector<char16_t>& data)
+std::map<Language, std::string> Volume::ReadWiiNames(std::span<const char16_t> data)
{
std::map<Language, std::string> names;
for (size_t i = 0; i < NUMBER_OF_LANGUAGES; ++i)
diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h
index a001c60c85..7dfabb3e97 100644
--- a/Source/Core/DiscIO/Volume.h
+++ b/Source/Core/DiscIO/Volume.h
@@ -81,7 +81,7 @@ public:
virtual std::vector<u8> GetContent(u16 index) const { return {}; }
virtual std::vector<u64> GetContentOffsets() const { return {}; }
virtual bool CheckContentIntegrity(const IOS::ES::Content& content,
- const std::vector<u8>& encrypted_data,
+ std::span<const u8> encrypted_data,
const IOS::ES::TicketReader& ticket) const
{
return false;
@@ -150,7 +150,7 @@ protected:
void AddTMDToSyncHash(Common::SHA1::Context* context, const Partition& partition) const;
virtual u32 GetOffsetShift() const { return 0; }
- static std::map<Language, std::string> ReadWiiNames(const std::vector<char16_t>& data);
+ static std::map<Language, std::string> ReadWiiNames(std::span<const char16_t> data);
static constexpr size_t NUMBER_OF_LANGUAGES = 10;
static constexpr size_t NAME_CHARS_LENGTH = 42;
diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp
index 7fd4ce2768..9ffeb63757 100644
--- a/Source/Core/DiscIO/VolumeVerifier.cpp
+++ b/Source/Core/DiscIO/VolumeVerifier.cpp
@@ -213,7 +213,7 @@ static std::vector<u8> ParseHash(const char* str)
return hash;
}
-std::vector<RedumpVerifier::PotentialMatch> RedumpVerifier::ScanDatfile(const std::vector<u8>& data,
+std::vector<RedumpVerifier::PotentialMatch> RedumpVerifier::ScanDatfile(std::span<const u8> data,
const std::string& system)
{
pugi::xml_document doc;
diff --git a/Source/Core/DiscIO/VolumeVerifier.h b/Source/Core/DiscIO/VolumeVerifier.h
index 7a5c342e1b..bb814f8b4d 100644
--- a/Source/Core/DiscIO/VolumeVerifier.h
+++ b/Source/Core/DiscIO/VolumeVerifier.h
@@ -85,7 +85,7 @@ private:
static DownloadStatus DownloadDatfile(const std::string& system, DownloadStatus old_status);
static std::vector<u8> ReadDatfile(const std::string& system);
- std::vector<PotentialMatch> ScanDatfile(const std::vector<u8>& data, const std::string& system);
+ std::vector<PotentialMatch> ScanDatfile(std::span<const u8> data, const std::string& system);
std::string m_game_id;
u16 m_revision = 0;
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index 44e229e1ce..95c6a68dc6 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -7,6 +7,7 @@
#include <map>
#include <memory>
#include <optional>
+#include <span>
#include <string>
#include <utility>
#include <vector>
@@ -149,7 +150,7 @@ std::vector<u64> VolumeWAD::GetContentOffsets() const
}
bool VolumeWAD::CheckContentIntegrity(const IOS::ES::Content& content,
- const std::vector<u8>& encrypted_data,
+ std::span<const u8> encrypted_data,
const IOS::ES::TicketReader& ticket) const
{
if (encrypted_data.size() != Common::AlignUp(content.size, 0x40))
diff --git a/Source/Core/DiscIO/VolumeWad.h b/Source/Core/DiscIO/VolumeWad.h
index a5d843eed4..2c383c0254 100644
--- a/Source/Core/DiscIO/VolumeWad.h
+++ b/Source/Core/DiscIO/VolumeWad.h
@@ -6,6 +6,7 @@
#include <map>
#include <memory>
#include <optional>
+#include <span>
#include <string>
#include <vector>
@@ -38,7 +39,7 @@ public:
GetCertificateChain(const Partition& partition = PARTITION_NONE) const override;
std::vector<u8> GetContent(u16 index) const override;
std::vector<u64> GetContentOffsets() const override;
- bool CheckContentIntegrity(const IOS::ES::Content& content, const std::vector<u8>& encrypted_data,
+ bool CheckContentIntegrity(const IOS::ES::Content& content, std::span<const u8> encrypted_data,
const IOS::ES::TicketReader& ticket) const override;
IOS::ES::TicketReader GetTicketWithFixedCommonKey() const override;
std::string GetGameID(const Partition& partition = PARTITION_NONE) const override;
diff --git a/Source/Core/DiscIO/WIABlob.cpp b/Source/Core/DiscIO/WIABlob.cpp
index 31000deb02..3f7b274ca8 100644
--- a/Source/Core/DiscIO/WIABlob.cpp
+++ b/Source/Core/DiscIO/WIABlob.cpp
@@ -860,7 +860,7 @@ size_t WIARVZFileReader<RVZ>::Chunk::GetOutBytesWrittenExcludingExceptions() con
template <bool RVZ>
bool WIARVZFileReader<RVZ>::ApplyHashExceptions(
- const std::vector<HashExceptionEntry>& exception_list,
+ std::span<const HashExceptionEntry> exception_list,
VolumeWii::HashBlock hash_blocks[VolumeWii::BLOCKS_PER_GROUP])
{
for (const HashExceptionEntry& exception : exception_list)
diff --git a/Source/Core/DiscIO/WIABlob.h b/Source/Core/DiscIO/WIABlob.h
index 96ef455fcb..cb9acaa1a5 100644
--- a/Source/Core/DiscIO/WIABlob.h
+++ b/Source/Core/DiscIO/WIABlob.h
@@ -242,7 +242,7 @@ private:
WIARVZCompressionType compression_type, u32 exception_lists = 0,
u32 rvz_packed_size = 0, u64 data_offset = 0);
- static bool ApplyHashExceptions(const std::vector<HashExceptionEntry>& exception_list,
+ static bool ApplyHashExceptions(std::span<const HashExceptionEntry> exception_list,
VolumeWii::HashBlock hash_blocks[VolumeWii::BLOCKS_PER_GROUP]);
static std::string VersionToString(u32 version);
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
index bdc9518587..60633b010f 100644
--- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
+++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
@@ -45,7 +45,7 @@ void ConfigChoiceU32::OnConfigChanged()
setCurrentIndex(ReadValue(m_setting));
}
-ConfigStringChoice::ConfigStringChoice(const std::vector<std::string>& options,
+ConfigStringChoice::ConfigStringChoice(std::span<const std::string> options,
const Config::Info<std::string>& setting,
Config::Layer* layer)
: ConfigControl(setting.GetLocation(), layer), m_setting(setting), m_text_is_data(true)
@@ -57,7 +57,7 @@ ConfigStringChoice::ConfigStringChoice(const std::vector<std::string>& options,
connect(this, &QComboBox::currentIndexChanged, this, &ConfigStringChoice::Update);
}
-ConfigStringChoice::ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
+ConfigStringChoice::ConfigStringChoice(std::span<const std::pair<QString, QString>> options,
const Config::Info<std::string>& setting,
Config::Layer* layer)
: ConfigControl(setting.GetLocation(), layer), m_setting(setting), m_text_is_data(false)
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h
index 40f7bdccbe..46902e513a 100644
--- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h
+++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h
@@ -85,9 +85,9 @@ class ConfigStringChoice final : public ConfigControl<ToolTipComboBox>
{
Q_OBJECT
public:
- ConfigStringChoice(const std::vector<std::string>& options,
- const Config::Info<std::string>& setting, Config::Layer* layer = nullptr);
- ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
+ ConfigStringChoice(std::span<const std::string> options, const Config::Info<std::string>& setting,
+ Config::Layer* layer = nullptr);
+ ConfigStringChoice(std::span<const std::pair<QString, QString>> options,
const Config::Info<std::string>& setting, Config::Layer* layer = nullptr);
void Load();
diff --git a/Source/Core/DolphinQt/Config/VerifyWidget.cpp b/Source/Core/DolphinQt/Config/VerifyWidget.cpp
index 42835fd673..b95a4ac269 100644
--- a/Source/Core/DolphinQt/Config/VerifyWidget.cpp
+++ b/Source/Core/DolphinQt/Config/VerifyWidget.cpp
@@ -6,8 +6,8 @@
#include <future>
#include <memory>
#include <optional>
+#include <span>
#include <tuple>
-#include <vector>
#include <QByteArray>
#include <QHBoxLayout>
@@ -129,7 +129,7 @@ void VerifyWidget::ConnectWidgets()
#endif
}
-static void SetHash(QLineEdit* line_edit, const std::vector<u8>& hash)
+static void SetHash(QLineEdit* line_edit, std::span<const u8> hash)
{
const QByteArray byte_array = QByteArray::fromRawData(reinterpret_cast<const char*>(hash.data()),
static_cast<int>(hash.size()));
diff --git a/Source/Core/DolphinQt/Config/VerifyWidget.h b/Source/Core/DolphinQt/Config/VerifyWidget.h
index c2b2868d74..5a00efb013 100644
--- a/Source/Core/DolphinQt/Config/VerifyWidget.h
+++ b/Source/Core/DolphinQt/Config/VerifyWidget.h
@@ -4,7 +4,6 @@
#pragma once
#include <memory>
-#include <string>
#include <utility>
#include <QCheckBox>
diff --git a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp
index 260d51b9af..29b431d292 100644
--- a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp
+++ b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp
@@ -98,7 +98,7 @@ void WiimoteControllersWidget::StartBluetoothAdapterRefresh()
}
void WiimoteControllersWidget::OnBluetoothAdapterRefreshComplete(
- const std::vector<USBUtils::DeviceInfo>& devices)
+ std::span<const USBUtils::DeviceInfo> devices)
{
const int configured_vid = Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_VID);
const int configured_pid = Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_PID);
diff --git a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.h b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.h
index b2a082b3e2..6903d9eab3 100644
--- a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.h
+++ b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.h
@@ -4,6 +4,7 @@
#pragma once
#include <array>
+#include <span>
#include <QWidget>
@@ -40,7 +41,7 @@ private:
void OnBluetoothPassthroughDeviceChanged(int index);
void OnBluetoothPassthroughSyncPressed();
void OnBluetoothPassthroughResetPressed();
- void OnBluetoothAdapterRefreshComplete(const std::vector<USBUtils::DeviceInfo>& devices);
+ void OnBluetoothAdapterRefreshComplete(std::span<const USBUtils::DeviceInfo> devices);
void OnWiimoteRefreshPressed();
void OnWiimoteConfigure(size_t index);
void StartBluetoothAdapterRefresh();
diff --git a/Source/Core/DolphinQt/GBAHost.cpp b/Source/Core/DolphinQt/GBAHost.cpp
index 453ae67460..847433e0f3 100644
--- a/Source/Core/DolphinQt/GBAHost.cpp
+++ b/Source/Core/DolphinQt/GBAHost.cpp
@@ -38,7 +38,7 @@ void GBAHost::GameChanged()
});
}
-void GBAHost::FrameEnded(const std::vector<u32>& video_buffer)
+void GBAHost::FrameEnded(std::span<const u32> video_buffer)
{
QueueOnObject(m_widget_controller, [widget_controller = m_widget_controller, video_buffer] {
widget_controller->FrameEnded(video_buffer);
diff --git a/Source/Core/DolphinQt/GBAHost.h b/Source/Core/DolphinQt/GBAHost.h
index da8c6660ab..a2f4aeab10 100644
--- a/Source/Core/DolphinQt/GBAHost.h
+++ b/Source/Core/DolphinQt/GBAHost.h
@@ -5,7 +5,7 @@
#ifdef HAS_LIBMGBA
-#include <vector>
+#include <span>
#include "Core/Host.h"
@@ -22,7 +22,7 @@ public:
explicit GBAHost(std::weak_ptr<HW::GBA::Core> core);
~GBAHost() override;
void GameChanged() override;
- void FrameEnded(const std::vector<u32>& video_buffer) override;
+ void FrameEnded(std::span<const u32> video_buffer) override;
private:
GBAWidgetController* m_widget_controller{};
diff --git a/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp b/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp
index b24c2563ff..0c69f76597 100644
--- a/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp
+++ b/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp
@@ -65,7 +65,7 @@ void ChunkedProgressDialog::ConnectWidgets()
}
void ChunkedProgressDialog::show(const QString& title, const u64 data_size,
- const std::vector<int>& players)
+ std::span<const int> players)
{
m_progress_box->setTitle(title);
m_data_size = data_size;
diff --git a/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.h b/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.h
index 0d63e180cc..61dc37212f 100644
--- a/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.h
+++ b/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.h
@@ -4,7 +4,7 @@
#pragma once
#include <map>
-#include <vector>
+#include <span>
#include <QDialog>
@@ -23,7 +23,7 @@ class ChunkedProgressDialog : public QDialog
public:
explicit ChunkedProgressDialog(QWidget* parent);
- void show(const QString& title, u64 data_size, const std::vector<int>& players);
+ void show(const QString& title, u64 data_size, std::span<const int> players);
void SetProgress(int pid, u64 progress);
void reject() override;
diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp
index d50cee2b9a..b71af44161 100644
--- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp
+++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp
@@ -1248,7 +1248,7 @@ void NetPlayDialog::AbortGameDigest()
}
void NetPlayDialog::ShowChunkedProgressDialog(const std::string& title, const u64 data_size,
- const std::vector<int>& players)
+ std::span<const int> players)
{
QueueOnObject(this, [this, title, data_size, players] {
if (m_chunked_progress_dialog->isVisible())
diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h
index 8b5da5fa18..54cc111e92 100644
--- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h
+++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h
@@ -93,7 +93,7 @@ public:
void AbortGameDigest() override;
void ShowChunkedProgressDialog(const std::string& title, u64 data_size,
- const std::vector<int>& players) override;
+ std::span<const int> players) override;
void HideChunkedProgressDialog() override;
void SetChunkedProgress(int pid, u64 progress) override;
diff --git a/Source/Core/UICommon/NetPlayIndex.cpp b/Source/Core/UICommon/NetPlayIndex.cpp
index f6f3b57754..1d4b5e0b8a 100644
--- a/Source/Core/UICommon/NetPlayIndex.cpp
+++ b/Source/Core/UICommon/NetPlayIndex.cpp
@@ -5,6 +5,7 @@
#include <chrono>
#include <numeric>
+#include <span>
#include <string>
#include <picojson.h>
@@ -23,14 +24,13 @@ NetPlayIndex::~NetPlayIndex()
Remove();
}
-static std::optional<picojson::value> ParseResponse(const std::vector<u8>& response)
+static std::optional<picojson::value> ParseResponse(std::span<const u8> response)
{
- const std::string response_string(reinterpret_cast<const char*>(response.data()),
- response.size());
+ const char* data = reinterpret_cast<const char*>(response.data());
picojson::value json;
- const auto error = picojson::parse(json, response_string);
+ const auto error = picojson::parse(json, data, data + response.size());
if (!error.empty())
return {};
diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp
index 56f9c7f7e8..0d98f19187 100644
--- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp
+++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp
@@ -14,7 +14,9 @@
#include <mbedtls/sha256.h>
#include <zlib.h>
+#ifdef _WIN32
#include "Common/CommonFuncs.h"
+#endif
#include "Common/CommonPaths.h"
#include "Common/FileUtil.h"
#include "Common/HttpRequest.h"
@@ -204,7 +206,7 @@ void TodoList::Log() const
}
}
-static bool DownloadContent(const std::vector<TodoList::DownloadOp>& to_download,
+static bool DownloadContent(std::span<const TodoList::DownloadOp> to_download,
const std::string& content_base_url, const std::string& temp_path)
{
Common::HttpRequest req(std::chrono::seconds(30), ProgressCallback);
@@ -337,7 +339,7 @@ static bool BackupFile(const std::string& path)
return true;
}
-static bool DeleteObsoleteFiles(const std::vector<TodoList::DeleteOp>& to_delete,
+static bool DeleteObsoleteFiles(std::span<const TodoList::DeleteOp> to_delete,
const std::string& install_base_path)
{
for (const auto& op : to_delete)
@@ -370,7 +372,7 @@ static bool DeleteObsoleteFiles(const std::vector<TodoList::DeleteOp>& to_delete
return true;
}
-static bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
+static bool UpdateFiles(std::span<const TodoList::UpdateOp> to_update,
const std::string& install_base_path, const std::string& temp_path)
{
#ifdef _WIN32
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp
index 973b944d98..6d69803827 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexShaderManager.cpp
@@ -161,7 +161,7 @@ bool VertexShaderManager::UseVertexDepthRange()
// Syncs the shader constant buffers with xfmem
// TODO: A cleaner way to control the matrices without making a mess in the parameters field
-void VertexShaderManager::SetConstants(const std::vector<std::string>& textures,
+void VertexShaderManager::SetConstants(std::span<const std::string> textures,
XFStateManager& xf_state_manager)
{
if (constants.missing_color_hex != g_ActiveConfig.iMissingColorValue)
diff --git a/Source/Core/VideoCommon/VertexShaderManager.h b/Source/Core/VideoCommon/VertexShaderManager.h
index 9678aae58f..600ba3b10f 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.h
+++ b/Source/Core/VideoCommon/VertexShaderManager.h
@@ -4,10 +4,9 @@
#pragma once
#include <array>
+#include <span>
#include <string>
-#include <vector>
-#include "Common/BitSet.h"
#include "Common/CommonTypes.h"
#include "Common/Matrix.h"
#include "VideoCommon/ConstantManager.h"
@@ -26,7 +25,7 @@ public:
// constant management
void SetProjectionMatrix(XFStateManager& xf_state_manager);
- void SetConstants(const std::vector<std::string>& textures, XFStateManager& xf_state_manager);
+ void SetConstants(std::span<const std::string> textures, XFStateManager& xf_state_manager);
// data: 3 floats representing the X, Y and Z vertex model coordinates and the posmatrix index.
// out: 4 floats which will be initialized with the corresponding clip space coordinates
diff --git a/Source/UnitTests/Core/DSP/DSPAssemblyTest.cpp b/Source/UnitTests/Core/DSP/DSPAssemblyTest.cpp
index 44e4cde30e..5335452588 100644
--- a/Source/UnitTests/Core/DSP/DSPAssemblyTest.cpp
+++ b/Source/UnitTests/Core/DSP/DSPAssemblyTest.cpp
@@ -13,7 +13,7 @@
#include <gtest/gtest.h>
-static bool RoundTrippableDisassemble(const std::vector<u16>& code, std::string& text)
+static bool RoundTrippableDisassemble(std::span<const u16> code, std::string& text)
{
DSP::AssemblerSettings settings;
settings.ext_separator = '\'';
@@ -29,7 +29,7 @@ static bool RoundTrippableDisassemble(const std::vector<u16>& code, std::string&
// This test goes from text ASM to binary to text ASM and once again back to binary.
// Then the two binaries are compared.
-static bool RoundTrip(const std::vector<u16>& code1)
+static bool RoundTrip(std::span<const u16> code1)
{
std::vector<u16> code2;
std::string text;
@@ -90,7 +90,7 @@ static bool SuperTrip(const char* asm_code)
}
// Assembles asm_code, and verifies that it matches code1.
-static bool AssembleAndCompare(const char* asm_code, const std::vector<u16>& code1)
+static bool AssembleAndCompare(const char* asm_code, std::span<const u16> code1)
{
std::vector<u16> code2;
if (!DSP::Assemble(asm_code, code2))