Memphiz/xbmc — comment on commit 9b9732fef463d2f7aef0fd226d468ce215879834
File:  line 0
By jmarshallnz:

The code in this area is all over the show, and trying to unify it at this point is going to be a nightmare, so let's give up on that root.

Basically what you need to do is add an unsigned int to the ProcessJoystickEvent() which is the length of time the button has been held down - then set the hold time in the action (either in the buttontranslator or directly in the action you get back from it).

Then, you need some sort of timer to push joystick events into CApp::ProcessJoystickEvent() every 10ms or so while the button is held down, stopping when the button is taken back up again. You could do this direct in the IOS event stuff if you want (eg just have a static timer, last_button_id and start_time). When you get a DOWN event, set last_button_id and start_time to the current time and start the timer. Every time the timer fires, send an event with a param for the time (in ms) since start_time. When you get an UP event (or a DOWN event with a different button id) stop the timer and (re)set the last_button and start_time. You might not need the start_time if the timer itself contains that information. IIRC Davilla said something about an NSTimer ?