Misc: Swap from gsl::span to std::span

This commit is contained in:
Stenzek 2023-07-19 23:53:42 +10:00 committed by Connor McLaughlin
parent ad0190d6ed
commit cd4daa115f
42 changed files with 125 additions and 127 deletions

View File

@ -115,7 +115,7 @@ void ControllerBindingWidget::onTypeChanged()
if (has_settings) if (has_settings)
{ {
const gsl::span<const SettingInfo> settings(cinfo->settings, cinfo->num_settings); const std::span<const SettingInfo> settings(cinfo->settings, cinfo->num_settings);
m_settings_widget = new ControllerCustomSettingsWidget( m_settings_widget = new ControllerCustomSettingsWidget(
settings, m_config_section, std::string(), "Pad", getDialog(), m_ui.stackedWidget); settings, m_config_section, std::string(), "Pad", getDialog(), m_ui.stackedWidget);
m_ui.stackedWidget->addWidget(m_settings_widget); m_ui.stackedWidget->addWidget(m_settings_widget);
@ -471,7 +471,7 @@ void ControllerMacroEditWidget::updateBinds()
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ControllerCustomSettingsWidget::ControllerCustomSettingsWidget(gsl::span<const SettingInfo> settings, std::string config_section, ControllerCustomSettingsWidget::ControllerCustomSettingsWidget(std::span<const SettingInfo> settings, std::string config_section,
std::string config_prefix, const char* translation_ctx, ControllerSettingsDialog* dialog, QWidget* parent_widget) std::string config_prefix, const char* translation_ctx, ControllerSettingsDialog* dialog, QWidget* parent_widget)
: QWidget(parent_widget) : QWidget(parent_widget)
, m_settings(settings) , m_settings(settings)
@ -932,8 +932,8 @@ void USBDeviceWidget::populatePages()
m_settings_widget = nullptr; m_settings_widget = nullptr;
} }
const gsl::span<const InputBindingInfo> bindings(USB::GetDeviceBindings(m_device_type, m_device_subtype)); const std::span<const InputBindingInfo> bindings(USB::GetDeviceBindings(m_device_type, m_device_subtype));
const gsl::span<const SettingInfo> settings(USB::GetDeviceSettings(m_device_type, m_device_subtype)); const std::span<const SettingInfo> settings(USB::GetDeviceSettings(m_device_type, m_device_subtype));
m_ui.bindings->setEnabled(!bindings.empty()); m_ui.bindings->setEnabled(!bindings.empty());
m_ui.settings->setEnabled(!settings.empty()); m_ui.settings->setEnabled(!settings.empty());
@ -1110,7 +1110,7 @@ std::string USBBindingWidget::getBindingKey(const char* binding_name) const
return USB::GetConfigSubKey(getDeviceType(), binding_name); return USB::GetConfigSubKey(getDeviceType(), binding_name);
} }
void USBBindingWidget::createWidgets(gsl::span<const InputBindingInfo> bindings) void USBBindingWidget::createWidgets(std::span<const InputBindingInfo> bindings)
{ {
QGroupBox* axis_gbox = nullptr; QGroupBox* axis_gbox = nullptr;
QGridLayout* axis_layout = nullptr; QGridLayout* axis_layout = nullptr;
@ -1199,7 +1199,7 @@ void USBBindingWidget::createWidgets(gsl::span<const InputBindingInfo> bindings)
} }
void USBBindingWidget::bindWidgets(gsl::span<const InputBindingInfo> bindings) void USBBindingWidget::bindWidgets(std::span<const InputBindingInfo> bindings)
{ {
SettingsInterface* sif = getDialog()->getProfileSettingsInterface(); SettingsInterface* sif = getDialog()->getProfileSettingsInterface();
@ -1222,7 +1222,7 @@ void USBBindingWidget::bindWidgets(gsl::span<const InputBindingInfo> bindings)
} }
USBBindingWidget* USBBindingWidget::createInstance( USBBindingWidget* USBBindingWidget::createInstance(
const std::string& type, u32 subtype, gsl::span<const InputBindingInfo> bindings, USBDeviceWidget* parent) const std::string& type, u32 subtype, std::span<const InputBindingInfo> bindings, USBDeviceWidget* parent)
{ {
USBBindingWidget* widget = new USBBindingWidget(parent); USBBindingWidget* widget = new USBBindingWidget(parent);
bool has_template = false; bool has_template = false;

View File

@ -19,7 +19,7 @@
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include "gsl/span" #include <span>
#include "ui_ControllerBindingWidget.h" #include "ui_ControllerBindingWidget.h"
#include "ui_ControllerBindingWidget_DualShock2.h" #include "ui_ControllerBindingWidget_DualShock2.h"
@ -139,7 +139,7 @@ class ControllerCustomSettingsWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
ControllerCustomSettingsWidget(gsl::span<const SettingInfo> settings, std::string config_section, std::string config_prefix, ControllerCustomSettingsWidget(std::span<const SettingInfo> settings, std::string config_section, std::string config_prefix,
const char* translation_ctx, ControllerSettingsDialog* dialog, QWidget* parent_widget); const char* translation_ctx, ControllerSettingsDialog* dialog, QWidget* parent_widget);
~ControllerCustomSettingsWidget(); ~ControllerCustomSettingsWidget();
@ -149,7 +149,7 @@ private Q_SLOTS:
private: private:
void createSettingWidgets(const char* translation_ctx, QWidget* widget_parent, QGridLayout* layout); void createSettingWidgets(const char* translation_ctx, QWidget* widget_parent, QGridLayout* layout);
gsl::span<const SettingInfo> m_settings; std::span<const SettingInfo> m_settings;
std::string m_config_section; std::string m_config_section;
std::string m_config_prefix; std::string m_config_prefix;
ControllerSettingsDialog* m_dialog; ControllerSettingsDialog* m_dialog;
@ -252,11 +252,11 @@ public:
QIcon getIcon() const; QIcon getIcon() const;
static USBBindingWidget* createInstance(const std::string& type, u32 subtype, gsl::span<const InputBindingInfo> bindings, USBDeviceWidget* parent); static USBBindingWidget* createInstance(const std::string& type, u32 subtype, std::span<const InputBindingInfo> bindings, USBDeviceWidget* parent);
protected: protected:
std::string getBindingKey(const char* binding_name) const; std::string getBindingKey(const char* binding_name) const;
void createWidgets(gsl::span<const InputBindingInfo> bindings); void createWidgets(std::span<const InputBindingInfo> bindings);
void bindWidgets(gsl::span<const InputBindingInfo> bindings); void bindWidgets(std::span<const InputBindingInfo> bindings);
}; };

