Skip to content

Commit 6a1bbb7

Browse files
committed
warning: this crashes (on linux)
1 parent e89c041 commit 6a1bbb7

File tree

4 files changed

+53
-3
lines changed

4 files changed

+53
-3
lines changed

source/funkin/backend/assets/Paths.hx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,35 @@ class Paths
2323
});
2424
}
2525

26-
public static inline function getPath(file:String, ?library:String)
27-
return library != null ? '$library:assets/$library/$file' : 'assets/$file';
26+
public static inline function getPath(file:String, ?library:String) {
27+
var returnedPath:String = library != null ? '$library:assets/$library/$file' : 'assets/$file';
28+
#if linux
29+
returnedPath = Path.normalize(returnedPath);
30+
var fixedPath:String = library != null ? '$library:assets/$library/' : 'assets/';
31+
var parts:Array<String> = returnedPath.split("/");
32+
trace(parts);
33+
for (it=>part in parts) {
34+
if (it == 0) continue;
35+
var entries:Array<String> = null;
36+
if (Path.extension(part) == "") assetsTree.getFolders(fixedPath);
37+
else assetsTree.getFiles(fixedPath);
38+
trace(entries);
39+
for (entry in entries) {
40+
trace(part, entry);
41+
if (entry.toLowerCase() == part.toLowerCase()) {
42+
fixedPath += entry + (it != parts.length - 1 ? "/" : "");
43+
}
44+
}
45+
}
46+
if (returnedPath.toLowerCase() != fixedPath.toLowerCase()) {
47+
trace("this shit broke!!!");
48+
trace(fixedPath);
49+
}
50+
else returnedPath = fixedPath;
51+
#end
52+
trace(returnedPath);
53+
return returnedPath;
54+
}
2855

2956
public static inline function video(key:String, ?ext:String)
3057
return getPath('videos/$key.${ext != null ? ext : Flags.VIDEO_EXT}');

source/funkin/backend/system/MainState.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class MainState extends FlxState {
113113
ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder); // Loads global.hx
114114
MusicBeatTransition.script = Flags.DEFAULT_TRANSITION_SCRIPT;
115115
WindowUtils.resetTitle();
116+
WindowUtils.setWindow();
116117
Main.refreshAssets();
117118
DiscordUtil.init();
118119
EventsData.reloadEvents();

source/funkin/backend/utils/WindowUtils.hx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ final class WindowUtils {
6363
* @param image The image to set as the icon.
6464
**/
6565
public static inline function setWindow(?name:String, ?image:String)
66-
{ Lib.application.window.setIcon(lime.graphics.Image.fromBytes(Assets.getBytes(image != null ? image : Flags.MOD_ICON)));
66+
{
67+
if (Flags.MOD_ICON == null && image == null) return;
68+
Lib.application.window.setIcon(lime.graphics.Image.fromBytes(Assets.getBytes(Paths.image(image != null ? image : Flags.MOD_ICON))));
6769
title = name != null ? name : Flags.MOD_NAME;
6870
}
6971

source/funkin/menus/MainMenuState.hx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class MainMenuState extends MusicBeatState
2525
var camFollow:FlxObject;
2626
var versionText:FunkinText;
2727

28+
var devModeWarning:FunkinText;
29+
2830
public var canAccessDebugMenus:Bool = !Flags.DISABLE_EDITORS;
2931

3032
override function create()
@@ -85,10 +87,17 @@ class MainMenuState extends MusicBeatState
8587
add(versionText);
8688

8789
changeItem();
90+
91+
devModeWarning = new FunkinText(0, FlxG.height - 50, 1280, "You have to enable DEVELOPER MODE in the miscellaneous settings!", 24);
92+
devModeWarning.alignment = CENTER;
93+
add(devModeWarning);
94+
devModeWarning.scrollFactor.set();
95+
devModeWarning.alpha = 0;
8896
}
8997

9098
var selectedSomethin:Bool = false;
9199
var forceCenterX:Bool = true;
100+
var devModeCount:Int = 0;
92101

93102
override function update(elapsed:Float)
94103
{
@@ -111,6 +120,17 @@ class MainMenuState extends MusicBeatState
111120
}
112121
*/
113122
}
123+
if (!Options.devMode && FlxG.keys.justPressed.SEVEN) {
124+
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_DELETE_SOUND));
125+
if (devModeCount++ == 2) {
126+
FlxTween.tween(devModeWarning, {alpha: 1}, 0.4);
127+
}
128+
FlxTween.completeTweensOf(devModeWarning);
129+
FlxTween.color(devModeWarning, 0.2, 0xFFFF0000, 0xFFFFFFFF);
130+
FlxTween.shake(devModeWarning, 0.005);
131+
devModeWarning.y = FlxG.height - 75;
132+
FlxTween.tween(devModeWarning, {y: FlxG.height - 50}, 0.4);
133+
}
114134

115135
var upP = controls.UP_P;
116136
var downP = controls.DOWN_P;

0 commit comments

Comments
 (0)