mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-14 07:36:26 +00:00
Major refactor for better modularity
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
namespace boo
|
||||
{
|
||||
|
||||
extern const SDeviceSignature BOO_DEVICE_SIGS[];
|
||||
extern const DeviceSignature BOO_DEVICE_SIGS[];
|
||||
|
||||
|
||||
bool SDeviceSignature::DeviceMatchToken(const CDeviceToken& token, const TDeviceSignatureSet& sigSet)
|
||||
bool DeviceSignature::DeviceMatchToken(const DeviceToken& token, const TDeviceSignatureSet& sigSet)
|
||||
{
|
||||
if (token.getDeviceType() == CDeviceToken::DEVTYPE_GENERICHID)
|
||||
if (token.getDeviceType() == DeviceToken::DEVTYPE_GENERICHID)
|
||||
return true;
|
||||
for (const SDeviceSignature* sig : sigSet)
|
||||
for (const DeviceSignature* sig : sigSet)
|
||||
{
|
||||
if (sig->m_vid == token.getVendorId() && sig->m_pid == token.getProductId())
|
||||
return true;
|
||||
@@ -21,15 +21,15 @@ bool SDeviceSignature::DeviceMatchToken(const CDeviceToken& token, const TDevice
|
||||
return false;
|
||||
}
|
||||
|
||||
IHIDDevice* IHIDDeviceNew(CDeviceToken& token, CDeviceBase& devImp);
|
||||
CDeviceBase* SDeviceSignature::DeviceNew(CDeviceToken& token)
|
||||
IHIDDevice* IHIDDeviceNew(DeviceToken& token, DeviceBase& devImp);
|
||||
DeviceBase* DeviceSignature::DeviceNew(DeviceToken& token)
|
||||
{
|
||||
CDeviceBase* retval = NULL;
|
||||
DeviceBase* retval = NULL;
|
||||
|
||||
/* Early-return for generic HID devices */
|
||||
if (token.getDeviceType() == CDeviceToken::DEVTYPE_GENERICHID)
|
||||
if (token.getDeviceType() == DeviceToken::DEVTYPE_GENERICHID)
|
||||
{
|
||||
retval = new CGenericPad(&token);
|
||||
retval = new GenericPad(&token);
|
||||
if (!retval)
|
||||
return NULL;
|
||||
|
||||
@@ -44,8 +44,8 @@ CDeviceBase* SDeviceSignature::DeviceNew(CDeviceToken& token)
|
||||
}
|
||||
|
||||
/* Otherwise perform signature-matching to find the appropriate device-factory */
|
||||
const SDeviceSignature* foundSig = NULL;
|
||||
const SDeviceSignature* sigIter = BOO_DEVICE_SIGS;
|
||||
const DeviceSignature* foundSig = NULL;
|
||||
const DeviceSignature* sigIter = BOO_DEVICE_SIGS;
|
||||
unsigned targetVid = token.getVendorId();
|
||||
unsigned targetPid = token.getProductId();
|
||||
while (sigIter->m_name)
|
||||
|
||||
Reference in New Issue
Block a user