Compare commits

..

4 Commits

15 changed files with 137 additions and 42 deletions

View File

@ -16,7 +16,7 @@
<!--Minimum without FLX_NO_GAMEPAD: 11.8, without FLX_NO_NATIVE_CURSOR: 11.2--> <!--Minimum without FLX_NO_GAMEPAD: 11.8, without FLX_NO_NATIVE_CURSOR: 11.2-->
<set name="SWF_VERSION" value="11.8" /> <set name="SWF_VERSION" value="11.8" />
*
<!-- ____________________________ Window Settings ___________________________ --> <!-- ____________________________ Window Settings ___________________________ -->
<!--These window settings apply to all targets--> <!--These window settings apply to all targets-->
@ -166,8 +166,6 @@
<!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!--> <!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!-->
<haxedef name="FLX_NO_DEBUG" unless="debug" /> <haxedef name="FLX_NO_DEBUG" unless="debug" />
<haxedef name="HXCPP_GC_BIG_BLOCKS"/>
<!--Enable this for Nape release builds for a serious peformance improvement--> <!--Enable this for Nape release builds for a serious peformance improvement-->
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" /> <haxedef name="NAPE_RELEASE_BUILD" unless="debug" />

View File

@ -14,19 +14,19 @@
- Linux: install the `git` package: `sudo apt install git` (ubuntu), `sudo pacman -S git` (arch), etc... (you probably already have it) - Linux: install the `git` package: `sudo apt install git` (ubuntu), `sudo pacman -S git` (arch), etc... (you probably already have it)
4. Install and set up the necessary libraries: 4. Install and set up the necessary libraries:
- `haxelib install lime 7.9.0` - `haxelib install lime 7.9.0`
- `haxelib install openfl` - `haxelib install openfl 9.1.0`
- `haxelib install flixel` - `haxelib install flixel 4.11.0`
- `haxelib run lime setup` - `haxelib run lime setup`
- `haxelib run lime setup flixel` - `haxelib run lime setup flixel`
- `haxelib install flixel-tools` - `haxelib install flixel-tools`
- `haxelib run flixel-tools setup` - `haxelib run flixel-tools setup`
- `haxelib install flixel-addons` - `haxelib install flixel-addons 2.11.0`
- `haxelib install flixel-ui` - `haxelib install flixel-ui 2.4.0`
- `haxelib install hscript` - `haxelib install hscript 2.3.0`
- `haxelib install newgrounds` - `haxelib install newgrounds 1.1.5`
- `haxelib git linc_luajit https://github.com/AndreiRudenko/linc_luajit.git` - `haxelib git linc_luajit https://github.com/AndreiRudenko/linc_luajit.git`
- `haxelib git faxe https://github.com/uhrobots/faxe` - `haxelib git faxe https://github.com/uhrobots/faxe`
- `haxelib git polymod https://github.com/larsiusprime/polymod.git` - `haxelib install polymod 1.3.0`
- `haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc` - `haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc`
- `haxelib install actuate` - `haxelib install actuate`
- `haxelib git extension-webm https://github.com/KadeDev/extension-webm` - `haxelib git extension-webm https://github.com/KadeDev/extension-webm`

View File

@ -1,7 +0,0 @@
package;
class APIStuff
{
public static var API:String = "";
public static var EncKey:String = "";
}

View File

@ -60,9 +60,9 @@ class DiffOverview extends FlxSubState
FlxG.cameras.add(camGame); FlxG.cameras.add(camGame);
FlxG.cameras.add(camHUD); FlxG.cameras.add(camHUD, false);
FlxCamera.defaultCameras = [camGame]; //FlxG.cameras.setDefaultDrawTarget(camGame,true);
playerStrums = new FlxTypedGroup<FlxSprite>(); playerStrums = new FlxTypedGroup<FlxSprite>();

View File

