IPC-HLE event handling improvements

See commits for detailed description.  Makes the System Menu work much better: installed channels can now be launched from the System Menu.

This is making changes to historically sensitive timing code, but testing hasn't found any regressions involving Wiimote handling (or anything else).
Can these two vars be renamed to show better that they are event ids?