Skip to content

Commit

Permalink
yeah...
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackx2 committed Mar 3, 2025
1 parent 5c63c28 commit 511a7fb
Show file tree
Hide file tree
Showing 12 changed files with 406 additions and 280 deletions.
13 changes: 4 additions & 9 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@
<!-- Shows the loading screen. -->
<define name="SHOW_LOADING_SCREEN" />

<!--
Enables watermarks for unreleased mods.
Uses Md5 hashing system to hash the players system username.(soo u can unhash iguess it just looks cool 😎)
Also checks for a discord client and shows that name too!!!
and userid LOL!!!!!!!!!!!
helps find out who leak!!!!!!!!!!!!!!
md5 cannot be reversed so just hash there name and if the hash is the same u got them >:)
Used for beta testers lol!
-->
<!-- <define name="WATERMARK" /> -->

<!-- Enables astro engine watermarks. -->
Expand All @@ -59,6 +50,8 @@
<!-- Enables Hscript Iris Debug Stuff -->
<define name="IRIS_DEBUG"/>

<define name="MULTITHREADED_LOADING"/>

<!-- Enables HScript Support -->
<define name="HSCRIPT_ALLOWED" if="desktop" />

Expand Down Expand Up @@ -98,6 +91,8 @@
<!-- Crash handler -->
<define name="CRASH_HANDLER" if="desktop release" />

<!-- <define name="SKIP_SPLASH_SCREEN" /> -->

<!-- DONT ENABLE THIS -->
<define name="CHECK_FOR_UPDATES" if="desktop officialBuild"/>

Expand Down
46 changes: 35 additions & 11 deletions source/funkin/backend/ShaderBackend.hx
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
package funkin.backend;