@ -1,5 +1,6 @@
package; package;
import cpp.vm.Gc;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxObject; import flixel.FlxObject;
import flixel.FlxSubState; import flixel.FlxSubState;
@ -16,6 +17,10 @@ class GameOverSubstate extends MusicBeatSubstate
public function new(x:Float, y:Float) public function new(x:Float, y:Float)
{ {
if (!FlxG.save.data.GC) {
Gc.enable(true);
trace("Player died. We can reenable the garbage collector");
}
var daStage = PlayState.curStage; var daStage = PlayState.curStage;
var daBf:String = ''; var daBf:String = '';
switch (PlayState.SONG.player1) switch (PlayState.SONG.player1)

View File

@ -46,11 +46,12 @@ class KadeEngineData
if (FlxG.save.data.fpsRain == null) if (FlxG.save.data.fpsRain == null)
FlxG.save.data.fpsRain = false; FlxG.save.data.fpsRain = false;
if (FlxG.save.data.fpsCap == null) /*if (FlxG.save.data.fpsCap == null)
FlxG.save.data.fpsCap = 120; FlxG.save.data.fpsCap = 120;*/
if (FlxG.save.data.fpsCap > 285 || FlxG.save.data.fpsCap < 60) if (FlxG.save.data.fpsCap > 1000 || FlxG.save.data.fpsCap < 60)
FlxG.save.data.fpsCap = 120; // baby proof so you can't hard lock ur copy of kade engine //FlxG.save.data.fpsCap = 120; // baby proof so you can't hard lock ur copy of kade engine
trace("nerd");
if (FlxG.save.data.scrollSpeed == null) if (FlxG.save.data.scrollSpeed == null)
FlxG.save.data.scrollSpeed = 1; FlxG.save.data.scrollSpeed = 1;
@ -118,6 +119,9 @@ class KadeEngineData
if (FlxG.save.data.zoom == null) if (FlxG.save.data.zoom == null)
FlxG.save.data.zoom = 1; FlxG.save.data.zoom = 1;
if (FlxG.save.data.GC == null)
FlxG.save.data.GC == true;
var gamepad:FlxGamepad = FlxG.gamepads.lastActive; var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
KeyBinds.gamepad = gamepad != null; KeyBinds.gamepad = gamepad != null;

View File

@ -1,5 +1,6 @@
package; package;
import cpp.vm.Gc;
import lime.app.Application; import lime.app.Application;
#if windows #if windows
import Discord.DiscordClient; import Discord.DiscordClient;
@ -102,6 +103,8 @@ class Main extends Sprite
fpsCounter = new FPS(10, 3, 0xFFFFFF); fpsCounter = new FPS(10, 3, 0xFFFFFF);
addChild(fpsCounter); addChild(fpsCounter);
toggleFPS(FlxG.save.data.fps); toggleFPS(FlxG.save.data.fps);
memory = new Memory(10, 15, 0xFFFFFF);
addChild(memory);
#end #end
} }
@ -109,6 +112,8 @@ class Main extends Sprite
var fpsCounter:FPS; var fpsCounter:FPS;
var memory:Memory;
public function toggleFPS(fpsEnabled:Bool):Void { public function toggleFPS(fpsEnabled:Bool):Void {
fpsCounter.visible = fpsEnabled; fpsCounter.visible = fpsEnabled;
} }

49
source/Memory.hx Normal file
View File

@ -0,0 +1,49 @@
package;
import flixel.util.FlxStringUtil;
import openfl.events.Event;
import openfl.text.TextFormat;
import cpp.vm.Gc;
import openfl.text.TextField;
import openfl.Lib;
class Memory extends TextField {
//private var overCounter = 0;
//private var isOver = false;
@:noCompletion private var cacheCount:Int;
@:noCompletion private var currentTime:Float;
@:noCompletion private var times:Array<Float>;
public function new(x:Float = 15, y:Float = 20, color:Int = 0x000000) {
super();
this.x = x;
this.y = y;
this.width = 150;
defaultTextFormat = new TextFormat("_sans", 12, color);
text = "Memory: ";
addEventListener(Event.ENTER_FRAME, function(e)
{
/*var usedMemory:Float = Gc.memUsage();
if (Gc.memUsage() < 0 && !isOver)
{
isOver = true;
}
if (Gc.memUsage() > 0 && isOver)
{
overCounter++;
isOver = false;
}
if (isOver) {
usedMemory = 2147483647+(2147483647-(Math.abs(Gc.memUsage()))); // funny math to represent values over 2GB
}*/
text = "Memory: " + FlxStringUtil.formatBytes(/*usedMemory + 4294967296*overCounter*/ Gc.memInfo64(0));
/*for (i in 0...4) {
text += "\nMemory info " + i + ": " + FlxStringUtil.formatBytes(Gc.memInfo64(i));
}*/
});
}
}

View File