View File

@ -19,7 +19,7 @@
#include "glad.h" #include "glad.h"
#include <gsl/span> #include <span>
#if defined(__APPLE__) && defined(__OBJC__) #if defined(__APPLE__) && defined(__OBJC__)
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
@ -35,7 +35,7 @@ public:
GLContextAGL(const WindowInfo& wi); GLContextAGL(const WindowInfo& wi);
~GLContextAGL() override; ~GLContextAGL() override;
static std::unique_ptr<GLContext> Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try); static std::unique_ptr<GLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try);
void* GetProcAddress(const char* name) override; void* GetProcAddress(const char* name) override;
bool ChangeSurface(const WindowInfo& new_wi) override; bool ChangeSurface(const WindowInfo& new_wi) override;
@ -47,7 +47,7 @@ public:
std::unique_ptr<GLContext> CreateSharedContext(const WindowInfo& wi) override; std::unique_ptr<GLContext> CreateSharedContext(const WindowInfo& wi) override;
private: private:
bool Initialize(gsl::span<const Version> versions_to_try); bool Initialize(std::span<const Version> versions_to_try);
bool CreateContext(NSOpenGLContext* share_context, int profile, bool make_current); bool CreateContext(NSOpenGLContext* share_context, int profile, bool make_current);
void BindContextToView(); void BindContextToView();
void CleanupView(); void CleanupView();

View File

@ -46,7 +46,7 @@ GLContextAGL::~GLContextAGL()
[m_context release]; [m_context release];
} }
std::unique_ptr<GLContext> GLContextAGL::Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try) std::unique_ptr<GLContext> GLContextAGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try)
{ {
std::unique_ptr<GLContextAGL> context = std::make_unique<GLContextAGL>(wi); std::unique_ptr<GLContextAGL> context = std::make_unique<GLContextAGL>(wi);
if (!context->Initialize(versions_to_try)) if (!context->Initialize(versions_to_try))
@ -55,7 +55,7 @@ std::unique_ptr<GLContext> GLContextAGL::Create(const WindowInfo& wi, gsl::span<
return context; return context;
} }
bool GLContextAGL::Initialize(gsl::span<const Version> versions_to_try) bool GLContextAGL::Initialize(std::span<const Version> versions_to_try)
{ {
for (const Version& cv : versions_to_try) for (const Version& cv : versions_to_try)
{ {

View File

@ -35,7 +35,7 @@ GLContextEGL::~GLContextEGL()
DestroyContext(); DestroyContext();
} }
std::unique_ptr<GLContext> GLContextEGL::Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try) std::unique_ptr<GLContext> GLContextEGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try)
{ {
std::unique_ptr<GLContextEGL> context = std::make_unique<GLContextEGL>(wi); std::unique_ptr<GLContextEGL> context = std::make_unique<GLContextEGL>(wi);
if (!context->Initialize(versions_to_try)) if (!context->Initialize(versions_to_try))

View File

@ -19,7 +19,7 @@
#include "glad_egl.h" #include "glad_egl.h"
#include <gsl/span> #include <span>
class GLContextEGL : public GLContext class GLContextEGL : public GLContext
{ {
@ -27,7 +27,7 @@ public:
GLContextEGL(const WindowInfo& wi); GLContextEGL(const WindowInfo& wi);
~GLContextEGL() override; ~GLContextEGL() override;
static std::unique_ptr<GLContext> Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try); static std::unique_ptr<GLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try);
void* GetProcAddress(const char* name) override; void* GetProcAddress(const char* name) override;
virtual bool ChangeSurface(const WindowInfo& new_wi) override; virtual bool ChangeSurface(const WindowInfo& new_wi) override;

View File

@ -36,7 +36,7 @@ GLContextEGLWayland::~GLContextEGLWayland()
dlclose(m_wl_module); dlclose(m_wl_module);
} }
std::unique_ptr<GLContext> GLContextEGLWayland::Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try) std::unique_ptr<GLContext> GLContextEGLWayland::Create(const WindowInfo& wi, std::span<const Version> versions_to_try)
{ {
std::unique_ptr<GLContextEGLWayland> context = std::make_unique<GLContextEGLWayland>(wi); std::unique_ptr<GLContextEGLWayland> context = std::make_unique<GLContextEGLWayland>(wi);
if (!context->LoadModule() || !context->Initialize(versions_to_try)) if (!context->LoadModule() || !context->Initialize(versions_to_try))

View File

@ -26,7 +26,7 @@ public:
GLContextEGLWayland(const WindowInfo& wi); GLContextEGLWayland(const WindowInfo& wi);
~GLContextEGLWayland() override; ~GLContextEGLWayland() override;
static std::unique_ptr<GLContext> Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try); static std::unique_ptr<GLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try);
std::unique_ptr<GLContext> CreateSharedContext(const WindowInfo& wi) override; std::unique_ptr<GLContext> CreateSharedContext(const WindowInfo& wi) override;
void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override; void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override;

View File

@ -25,7 +25,7 @@ GLContextEGLX11::GLContextEGLX11(const WindowInfo& wi)
} }
GLContextEGLX11::~GLContextEGLX11() = default; GLContextEGLX11::~GLContextEGLX11() = default;
std::unique_ptr<GLContext> GLContextEGLX11::Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try) std::unique_ptr<GLContext> GLContextEGLX11::Create(const WindowInfo& wi, std::span<const Version> versions_to_try)
{ {
std::unique_ptr<GLContextEGLX11> context = std::make_unique<GLContextEGLX11>(wi); std::unique_ptr<GLContextEGLX11> context = std::make_unique<GLContextEGLX11>(wi);
if (!context->Initialize(versions_to_try)) if (!context->Initialize(versions_to_try))

View File

@ -23,7 +23,7 @@ public:
GLContextEGLX11(const WindowInfo& wi); GLContextEGLX11(const WindowInfo& wi);
~GLContextEGLX11() override; ~GLContextEGLX11() override;
static std::unique_ptr<GLContext> Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try); static std::unique_ptr<GLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try);
std::unique_ptr<GLContext> CreateSharedContext(const WindowInfo& wi) override; std::unique_ptr<GLContext> CreateSharedContext(const WindowInfo& wi) override;
void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override; void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override;