@:access(funkin.backend.system.MusicBeatState)
class ShaderBackend extends flixel.system.FlxAssets.FlxShader
{ // all shaders to be added to dis thing
public function new()
/**
* All non runtime shaders should extend from this abstract class.
*/
@:access(funkin.backend.system.MusicBeatState._shaderGroup)
abstract class ShaderBackend extends flixel.system.FlxAssets.FlxShader
{
/**
* Constructor function.
*/
public function new():Void
{
/**
* Call the parent constructor
*/
super();

if (cast FlxG.state is MusicBeatState)
/**
* Check if the current state is an instance of MusicBeatState
*/
if (Std.is(flixel.FlxG.state, MusicBeatState))
{
final state:Dynamic = FlxG.state;
if(state.shaderGroup == null)
state.shaderGroup = [];
trace('pushed shader');
state.shaderGroup.push(this);
/**
* Grabs the current state from `FlxG.state`.
*/
final currentState:MusicBeatState = cast(flixel.FlxG.state, MusicBeatState);

/**
* If `_shaderGroup` equals null set it to `[]`.
*/
currentState._shaderGroup ??= [];

/**
* Pushes `this` to `_shadeGroup`.
*/
currentState._shaderGroup.push(this);
}
}

private function update(elapsed:Float):Void{}
/**
* Update function.
*/
@:dox(hide) function update(elapsed:Float):Void {}
}
74 changes: 1 addition & 73 deletions source/funkin/backend/objects/editers/FileDialogHandler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import lime.ui.*;
import flixel.FlxBasic;

//Currently only supports OPEN and SAVE, might change that in the future, who knows
@:access(funkin.backend.objects.editers.FileReferenceCustom)
class FileDialogHandler extends FlxBasic
{
var _fileRef:FileReferenceCustom;
Expand Down Expand Up @@ -87,7 +88,6 @@ class FileDialogHandler extends FlxBasic
public var completed:Bool = true;
function onSaveComplete(_)
{
@:privateAccess
this.path = _fileRef._trackSavedPath;
this.completed = true;
trace('Saved file to: $path');
Expand All @@ -99,7 +99,6 @@ class FileDialogHandler extends FlxBasic

function onLoadComplete(_)
{
@:privateAccess
this.path = _fileRef.__path;
this.data = File.getContent(this.path);
this.completed = true;
Expand All @@ -113,7 +112,6 @@ class FileDialogHandler extends FlxBasic

function onLoadDirectoryComplete(_)
{
@:privateAccess
this.path = _fileRef.__path;
this.completed = true;
trace('Loaded directory: $path');
Expand Down Expand Up @@ -170,74 +168,4 @@ class FileDialogHandler extends FlxBasic
completed = true;
super.destroy();
}
}

//Only way I could find to keep the path after saving a file
class FileReferenceCustom extends FileReference
{
@:allow(backend.FileDialogHandler)
var _trackSavedPath:String;
override function saveFileDialog_onSelect(path:String):Void
{
_trackSavedPath = path;
super.saveFileDialog_onSelect(path);
}

public function browseEx(browseType:FileDialogType = OPEN, ?defaultName:String, ?title:String = null, ?typeFilter:Array<FileFilter> = null):Bool
{
__data = null;
__path = null;

#if desktop
var filter = null;

if (typeFilter != null)
{
var filters = [];

for (type in typeFilter)
{
filters.push(StringTools.replace(StringTools.replace(type.extension, "*.", ""), ";", ","));
}

filter = filters.join(";");
}

var openFileDialog = new FileDialog();
openFileDialog.onCancel.add(openFileDialog_onCancel);
openFileDialog.onSelect.add(openFileDialog_onSelect);
openFileDialog.browse(browseType, filter, defaultName, title);
return true;
#elseif (js && html5)
var filter = null;
if (typeFilter != null)
{
var filters = [];
for (type in typeFilter)
{
filters.push(StringTools.replace(StringTools.replace(type.extension, "*.", "."), ";", ","));
}
filter = filters.join(",");
}
if (filter != null)
{
__inputControl.setAttribute("accept", filter);
}
__inputControl.onchange = function()
{
var file = __inputControl.files[0];
modificationDate = Date.fromTime(file.lastModified);
creationDate = modificationDate;
size = file.size;
type = "." + Path.extension(file.name);
name = Path.withoutDirectory(file.name);
__path = file.name;
dispatchEvent(new Event(Event.SELECT));
}
__inputControl.click();
return true;
#end

return false;
}
}
76 changes: 76 additions & 0 deletions source/funkin/backend/objects/editers/FileReferenceCustom.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package funkin.backend.objects.editers;

import lime.ui.FileDialog;
import openfl.net.FileFilter;
import lime.ui.FileDialogType;
import openfl.net.FileReference;

//Only way I could find to keep the path after saving a file
class FileReferenceCustom extends FileReference
{
@:allow(backend.FileDialogHandler)
var _trackSavedPath:String;
override function saveFileDialog_onSelect(path:String):Void
{
_trackSavedPath = path;
super.saveFileDialog_onSelect(path);
}

public function browseEx(browseType:FileDialogType = OPEN, ?defaultName:String, ?title:String = null, ?typeFilter:Array<FileFilter> = null):Bool
{
__data = null;
__path = null;

#if desktop
var filter = null;

if (typeFilter != null)
{
var filters = [];

for (type in typeFilter)
{
filters.push(StringTools.replace(StringTools.replace(type.extension, "*.", ""), ";", ","));
}

filter = filters.join(";");
}

var openFileDialog = new FileDialog();
openFileDialog.onCancel.add(openFileDialog_onCancel);
openFileDialog.onSelect.add(openFileDialog_onSelect);
openFileDialog.browse(browseType, filter, defaultName, title);
return true;
#elseif (js && html5)
var filter = null;
if (typeFilter != null)
{
var filters = [];
for (type in typeFilter)
{
filters.push(StringTools.replace(StringTools.replace(type.extension, "*.", "."), ";", ","));
}
filter = filters.join(",");
}
if (filter != null)
{
__inputControl.setAttribute("accept", filter);
}
__inputControl.onchange = function()
{
var file = __inputControl.files[0];
modificationDate = Date.fromTime(file.lastModified);
creationDate = modificationDate;
size = file.size;
type = "." + Path.extension(file.name);
name = Path.withoutDirectory(file.name);
__path = file.name;
dispatchEvent(new Event(Event.SELECT));
}
__inputControl.click();
return true;
#end

return false;
}
}
16 changes: 6 additions & 10 deletions source/funkin/backend/system/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import funkin.backend.utils.Controls;
import flixel.FlxCamera;
import flixel.FlxBasic;

@:access(funkin.backend.ShaderBackend.update)
abstract class MusicBeatState extends FlxState
{
private var shaderGroup:Array<ShaderBackend>;
private var _shaderGroup:Array<ShaderBackend>;

private var customCameraLoaded:Bool = false;

Expand All @@ -35,7 +36,7 @@ abstract class MusicBeatState extends FlxState
override function create():Void
{
var skip:Bool = FlxTransitionableState.skipNextTransOut;
shaderGroup = null;
_shaderGroup = null;
super.create();

if (!customCameraLoaded)
Expand Down Expand Up @@ -73,14 +74,9 @@ abstract class MusicBeatState extends FlxState
updateCurStep();
updateBeat();

if (shaderGroup != null)
{
for (i in shaderGroup)
{
@:privateAccess
i.update(elapsed);
}
}
if (_shaderGroup != null)
for (shader in _shaderGroup)
try{shader.update(elapsed);}catch(err)Logs.trace('err', RED);

if (oldStep != curStep)
{
Expand Down
Loading

0 comments on commit 511a7fb

Please sign in to comment.