Skip to content

Commit 09f897a

Browse files
committed
Just don't capture while loading
1 parent d022c42 commit 09f897a

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

Source/VideoCapture.cs

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ private static void UpdateEngineView(int width, int height) {
142142
Engine.Viewport = viewport;
143143
}
144144

145-
private const int LevelLoadWaitTimeoutMS = 10_000;
146-
private static bool firstLevelLoaderFrame = true;
147-
private static readonly Stopwatch levelLoadWatch = new();
148-
149145
// We need to use a modified version of the main game loop to avoid skipping frames
150146
private delegate void orig_Game_Tick(Game self);
151147
private static void On_Game_Tick(orig_Game_Tick orig, Game self) {
@@ -178,7 +174,10 @@ private static void On_Game_Tick(orig_Game_Tick orig, Game self) {
178174
return;
179175
}
180176

181-
Syncing.SyncWithAudio();
177+
bool skipCapturingFrame = Engine.Scene is LevelLoader;
178+
if (!skipCapturingFrame) {
179+
Syncing.SyncWithAudio();
180+
}
182181

183182
FNAPlatform.PollEvents(self, ref self.currentAdapter, self.textInputControlDown, ref self.textInputSuppress);
184183

@@ -203,24 +202,8 @@ private static void On_Game_Tick(orig_Game_Tick orig, Game self) {
203202
tickHookActive = false;
204203

205204
// Fast-forward through saving
206-
while (UserIO.Saving)
205+
while (UserIO.Saving) {
207206
Celeste.SaveRoutine.Update();
208-
// Fast-forward through level loading
209-
if (Engine.Scene is LevelLoader loader) {
210-
if (firstLevelLoaderFrame) {
211-
// Let the first frame run as normal, so everything initializes
212-
firstLevelLoaderFrame = false;
213-
levelLoadWatch.Restart();
214-
} else {
215-
while (!loader.Loaded && levelLoadWatch.ElapsedMilliseconds < LevelLoadWaitTimeoutMS) { }
216-
217-
// If the wait takes too long, let it run normally
218-
if (levelLoadWatch.ElapsedMilliseconds >= LevelLoadWaitTimeoutMS) {
219-
Log.Warn("Level loading took more than 10s! Disabling level loading wait");
220-
}
221-
}
222-
} else {
223-
firstLevelLoaderFrame = true;
224207
}
225208
// Fast-forward through level exiting
226209
if (Engine.Scene is LevelExit { mode: LevelExit.Mode.Completed } exit) {
@@ -267,7 +250,7 @@ private static void On_Game_Tick(orig_Game_Tick orig, Game self) {
267250
Engine.Viewport = oldViewport;
268251

269252
// Recording might have stopped with the last update
270-
if (RecordingManager.RecordingVideo){
253+
if (RecordingManager.RecordingVideo && !skipCapturingFrame) {
271254
CaptureFrame();
272255
}
273256

0 commit comments

Comments
 (0)