Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
Added compatibility with alt anim-specific notes (by SNIFF charts)
Restarting the song or exiting to Freeplay now closes FFmpeg (if it's already running)
  • Loading branch information
JordanSantiagoYT committed Mar 22, 2024
1 parent 5cd0fc3 commit ab87fdd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class FreeplayState extends MusicBeatState
Paths.clearStoredMemory();
Paths.clearUnusedMemory();
Paths.gc();

if (PlayState.process != null) PlayState.stopRender();

persistentUpdate = true;
PlayState.isStoryMode = false;
Expand Down
7 changes: 5 additions & 2 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4025,6 +4025,8 @@ class PlayState extends MusicBeatState
if (swagNote.noteskin.length > 0 && !Paths.noteSkinFramesMap.exists(swagNote.noteskin)) inline Paths.initNote(4, swagNote.noteskin);

if(!Std.isOfType(songNotes[3], String)) swagNote.noteType = ChartingState.noteTypeList[songNotes[3]]; //Backward compatibility + compatibility with Week 7 charts

if(Std.isOfType(songNotes[3], Bool)) swagNote.animSuffix = (songNotes[3] || section.altAnim ? '-alt' : ''); //Compatibility with charts made by SNIFF

if (!noteTypeMap.exists(swagNote.noteType)) {
noteTypeMap.set(swagNote.noteType, true);
Expand Down Expand Up @@ -6410,6 +6412,7 @@ if (ClientPrefs.showNPS && (notesHitDateArray.length > 0 || oppNotesHitDateArray

public static function restartSong(noTrans:Bool = true)
{
if (process != null) stopRender();
PlayState.instance.paused = true; // For lua
if (ClientPrefs.songLoading) FlxG.sound.music.volume = 0;
if (ClientPrefs.songLoading) PlayState.instance.vocals.volume = 0;
Expand Down Expand Up @@ -9141,7 +9144,7 @@ if (ClientPrefs.showNPS && (notesHitDateArray.length > 0 || oppNotesHitDateArray

// Render mode stuff.. If SGWLC isn't ok with this I will remove it :thumbsup:

private var process:sys.io.Process;
public static var process:sys.io.Process;
var ffmpegExists:Bool = false;

private function initRender():Void
Expand Down Expand Up @@ -9171,7 +9174,7 @@ if (ClientPrefs.showNPS && (notesHitDateArray.length > 0 || oppNotesHitDateArray
process.stdin.writeBytes(bytes, 0, bytes.length);
}

public function stopRender():Void
public static function stopRender():Void
{
if (!ClientPrefs.ffmpegMode)
return;
Expand Down
2 changes: 1 addition & 1 deletion source/RenderingDoneSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RenderingDoneSubState extends MusicBeatSubstate {

override public function create() {
super.create();
PlayState.instance.stopRender();
PlayState.stopRender();

var leDate = Date.now();
if (leDate.getHours() >= 6 && leDate.getHours() <= 18) {
Expand Down

0 comments on commit ab87fdd

Please sign in to comment.