From b1818e183145212c16dac1cfa561ef1e324d4e13 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Fri, 10 Feb 2006 08:54:07 +0000 Subject: [PATCH] Make API stricter so that a physical device cannot have logical devices of different types. For example, if 15 joysticks already have IDs and an adaptor that has two logical joysticks is assigning IDs, it cannot have DEVICE_JOY16 for the first and DEVICE_PUMP1 for the second. --- stepmania/src/archutils/Darwin/HIDDevice.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stepmania/src/archutils/Darwin/HIDDevice.h b/stepmania/src/archutils/Darwin/HIDDevice.h index f0abc62ef8..2766b2bd8b 100644 --- a/stepmania/src/archutils/Darwin/HIDDevice.h +++ b/stepmania/src/archutils/Darwin/HIDDevice.h @@ -18,17 +18,17 @@ /* A few helper functions. */ // The result needs to be released. -static inline CFNumberRef CFInt( int n ) +inline CFNumberRef CFInt( int n ) { return CFNumberCreate( kCFAllocatorDefault, kCFNumberIntType, &n ); } -static inline void PrintIOErr( IOReturn err, const char *s ) +inline void PrintIOErr( IOReturn err, const char *s ) { LOG->Warn( "%s - %s(%x,%d)", s, mach_error_string(err), err, err & 0xFFFFFF ); } -static inline Boolean IntValue( const void *o, int &n ) +inline Boolean IntValue( const void *o, int &n ) { return CFNumberGetValue( CFNumberRef(o), kCFNumberIntType, &n ); } @@ -74,7 +74,8 @@ public: /* * Returns the number of IDs assigned starting from startID. This is not meaningful for devices like - * keyboards that all share the same InputDevice id. + * keyboards that all share the same InputDevice id. If a particular device has multiple logical + * devices, then it must ensure that AssignIDs does not assign an ID outside of its range. */ virtual int AssignIDs( InputDevice startID ) { return 0; } virtual void GetDevicesAndDescriptions( vector& dev, vector& desc ) const = 0;