View File

@ -59,7 +59,7 @@ GLContextWGL::~GLContextWGL()
ReleaseDC(); ReleaseDC();
} }
std::unique_ptr<GLContext> GLContextWGL::Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try) std::unique_ptr<GLContext> GLContextWGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try)
{ {
std::unique_ptr<GLContextWGL> context = std::make_unique<GLContextWGL>(wi); std::unique_ptr<GLContextWGL> context = std::make_unique<GLContextWGL>(wi);
if (!context->Initialize(versions_to_try)) if (!context->Initialize(versions_to_try))
@ -68,7 +68,7 @@ std::unique_ptr<GLContext> GLContextWGL::Create(const WindowInfo& wi, gsl::span<
return context; return context;
} }
bool GLContextWGL::Initialize(gsl::span<const Version> versions_to_try) bool GLContextWGL::Initialize(std::span<const Version> versions_to_try)
{ {
if (m_wi.type == WindowInfo::Type::Win32) if (m_wi.type == WindowInfo::Type::Win32)
{ {

View File

@ -22,8 +22,8 @@
#include "glad_wgl.h" #include "glad_wgl.h"
#include "glad.h" #include "glad.h"
#include <gsl/span>
#include <optional> #include <optional>
#include <span>
class GLContextWGL final : public GLContext class GLContextWGL final : public GLContext
{ {
@ -31,7 +31,7 @@ public:
GLContextWGL(const WindowInfo& wi); GLContextWGL(const WindowInfo& wi);
~GLContextWGL() override; ~GLContextWGL() override;
static std::unique_ptr<GLContext> Create(const WindowInfo& wi, gsl::span<const Version> versions_to_try); static std::unique_ptr<GLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try);
void* GetProcAddress(const char* name) override; void* GetProcAddress(const char* name) override;
bool ChangeSurface(const WindowInfo& new_wi) override; bool ChangeSurface(const WindowInfo& new_wi) override;
@ -47,7 +47,7 @@ private:
HDC GetDCAndSetPixelFormat(HWND hwnd); HDC GetDCAndSetPixelFormat(HWND hwnd);
bool Initialize(gsl::span<const Version> versions_to_try); bool Initialize(std::span<const Version> versions_to_try);
bool InitializeDC(); bool InitializeDC();
void ReleaseDC(); void ReleaseDC();
bool CreatePBuffer(); bool CreatePBuffer();

View File

@ -4069,7 +4069,7 @@ void FullscreenUI::DrawControllerSettingsPage()
} }
const u32 subtype = USB::GetConfigSubType(*bsi, port, type); const u32 subtype = USB::GetConfigSubType(*bsi, port, type);
const gsl::span<const char*> subtypes(USB::GetDeviceSubtypes(type)); const std::span<const char*> subtypes(USB::GetDeviceSubtypes(type));
if (!subtypes.empty()) if (!subtypes.empty())
{ {
const char* subtype_name = USB::GetDeviceSubtypeName(type, subtype); const char* subtype_name = USB::GetDeviceSubtypeName(type, subtype);
@ -4094,7 +4094,7 @@ void FullscreenUI::DrawControllerSettingsPage()
} }
} }
const gsl::span<const InputBindingInfo> bindings(USB::GetDeviceBindings(type, subtype)); const std::span<const InputBindingInfo> bindings(USB::GetDeviceBindings(type, subtype));
if (!bindings.empty()) if (!bindings.empty())
{ {
MenuHeading(fmt::format(ICON_FA_KEYBOARD " {} Bindings", USB::GetDeviceName(type)).c_str()); MenuHeading(fmt::format(ICON_FA_KEYBOARD " {} Bindings", USB::GetDeviceName(type)).c_str());
@ -4110,7 +4110,7 @@ void FullscreenUI::DrawControllerSettingsPage()
DrawInputBindingButton(bsi, bi.bind_type, section.c_str(), USB::GetConfigSubKey(type, bi.name).c_str(), bi.display_name); DrawInputBindingButton(bsi, bi.bind_type, section.c_str(), USB::GetConfigSubKey(type, bi.name).c_str(), bi.display_name);
} }
const gsl::span<const SettingInfo> settings(USB::GetDeviceSettings(type, subtype)); const std::span<const SettingInfo> settings(USB::GetDeviceSettings(type, subtype));
if (!settings.empty()) if (!settings.empty())
{ {
MenuHeading(fmt::format(ICON_FA_SLIDERS_H " {} Settings", USB::GetDeviceName(type)).c_str()); MenuHeading(fmt::format(ICON_FA_SLIDERS_H " {} Settings", USB::GetDeviceName(type)).c_str());

View File

@ -40,7 +40,6 @@
#include "common/Timer.h" #include "common/Timer.h"
#include "fmt/core.h" #include "fmt/core.h"
#include "gsl/span"
#include "imgui.h" #include "imgui.h"
#include <array> #include <array>
@ -48,6 +47,7 @@
#include <cmath> #include <cmath>
#include <deque> #include <deque>
#include <mutex> #include <mutex>
#include <span>
#include <tuple> #include <tuple>
#include <unordered_map> #include <unordered_map>
@ -60,7 +60,7 @@ namespace ImGuiManager
static void DrawInputRecordingOverlay(float& position_y); static void DrawInputRecordingOverlay(float& position_y);
} // namespace ImGuiManager } // namespace ImGuiManager
static std::tuple<float, float> GetMinMax(gsl::span<const float> values) static std::tuple<float, float> GetMinMax(std::span<const float> values)
{ {
GSVector4 vmin(GSVector4::load<false>(values.data())); GSVector4 vmin(GSVector4::load<false>(values.data()));
GSVector4 vmax(vmin); GSVector4 vmax(vmin);
@ -565,7 +565,7 @@ void ImGuiManager::DrawInputsOverlay()
if (EmuConfig.USB.Ports[port].DeviceType < 0) if (EmuConfig.USB.Ports[port].DeviceType < 0)
continue; continue;
const gsl::span<const InputBindingInfo> bindings(USB::GetDeviceBindings(port)); const std::span<const InputBindingInfo> bindings(USB::GetDeviceBindings(port));
if (bindings.empty()) if (bindings.empty())
continue; continue;

View File

@ -200,7 +200,7 @@ void PINEServer::MainLoop()
// use a bunch of auto // use a bunch of auto
auto receive_length = 0; auto receive_length = 0;
auto end_length = 4; auto end_length = 4;
const gsl::span<u8> ipc_buffer_span = gsl::make_span(m_ipc_buffer); const std::span<u8> ipc_buffer_span(m_ipc_buffer);
// while we haven't received the entire packet, maybe due to // while we haven't received the entire packet, maybe due to
// socket datagram splittage, we continue to read // socket datagram splittage, we continue to read
@ -271,7 +271,7 @@ void PINEServer::Deinitialize()
} }
} }
PINEServer::IPCBuffer PINEServer::ParseCommand(gsl::span<u8> buf, std::vector<u8>& ret_buffer, u32 buf_size) PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8>& ret_buffer, u32 buf_size)
{ {
u32 ret_cnt = 5; u32 ret_cnt = 5;
u32 buf_cnt = 0; u32 buf_cnt = 0;

View File

@ -29,7 +29,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <atomic> #include <atomic>
#include <gsl/span> #include <span>
#ifdef _WIN32 #ifdef _WIN32
#include <WinSock2.h> #include <WinSock2.h>
#include <windows.h> #include <windows.h>
@ -152,7 +152,7 @@ protected:
* return value: IPCBuffer containing a buffer with the result * return value: IPCBuffer containing a buffer with the result
* of the command and its size. * of the command and its size.
*/ */
IPCBuffer ParseCommand(gsl::span<u8> buf, std::vector<u8>& ret_buffer, u32 buf_size); IPCBuffer ParseCommand(std::span<u8> buf, std::vector<u8>& ret_buffer, u32 buf_size);
/** /**
* Formats an IPC buffer * Formats an IPC buffer
@ -190,7 +190,7 @@ protected:
* NB: implicitely inlined * NB: implicitely inlined
*/ */
template <typename T> template <typename T>
static T FromSpan(gsl::span<u8> span, int i) static T FromSpan(std::span<u8> span, int i)
{ {
return *(T*)(&span[i]); return *(T*)(&span[i]);
} }

View File

@ -33,11 +33,11 @@
#include "IconsFontAwesome5.h" #include "IconsFontAwesome5.h"
#include "fmt/format.h" #include "fmt/format.h"
#include "gsl/span"
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include <memory> #include <memory>
#include <span>
#include <sstream> #include <sstream>
#include <vector> #include <vector>
@ -148,7 +148,7 @@ namespace Patch
static void TrimPatchLine(std::string& buffer); static void TrimPatchLine(std::string& buffer);
static int PatchTableExecute(PatchGroup* group, const std::string_view& lhs, const std::string_view& rhs, static int PatchTableExecute(PatchGroup* group, const std::string_view& lhs, const std::string_view& rhs,
const gsl::span<const PatchTextTable>& Table); const std::span<const PatchTextTable>& Table);
static void LoadPatchLine(PatchGroup* group, const std::string_view& line); static void LoadPatchLine(PatchGroup* group, const std::string_view& line);
static u32 LoadPatchesFromString(PatchList* patch_list, const std::string& patch_file); static u32 LoadPatchesFromString(PatchList* patch_list, const std::string& patch_file);
static bool OpenPatchesZip(); static bool OpenPatchesZip();
@ -215,7 +215,7 @@ void Patch::TrimPatchLine(std::string& buffer)
} }
int Patch::PatchTableExecute(PatchGroup* group, const std::string_view& lhs, const std::string_view& rhs, int Patch::PatchTableExecute(PatchGroup* group, const std::string_view& lhs, const std::string_view& rhs,
const gsl::span<const PatchTextTable>& Table) const std::span<const PatchTextTable>& Table)
{ {
int i = 0; int i = 0;

View File

@ -89,7 +89,7 @@ static SndOutModule* mods[] =
static SndOutModule* s_output_module; static SndOutModule* s_output_module;
gsl::span<SndOutModule*> GetSndOutModules() std::span<SndOutModule*> GetSndOutModules()
{ {
return mods; return mods;
} }

View File

@ -15,10 +15,9 @@
#pragma once #pragma once
#include <span>
#include <vector> #include <vector>
#include "gsl/span"
// Number of stereo samples per SndOut block. // Number of stereo samples per SndOut block.
// All drivers must work in units of this size when communicating with // All drivers must work in units of this size when communicating with
// SndOut. // SndOut.
@ -347,4 +346,4 @@ public:
virtual int GetEmptySampleCount() = 0; virtual int GetEmptySampleCount() = 0;
}; };
gsl::span<SndOutModule*> GetSndOutModules(); std::span<SndOutModule*> GetSndOutModules();

