[HID] Redesigned support for Portals

- Added hotplug support on Windows
- Added support for XamInputNonControllerGetRawEx & XamInputNonControllerSetRawEx
This commit is contained in:
Gliniak
2026-03-13 22:31:24 +01:00
committed by Radosław Gliński
parent 3b8debcf5b
commit d37c22aad0
24 changed files with 427 additions and 340 deletions

View File

@@ -0,0 +1,55 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2025 Xenia Canary. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_HID_PORTAL_PORTAL_H_
#define XENIA_HID_PORTAL_PORTAL_H_
#include <span>
#include "xenia/base/mutex.h"
#include "xenia/xbox.h"
namespace xe {
namespace hid {
constexpr uint8_t kPortalBufferSize = 0x20;
class Portal {
public:
Portal();
virtual ~Portal();
bool IsConnected();
virtual X_STATUS Read(std::span<uint8_t> data, uint32_t& bytes_read,
uint16_t& state);
virtual X_STATUS Write(std::span<uint8_t> data);
virtual void OnDeviceArrival() = 0;
virtual void OnDeviceRemoval() = 0;
protected:
bool connected_ = false;
private:
virtual void OpenDevice() = 0;
virtual void CloseDevice() = 0;
virtual X_STATUS ReadInternal(std::span<uint8_t> data,
int32_t& read_count) = 0;
virtual X_STATUS WriteInternal(std::span<uint8_t> data) = 0;
xe_mutex lock_;
X_STATUS previous_status_ = 0;
};
} // namespace hid
} // namespace xe
#endif