Exemplo n.º 1
0
 static public bool OnEventConnectionInterruptedDelegate(int connection_interrupted_player, int connection_interrupted_disconnect_timeout)
 {
     ngs.SetDisconnectTimeout(connection_interrupted_player,
                              Helper.TimeGetTime(),
                              connection_interrupted_disconnect_timeout);
     return(true);
 }
Exemplo n.º 2
0
        /*
         * vw_on_event_callback --
         *
         * Notification from GGPO that something has happened.  Update the status
         * text at the bottom of the screen to notify the user.
         */

        static bool Vw_on_event_callback(IntPtr evtPtr)
        {
            Debug.Assert(gs != null && ngs != null);
            int[] data = new int[4];
            Marshal.Copy(evtPtr, data, 0, 4);
            int info_code                                 = data[0];
            int connected_player                          = data[1];
            int synchronizing_player                      = data[1];
            int synchronizing_count                       = data[2];
            int synchronizing_total                       = data[3];
            int synchronized_player                       = data[1];
            int disconnected_player                       = data[1];
            int timesync_frames_ahead                     = data[1];
            int connection_interrupted_player             = data[1];
            int connection_interrupted_disconnect_timeout = data[2];
            int connection_resumed_player                 = data[1];

            OnLog?.Invoke($"vw_on_event_callback {data[0]} {data[1]} {data[2]} {data[3]}");

            int progress;

            switch (info_code)
            {
            case GGPO.EVENTCODE_CONNECTED_TO_PEER:
                ngs.SetConnectState(connected_player, PlayerConnectState.Synchronizing);
                break;

            case GGPO.EVENTCODE_SYNCHRONIZING_WITH_PEER:
                progress = 100 * synchronizing_count / synchronizing_total;
                ngs.UpdateConnectProgress(synchronizing_player, progress);
                break;

            case GGPO.EVENTCODE_SYNCHRONIZED_WITH_PEER:
                ngs.UpdateConnectProgress(synchronized_player, 100);
                break;

            case GGPO.EVENTCODE_RUNNING:
                ngs.SetConnectState(PlayerConnectState.Running);
                SetStatusText("");
                break;

            case GGPO.EVENTCODE_CONNECTION_INTERRUPTED:
                ngs.SetDisconnectTimeout(connection_interrupted_player,
                                         Helper.TimeGetTime(),
                                         connection_interrupted_disconnect_timeout);
                break;

            case GGPO.EVENTCODE_CONNECTION_RESUMED:
                ngs.SetConnectState(connection_resumed_player, PlayerConnectState.Running);
                break;

            case GGPO.EVENTCODE_DISCONNECTED_FROM_PEER:
                ngs.SetConnectState(disconnected_player, PlayerConnectState.Disconnected);
                break;

            case GGPO.EVENTCODE_TIMESYNC:
                Helper.Sleep(1000 * timesync_frames_ahead / 60);
                break;
            }
            return(true);
        }
Exemplo n.º 3
0
 public void OnConnectionInterrupted(int playerId, int disconnectTimeout)
 {
     ngs.SetDisconnectTimeout(playerId, Utility.GetCurrentTime(), disconnectTimeout);
 }