Skip to content

Commit

Permalink
gwa
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackx2 committed Mar 5, 2025
1 parent fe96f28 commit 9afbdf7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
8 changes: 4 additions & 4 deletions source/funkin/backend/system/initialization/Logs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ import funkin.backend.utils.native.Terminal.TColor;
* Trace with color + prefix support.
* (NOTICE: uses threading, only if `THREADING_ALLOWED` is allowed).
*/
public static function prefixedTrace(x:Dynamic, customPrefix:String, ?color:TColor, ?infos:PosInfos):Void
public static function prefixedTrace(x:Dynamic, ?customPrefix:String, ?color:TColor, ?infos:PosInfos):Void
{
#if THREADING_ALLOWED mutex.acquire(); #end // it looks ugly, ik...
final oldPrefix:String = prefix;
prefix = customPrefix;
final prevPrefix:String = prefix;
prefix = customPrefix ??="invalid prefix";
print(x, color, infos);
prefix = oldPrefix;
prefix = prevPrefix;
#if THREADING_ALLOWED mutex.release(); #end
}

Expand Down
23 changes: 15 additions & 8 deletions source/funkin/backend/system/scripts/GlobalScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ class GlobalScript
{
public static var instance:GlobalScript = null;

public static function init() : Void {
instance = Type.createInstance(GlobalScript, []);
}
public static function init():Void
{
try
{
instance = Type.createInstance(GlobalScript, []);
Logs.prefixedTrace('Successfully initialized', 'GlobalScript', GREEN);
}
catch (error:Dynamic)
Logs.prefixedTrace('Failed to initialized : $error', 'GlobalScript', RED);
}

#if HSCRIPT_ALLOWED
#if HSCRIPT_ALLOWED
/**
* An `array` full of all init'd hscript files.
*/
Expand All @@ -20,15 +27,15 @@ class GlobalScript
private var instancesExclude:Array<String> = [];
#end

#if LUA_ALLOWED
#if LUA_ALLOWED
/**
* An array of all running lua scripts?
* i need to check :3c -orbl
*/
public var luaArray:Array<FunkinLua> = [];
#end
#end

#if LUA_ALLOWED
#if LUA_ALLOWED
public function startLuasNamed(luaFile:String)
{
for (script in GlobalScript.instance.luaArray)
Expand Down Expand Up @@ -68,7 +75,7 @@ class GlobalScript
#if HSCRIPT_ALLOWED
public function startHScriptsNamed(scriptFile:String)
{
var scriptToLoad:String;
var scriptToLoad:String;
#if MODS_ALLOWED
scriptToLoad = Paths.modFolders(scriptFile);
if (!FileSystem.exists(scriptToLoad))
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/game/Init.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class Init extends flixel.FlxState
funkin.backend.utils.ClientPrefs.init();
this.init();

GlobalScript.init();
#if desktop funkin.backend.system.initialization.TemporaryFolder.init(); #end
#if LUA_ALLOWED Lua.set_callbacks_function(cpp.Callable.fromStaticFunction(CallbackHandler.call)); #end
#if CRASH_HANDLER CrashLogger.init(); #end
Expand All @@ -56,6 +55,7 @@ class Init extends flixel.FlxState
#if SHADERS_ALLOWED ShaderCoordsFix.init(); #end
#if windows AudioSwitchFix.init(); #end
#if HSCRIPT_ALLOWED IrisConfig.init(); #end
GlobalScript.init();

funkin.game.objects.Alphabet.AlphaCharacter.loadAlphabetData();

Expand Down
2 changes: 1 addition & 1 deletion source/funkin/game/states/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class FreeplayState extends MusicBeatState
Song.loadFromJson(poop, songLowercase);
PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty;
Logs.prefixedTrace('CURRENT WEEK: ${WeekData.getWeekFileName()}','Freeplay', GREEN);
Logs.prefixedTrace('Current Week: ${WeekData.getWeekFileName()}', 'Freeplay', GREEN);
}
catch(e:haxe.Exception)
{
Expand Down

0 comments on commit 9afbdf7

Please sign in to comment.