Huge shader infrastructure refactor

This commit is contained in:
Jack Andersen
2018-10-06 16:49:22 -10:00
parent 08d632a8bd
commit c29d837ab5
55 changed files with 10392 additions and 1472 deletions

View File

@@ -6,8 +6,8 @@
namespace boo
{
DeviceBase::DeviceBase(DeviceToken* token)
: m_token(token)
DeviceBase::DeviceBase(uint64_t typeHash, DeviceToken* token)
: m_typeHash(typeHash), m_token(token)
{
}

View File

@@ -13,13 +13,14 @@ bool DeviceSignature::DeviceMatchToken(const DeviceToken& token, const TDeviceSi
{
if (token.getDeviceType() == DeviceType::HID)
{
uint64_t genPadHash = dev_typeid(GenericPad);
bool hasGenericPad = false;
for (const DeviceSignature* sig : sigSet)
{
if (sig->m_vid == token.getVendorId() && sig->m_pid == token.getProductId() &&
sig->m_type != DeviceType::HID)
return false;
if (sig->m_typeIdx == typeid(GenericPad))
if (sig->m_typeHash == genPadHash)
hasGenericPad = true;
}
return hasGenericPad;

View File

@@ -1,4 +1,5 @@
#include "boo/inputdev/DolphinSmashAdapter.hpp"
#include "boo/inputdev/DeviceSignature.hpp"
#include <cstdio>
#include <cstring>
@@ -8,7 +9,8 @@ namespace boo
* Reference: https://github.com/ToadKing/wii-u-gc-adapter/blob/master/wii-u-gc-adapter.c
*/
DolphinSmashAdapter::DolphinSmashAdapter(DeviceToken* token) : TDeviceBase<IDolphinSmashAdapterCallback>(token) {}
DolphinSmashAdapter::DolphinSmashAdapter(DeviceToken* token)
: TDeviceBase<IDolphinSmashAdapterCallback>(dev_typeid(DolphinSmashAdapter), token) {}
DolphinSmashAdapter::~DolphinSmashAdapter() {}

View File

@@ -1,4 +1,5 @@
#include "boo/inputdev/DualshockPad.hpp"
#include "boo/inputdev/DeviceSignature.hpp"
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
@@ -33,7 +34,7 @@ static const uint8_t defaultReport[49] = {
};
DualshockPad::DualshockPad(DeviceToken* token)
: TDeviceBase<IDualshockPadCallback>(token),
: TDeviceBase<IDualshockPadCallback>(dev_typeid(DualshockPad), token),
m_rumbleRequest(EDualshockMotor::None),
m_rumbleState(EDualshockMotor::None)
{

View File

@@ -5,7 +5,7 @@ namespace boo
{
GenericPad::GenericPad(DeviceToken* token)
: TDeviceBase<IGenericPadCallback>(token)
: TDeviceBase<IGenericPadCallback>(dev_typeid(GenericPad), token)
{
}

View File

@@ -0,0 +1,34 @@
#include "IHIDDevice.hpp"
namespace boo
{
class HIDDeviceNX : public IHIDDevice
{
DeviceToken& m_token;
std::shared_ptr<DeviceBase> m_devImp;
std::string_view m_devPath;
public:
HIDDeviceNX(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp)
: m_token(token),
m_devImp(devImp),
m_devPath(token.getDevicePath())
{
}
void _deviceDisconnected() {}
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) { return false; }
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) { return 0; }
std::vector<uint8_t> _getReportDescriptor() { return {}; }
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) { return false; }
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) { return 0; }
void _startThread() {}
};
std::shared_ptr<IHIDDevice> IHIDDeviceNew(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp)
{
return std::make_shared<HIDDeviceNX>(token, devImp);
}
}

View File

@@ -0,0 +1,25 @@
#include "boo/inputdev/IHIDListener.hpp"
namespace boo
{
class HIDListenerNX : public IHIDListener
{
DeviceFinder& m_finder;
public:
HIDListenerNX(DeviceFinder& finder)
: m_finder(finder)
{}
bool startScanning() { return false; }
bool stopScanning() { return false; }
bool scanNow() { return false; }
};
std::unique_ptr<IHIDListener> IHIDListenerNew(DeviceFinder& finder)
{
return std::make_unique<HIDListenerNX>(finder);
}
}

View File

@@ -1,9 +1,10 @@
#include "boo/inputdev/NintendoPowerA.hpp"
#include "boo/inputdev/DeviceSignature.hpp"
#include <memory.h>
namespace boo
{
NintendoPowerA::NintendoPowerA(DeviceToken* token)
: TDeviceBase<INintendoPowerACallback>(token)
: TDeviceBase<INintendoPowerACallback>(dev_typeid(NintendoPowerA), token)
{
}