Function InitRecInputService(Priority):
- Set MyPriority to Priority.
- Create an ES_INIT event.
- Post ES_INIT to this service's queue.
- Return true if the event is successfully posted, otherwise return false.
Function PostRecInputService(Event):
- Post the given event to this service's queue.
- Return the result of the post operation (true/false).
Function RunRecInputService(Event):
- Initialize a default ReturnEvent with EventType = ES_NO_EVENT.
**Event Handling:**
- If Event.EventType == ES_TIMEOUT:
1. Print "RECINPUT_TIMER TIMEOUT" to the debug console.
2. Create a PLAY_SEQUENCE event.
3. Post the PLAY_SEQUENCE event to the GameFSM.
- If Event.EventType == WAITING_INPUT:
1. Print "WAITING INPUT" to the debug console.
2. Start the RECINPUT_TIMER with a duration of 20 seconds.
- If Event.EventType == JOYSTICK_UP:
1. Stop the RECINPUT_TIMER.
2. Create a RECORD_INPUT event with EventParam = 2.
3. Post the RECORD_INPUT event to the GameFSM.
- If Event.EventType == JOYSTICK_DOWN:
1. Stop the RECINPUT_TIMER.
2. Create a RECORD_INPUT event with EventParam = 4.
3. Post the RECORD_INPUT event to the GameFSM.
- If Event.EventType == JOYSTICK_LEFT:
1. Stop the RECINPUT_TIMER.
2. Create a RECORD_INPUT event with EventParam = 1.
3. Post the RECORD_INPUT event to the GameFSM.
- If Event.EventType == JOYSTICK_RIGHT:
1. Stop the RECINPUT_TIMER.
2. Create a RECORD_INPUT event with EventParam = 3.
3. Post the RECORD_INPUT event to the GameFSM.
- If Event.EventType == BUTTON_PRESSED:
1. Stop the RECINPUT_TIMER.
2. Create a RECORD_INPUT event with EventParam = 5.
3. Post the RECORD_INPUT event to the GameFSM.
- For all other events:
- Do nothing.
- Return ReturnEvent.