From 7b3c9f1131ff9e4a1eef2ddcee5d07b8f5339495 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 6 Jun 2025 17:16:19 -0400 Subject: [PATCH 1/4] Update HXCPP to support the latest version of Tracy, check out the flame graph! --- hmm.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hmm.json b/hmm.json index 857a012ee..2d14e161e 100644 --- a/hmm.json +++ b/hmm.json @@ -118,7 +118,7 @@ "name": "hxcpp", "type": "git", "dir": null, - "ref": "43e368e3af08ea38bdc4ea9d4a7a9d4365941b9a", + "ref": "d5d9bd200e509f2e6022c8999c91543a0fda30c6", "url": "https://github.com/FunkinCrew/hxcpp" }, { From c6526527f1faa164bb058108c55a50603290f471 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 6 Jun 2025 17:33:04 -0400 Subject: [PATCH 2/4] Add HXCPP build to Prebuild, and add timer to Prebuild script --- source/Prebuild.hx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source/Prebuild.hx b/source/Prebuild.hx index 24c0a2ed4..060014c1b 100644 --- a/source/Prebuild.hx +++ b/source/Prebuild.hx @@ -21,15 +21,22 @@ class NewgroundsCredentials static function main():Void { - trace('[PREBUILD] Building...'); + var start:Float = Sys.time(); + trace('[PREBUILD] Performing pre-build tasks...'); saveBuildTime(); buildCredsFile(); + buildHXCPP(); + + var end:Float = Sys.time(); + var duration:Float = end - start; + trace('[PREBUILD] Finished pre-build tasks in $duration seconds.'); } static function saveBuildTime():Void { + // PostBuild.hx reads this file and computes the total build duration. var fo:sys.io.FileOutput = File.write(BUILD_TIME_FILE); var now:Float = Sys.time(); fo.writeDouble(now); @@ -51,4 +58,14 @@ class NewgroundsCredentials sys.io.File.saveContent(NG_CREDS_PATH, fileContents); } } + + static function buildHXCPP():Void + { + // This sometimes needs to be run on HXCPP development builds. + // It's quick enough to run that it saves work to just run it every time. + trace('[PREBUILD] Building HXCPP binaries...'); + + Sys.command("cd", [".\\.haxelib\\hxcpp\\git\\tools\\hxcpp"]); + Sys.command("haxe", ["compile.hxml"]); + } } From 285a607d9a48a2f5a254758368da64db20617df1 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 6 Jun 2025 17:33:42 -0400 Subject: [PATCH 3/4] Stop recreating the Hold Note graphic every time it is revived. This plugs a memory leak. --- source/funkin/play/notes/SustainTrail.hx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/source/funkin/play/notes/SustainTrail.hx b/source/funkin/play/notes/SustainTrail.hx index b37735cf6..12dbe18e3 100644 --- a/source/funkin/play/notes/SustainTrail.hx +++ b/source/funkin/play/notes/SustainTrail.hx @@ -73,8 +73,6 @@ class SustainTrail extends FlxSprite */ public var uvtData:DrawData = new DrawData(); - private var processedGraphic:FlxGraphic; - private var zoom:Float = 1; /** @@ -214,7 +212,6 @@ class SustainTrail extends FlxSprite // alpha = 0.6; alpha = 1.0; - // calls updateColorTransform(), which initializes processedGraphic! updateColorTransform(); updateClipping(); @@ -398,7 +395,7 @@ class SustainTrail extends FlxSprite // if (!isOnScreen(camera)) continue; // TODO: Update this code to make it work properly. getScreenPosition(_point, camera).subtractPoint(offset); - camera.drawTriangles(processedGraphic, vertices, indices, uvtData, null, _point, blend, true, antialiasing); + camera.drawTriangles(graphic, vertices, indices, uvtData, null, _point, blend, true, antialiasing); } #if FLX_DEBUG @@ -440,16 +437,7 @@ class SustainTrail extends FlxSprite vertices = null; indices = null; uvtData = null; - processedGraphic.destroy(); super.destroy(); } - - override function updateColorTransform():Void - { - super.updateColorTransform(); - if (processedGraphic != null) processedGraphic.destroy(); - processedGraphic = FlxGraphic.fromGraphic(graphic, true); - processedGraphic.bitmap.colorTransform(processedGraphic.bitmap.rect, colorTransform); - } } From 72a6b92daf4526ba32e5ac01e15267d895841bcf Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 6 Jun 2025 20:46:50 -0400 Subject: [PATCH 4/4] Remove auto-rebuilding of HXCPP (it forces the game to clean build every time) --- source/Prebuild.hx | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/source/Prebuild.hx b/source/Prebuild.hx index 060014c1b..7102d826b 100644 --- a/source/Prebuild.hx +++ b/source/Prebuild.hx @@ -27,7 +27,6 @@ class NewgroundsCredentials saveBuildTime(); buildCredsFile(); - buildHXCPP(); var end:Float = Sys.time(); var duration:Float = end - start; @@ -58,14 +57,4 @@ class NewgroundsCredentials sys.io.File.saveContent(NG_CREDS_PATH, fileContents); } } - - static function buildHXCPP():Void - { - // This sometimes needs to be run on HXCPP development builds. - // It's quick enough to run that it saves work to just run it every time. - trace('[PREBUILD] Building HXCPP binaries...'); - - Sys.command("cd", [".\\.haxelib\\hxcpp\\git\\tools\\hxcpp"]); - Sys.command("haxe", ["compile.hxml"]); - } }