Revert "tried optimization thing but it didnt worked lol"
This reverts commit e51b618baa.
This commit is contained in:
+1
-2
@@ -1,5 +1,4 @@
|
||||
export/
|
||||
latest/windows/obj/
|
||||
latest/windows/haxe/
|
||||
.vscode/
|
||||
**.png.bin
|
||||
.vscode/
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1369
|
||||
1354
|
||||
@@ -20,7 +20,7 @@ class CharacterEditor extends MusicBeatState {
|
||||
public override function create() {
|
||||
super.create();
|
||||
|
||||
add(new Stage("stage"));
|
||||
add(new Stage("default"));
|
||||
|
||||
character = new Character(770, 100, characterName, true);
|
||||
characterName = character.curCharacter;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package funkin.mods;
|
||||
|
||||
import funkin.options.Options;
|
||||
import lime.graphics.ImageBuffer;
|
||||
import lime.utils.Log;
|
||||
import lime.utils.AssetLibrary;
|
||||
import lime.utils.Assets as LimeAssets;
|
||||
@@ -98,23 +96,8 @@ class ModsFolderLibrary extends AssetLibrary implements ModsAssetLibrary {
|
||||
var path = getAssetPath();
|
||||
editedTimes[id] = FileSystem.stat(path).mtime.getTime();
|
||||
|
||||
var buffer:ImageBuffer = null;
|
||||
var image:Image;
|
||||
if (Options.enablePngBins) {
|
||||
if (PngBinHandler.exists(path)) {
|
||||
buffer = PngBinHandler.loadBinPng(path);
|
||||
@:privateAccess
|
||||
image = new Image(buffer);
|
||||
} else {
|
||||
@:privateAccess
|
||||
image = Image.fromFile(path);
|
||||
PngBinHandler.saveBinPng(image.buffer, path);
|
||||
}
|
||||
} else {
|
||||
@:privateAccess
|
||||
image = Image.fromFile(path);
|
||||
}
|
||||
return image;
|
||||
var e = Image.fromFile(path);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package funkin.mods;
|
||||
|
||||
import sys.FileSystem;
|
||||
import lime.utils.UInt8Array;
|
||||
import lime.graphics.ImageBuffer;
|
||||
import openfl.utils.ByteArray;
|
||||
import openfl.utils.Assets;
|
||||
import sys.io.File;
|
||||
|
||||
class PngBinHandler {
|
||||
public static function loadBinPng(path:String) {
|
||||
#if sys
|
||||
var bytes = File.getBytes('$path.bin');
|
||||
|
||||
var width:Int = bytes.getInt32(0);
|
||||
var height:Int = bytes.getInt32(4);
|
||||
var bitsPerPixel:Int = bytes.getUInt16(8);
|
||||
var pixelFormat:Int = bytes.getUInt16(10);
|
||||
|
||||
var imageBuffer = new ImageBuffer(UInt8Array.fromBytes(bytes, 12), width, height, bitsPerPixel, pixelFormat);
|
||||
|
||||
return imageBuffer;
|
||||
#else
|
||||
return null;
|
||||
#end
|
||||
}
|
||||
|
||||
public static function saveBinPng(buffer:ImageBuffer, path:String) {
|
||||
#if sys
|
||||
var array = new ByteArrayData(buffer.data.length + 12);
|
||||
array.writeInt(buffer.width);
|
||||
array.writeInt(buffer.height);
|
||||
array.writeShort(buffer.bitsPerPixel);
|
||||
array.writeShort(buffer.format);
|
||||
array.writeBytes(buffer.data.toBytes());
|
||||
File.saveBytes('$path.bin', array);
|
||||
#end
|
||||
}
|
||||
|
||||
public static function exists(path:String) {
|
||||
#if sys
|
||||
return FileSystem.exists('$path.bin');
|
||||
#else
|
||||
return false;
|
||||
#end
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ class Options
|
||||
public static var fpsCounter:Bool = true;
|
||||
public static var autoPause:Bool = true;
|
||||
public static var antialiasing:Bool = true;
|
||||
public static var enablePngBins:Bool = true; // optimization feature kinda which takes space on your computer!
|
||||
public static var volume:Float = 1;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user