diff --git a/Project.xml b/Project.xml
index dca9035c..d85e6216 100644
--- a/Project.xml
+++ b/Project.xml
@@ -131,11 +131,15 @@
+
+
+
+
diff --git a/buildnumber.txt b/buildnumber.txt
index f3409cd6..929701d3 100644
--- a/buildnumber.txt
+++ b/buildnumber.txt
@@ -1 +1 @@
-2204
\ No newline at end of file
+2220
\ No newline at end of file
diff --git a/source/funkin/system/FunkinGame.hx b/source/funkin/system/FunkinGame.hx
new file mode 100644
index 00000000..a3e7f079
--- /dev/null
+++ b/source/funkin/system/FunkinGame.hx
@@ -0,0 +1,13 @@
+package funkin.system;
+
+import flixel.FlxState;
+import flixel.FlxGame;
+
+class FunkinGame extends FlxGame {
+ public function new(gameWidth = 0, gameHeight = 0, ?initialState:Class, updateFramerate = 60, drawFramerate = 60, skipSplash = false, startFullscreen = false) {
+ super(gameWidth, gameHeight, initialState, 1, updateFramerate, drawFramerate, skipSplash, startFullscreen);
+ #if (cpp && ENABLE_PROFILER)
+ cpp.vm.Profiler.start('./profiler.txt');
+ #end
+ }
+}
\ No newline at end of file
diff --git a/source/funkin/system/FunkinProfiler.hx b/source/funkin/system/FunkinProfiler.hx
new file mode 100644
index 00000000..0f320738
--- /dev/null
+++ b/source/funkin/system/FunkinProfiler.hx
@@ -0,0 +1,64 @@
+package funkin.system;
+
+import flixel.util.FlxDestroyUtil.IFlxDestroyable;
+import flixel.util.FlxPool;
+class FunkinProfiler {
+ private static var __pool:FlxPool = new FlxPool(FunkinProfilerEvent);
+ private static inline function __getEvent(name:String)
+ return __pool.get().set(name);
+
+ public static var events:Array = [];
+
+ public static function reset() {
+ for(e in events)
+ e.recycle();
+ }
+
+ public static function registerEvent(event:String, level:Int = 0) {
+ var curEventsArray = events;
+ var l:Int = 0;
+ var ev:FunkinProfilerEvent;
+ while(l < level) {
+ ev = curEventsArray.last();
+ if (ev == null)
+ curEventsArray.push(ev = __getEvent("Unknown"));
+ curEventsArray = ev.childs;
+ l++;
+ }
+
+ curEventsArray.push(__getEvent(event));
+ }
+
+}
+
+class FunkinProfilerEvent implements IFlxDestroyable {
+ public var name:String = null;
+ public var childs:Array = [];
+
+ public function new() {}
+
+ public function set(name:String):FunkinProfilerEvent {
+ this.name = name;
+ if (childs != null)
+ while(childs.length > 0)
+ childs.shift();
+ else
+ childs = [];
+ return this;
+ }
+
+ public function destroy() {
+ name = null;
+ childs = null;
+ }
+
+ public function recycle() {
+ name = null;
+ if (childs != null)
+ for(c in childs)
+ if (c != null)
+ c.recycle();
+ @:privateAccess
+ FunkinProfiler.__pool.put(this);
+ }
+}
\ No newline at end of file
diff --git a/source/funkin/system/Main.hx b/source/funkin/system/Main.hx
index a3073244..d6ba2e4c 100644
--- a/source/funkin/system/Main.hx
+++ b/source/funkin/system/Main.hx
@@ -100,7 +100,7 @@ class Main extends Sprite
}
- addChild(new FlxGame(gameWidth, gameHeight, null, zoom, framerate, framerate, skipSplash, startFullscreen));
+ addChild(new FunkinGame(gameWidth, gameHeight, null, framerate, framerate, skipSplash, startFullscreen));
loadGameSettings();
// FlxG.switchState(new TitleState());
FlxG.switchState(new funkin.menus.BetaWarningState());