From 225d9abd29b575b256ef5aa3ed0175229db75aed Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Tue, 20 Dec 2022 02:46:31 +0100 Subject: [PATCH] updater should be good now --- buildnumber.txt | 2 +- source/funkin/updating/AsyncUpdater.hx | 6 +++--- source/funkin/updating/UpdateScreen.hx | 2 +- source/funkin/updating/UpdateUtil.hx | 27 +++++++++++++++++--------- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index f21f44f5..f609192e 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1582 \ No newline at end of file +1585 \ No newline at end of file diff --git a/source/funkin/updating/AsyncUpdater.hx b/source/funkin/updating/AsyncUpdater.hx index 4cf1a5fa..6e43413f 100644 --- a/source/funkin/updating/AsyncUpdater.hx +++ b/source/funkin/updating/AsyncUpdater.hx @@ -58,7 +58,7 @@ class AsyncUpdater { progress.curZipProgress = new ZipProgress(); ZipUtils.uncompressZip(reader, './', null, progress.curZipProgress); - FileSystem.deleteFile(path); + // FileSystem.deleteFile(path); } if (executableReplaced = FileSystem.exists('$path$executableName')) { var progPath = Sys.programPath(); @@ -93,11 +93,11 @@ class AsyncUpdater { progress.files = 1; progress.step = DOWNLOADING_EXECUTABLE; trace('starting exe download'); - // doFile([exePath], [executableName], function() { + doFile([exePath], [executableName], function() { trace('done, starting installation'); installFiles(fileNames); progress.done = true; - // }); + }); }); } diff --git a/source/funkin/updating/UpdateScreen.hx b/source/funkin/updating/UpdateScreen.hx index 653da253..e793d32e 100644 --- a/source/funkin/updating/UpdateScreen.hx +++ b/source/funkin/updating/UpdateScreen.hx @@ -69,7 +69,7 @@ class UpdateScreen extends MusicBeatState { FlxG.sound.music.stop(); overSound.play(); bf.animation.curAnim.frameRate = 24; - bf.animation.play("loading-anim"); + bf.animation.play("loading-anim", true, false, 1); bf.alpha = 1; FlxG.camera.fade(0xFF000000, overSound.length / 1000, false, function() { if (updater.executableReplaced) { diff --git a/source/funkin/updating/UpdateUtil.hx b/source/funkin/updating/UpdateUtil.hx index 0515badb..494688a6 100644 --- a/source/funkin/updating/UpdateUtil.hx +++ b/source/funkin/updating/UpdateUtil.hx @@ -52,7 +52,7 @@ class UpdateUtil { }; } - static var __curVersionPos = 0; + static var __curVersionPos = -2; static function __doReleaseFiltering(releases:Array, currentVersionTag:String) { releases = releases.filterReleases(Options.betaUpdates, false); if (releases.length <= 0) @@ -60,24 +60,33 @@ class UpdateUtil { var newArray:Array = []; + var skipNextBinaryChecks:Bool = false; for(index in 0...releases.length) { - var i = releases.length - 1 - index; + var i = index; var release = releases[i]; - var containsBinary = false; - for(asset in release.assets) { - if (asset.name.toLowerCase() == AsyncUpdater.executableGitHubName.toLowerCase()) { - containsBinary = true; - break; + var containsBinary = skipNextBinaryChecks; + if (!containsBinary) { + for(asset in release.assets) { + if (asset.name.toLowerCase() == AsyncUpdater.executableGitHubName.toLowerCase()) { + containsBinary = true; + break; + } } } if (containsBinary) { + skipNextBinaryChecks = true; // no need to check for older versions if (release.tag_name == currentVersionTag) { - __curVersionPos = index; + __curVersionPos = -1; } - newArray.push(release); + newArray.insert(0, release); + if (__curVersionPos > -2) + __curVersionPos++; + trace(release.tag_name); } } + if (__curVersionPos < -1) + __curVersionPos = -1; return newArray.length <= 0 ? newArray : newArray.splice(__curVersionPos+1, newArray.length-(__curVersionPos+1)); }