@@ -69,8 +69,6 @@ class GameMemory
69
69
private IntPtr _custTimeCountPtr ;
70
70
private Detour _custTimeInjection ;
71
71
72
- private int _ticksOffset ;
73
-
74
72
public GameState _state ;
75
73
76
74
// TODO: match tickrate as closely as possible without going over
@@ -1032,17 +1030,18 @@ void CheckGameState(GameState state)
1032
1030
if ( state . SignOnState . Current != state . SignOnState . Old )
1033
1031
Debug . WriteLine ( "SignOnState changed to " + state . SignOnState . Current ) ;
1034
1032
1035
- if ( state . ServerState . Current == ServerState . Dead )
1036
- this . SendMiscTimeEvent ( _custTimeCountWatcher . Current - _custTimeCountWatcher . Old , MiscTimeType . ClientDisconnectTime ) ;
1037
1033
1038
1034
// if player is fully in game
1039
1035
if ( state . SignOnState . Current == SignOnState . Full && state . HostState . Current == HostState . Run )
1040
1036
{
1041
1037
// note: seems to be slow sometimes. ~3ms
1042
1038
1043
- if ( state . ServerState . Current == ServerState . Paused )
1044
- this . SendMiscTimeEvent ( _custTimeCountWatcher . Current - _custTimeCountWatcher . Old , MiscTimeType . PauseTime ) ;
1045
- else this . SendSessionTimeUpdateEvent ( _custTimeCountWatcher . Current - _custTimeCountWatcher . Old ) ;
1039
+ if ( state . TickCount > 0 )
1040
+ {
1041
+ if ( state . ServerState . Current == ServerState . Paused )
1042
+ this . SendMiscTimeEvent ( _custTimeCountWatcher . Current - _custTimeCountWatcher . Old , MiscTimeType . PauseTime ) ;
1043
+ else this . SendSessionTimeUpdateEvent ( _custTimeCountWatcher . Current - _custTimeCountWatcher . Old ) ;
1044
+ }
1046
1045
1047
1046
// first tick when player is fully in game
1048
1047
if ( state . SignOnState . Current != state . SignOnState . Old )
@@ -1071,11 +1070,11 @@ void CheckGameState(GameState state)
1071
1070
{
1072
1071
if ( state . HostState . Old == HostState . Run )
1073
1072
{
1074
- _ticksOffset = 0 ;
1075
-
1076
1073
// the map changed or a quicksave was loaded
1077
1074
Debug . WriteLine ( "session ended" ) ;
1078
1075
1076
+ state . TickBase = - 1 ;
1077
+
1079
1078
// the map changed or a save was loaded
1080
1079
this . SendSessionEndedEvent ( ) ;
1081
1080
@@ -1140,6 +1139,10 @@ void CheckGameState(GameState state)
1140
1139
if ( state . GameSupport != null )
1141
1140
state . QueueOnNextSessionEnd = GameSupportResult . DoNothing ;
1142
1141
}
1142
+
1143
+
1144
+ if ( state . ServerState . Current == ServerState . Dead && state . HostState . Current == HostState . Run )
1145
+ this . SendMiscTimeEvent ( _custTimeCountWatcher . Current - _custTimeCountWatcher . Old , MiscTimeType . ClientDisconnectTime ) ;
1143
1146
}
1144
1147
1145
1148
void HandleGameSupportResult ( GameSupportResult result , GameState state )
0 commit comments