* well boys I fixed it. you can now have Zipped Mods!!!!! * comment update * quick fixes + optimizations * fixed stream audio bug???? * found the issue ffs * removing traces oops * fixed videos from not being able to play. Inspired from VideoCutscene's fix for ZIP videos, and also removed that fix in favor for just fixing the issue entirely * oop just in case no special characters that kill themself on other shit * Implemented preloading every video (caching) when loading a ZipFolderLibrary. Since videos have to be decompressed and be saved as a file anyways this reduces the time to do that, and what not. * [UNTESTED] Allowed Zip Extensions for allowing any extension in the list to be passed as a `.zip` * After some more testing loading Zip Addons works as well. * Added the long awaited .cnemod file type!!!!! (it's just a folder with .cnemod with a .zip inside LMAO) * Chalking up the Streamed Audio Bug to a mod issue, and also added capabilites to detect if a library is considered compressed * Added warning to those who try to use the editor with compressed libraries * ok instead of making it a .cnemod, the zip name will be `cnemod.zip` or what not. * removing unnessesary traces oops * clean Library accessor ig then * fixed small issues and removed an idiot idea * writing todos and fixing some context that left the room in comments * Fixed an issue where if you had a file of 0 bytes (nothing) in a zipped library it would FUCKING CRASH the game * Actually fixed the issue of decompressing 0 byte files Also stopped saving the data for Folders in Zipped files, as they are 0 bytes anyways. * Added the features that needed to exist, and removed a stupid line I saw in `ModsFolder` lol For some reason animation offsets for characters are breaking and I can't tell if its my drive killing itself or cne so uh * fix an issue that will force the game to crash if first ever mod being loaded is a ZipModLibrary
84 lines
1.9 KiB
Haxe
84 lines
1.9 KiB
Haxe
package funkin.menus;
|
|
|
|
#if MOD_SUPPORT
|
|
import flixel.tweens.FlxTween;
|
|
import flixel.util.FlxColor;
|
|
import funkin.backend.assets.ModsFolder;
|
|
import haxe.io.Path;
|
|
import sys.FileSystem;
|
|
|
|
class ModSwitchMenu extends MusicBeatSubstate {
|
|
var mods:Array<String> = [];
|
|
var alphabets:FlxTypedGroup<Alphabet>;
|
|
var curSelected:Int = 0;
|
|
|
|
var subCam:FlxCamera;
|
|
|
|
public override function create() {
|
|
super.create();
|
|
|
|
camera = subCam = new FlxCamera();
|
|
subCam.bgColor = 0;
|
|
FlxG.cameras.add(subCam, false);
|
|
|
|
var bg = new FlxSprite(0, 0).makeSolid(FlxG.width, FlxG.height, 0xFF000000);
|
|
bg.updateHitbox();
|
|
bg.scrollFactor.set();
|
|
add(bg);
|
|
|
|
bg.alpha = 0;
|
|
FlxTween.tween(bg, {alpha: 0.5}, 0.25, {ease: FlxEase.cubeOut});
|
|
|
|
mods = ModsFolder.getModsList();
|
|
mods.push(null);
|
|
|
|
alphabets = new FlxTypedGroup<Alphabet>();
|
|
for(mod in mods) {
|
|
var a = new Alphabet(0, 0, mod == null ? TU.translate("mods.disableMods") : Path.withoutExtension(mod), "bold");
|
|
if(mod == ModsFolder.currentModFolder)
|
|
a.color = FlxColor.LIME;
|
|
a.isMenuItem = true;
|
|
a.scrollFactor.set();
|
|
alphabets.add(a);
|
|
}
|
|
add(alphabets);
|
|
changeSelection(0, true);
|
|
}
|
|
|
|
public override function update(elapsed:Float) {
|
|
super.update(elapsed);
|
|
|
|
changeSelection((controls.DOWN_P ? 1 : 0) + (controls.UP_P ? -1 : 0) - FlxG.mouse.wheel);
|
|
|
|
if (controls.ACCEPT) {
|
|
ModsFolder.switchMod(mods[curSelected]);
|
|
close();
|
|
}
|
|
|
|
if (controls.BACK)
|
|
close();
|
|
}
|
|
|
|
public function changeSelection(change:Int, force:Bool = false) {
|
|
if (change == 0 && !force) return;
|
|
|
|
curSelected = FlxMath.wrap(curSelected + change, 0, alphabets.length-1);
|
|
|
|
CoolUtil.playMenuSFX(SCROLL, 0.7);
|
|
|
|
for(k=>alphabet in alphabets.members) {
|
|
alphabet.alpha = 0.6;
|
|
alphabet.targetY = k - curSelected;
|
|
}
|
|
alphabets.members[curSelected].alpha = 1;
|
|
}
|
|
|
|
override function destroy() {
|
|
super.destroy();
|
|
|
|
if (FlxG.cameras.list.contains(subCam))
|
|
FlxG.cameras.remove(subCam);
|
|
}
|
|
}
|
|
#end
|