mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-12 14:46:49 +01:00
cleanup some osx keyboard code...still can't get mouse or hid transactions to work (although supposedly the kernel caches reports anyways)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5411 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
06f0bc91ee
commit
a4acd0d66c
@ -20,7 +20,7 @@ protected:
|
|||||||
|
|
||||||
struct State
|
struct State
|
||||||
{
|
{
|
||||||
unsigned char buttons[32];
|
Boolean *keyboard_keys;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Input : public ControllerInterface::Device::Input
|
class Input : public ControllerInterface::Device::Input
|
||||||
@ -46,8 +46,8 @@ protected:
|
|||||||
Key( IOHIDElementRef key_element );
|
Key( IOHIDElementRef key_element );
|
||||||
ControlState GetState( const State* const state );
|
ControlState GetState( const State* const state );
|
||||||
private:
|
private:
|
||||||
IOHIDElementRef m_key_element;
|
IOHIDElementRef m_key_element;
|
||||||
std::string m_key_name;
|
std::string m_key_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Button : public Input
|
class Button : public Input
|
||||||
@ -60,7 +60,7 @@ protected:
|
|||||||
ControlState GetState( const State* const state );
|
ControlState GetState( const State* const state );
|
||||||
private:
|
private:
|
||||||
IOHIDElementRef m_button_element;
|
IOHIDElementRef m_button_element;
|
||||||
std::string m_button_name;
|
std::string m_button_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Axis : public Input
|
class Axis : public Input
|
||||||
@ -73,7 +73,7 @@ protected:
|
|||||||
ControlState GetState( const State* const state );
|
ControlState GetState( const State* const state );
|
||||||
private:
|
private:
|
||||||
IOHIDElementRef m_axis_element;
|
IOHIDElementRef m_axis_element;
|
||||||
std::string m_axis_name;
|
std::string m_axis_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Light : public Output
|
class Light : public Output
|
||||||
@ -86,7 +86,7 @@ protected:
|
|||||||
void SetState( const ControlState state, unsigned char* const state_out );
|
void SetState( const ControlState state, unsigned char* const state_out );
|
||||||
private:
|
private:
|
||||||
IOHIDElementRef m_light_element;
|
IOHIDElementRef m_light_element;
|
||||||
std::string m_light_name;
|
std::string m_light_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool UpdateInput();
|
bool UpdateInput();
|
||||||
@ -103,10 +103,10 @@ public:
|
|||||||
int GetId() const;
|
int GetId() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
State m_state_in;
|
State m_state_in;
|
||||||
unsigned char m_state_out[6]; // ugly
|
unsigned char m_state_out[6]; // ugly
|
||||||
IOHIDDeviceRef m_device;
|
IOHIDDeviceRef m_device;
|
||||||
std::string m_device_name;
|
std::string m_device_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ static void DeviceMatching_callback(void* inContext,
|
|||||||
void* inSender,
|
void* inSender,
|
||||||
IOHIDDeviceRef inIOHIDDeviceRef)
|
IOHIDDeviceRef inIOHIDDeviceRef)
|
||||||
{
|
{
|
||||||
|
NSLog(@"-------------------------");
|
||||||
NSLog(@"Got Device: %@", IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(kIOHIDProductKey)));
|
NSLog(@"Got Device: %@", IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(kIOHIDProductKey)));
|
||||||
|
|
||||||
// Add to the devices vector if it's of a type we want
|
// Add to the devices vector if it's of a type we want
|
||||||
@ -44,13 +45,12 @@ static void DeviceMatching_callback(void* inContext,
|
|||||||
std::vector<ControllerInterface::Device*> *devices = (std::vector<ControllerInterface::Device*> *)inContext;
|
std::vector<ControllerInterface::Device*> *devices = (std::vector<ControllerInterface::Device*> *)inContext;
|
||||||
devices->push_back(new KeyboardMouse(inIOHIDDeviceRef));
|
devices->push_back(new KeyboardMouse(inIOHIDDeviceRef));
|
||||||
}
|
}
|
||||||
/* else if (IOHIDDeviceConformsTo(inIOHIDDeviceRef, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad))
|
else
|
||||||
{
|
{
|
||||||
}*/
|
|
||||||
else {
|
|
||||||
// Actually, we don't want it
|
// Actually, we don't want it
|
||||||
NSLog(@"Throwing away...");
|
NSLog(@"Throwing away...");
|
||||||
#define shortlog(x) NSLog(@"%s: %@", x, IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(x)));
|
#define shortlog(x)
|
||||||
|
//#define shortlog(x) NSLog(@"%s: %@", x, IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(x)));
|
||||||
shortlog(kIOHIDTransportKey)
|
shortlog(kIOHIDTransportKey)
|
||||||
shortlog(kIOHIDVendorIDKey)
|
shortlog(kIOHIDVendorIDKey)
|
||||||
shortlog(kIOHIDVendorIDSourceKey)
|
shortlog(kIOHIDVendorIDSourceKey)
|
||||||
@ -72,19 +72,7 @@ static void DeviceMatching_callback(void* inContext,
|
|||||||
shortlog(kIOHIDReportIntervalKey)
|
shortlog(kIOHIDReportIntervalKey)
|
||||||
shortlog(kIOHIDReportDescriptorKey)
|
shortlog(kIOHIDReportDescriptorKey)
|
||||||
#undef shortlog
|
#undef shortlog
|
||||||
NSLog(@"\n\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Will come in handy if we support hotplugging
|
|
||||||
static void DeviceRemoval_callback(void *inContext,
|
|
||||||
IOReturn inResult,
|
|
||||||
void *inSender,
|
|
||||||
IOHIDDeviceRef inIOHIDDeviceRef)
|
|
||||||
{
|
|
||||||
NSLog(@"%s( context: %p, result: %p, sender: %p, device: %p )",
|
|
||||||
__PRETTY_FUNCTION__, inContext, (void *)inResult, inSender, (void *)inIOHIDDeviceRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init( std::vector<ControllerInterface::Device*>& devices )
|
void Init( std::vector<ControllerInterface::Device*>& devices )
|
||||||
@ -114,7 +102,6 @@ void Init( std::vector<ControllerInterface::Device*>& devices )
|
|||||||
|
|
||||||
// Callbacks for acquisition or loss of a matching device
|
// Callbacks for acquisition or loss of a matching device
|
||||||
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, DeviceMatching_callback, (void *)&devices);
|
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, DeviceMatching_callback, (void *)&devices);
|
||||||
IOHIDManagerRegisterDeviceRemovalCallback(HIDManager, DeviceRemoval_callback, (void *)&devices);
|
|
||||||
|
|
||||||
// Match devices that are plugged right now.
|
// Match devices that are plugged right now.
|
||||||
IOHIDManagerScheduleWithRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
IOHIDManagerScheduleWithRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
||||||
@ -125,9 +112,7 @@ void Init( std::vector<ControllerInterface::Device*>& devices )
|
|||||||
while (CFRunLoopRunInMode(OurRunLoop,0,TRUE) == kCFRunLoopRunHandledSource);
|
while (CFRunLoopRunInMode(OurRunLoop,0,TRUE) == kCFRunLoopRunHandledSource);
|
||||||
|
|
||||||
// Things should be configured now. Disable hotplugging and other scheduling
|
// Things should be configured now. Disable hotplugging and other scheduling
|
||||||
// TODO: support hotplugging, get rid of the following:
|
|
||||||
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, NULL, NULL);
|
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, NULL, NULL);
|
||||||
IOHIDManagerRegisterDeviceRemovalCallback(HIDManager, NULL, NULL);
|
|
||||||
IOHIDManagerUnscheduleFromRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
IOHIDManagerUnscheduleFromRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,8 +202,9 @@ KeyboardMouse::KeyboardMouse(IOHIDDeviceRef device)
|
|||||||
{
|
{
|
||||||
outputs.push_back(new Light(e));
|
outputs.push_back(new Light(e));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
DeviceElementDebugPrint((void *)e, NULL);
|
{
|
||||||
|
// DeviceElementDebugPrint(e, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -278,6 +264,7 @@ ControlState KeyboardMouse::Key::GetState( const State* const state )
|
|||||||
//NSLog(@"element %x value %x scaled %f", IOHIDElementGetUsage(m_key_element), value, scaled_value);
|
//NSLog(@"element %x value %x scaled %f", IOHIDElementGetUsage(m_key_element), value, scaled_value);
|
||||||
return scaled_value > 0;
|
return scaled_value > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user