@@ -40,9 +40,7 @@ public class MMPatchLoader
4040 private string configSha ;
4141 private Dictionary < string , string > filesSha = new Dictionary < string , string > ( ) ;
4242
43- private const float yieldInterval = 1f / 30f ; // Patch at ~30fps
44-
45- private const float TIME_TO_WAIT_FOR_LOGS = 0.05f ;
43+ private const int STATUS_UPDATE_INVERVAL_MS = 33 ;
4644
4745 private readonly IEnumerable < ModListGenerator . ModAddedByAssembly > modsAddedByAssemblies ;
4846 private readonly IBasicLogger logger ;
@@ -133,26 +131,31 @@ public IEnumerable<IProtoUrlConfig> Run()
133131 patchLogger . Info ( status ) ;
134132
135133 IPass currentPass = null ;
136- float nextUpdate = Time . realtimeSinceStartup + yieldInterval ;
137134
138135 progress . OnPassStarted . Add ( delegate ( IPass pass )
139136 {
140137 currentPass = pass ;
141138 StatusUpdate ( progress , currentPass . Name ) ;
142139 } ) ;
143140
141+ System . Diagnostics . Stopwatch stopwatch = new System . Diagnostics . Stopwatch ( ) ;
142+ stopwatch . Start ( ) ;
143+
144144 progress . OnPatchApplied . Add ( delegate
145145 {
146- if ( Time . realtimeSinceStartup > nextUpdate )
146+ long timeRemaining = STATUS_UPDATE_INVERVAL_MS - stopwatch . ElapsedMilliseconds ;
147+ if ( timeRemaining < 0 )
147148 {
148149 StatusUpdate ( progress , currentPass . Name ) ;
149- nextUpdate = Time . realtimeSinceStartup + yieldInterval ;
150+ stopwatch . Reset ( ) ;
151+ stopwatch . Start ( ) ;
150152 }
151153 } ) ;
152154
153155 PatchApplier applier = new PatchApplier ( progress , patchLogger ) ;
154156 databaseConfigs = applier . ApplyPatches ( patchList ) ;
155157
158+ stopwatch . Stop ( ) ;
156159 StatusUpdate ( progress ) ;
157160
158161 patchLogger . Info ( "Done patching" ) ;
0 commit comments