Major refactor for better modularity

This commit is contained in:
Jack Andersen
2015-08-18 09:40:26 -10:00
parent 3007714b5a
commit e56b8539bf
62 changed files with 275 additions and 791 deletions

View File

@@ -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)