View File

@ -576,32 +576,32 @@ const char* USB::GetDeviceSubtypeName(const std::string_view& device, u32 subtyp
if (!dev) if (!dev)
return "Unknown"; return "Unknown";
const gsl::span<const char*> subtypes(dev->SubTypes()); const std::span<const char*> subtypes(dev->SubTypes());
if (subtypes.empty() || subtype >= subtypes.size()) if (subtypes.empty() || subtype >= subtypes.size())
return ""; return "";
return subtypes[subtype]; return subtypes[subtype];
} }
gsl::span<const char*> USB::GetDeviceSubtypes(const std::string_view& device) std::span<const char*> USB::GetDeviceSubtypes(const std::string_view& device)
{ {
const DeviceProxy* dev = RegisterDevice::instance().Device(device); const DeviceProxy* dev = RegisterDevice::instance().Device(device);
return dev ? dev->SubTypes() : gsl::span<const char*>(); return dev ? dev->SubTypes() : std::span<const char*>();
} }
gsl::span<const InputBindingInfo> USB::GetDeviceBindings(const std::string_view& device, u32 subtype) std::span<const InputBindingInfo> USB::GetDeviceBindings(const std::string_view& device, u32 subtype)
{ {
const DeviceProxy* dev = RegisterDevice::instance().Device(device); const DeviceProxy* dev = RegisterDevice::instance().Device(device);
return dev ? dev->Bindings(subtype) : gsl::span<const InputBindingInfo>(); return dev ? dev->Bindings(subtype) : std::span<const InputBindingInfo>();
} }
gsl::span<const SettingInfo> USB::GetDeviceSettings(const std::string_view& device, u32 subtype) std::span<const SettingInfo> USB::GetDeviceSettings(const std::string_view& device, u32 subtype)
{ {
const DeviceProxy* dev = RegisterDevice::instance().Device(device); const DeviceProxy* dev = RegisterDevice::instance().Device(device);
return dev ? dev->Settings(subtype) : gsl::span<const SettingInfo>(); return dev ? dev->Settings(subtype) : std::span<const SettingInfo>();
} }
gsl::span<const InputBindingInfo> USB::GetDeviceBindings(u32 port) std::span<const InputBindingInfo> USB::GetDeviceBindings(u32 port)
{ {
pxAssert(port < NUM_PORTS); pxAssert(port < NUM_PORTS);
if (s_usb_device_proxy[port]) if (s_usb_device_proxy[port])

View File

@ -16,13 +16,12 @@
#pragma once #pragma once
#include <optional> #include <optional>
#include <span>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "gsl/span"
#include "Config.h" #include "Config.h"
class SettingsInterface; class SettingsInterface;
@ -41,11 +40,11 @@ namespace USB
std::vector<std::pair<const char*, const char*>> GetDeviceTypes(); std::vector<std::pair<const char*, const char*>> GetDeviceTypes();
const char* GetDeviceName(const std::string_view& device); const char* GetDeviceName(const std::string_view& device);
const char* GetDeviceSubtypeName(const std::string_view& device, u32 subtype); const char* GetDeviceSubtypeName(const std::string_view& device, u32 subtype);
gsl::span<const char*> GetDeviceSubtypes(const std::string_view& device); std::span<const char*> GetDeviceSubtypes(const std::string_view& device);
gsl::span<const InputBindingInfo> GetDeviceBindings(const std::string_view& device, u32 subtype); std::span<const InputBindingInfo> GetDeviceBindings(const std::string_view& device, u32 subtype);
gsl::span<const SettingInfo> GetDeviceSettings(const std::string_view& device, u32 subtype); std::span<const SettingInfo> GetDeviceSettings(const std::string_view& device, u32 subtype);
gsl::span<const InputBindingInfo> GetDeviceBindings(u32 port); std::span<const InputBindingInfo> GetDeviceBindings(u32 port);
float GetDeviceBindValue(u32 port, u32 bind_index); float GetDeviceBindValue(u32 port, u32 bind_index);
void SetDeviceBindValue(u32 port, u32 bind_index, float value); void SetDeviceBindValue(u32 port, u32 bind_index, float value);

View File

@ -29,17 +29,17 @@ RegisterDevice* RegisterDevice::registerDevice = nullptr;
DeviceProxy::~DeviceProxy() = default; DeviceProxy::~DeviceProxy() = default;
gsl::span<const char*> DeviceProxy::SubTypes() const std::span<const char*> DeviceProxy::SubTypes() const
{ {
return {}; return {};
} }
gsl::span<const InputBindingInfo> DeviceProxy::Bindings(u32 subtype) const std::span<const InputBindingInfo> DeviceProxy::Bindings(u32 subtype) const
{ {
return {}; return {};
} }
gsl::span<const SettingInfo> DeviceProxy::Settings(u32 subtype) const std::span<const SettingInfo> DeviceProxy::Settings(u32 subtype) const
{ {
return {}; return {};
} }

View File

@ -16,6 +16,7 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <span>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <map> #include <map>
@ -23,7 +24,6 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <memory> #include <memory>
#include "gsl/span"
#include "qemu-usb/USBinternal.h" #include "qemu-usb/USBinternal.h"
@ -61,9 +61,9 @@ public:
virtual const char* Name() const = 0; virtual const char* Name() const = 0;
virtual const char* TypeName() const = 0; virtual const char* TypeName() const = 0;
virtual gsl::span<const char*> SubTypes() const; virtual std::span<const char*> SubTypes() const;
virtual gsl::span<const InputBindingInfo> Bindings(u32 subtype) const; virtual std::span<const InputBindingInfo> Bindings(u32 subtype) const;
virtual gsl::span<const SettingInfo> Settings(u32 subtype) const; virtual std::span<const SettingInfo> Settings(u32 subtype) const;
virtual USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const = 0; virtual USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const = 0;

View File

@ -514,14 +514,14 @@ namespace usb_eyetoy
// TODO: Update device name // TODO: Update device name
} }
gsl::span<const char*> EyeToyWebCamDevice::SubTypes() const std::span<const char*> EyeToyWebCamDevice::SubTypes() const
{ {
static const char* subtypes[] = { static const char* subtypes[] = {
TRANSLATE_NOOP("USB", "Sony EyeToy"), TRANSLATE_NOOP("USB", "Konami Capture Eye")}; TRANSLATE_NOOP("USB", "Sony EyeToy"), TRANSLATE_NOOP("USB", "Konami Capture Eye")};
return subtypes; return subtypes;
} }
gsl::span<const SettingInfo> EyeToyWebCamDevice::Settings(u32 subtype) const std::span<const SettingInfo> EyeToyWebCamDevice::Settings(u32 subtype) const
{ {
static constexpr const SettingInfo info[] = { static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "device_name", TRANSLATE_NOOP("USB", "Device Name"), {SettingInfo::Type::StringList, "device_name", TRANSLATE_NOOP("USB", "Device Name"),

View File

@ -475,8 +475,8 @@ namespace usb_eyetoy
const char* TypeName() const override; const char* TypeName() const override;
bool Freeze(USBDevice* dev, StateWrapper& sw) const override; bool Freeze(USBDevice* dev, StateWrapper& sw) const override;
void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override; void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override;
gsl::span<const char*> SubTypes() const override; std::span<const char*> SubTypes() const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
}; };
} // namespace usb_eyetoy } // namespace usb_eyetoy

View File

@ -948,7 +948,7 @@ namespace usb_hid
return "hidkbd"; return "hidkbd";
} }
gsl::span<const InputBindingInfo> HIDKbdDevice::Bindings(u32 subtype) const std::span<const InputBindingInfo> HIDKbdDevice::Bindings(u32 subtype) const
{ {
static constexpr const InputBindingInfo info[] = { static constexpr const InputBindingInfo info[] = {
{"Keyboard", TRANSLATE_NOOP("USB", "Keyboard"), InputBindingInfo::Type::Keyboard, 0, GenericInputBinding::Unknown}, {"Keyboard", TRANSLATE_NOOP("USB", "Keyboard"), InputBindingInfo::Type::Keyboard, 0, GenericInputBinding::Unknown},
@ -1041,7 +1041,7 @@ namespace usb_hid
return !sw.HasError(); return !sw.HasError();
} }
gsl::span<const InputBindingInfo> HIDMouseDevice::Bindings(u32 subtype) const std::span<const InputBindingInfo> HIDMouseDevice::Bindings(u32 subtype) const
{ {
static constexpr const InputBindingInfo info[] = { static constexpr const InputBindingInfo info[] = {
{"Pointer", TRANSLATE_NOOP("USB", "Pointer"), InputBindingInfo::Type::Pointer, INPUT_BUTTON__MAX, GenericInputBinding::Unknown}, {"Pointer", TRANSLATE_NOOP("USB", "Pointer"), InputBindingInfo::Type::Pointer, INPUT_BUTTON__MAX, GenericInputBinding::Unknown},

View File

@ -26,7 +26,7 @@ namespace usb_hid
public: public:
const char* Name() const override; const char* Name() const override;
const char* TypeName() const override; const char* TypeName() const override;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const override; std::span<const InputBindingInfo> Bindings(u32 subtype) const override;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override; USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override;
void SetBindingValue(USBDevice* dev, u32 bind, float value) const override; void SetBindingValue(USBDevice* dev, u32 bind, float value) const override;
bool Freeze(USBDevice* dev, StateWrapper& sw) const override; bool Freeze(USBDevice* dev, StateWrapper& sw) const override;
@ -37,7 +37,7 @@ namespace usb_hid
public: public:
const char* Name() const override; const char* Name() const override;
const char* TypeName() const override; const char* TypeName() const override;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const override; std::span<const InputBindingInfo> Bindings(u32 subtype) const override;
float GetBindingValue(const USBDevice* dev, u32 bind) const override; float GetBindingValue(const USBDevice* dev, u32 bind) const override;
void SetBindingValue(USBDevice* dev, u32 bind, float value) const override; void SetBindingValue(USBDevice* dev, u32 bind, float value) const override;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override; USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override;

View File

@ -478,7 +478,7 @@ namespace usb_lightgun
s->button_state &= ~bit; s->button_state &= ~bit;
} }
gsl::span<const InputBindingInfo> GunCon2Device::Bindings(u32 subtype) const std::span<const InputBindingInfo> GunCon2Device::Bindings(u32 subtype) const
{ {
static constexpr const InputBindingInfo bindings[] = { static constexpr const InputBindingInfo bindings[] = {
//{"pointer", "Pointer/Aiming", InputBindingInfo::Type::Pointer, BID_POINTER_X, GenericInputBinding::Unknown}, //{"pointer", "Pointer/Aiming", InputBindingInfo::Type::Pointer, BID_POINTER_X, GenericInputBinding::Unknown},
@ -502,7 +502,7 @@ namespace usb_lightgun
return bindings; return bindings;
} }
gsl::span<const SettingInfo> GunCon2Device::Settings(u32 subtype) const std::span<const SettingInfo> GunCon2Device::Settings(u32 subtype) const
{ {
static constexpr const SettingInfo info[] = { static constexpr const SettingInfo info[] = {
{SettingInfo::Type::Boolean, "custom_config", TRANSLATE_NOOP("USB", "Manual Screen Configuration"), {SettingInfo::Type::Boolean, "custom_config", TRANSLATE_NOOP("USB", "Manual Screen Configuration"),

View File

@ -28,7 +28,7 @@ namespace usb_lightgun
void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override; void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override;
float GetBindingValue(const USBDevice* dev, u32 bind_index) const override; float GetBindingValue(const USBDevice* dev, u32 bind_index) const override;
void SetBindingValue(USBDevice* dev, u32 bind_index, float value) const override; void SetBindingValue(USBDevice* dev, u32 bind_index, float value) const override;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const override; std::span<const InputBindingInfo> Bindings(u32 subtype) const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
}; };
} // namespace usb_lightgun } // namespace usb_lightgun

View File

@ -994,7 +994,7 @@ namespace usb_mic
// TODO: Update device // TODO: Update device
} }
gsl::span<const SettingInfo> HeadsetDevice::Settings(u32 subtype) const std::span<const SettingInfo> HeadsetDevice::Settings(u32 subtype) const
{ {
static constexpr const SettingInfo info[] = { static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Input Device"), {SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Input Device"),

View File

@ -26,7 +26,7 @@ namespace usb_mic
bool Freeze(USBDevice* dev, StateWrapper& sw) const override; bool Freeze(USBDevice* dev, StateWrapper& sw) const override;
void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override; void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
}; };
} // namespace usb_mic } // namespace usb_mic

View File

@ -846,7 +846,7 @@ namespace usb_mic
// TODO: Reload devices. // TODO: Reload devices.
} }
gsl::span<const SettingInfo> SingstarDevice::Settings(u32 subtype) const std::span<const SettingInfo> SingstarDevice::Settings(u32 subtype) const
{ {
static constexpr const SettingInfo info[] = { static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "player1_device_name", TRANSLATE_NOOP("USB", "Player 1 Device"), {SettingInfo::Type::StringList, "player1_device_name", TRANSLATE_NOOP("USB", "Player 1 Device"),
@ -872,7 +872,7 @@ namespace usb_mic
return TRANSLATE_NOOP("USB", "Logitech USB Mic"); return TRANSLATE_NOOP("USB", "Logitech USB Mic");
} }
gsl::span<const SettingInfo> LogitechMicDevice::Settings(u32 subtype) const std::span<const SettingInfo> LogitechMicDevice::Settings(u32 subtype) const
{ {
static constexpr const SettingInfo info[] = { static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Input Device"), {SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Input Device"),

View File

@ -28,7 +28,7 @@ namespace usb_mic
const char* TypeName() const override; const char* TypeName() const override;
bool Freeze(USBDevice* dev, StateWrapper& sw) const override; bool Freeze(USBDevice* dev, StateWrapper& sw) const override;
void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override; void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
}; };
class LogitechMicDevice final : public SingstarDevice class LogitechMicDevice final : public SingstarDevice
@ -37,6 +37,6 @@ namespace usb_mic
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override; USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override;
const char* TypeName() const override; const char* TypeName() const override;
const char* Name() const override; const char* Name() const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
}; };
} // namespace usb_mic } // namespace usb_mic

View File

@ -1053,7 +1053,7 @@ namespace usb_msd
// TODO: Handle changes to path. // TODO: Handle changes to path.
} }
gsl::span<const SettingInfo> MsdDevice::Settings(u32 subtype) const std::span<const SettingInfo> MsdDevice::Settings(u32 subtype) const
{ {
static constexpr const SettingInfo settings[] = { static constexpr const SettingInfo settings[] = {
{SettingInfo::Type::Path, "ImagePath", TRANSLATE_NOOP("USB", "Image Path"), {SettingInfo::Type::Path, "ImagePath", TRANSLATE_NOOP("USB", "Image Path"),

View File

@ -27,6 +27,6 @@ namespace usb_msd
const char* Name() const override; const char* Name() const override;
bool Freeze(USBDevice* dev, StateWrapper& sw) const override; bool Freeze(USBDevice* dev, StateWrapper& sw) const override;
void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override; void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
}; };
} // namespace usb_msd } // namespace usb_msd

View File

@ -82,7 +82,7 @@ namespace usb_pad
return exponent; return exponent;
} }
static gsl::span<const InputBindingInfo> GetWheelBindings(PS2WheelTypes wt) static std::span<const InputBindingInfo> GetWheelBindings(PS2WheelTypes wt)
{ {
switch (wt) switch (wt)
{ {
@ -169,7 +169,7 @@ namespace usb_pad
} }
} }
static gsl::span<const SettingInfo> GetWheelSettings(PS2WheelTypes wt) static std::span<const SettingInfo> GetWheelSettings(PS2WheelTypes wt)
{ {
if (wt <= WT_GT_FORCE) if (wt <= WT_GT_FORCE)
{ {
@ -874,7 +874,7 @@ namespace usb_pad
s->SetBindValue(bind_index, value); s->SetBindValue(bind_index, value);
} }
gsl::span<const char*> PadDevice::SubTypes() const std::span<const char*> PadDevice::SubTypes() const
{ {
static const char* subtypes[] = {TRANSLATE_NOOP("USB", "Driving Force"), static const char* subtypes[] = {TRANSLATE_NOOP("USB", "Driving Force"),
TRANSLATE_NOOP("USB", "Driving Force Pro"), TRANSLATE_NOOP("USB", "Driving Force Pro (rev11.02)"), TRANSLATE_NOOP("USB", "Driving Force Pro"), TRANSLATE_NOOP("USB", "Driving Force Pro (rev11.02)"),
@ -882,12 +882,12 @@ namespace usb_pad
return subtypes; return subtypes;
} }
gsl::span<const InputBindingInfo> PadDevice::Bindings(u32 subtype) const std::span<const InputBindingInfo> PadDevice::Bindings(u32 subtype) const
{ {
return GetWheelBindings(static_cast<PS2WheelTypes>(subtype)); return GetWheelBindings(static_cast<PS2WheelTypes>(subtype));
} }
gsl::span<const SettingInfo> PadDevice::Settings(u32 subtype) const std::span<const SettingInfo> PadDevice::Settings(u32 subtype) const
{ {
return GetWheelSettings(static_cast<PS2WheelTypes>(subtype)); return GetWheelSettings(static_cast<PS2WheelTypes>(subtype));
} }
@ -939,12 +939,12 @@ namespace usb_pad
return nullptr; return nullptr;
} }
gsl::span<const char*> RBDrumKitDevice::SubTypes() const std::span<const char*> RBDrumKitDevice::SubTypes() const
{ {
return {}; return {};
} }
gsl::span<const InputBindingInfo> RBDrumKitDevice::Bindings(u32 subtype) const std::span<const InputBindingInfo> RBDrumKitDevice::Bindings(u32 subtype) const
{ {
static constexpr const InputBindingInfo bindings[] = { static constexpr const InputBindingInfo bindings[] = {
{"Blue", TRANSLATE_NOOP("USB", "Blue"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::R1}, {"Blue", TRANSLATE_NOOP("USB", "Blue"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::R1},
@ -959,7 +959,7 @@ namespace usb_pad
return bindings; return bindings;
} }
gsl::span<const SettingInfo> RBDrumKitDevice::Settings(u32 subtype) const std::span<const SettingInfo> RBDrumKitDevice::Settings(u32 subtype) const
{ {
return {}; return {};
} }
@ -976,12 +976,12 @@ namespace usb_pad
return "BuzzDevice"; return "BuzzDevice";
} }
gsl::span<const char*> BuzzDevice::SubTypes() const std::span<const char*> BuzzDevice::SubTypes() const
{ {
return {}; return {};
} }
gsl::span<const InputBindingInfo> BuzzDevice::Bindings(u32 subtype) const std::span<const InputBindingInfo> BuzzDevice::Bindings(u32 subtype) const
{ {
static constexpr const InputBindingInfo bindings[] = { static constexpr const InputBindingInfo bindings[] = {
{"Red1", TRANSLATE_NOOP("USB", "Player 1 Red"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Circle}, {"Red1", TRANSLATE_NOOP("USB", "Player 1 Red"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Circle},
@ -1012,7 +1012,7 @@ namespace usb_pad
return bindings; return bindings;
} }
gsl::span<const SettingInfo> BuzzDevice::Settings(u32 subtype) const std::span<const SettingInfo> BuzzDevice::Settings(u32 subtype) const
{ {
return {}; return {};
} }
@ -1050,12 +1050,12 @@ namespace usb_pad
return "Keyboardmania"; return "Keyboardmania";
} }
gsl::span<const char*> KeyboardmaniaDevice::SubTypes() const std::span<const char*> KeyboardmaniaDevice::SubTypes() const
{ {
return {}; return {};
} }
gsl::span<const InputBindingInfo> KeyboardmaniaDevice::Bindings(u32 subtype) const std::span<const InputBindingInfo> KeyboardmaniaDevice::Bindings(u32 subtype) const
{ {
static constexpr const InputBindingInfo bindings[] = { static constexpr const InputBindingInfo bindings[] = {
{"C1", TRANSLATE_NOOP("USB", "C 1"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Unknown}, {"C1", TRANSLATE_NOOP("USB", "C 1"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Unknown},
@ -1092,7 +1092,7 @@ namespace usb_pad
return bindings; return bindings;
} }
gsl::span<const SettingInfo> KeyboardmaniaDevice::Settings(u32 subtype) const std::span<const SettingInfo> KeyboardmaniaDevice::Settings(u32 subtype) const
{ {
return {}; return {};
} }

View File

@ -91,9 +91,9 @@ namespace usb_pad
void SetBindingValue(USBDevice* dev, u32 bind_index, float value) const override; void SetBindingValue(USBDevice* dev, u32 bind_index, float value) const override;
void InputDeviceConnected(USBDevice* dev, const std::string_view& identifier) const override; void InputDeviceConnected(USBDevice* dev, const std::string_view& identifier) const override;
void InputDeviceDisconnected(USBDevice* dev, const std::string_view& identifier) const override; void InputDeviceDisconnected(USBDevice* dev, const std::string_view& identifier) const override;
gsl::span<const char*> SubTypes() const override; std::span<const char*> SubTypes() const override;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const override; std::span<const InputBindingInfo> Bindings(u32 subtype) const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
}; };
class RBDrumKitDevice final : public PadDevice class RBDrumKitDevice final : public PadDevice
@ -101,9 +101,9 @@ namespace usb_pad
public: public:
const char* Name() const override; const char* Name() const override;
const char* TypeName() const override; const char* TypeName() const override;
gsl::span<const char*> SubTypes() const override; std::span<const char*> SubTypes() const override;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const override; std::span<const InputBindingInfo> Bindings(u32 subtype) const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override; USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override;
}; };
@ -112,9 +112,9 @@ namespace usb_pad
public: public:
const char* Name() const; const char* Name() const;
const char* TypeName() const; const char* TypeName() const;
gsl::span<const char*> SubTypes() const; std::span<const char*> SubTypes() const;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const; std::span<const InputBindingInfo> Bindings(u32 subtype) const;
gsl::span<const SettingInfo> Settings(u32 subtype) const; std::span<const SettingInfo> Settings(u32 subtype) const;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const; USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const;
}; };
@ -123,9 +123,9 @@ namespace usb_pad
public: public:
const char* Name() const; const char* Name() const;
const char* TypeName() const; const char* TypeName() const;
gsl::span<const char*> SubTypes() const; std::span<const char*> SubTypes() const;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const; std::span<const InputBindingInfo> Bindings(u32 subtype) const;
gsl::span<const SettingInfo> Settings(u32 subtype) const; std::span<const SettingInfo> Settings(u32 subtype) const;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const; USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const;
bool Freeze(USBDevice* dev, StateWrapper& sw) const; bool Freeze(USBDevice* dev, StateWrapper& sw) const;
}; };
@ -135,9 +135,9 @@ namespace usb_pad
public: public:
const char* Name() const; const char* Name() const;
const char* TypeName() const; const char* TypeName() const;
gsl::span<const char*> SubTypes() const; std::span<const char*> SubTypes() const;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const; std::span<const InputBindingInfo> Bindings(u32 subtype) const;
gsl::span<const SettingInfo> Settings(u32 subtype) const; std::span<const SettingInfo> Settings(u32 subtype) const;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const; USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const;
}; };

View File

@ -353,12 +353,12 @@ namespace usb_pad
return "seamic"; return "seamic";
} }
gsl::span<const char*> SeamicDevice::SubTypes() const std::span<const char*> SeamicDevice::SubTypes() const
{ {
return {}; return {};
} }
gsl::span<const InputBindingInfo> SeamicDevice::Bindings(u32 subtype) const std::span<const InputBindingInfo> SeamicDevice::Bindings(u32 subtype) const
{ {
// TODO: This is likely wrong. Someone who cares can fix it. // TODO: This is likely wrong. Someone who cares can fix it.
static constexpr const InputBindingInfo bindings[] = { static constexpr const InputBindingInfo bindings[] = {
@ -385,7 +385,7 @@ namespace usb_pad
return bindings; return bindings;
} }
gsl::span<const SettingInfo> SeamicDevice::Settings(u32 subtype) const std::span<const SettingInfo> SeamicDevice::Settings(u32 subtype) const
{ {
static constexpr const SettingInfo info[] = { static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Input Device"), {SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Input Device"),

View File

@ -430,7 +430,7 @@ namespace usb_pad
} }
} }
gsl::span<const InputBindingInfo> DJTurntableDevice::Bindings(u32 subtype) const std::span<const InputBindingInfo> DJTurntableDevice::Bindings(u32 subtype) const
{ {
static constexpr const InputBindingInfo bindings[] = { static constexpr const InputBindingInfo bindings[] = {
{"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), InputBindingInfo::Type::Button, CID_DJ_DPAD_UP, GenericInputBinding::DPadUp}, {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), InputBindingInfo::Type::Button, CID_DJ_DPAD_UP, GenericInputBinding::DPadUp},
@ -463,7 +463,7 @@ namespace usb_pad
return bindings; return bindings;
} }
gsl::span<const SettingInfo> DJTurntableDevice::Settings(u32 subtype) const std::span<const SettingInfo> DJTurntableDevice::Settings(u32 subtype) const
{ {
static constexpr const SettingInfo info[] = { static constexpr const SettingInfo info[] = {
{SettingInfo::Type::Float, "TurntableMultiplier", TRANSLATE_NOOP("USB", "Turntable Multiplier"), {SettingInfo::Type::Float, "TurntableMultiplier", TRANSLATE_NOOP("USB", "Turntable Multiplier"),

View File

@ -101,8 +101,8 @@ namespace usb_pad
float GetBindingValue(const USBDevice* dev, u32 bind_index) const override; float GetBindingValue(const USBDevice* dev, u32 bind_index) const override;
void SetBindingValue(USBDevice* dev, u32 bind_index, float value) const override; void SetBindingValue(USBDevice* dev, u32 bind_index, float value) const override;
void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override; void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override;
gsl::span<const InputBindingInfo> Bindings(u32 subtype) const override; std::span<const InputBindingInfo> Bindings(u32 subtype) const override;
gsl::span<const SettingInfo> Settings(u32 subtype) const override; std::span<const SettingInfo> Settings(u32 subtype) const override;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override; USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override;
}; };

View File

@ -368,7 +368,7 @@ namespace usb_printer
return true; return true;
} }
gsl::span<const char*> PrinterDevice::SubTypes() const std::span<const char*> PrinterDevice::SubTypes() const
{ {
return sPrinterNames; return sPrinterNames;
} }

View File

@ -128,7 +128,7 @@ namespace usb_printer
const char* TypeName() const override; const char* TypeName() const override;
bool Freeze(USBDevice* dev, StateWrapper& sw) const override; bool Freeze(USBDevice* dev, StateWrapper& sw) const override;
gsl::span<const char*> SubTypes() const override; std::span<const char*> SubTypes() const override;
}; };
#pragma pack(push, 1) #pragma pack(push, 1)