vnIIc Update - Keyboard/Joystick support

Crossing something off my TODO list (and giving my brain a rest for a while) I dusted off some in-progress work on vnIIc and published version 1.0.0.15.
Changes:
  • Keyboard support - as you type on the Apple II client, keys are sent back to the Windows server. If the vnIIc window is not active, key events are sent to Windows. So you can, for example, type into Notepad.
  • Joystick/Paddle support - paddle states are sent to the Windows server as well. If the vnIIc window is not active, these are translated into mouse events.
  • Open/Closed Apple (a.k.a. Joystick/Paddle button) support - these are mapped to the left and right ALT keys. Sorry, you can't click the mouse with the Apple.
  • Screen region selection - click the "+" button at the top of the window, then drag your mouse to select part of your desktop to focus in on - great for streaming non-full-screen applications.
Most of this has been done for a while, but unpublished. The initial protocol was one way only. I'd bodged in handling receiving data from the client, but it was done with an asynchronous event handler and the system would behave unreliably. The server would continue to stream data to the client while it was busy reading the paddle states (which can take several milliseconds) and all hell would break loose. 
I reworked the protocol to be synchronous (the server sends 256 bytes of graphic data, then reads 1 byte of input state data), and then spent 2 hours tracking down a silly bug where the client would fall into an infinite loop. At that point, everything was rock solid.

This probably means I can simplify the client->server transmission protocol. Right now it sends keyboard state (if changed) *or* open apple state (if changed) *or* closed apple state (if changed) *or* paddle 0 state (if changed) *or* paddle 1 state (if changed) *or* a sync byte - in other words, it sends the most relevant state change as a single byte. This is legacy from when the time the client would spend computing what to send and sending it would cause the communication to fall out of sync. Now that it is synchronous, I can probably just send everything.

It also means that I can bolt on mouse support some time soon. (i.e. in 6 months when I feel like touching this again)

Comments