@ -530,10 +530,10 @@ class FPSCapOption extends Option
} }
override function right():Bool { override function right():Bool {
if (FlxG.save.data.fpsCap >= 290) if (FlxG.save.data.fpsCap >= 1000)
{ {
FlxG.save.data.fpsCap = 290; FlxG.save.data.fpsCap = 1000;
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(290); (cast (Lib.current.getChildAt(0), Main)).setFPSCap(1000);
} }
else else
FlxG.save.data.fpsCap = FlxG.save.data.fpsCap + 10; FlxG.save.data.fpsCap = FlxG.save.data.fpsCap + 10;
@ -543,8 +543,8 @@ class FPSCapOption extends Option
} }
override function left():Bool { override function left():Bool {
if (FlxG.save.data.fpsCap > 290) if (FlxG.save.data.fpsCap > 1000)
FlxG.save.data.fpsCap = 290; FlxG.save.data.fpsCap = 1000;
else if (FlxG.save.data.fpsCap < 60) else if (FlxG.save.data.fpsCap < 60)
FlxG.save.data.fpsCap = Application.current.window.displayMode.refreshRate; FlxG.save.data.fpsCap = Application.current.window.displayMode.refreshRate;
else else
@ -631,6 +631,27 @@ class RainbowFPSOption extends Option
} }
} }
class GarbageCollection extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.GC = !FlxG.save.data.GC;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Garbage Collection " + ((FlxG.save.data.GC) ? " ON " : "OFF") ;
}
}
class Optimization extends Option class Optimization extends Option
{ {
public function new(desc:String) public function new(desc:String)
@ -946,6 +967,7 @@ class ResetSettings extends Option
FlxG.save.data.optimize = null; FlxG.save.data.optimize = null;
FlxG.save.data.cacheImages = null; FlxG.save.data.cacheImages = null;
FlxG.save.data.editor = null; FlxG.save.data.editor = null;
FlxG.save.data.GC = null;
KadeEngineData.initSave(); KadeEngineData.initSave();
confirm = false; confirm = false;

View File

@ -60,6 +60,7 @@ class OptionsMenu extends MusicBeatState
new MissSoundsOption("Toggle miss sounds playing when you don't hit a note."), new MissSoundsOption("Toggle miss sounds playing when you don't hit a note."),
new ScoreScreen("Show the score screen after the end of a song"), new ScoreScreen("Show the score screen after the end of a song"),
new ShowInput("Display every single input on the score screen."), new ShowInput("Display every single input on the score screen."),
new GarbageCollection("Reduces lag at the cost of immense RAM usage."),
new Optimization("No characters or backgrounds. Just a usual rhythm game layout."), new Optimization("No characters or backgrounds. Just a usual rhythm game layout."),
new GraphicLoading("On startup, cache every character. Significantly decrease load times. (HIGH MEMORY)"), new GraphicLoading("On startup, cache every character. Significantly decrease load times. (HIGH MEMORY)"),
new BotPlay("Showcase your charts and mods with autoplay.") new BotPlay("Showcase your charts and mods with autoplay.")

View File

@ -128,12 +128,12 @@ class Paths
inline static public function getSparrowAtlas(key:String, ?library:String, ?isCharacter:Bool = false) inline static public function getSparrowAtlas(key:String, ?library:String, ?isCharacter:Bool = false)
{ {
var usecahce = FlxG.save.data.cacheImages; var useCache = FlxG.save.data.cacheImages;
#if !cpp #if !cpp
usecahce = false; useCache = false;
#end #end
if (isCharacter) if (isCharacter)
if (usecahce) if (useCache)
#if cpp #if cpp
return FlxAtlasFrames.fromSparrow(imageCached(key), file('images/characters/$key.xml', library)); return FlxAtlasFrames.fromSparrow(imageCached(key), file('images/characters/$key.xml', library));
#else #else

View File

@ -81,7 +81,7 @@ class PauseSubState extends MusicBeatSubstate
perSongOffset = new FlxText(5, FlxG.height - 18, 0, "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.', 12); perSongOffset = new FlxText(5, FlxG.height - 18, 0, "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.', 12);
perSongOffset.scrollFactor.set(); perSongOffset.scrollFactor.set();
perSongOffset.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); perSongOffset.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
#if cpp #if cpp
add(perSongOffset); add(perSongOffset);
#end #end
@ -225,6 +225,10 @@ class PauseSubState extends MusicBeatSubstate
PlayState.instance.clean(); PlayState.instance.clean();
FlxG.resetState(); FlxG.resetState();
case "Exit to menu": case "Exit to menu":
if (!FlxG.save.data.GC) {
cpp.vm.Gc.enable(true);
trace("Exiting the song. We can reenable the garbage collector");
}
PlayState.startTime = 0; PlayState.startTime = 0;
if (PlayState.instance.useVideo) if (PlayState.instance.useVideo)
{ {
@ -246,8 +250,8 @@ class PauseSubState extends MusicBeatSubstate
PlayState.luaModchart = null; PlayState.luaModchart = null;
} }
#end #end
if (FlxG.save.data.fpsCap > 290) if (FlxG.save.data.fpsCap > 1000)
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(290); (cast (Lib.current.getChildAt(0), Main)).setFPSCap(1000);
PlayState.instance.clean(); PlayState.instance.clean();

View File

@ -1,6 +1,7 @@
package; package;
import cpp.vm.Gc;
import Song.Event; import Song.Event;
import openfl.media.Sound; import openfl.media.Sound;
#if sys #if sys
@ -400,13 +401,13 @@ class PlayState extends MusicBeatState
camNotes.bgColor.alpha = 0; camNotes.bgColor.alpha = 0;
FlxG.cameras.reset(camGame); FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD); FlxG.cameras.add(camHUD, false);
FlxG.cameras.add(camSustains); FlxG.cameras.add(camSustains, false);
FlxG.cameras.add(camNotes); FlxG.cameras.add(camNotes, false);
camHUD.zoom = PlayStateChangeables.zoom; camHUD.zoom = PlayStateChangeables.zoom;
FlxCamera.defaultCameras = [camGame]; //FlxG.cameras.setDefaultDrawTarget(camGame, true);
persistentUpdate = true; persistentUpdate = true;
persistentDraw = true; persistentDraw = true;
@ -1692,6 +1693,10 @@ class PlayState extends MusicBeatState
function startSong():Void function startSong():Void
{ {
if (!FlxG.save.data.GC) {
Gc.enable(false);
trace("Song started. Garbage collection has been disabled");
}
startingSong = false; startingSong = false;
songStarted = true; songStarted = true;
previousFrameTime = FlxG.game.ticks; previousFrameTime = FlxG.game.ticks;
@ -3313,6 +3318,10 @@ class PlayState extends MusicBeatState
function endSong():Void function endSong():Void
{ {
if (!FlxG.save.data.GC) {
Gc.enable(true);
trace("Song ended. We can reenable the garbage collector");
}
endingSong = true; endingSong = true;
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput);
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput);
@ -3334,8 +3343,8 @@ class PlayState extends MusicBeatState
PlayStateChangeables.useDownscroll = false; PlayStateChangeables.useDownscroll = false;
} }
if (FlxG.save.data.fpsCap > 290) if (FlxG.save.data.fpsCap > 1000)
(cast(Lib.current.getChildAt(0), Main)).setFPSCap(290); (cast(Lib.current.getChildAt(0), Main)).setFPSCap(1000);
#if cpp #if cpp
if (luaModchart != null) if (luaModchart != null)

View File

@ -40,7 +40,7 @@ class TimingStruct
if (msTime >= i.startTime * 1000 && msTime < (i.startTime + i.length) * 1000) if (msTime >= i.startTime * 1000 && msTime < (i.startTime + i.length) * 1000)
return i; return i;
} }
trace('Apparently ' + msTime + ' is out of any segs'); /*trace('Apparently ' + msTime + ' is out of any segs');*/
return null; return null;
} }

View File

@ -54,7 +54,7 @@ class TitleState extends MusicBeatState
override public function create():Void override public function create():Void
{ {
#if polymod #if polymod
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']}); //polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']});
#end #end
#if sys #if sys
@ -290,6 +290,11 @@ class TitleState extends MusicBeatState
MainMenuState.firstStart = true; MainMenuState.firstStart = true;
MainMenuState.finishedFunnyMove = false; MainMenuState.finishedFunnyMove = false;
new FlxTimer().start(2, function(tmr:FlxTimer)
{
FlxG.switchState(new MainMenuState());
clean();
});
// FlxG.sound.play(Paths.music('titleShoot'), 0.7); // FlxG.sound.play(Paths.music('titleShoot'), 0.7);
} }