diff --git a/README.md b/README.md
index f06dd0576..72aecfc30 100755
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
yuzu emulator early access
=============
-This is the source code for early-access 3350.
+This is the source code for early-access 3351.
## Legal Notice
diff --git a/dist/yuzu.ico b/dist/yuzu.ico
index df3be8464..7c998a5c5 100755
Binary files a/dist/yuzu.ico and b/dist/yuzu.ico differ
diff --git a/dist/yuzu.svg b/dist/yuzu.svg
index 93171d1bf..98ded2d8f 100755
--- a/dist/yuzu.svg
+++ b/dist/yuzu.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/common/input.h b/src/common/input.h
index 1f9db5af2..5cfacc307 100755
--- a/src/common/input.h
+++ b/src/common/input.h
@@ -130,6 +130,8 @@ struct ButtonStatus {
bool inverted{};
// Press once to activate, press again to release
bool toggle{};
+ // Spams the button when active
+ bool turbo{};
// Internal lock for the toggle status
bool locked{};
};
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index b847fd4d9..b9e897f3b 100755
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -30,7 +30,7 @@ std::string ToUpper(std::string str) {
return str;
}
-std::string StringFromBuffer(const std::vector& data) {
+std::string StringFromBuffer(std::span data) {
return std::string(data.begin(), std::find(data.begin(), data.end(), '\0'));
}
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 2ba7cadb9..e03bde0a5 100755
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -5,6 +5,7 @@
#pragma once
#include
+#include
#include
#include
#include "common/common_types.h"
@@ -17,7 +18,7 @@ namespace Common {
/// Make a string uppercase
[[nodiscard]] std::string ToUpper(std::string str);
-[[nodiscard]] std::string StringFromBuffer(const std::vector& data);
+[[nodiscard]] std::string StringFromBuffer(std::span data);
[[nodiscard]] std::string StripSpaces(const std::string& s);
[[nodiscard]] std::string StripQuotes(const std::string& s);
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 2269a9edd..ec95e3ca0 100755
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -182,6 +182,8 @@ add_library(core STATIC
hle/kernel/k_auto_object_container.cpp
hle/kernel/k_auto_object_container.h
hle/kernel/k_affinity_mask.h
+ hle/kernel/k_capabilities.cpp
+ hle/kernel/k_capabilities.h
hle/kernel/k_class_token.cpp
hle/kernel/k_class_token.h
hle/kernel/k_client_port.cpp
diff --git a/src/core/hardware_properties.h b/src/core/hardware_properties.h
index 23e20c2cc..c0d8d267e 100755
--- a/src/core/hardware_properties.h
+++ b/src/core/hardware_properties.h
@@ -25,6 +25,26 @@ constexpr std::array()> VirtualToPhysicalCoreMap{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
};
+static constexpr inline size_t NumVirtualCores = Common::BitSize();
+
+static constexpr inline u64 VirtualCoreMask = [] {
+ u64 mask = 0;
+ for (size_t i = 0; i < NumVirtualCores; ++i) {
+ mask |= (UINT64_C(1) << i);
+ }
+ return mask;
+}();
+
+static constexpr inline u64 ConvertVirtualCoreMaskToPhysical(u64 v_core_mask) {
+ u64 p_core_mask = 0;
+ while (v_core_mask != 0) {
+ const u64 next = std::countr_zero(v_core_mask);
+ v_core_mask &= ~(static_cast(1) << next);
+ p_core_mask |= (static_cast(1) << VirtualToPhysicalCoreMap[next]);
+ }
+ return p_core_mask;
+}
+
// Cortex-A57 supports 4 memory watchpoints
constexpr u64 NUM_WATCHPOINTS = 4;
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 3d43145a1..08932ac77 100755
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -687,6 +687,7 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
}
current_status.toggle = new_status.toggle;
+ current_status.turbo = new_status.turbo;
current_status.uuid = uuid;
// Update button status with current
@@ -1548,7 +1549,7 @@ NpadButtonState EmulatedController::GetNpadButtons() const {
if (is_configuring) {
return {};
}
- return controller.npad_button_state;
+ return {controller.npad_button_state.raw & GetTurboButtonMask()};
}
DebugPadButton EmulatedController::GetDebugPadButtons() const {
@@ -1656,4 +1657,74 @@ void EmulatedController::DeleteCallback(int key) {
}
callback_list.erase(iterator);
}
+
+void EmulatedController::TurboButtonUpdate() {
+ turbo_button_state = !turbo_button_state;
+}
+
+NpadButton EmulatedController::GetTurboButtonMask() const {
+ // Apply no mask when disabled
+ if (!turbo_button_state) {
+ return {NpadButton::All};
+ }
+
+ NpadButtonState button_mask{};
+ for (std::size_t index = 0; index < controller.button_values.size(); ++index) {
+ if (!controller.button_values[index].turbo) {
+ continue;
+ }
+
+ switch (index) {
+ case Settings::NativeButton::A:
+ button_mask.a.Assign(1);
+ break;
+ case Settings::NativeButton::B:
+ button_mask.b.Assign(1);
+ break;
+ case Settings::NativeButton::X:
+ button_mask.x.Assign(1);
+ break;
+ case Settings::NativeButton::Y:
+ button_mask.y.Assign(1);
+ break;
+ case Settings::NativeButton::L:
+ button_mask.l.Assign(1);
+ break;
+ case Settings::NativeButton::R:
+ button_mask.r.Assign(1);
+ break;
+ case Settings::NativeButton::ZL:
+ button_mask.zl.Assign(1);
+ break;
+ case Settings::NativeButton::ZR:
+ button_mask.zr.Assign(1);
+ break;
+ case Settings::NativeButton::DLeft:
+ button_mask.left.Assign(1);
+ break;
+ case Settings::NativeButton::DUp:
+ button_mask.up.Assign(1);
+ break;
+ case Settings::NativeButton::DRight:
+ button_mask.right.Assign(1);
+ break;
+ case Settings::NativeButton::DDown:
+ button_mask.down.Assign(1);
+ break;
+ case Settings::NativeButton::SL:
+ button_mask.left_sl.Assign(1);
+ button_mask.right_sl.Assign(1);
+ break;
+ case Settings::NativeButton::SR:
+ button_mask.left_sr.Assign(1);
+ button_mask.right_sr.Assign(1);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return static_cast(~button_mask.raw);
+}
+
} // namespace Core::HID
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index dd97bb817..77963e32d 100755
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -411,6 +411,9 @@ public:
*/
void DeleteCallback(int key);
+ /// Swaps the state of the turbo buttons
+ void TurboButtonUpdate();
+
private:
/// creates input devices from params
void LoadDevices();
@@ -511,6 +514,8 @@ private:
*/
void TriggerOnChange(ControllerTriggerType type, bool is_service_update);
+ NpadButton GetTurboButtonMask() const;
+
const NpadIdType npad_id_type;
NpadStyleIndex npad_type{NpadStyleIndex::None};
NpadStyleIndex original_npad_type{NpadStyleIndex::None};
@@ -520,6 +525,7 @@ private:
bool system_buttons_enabled{true};
f32 motion_sensitivity{0.01f};
bool force_update_motion{false};
+ bool turbo_button_state{false};
// Temporary values to avoid doing changes while the controller is in configuring mode
NpadStyleIndex tmp_npad_type{NpadStyleIndex::None};
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index b2879a24d..20c051364 100755
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -11,6 +11,7 @@
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/logging/log.h"
+#include "common/scratch_buffer.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/k_auto_object.h"
@@ -325,7 +326,7 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa
return ResultSuccess;
}
-std::vector HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
+std::vector HLERequestContext::ReadBufferCopy(std::size_t buffer_index) const {
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
BufferDescriptorA()[buffer_index].Size()};
if (is_buffer_a) {
@@ -345,6 +346,33 @@ std::vector HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
}
}
+std::span HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
+ static thread_local std::array, 2> read_buffer_a;
+ static thread_local std::array, 2> read_buffer_x;
+
+ const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
+ BufferDescriptorA()[buffer_index].Size()};
+ if (is_buffer_a) {
+ ASSERT_OR_EXECUTE_MSG(
+ BufferDescriptorA().size() > buffer_index, { return {}; },
+ "BufferDescriptorA invalid buffer_index {}", buffer_index);
+ auto& read_buffer = read_buffer_a[buffer_index];
+ read_buffer.resize_destructive(BufferDescriptorA()[buffer_index].Size());
+ memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), read_buffer.data(),
+ read_buffer.size());
+ return read_buffer;
+ } else {
+ ASSERT_OR_EXECUTE_MSG(
+ BufferDescriptorX().size() > buffer_index, { return {}; },
+ "BufferDescriptorX invalid buffer_index {}", buffer_index);
+ auto& read_buffer = read_buffer_x[buffer_index];
+ read_buffer.resize_destructive(BufferDescriptorX()[buffer_index].Size());
+ memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), read_buffer.data(),
+ read_buffer.size());
+ return read_buffer;
+ }
+}
+
std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size,
std::size_t buffer_index) const {
if (size == 0) {
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 1715c0924..8eeeee4e1 100755
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -270,8 +271,11 @@ public:
return domain_message_header.has_value();
}
- /// Helper function to read a buffer using the appropriate buffer descriptor
- [[nodiscard]] std::vector ReadBuffer(std::size_t buffer_index = 0) const;
+ /// Helper function to get a span of a buffer using the appropriate buffer descriptor
+ [[nodiscard]] std::span ReadBuffer(std::size_t buffer_index = 0) const;
+
+ /// Helper function to read a copy of a buffer using the appropriate buffer descriptor
+ [[nodiscard]] std::vector ReadBufferCopy(std::size_t buffer_index = 0) const;
/// Helper function to write a buffer using the appropriate buffer descriptor
std::size_t WriteBuffer(const void* buffer, std::size_t size,
diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h
index 06f1d219b..44a7a7014 100755
--- a/src/core/hle/kernel/svc_types.h
+++ b/src/core/hle/kernel/svc_types.h
@@ -3,6 +3,8 @@
#pragma once
+#include
+
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -592,4 +594,7 @@ struct CreateProcessParameter {
};
static_assert(sizeof(CreateProcessParameter) == 0x30);
+constexpr size_t NumSupervisorCalls = 0xC0;
+using SvcAccessFlagSet = std::bitset;
+
} // namespace Kernel::Svc
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 294e7692b..d6f46e3c5 100755
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1124,7 +1124,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 offset{rp.Pop()};
- const std::vector data{ctx.ReadBuffer()};
+ const auto data{ctx.ReadBuffer()};
const std::size_t size{std::min(data.size(), backing.GetSize() - offset)};
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 539240842..a0d67412e 100755
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -112,7 +112,7 @@ private:
void RequestUpdate(Kernel::HLERequestContext& ctx) {
LOG_TRACE(Service_Audio, "called");
- std::vector input{ctx.ReadBuffer(0)};
+ const auto input{ctx.ReadBuffer(0)};
// These buffers are written manually to avoid an issue with WriteBuffer throwing errors for
// checking size 0. Performance size is 0 for most games.
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index 4508ea821..5953f1c4a 100755
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -93,7 +93,7 @@ private:
ctx.WriteBuffer(samples);
}
- bool DecodeOpusData(u32& consumed, u32& sample_count, const std::vector& input,
+ bool DecodeOpusData(u32& consumed, u32& sample_count, std::span input,
std::vector& output, u64* out_performance_time) const {
const auto start_time = std::chrono::steady_clock::now();
const std::size_t raw_output_sz = output.size() * sizeof(opus_int16);
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp
index c62f53b3d..1447688b4 100755
--- a/src/core/hle/service/es/es.cpp
+++ b/src/core/hle/service/es/es.cpp
@@ -122,7 +122,7 @@ private:
void ImportTicket(Kernel::HLERequestContext& ctx) {
const auto ticket = ctx.ReadBuffer();
- const auto cert = ctx.ReadBuffer(1);
+ [[maybe_unused]] const auto cert = ctx.ReadBuffer(1);
if (ticket.size() < sizeof(Core::Crypto::Ticket)) {
LOG_ERROR(Service_ETicket, "The input buffer is not large enough!");
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 779072def..34af9fd94 100755
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -190,7 +190,7 @@ private:
return;
}
- const std::vector data = ctx.ReadBuffer();
+ const auto data = ctx.ReadBuffer();
ASSERT_MSG(
static_cast(data.size()) <= length,
@@ -401,11 +401,8 @@ public:
}
void RenameFile(Kernel::HLERequestContext& ctx) {
- std::vector buffer = ctx.ReadBuffer(0);
- const std::string src_name = Common::StringFromBuffer(buffer);
-
- buffer = ctx.ReadBuffer(1);
- const std::string dst_name = Common::StringFromBuffer(buffer);
+ const std::string src_name = Common::StringFromBuffer(ctx.ReadBuffer(0));
+ const std::string dst_name = Common::StringFromBuffer(ctx.ReadBuffer(1));
LOG_DEBUG(Service_FS, "called. file '{}' to file '{}'", src_name, dst_name);
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp
index 03bd04f1a..a33de8166 100755
--- a/src/core/hle/service/glue/arp.cpp
+++ b/src/core/hle/service/glue/arp.cpp
@@ -228,7 +228,8 @@ private:
return;
}
- control = ctx.ReadBuffer();
+ // TODO: Can this be a span?
+ control = ctx.ReadBufferCopy();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 6b09bbf25..d2ac820a6 100755
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -428,6 +428,9 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) {
return;
}
+ // This function is unique to yuzu for the turbo buttons to work properly
+ controller.device->TurboButtonUpdate();
+
auto& pad_entry = controller.npad_pad_state;
auto& trigger_entry = controller.npad_trigger_state;
const auto button_state = controller.device->GetNpadButtons();
@@ -755,11 +758,12 @@ Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const {
return hid_core.GetSupportedStyleTag();
}
-void Controller_NPad::SetSupportedNpadIdTypes(u8* data, std::size_t length) {
+void Controller_NPad::SetSupportedNpadIdTypes(std::span data) {
+ const auto length = data.size();
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
supported_npad_id_types.clear();
supported_npad_id_types.resize(length / sizeof(u32));
- std::memcpy(supported_npad_id_types.data(), data, length);
+ std::memcpy(supported_npad_id_types.data(), data.data(), length);
}
void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) {
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index cfcc27222..968d671ac 100755
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
#include "common/bit_field.h"
#include "common/common_types.h"
@@ -95,7 +96,7 @@ public:
void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set);
Core::HID::NpadStyleTag GetSupportedStyleSet() const;
- void SetSupportedNpadIdTypes(u8* data, std::size_t length);
+ void SetSupportedNpadIdTypes(std::span data);
void GetSupportedNpadIdTypes(u32* data, std::size_t max_length);
std::size_t GetSupportedNpadIdTypesSize() const;
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 224d9f86a..1944ae64f 100755
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -1026,7 +1026,7 @@ void Hid::SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) {
const auto applet_resource_user_id{rp.Pop()};
applet_resource->GetController(HidController::NPad)
- .SetSupportedNpadIdTypes(ctx.ReadBuffer().data(), ctx.GetReadBufferSize());
+ .SetSupportedNpadIdTypes(ctx.ReadBuffer());
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
@@ -2104,7 +2104,7 @@ void Hid::WritePalmaRgbLedPatternEntry(Kernel::HLERequestContext& ctx) {
const auto connection_handle{rp.PopRaw()};
const auto unknown{rp.Pop()};
- const auto buffer = ctx.ReadBuffer();
+ [[maybe_unused]] const auto buffer = ctx.ReadBuffer();
LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, unknown={}",
connection_handle.npad_id, unknown);
diff --git a/src/core/hle/service/hid/hidbus/hidbus_base.h b/src/core/hle/service/hid/hidbus/hidbus_base.h
index ff5c56c9a..9258b73d6 100755
--- a/src/core/hle/service/hid/hidbus/hidbus_base.h
+++ b/src/core/hle/service/hid/hidbus/hidbus_base.h
@@ -4,6 +4,7 @@
#pragma once
#include
+#include
#include "common/common_types.h"
#include "core/hle/result.h"
@@ -150,7 +151,7 @@ public:
}
// Assigns a command from data
- virtual bool SetCommand(const std::vector& data) {
+ virtual bool SetCommand(std::span data) {
return {};
}
diff --git a/src/core/hle/service/hid/hidbus/ringcon.cpp b/src/core/hle/service/hid/hidbus/ringcon.cpp
index 2b8615ecc..8181531d7 100755
--- a/src/core/hle/service/hid/hidbus/ringcon.cpp
+++ b/src/core/hle/service/hid/hidbus/ringcon.cpp
@@ -116,7 +116,7 @@ std::vector RingController::GetReply() const {
}
}
-bool RingController::SetCommand(const std::vector& data) {
+bool RingController::SetCommand(std::span data) {
if (data.size() < 4) {
LOG_ERROR(Service_HID, "Command size not supported {}", data.size());
command = RingConCommands::Error;
diff --git a/src/core/hle/service/hid/hidbus/ringcon.h b/src/core/hle/service/hid/hidbus/ringcon.h
index e6e3b6572..1a7b477af 100755
--- a/src/core/hle/service/hid/hidbus/ringcon.h
+++ b/src/core/hle/service/hid/hidbus/ringcon.h
@@ -4,6 +4,7 @@
#pragma once
#include
+#include
#include "common/common_types.h"
#include "core/hle/service/hid/hidbus/hidbus_base.h"
@@ -31,7 +32,7 @@ public:
u8 GetDeviceId() const override;
// Assigns a command from data
- bool SetCommand(const std::vector& data) override;
+ bool SetCommand(std::span data) override;
// Returns a reply from a command
std::vector GetReply() const override;
diff --git a/src/core/hle/service/hid/hidbus/starlink.cpp b/src/core/hle/service/hid/hidbus/starlink.cpp
index 6d1d01629..3d74eaafd 100755
--- a/src/core/hle/service/hid/hidbus/starlink.cpp
+++ b/src/core/hle/service/hid/hidbus/starlink.cpp
@@ -42,7 +42,7 @@ std::vector Starlink::GetReply() const {
return {};
}
-bool Starlink::SetCommand(const std::vector& data) {
+bool Starlink::SetCommand(std::span data) {
LOG_ERROR(Service_HID, "Command not implemented");
return false;
}
diff --git a/src/core/hle/service/hid/hidbus/starlink.h b/src/core/hle/service/hid/hidbus/starlink.h
index 9be7d54c1..bbde84384 100755
--- a/src/core/hle/service/hid/hidbus/starlink.h
+++ b/src/core/hle/service/hid/hidbus/starlink.h
@@ -29,7 +29,7 @@ public:
u8 GetDeviceId() const override;
// Assigns a command from data
- bool SetCommand(const std::vector& data) override;
+ bool SetCommand(std::span data) override;
// Returns a reply from a command
std::vector GetReply() const override;
diff --git a/src/core/hle/service/hid/hidbus/stubbed.cpp b/src/core/hle/service/hid/hidbus/stubbed.cpp
index 7489d50cb..c4215443c 100755
--- a/src/core/hle/service/hid/hidbus/stubbed.cpp
+++ b/src/core/hle/service/hid/hidbus/stubbed.cpp
@@ -43,7 +43,7 @@ std::vector HidbusStubbed::GetReply() const {
return {};
}
-bool HidbusStubbed::SetCommand(const std::vector& data) {
+bool HidbusStubbed::SetCommand(std::span data) {
LOG_ERROR(Service_HID, "Command not implemented");
return false;
}
diff --git a/src/core/hle/service/hid/hidbus/stubbed.h b/src/core/hle/service/hid/hidbus/stubbed.h
index 0130707a9..0772bc6ee 100755
--- a/src/core/hle/service/hid/hidbus/stubbed.h
+++ b/src/core/hle/service/hid/hidbus/stubbed.h
@@ -29,7 +29,7 @@ public:
u8 GetDeviceId() const override;
// Assigns a command from data
- bool SetCommand(const std::vector& data) override;
+ bool SetCommand(std::span data) override;
// Returns a reply from a command
std::vector GetReply() const override;
diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp
index a6369d52a..ec162fd31 100755
--- a/src/core/hle/service/jit/jit.cpp
+++ b/src/core/hle/service/jit/jit.cpp
@@ -62,7 +62,7 @@ public:
const auto parameters{rp.PopRaw()};
// Optional input/output buffers
- std::vector input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector()};
+ const auto input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::span()};
std::vector output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
// Function call prototype:
@@ -132,7 +132,7 @@ public:
const auto command{rp.PopRaw()};
// Optional input/output buffers
- std::vector input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector()};
+ const auto input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::span()};
std::vector output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
// Function call prototype:
diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp
index a5ff82944..edd170132 100755
--- a/src/core/hle/service/ldn/ldn.cpp
+++ b/src/core/hle/service/ldn/ldn.cpp
@@ -427,7 +427,7 @@ public:
}
void SetAdvertiseData(Kernel::HLERequestContext& ctx) {
- std::vector read_buffer = ctx.ReadBuffer();
+ const auto read_buffer = ctx.ReadBuffer();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.SetAdvertiseData(read_buffer));
@@ -479,7 +479,7 @@ public:
parameters.security_config.passphrase_size,
parameters.security_config.security_mode, parameters.local_communication_version);
- const std::vector read_buffer = ctx.ReadBuffer();
+ const auto read_buffer = ctx.ReadBuffer();
if (read_buffer.size() != sizeof(NetworkInfo)) {
LOG_ERROR(Frontend, "NetworkInfo doesn't match read_buffer size!");
IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h
index 4020821b3..607d303d7 100755
--- a/src/core/hle/service/nvdrv/devices/nvdevice.h
+++ b/src/core/hle/service/nvdrv/devices/nvdevice.h
@@ -3,7 +3,9 @@
#pragma once
+#include
#include
+
#include "common/common_types.h"
#include "core/hle/service/nvdrv/nvdata.h"
@@ -31,7 +33,7 @@ public:
* @param output A buffer where the output data will be written to.
* @returns The result code of the ioctl.
*/
- virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+ virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) = 0;
/**
@@ -42,8 +44,8 @@ public:
* @param output A buffer where the output data will be written to.
* @returns The result code of the ioctl.
*/
- virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) = 0;
+ virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) = 0;
/**
* Handles an ioctl3 request.
@@ -53,7 +55,7 @@ public:
* @param inline_output A buffer where the inlined output data will be written to.
* @returns The result code of the ioctl.
*/
- virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
+ virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span input,
std::vector& output, std::vector& inline_output) = 0;
/**
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
index 6ddd40e85..0b4bb7bcb 100755
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
@@ -17,19 +17,19 @@ nvdisp_disp0::nvdisp_disp0(Core::System& system_, NvCore::Container& core)
: nvdevice{system_}, container{core}, nvmap{core.GetNvMapFile()} {}
nvdisp_disp0::~nvdisp_disp0() = default;
-NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
}
-NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) {
+NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
}
-NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, std::span input,
std::vector& output, std::vector& inline_output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
index e420efb4f..7e09e3331 100755
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
@@ -25,12 +25,12 @@ public:
explicit nvdisp_disp0(Core::System& system_, NvCore::Container& core);
~nvdisp_disp0() override;
- NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+ NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) override;
- NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) override;
- NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
- std::vector& output, std::vector& inline_output) override;
+ NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) override;
+ NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span input, std::vector& output,
+ std::vector& inline_output) override;
void OnOpen(DeviceFD fd) override;
void OnClose(DeviceFD fd) override;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
index 72a4d18eb..ad4fab423 100755
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -27,7 +27,7 @@ nvhost_as_gpu::nvhost_as_gpu(Core::System& system_, Module& module_, NvCore::Con
nvhost_as_gpu::~nvhost_as_gpu() = default;
-NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) {
switch (command.group) {
case 'A':
@@ -60,13 +60,13 @@ NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector
return NvResult::NotImplemented;
}
-NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) {
+NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
}
-NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span input,
std::vector& output, std::vector& inline_output) {
switch (command.group) {
case 'A':
@@ -87,7 +87,7 @@ NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector
void nvhost_as_gpu::OnOpen(DeviceFD fd) {}
void nvhost_as_gpu::OnClose(DeviceFD fd) {}
-NvResult nvhost_as_gpu::AllocAsEx(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::AllocAsEx(std::span input, std::vector& output) {
IoctlAllocAsEx params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -141,7 +141,7 @@ NvResult nvhost_as_gpu::AllocAsEx(const std::vector& input, std::vector&
return NvResult::Success;
}
-NvResult nvhost_as_gpu::AllocateSpace(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::AllocateSpace(std::span input, std::vector& output) {
IoctlAllocSpace params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -220,7 +220,7 @@ void nvhost_as_gpu::FreeMappingLocked(u64 offset) {
mapping_map.erase(offset);
}
-NvResult nvhost_as_gpu::FreeSpace(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::FreeSpace(std::span input, std::vector& output) {
IoctlFreeSpace params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -266,7 +266,7 @@ NvResult nvhost_as_gpu::FreeSpace(const std::vector& input, std::vector&
return NvResult::Success;
}
-NvResult nvhost_as_gpu::Remap(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::Remap(std::span input, std::vector& output) {
const auto num_entries = input.size() / sizeof(IoctlRemapEntry);
LOG_DEBUG(Service_NVDRV, "called, num_entries=0x{:X}", num_entries);
@@ -320,7 +320,7 @@ NvResult nvhost_as_gpu::Remap(const std::vector& input, std::vector& out
return NvResult::Success;
}
-NvResult nvhost_as_gpu::MapBufferEx(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::MapBufferEx(std::span input, std::vector& output) {
IoctlMapBufferEx params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -424,7 +424,7 @@ NvResult nvhost_as_gpu::MapBufferEx(const std::vector& input, std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::UnmapBuffer(std::span input, std::vector& output) {
IoctlUnmapBuffer params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -463,7 +463,7 @@ NvResult nvhost_as_gpu::UnmapBuffer(const std::vector& input, std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::BindChannel(std::span input, std::vector& output) {
IoctlBindChannel params{};
std::memcpy(¶ms, input.data(), input.size());
LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd);
@@ -492,7 +492,7 @@ void nvhost_as_gpu::GetVARegionsImpl(IoctlGetVaRegions& params) {
};
}
-NvResult nvhost_as_gpu::GetVARegions(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::GetVARegions(std::span input, std::vector& output) {
IoctlGetVaRegions params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -511,7 +511,7 @@ NvResult nvhost_as_gpu::GetVARegions(const std::vector& input, std::vector& input, std::vector& output,
+NvResult nvhost_as_gpu::GetVARegions(std::span input, std::vector& output,
std::vector& inline_output) {
IoctlGetVaRegions params{};
std::memcpy(¶ms, input.data(), input.size());
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
index 57b6a1f76..dcfc02419 100755
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
@@ -47,12 +47,12 @@ public:
explicit nvhost_as_gpu(Core::System& system_, Module& module, NvCore::Container& core);
~nvhost_as_gpu() override;
- NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+ NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) override;
- NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) override;
- NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
- std::vector& output, std::vector& inline_output) override;
+ NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) override;
+ NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span input, std::vector& output,
+ std::vector& inline_output) override;
void OnOpen(DeviceFD fd) override;
void OnClose(DeviceFD fd) override;
@@ -138,17 +138,17 @@ private:
static_assert(sizeof(IoctlGetVaRegions) == 16 + sizeof(VaRegion) * 2,
"IoctlGetVaRegions is incorrect size");
- NvResult AllocAsEx(const std::vector& input, std::vector& output);
- NvResult AllocateSpace(const std::vector& input, std::vector& output);
- NvResult Remap(const std::vector& input, std::vector& output);
- NvResult MapBufferEx(const std::vector& input, std::vector& output);
- NvResult UnmapBuffer(const std::vector& input, std::vector& output);
- NvResult FreeSpace(const std::vector& input, std::vector& output);
- NvResult BindChannel(const std::vector& input, std::vector& output);
+ NvResult AllocAsEx(std::span input, std::vector& output);
+ NvResult AllocateSpace(std::span input, std::vector& output);
+ NvResult Remap(std::span input, std::vector& output);
+ NvResult MapBufferEx(std::span input, std::vector& output);
+ NvResult UnmapBuffer(std::span input, std::vector& output);
+ NvResult FreeSpace(std::span input, std::vector& output);
+ NvResult BindChannel(std::span input, std::vector& output);
void GetVARegionsImpl(IoctlGetVaRegions& params);
- NvResult GetVARegions(const std::vector& input, std::vector& output);
- NvResult GetVARegions(const std::vector& input, std::vector& output,
+ NvResult GetVARegions(std::span input, std::vector& output);
+ NvResult GetVARegions(std::span input, std::vector& output,
std::vector& inline_output);
void FreeMappingLocked(u64 offset);
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index c6ab1447c..c2091af86 100755
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -34,7 +34,7 @@ nvhost_ctrl::~nvhost_ctrl() {
}
}
-NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) {
switch (command.group) {
case 0x0:
@@ -63,13 +63,13 @@ NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector&
return NvResult::NotImplemented;
}
-NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) {
+NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
}
-NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, std::span