1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-12-01 08:37:17 +00:00

Mac fix, doh!

This commit is contained in:
EliteMasterEric 2023-03-01 18:22:28 -05:00
parent fe92d00a04
commit 75b4c732db
4 changed files with 18 additions and 11 deletions

View file

@ -169,6 +169,7 @@ class PolymodHandler
// `polymod.*` // `polymod.*`
for (cls in ClassMacro.listClassesInPackage('polymod')) for (cls in ClassMacro.listClassesInPackage('polymod'))
{ {
if (cls == null) continue;
var className = Type.getClassName(cls); var className = Type.getClassName(cls);
Polymod.blacklistImport(className); Polymod.blacklistImport(className);
} }

View file

@ -60,7 +60,7 @@ class VanillaCutscenes
#if html5 #if html5
// Video displays OVER the FlxState. // Video displays OVER the FlxState.
vid = new FlxVideo(path); vid = new FlxVideo(path);
vid.finishCallback = finishCutscene; vid.finishCallback = finishCutscene.bind(0.5);
#else #else
// Video displays OVER the FlxState. // Video displays OVER the FlxState.
// vid = new FlxVideoSprite(0, 0); // vid = new FlxVideoSprite(0, 0);

View file

@ -5,6 +5,10 @@ import lime.utils.Bytes;
import lime.ui.FileDialog; import lime.ui.FileDialog;
import openfl.net.FileFilter; import openfl.net.FileFilter;
import haxe.io.Path; import haxe.io.Path;
#if html5
import openfl.net.FileReference;
import openfl.events.Event;
#end
/** /**
* Utilities for reading and writing files on various platforms. * Utilities for reading and writing files on various platforms.
@ -141,8 +145,6 @@ class FileUtil
fileDialog.open(filter, defaultPath, dialogTitle); fileDialog.open(filter, defaultPath, dialogTitle);
return true; return true;
#elseif html5 #elseif html5
var filter = convertTypeFilter(typeFilter);
var onFileLoaded = function(event) { var onFileLoaded = function(event) {
var loadedFileRef:FileReference = event.target; var loadedFileRef:FileReference = event.target;
trace('Loaded file: ' + loadedFileRef.name); trace('Loaded file: ' + loadedFileRef.name);
@ -157,8 +159,9 @@ class FileUtil
} }
var fileRef = new FileReference(); var fileRef = new FileReference();
file.addEventListener(Event.SELECT, onFileSelected); fileRef.addEventListener(Event.SELECT, onFileSelected);
file.open(filter, defaultPath, dialogTitle); fileRef.browse(typeFilter);
return true;
#else #else
onCancel(); onCancel();
return false; return false;
@ -169,7 +172,6 @@ class FileUtil
* Browses for a single file location, then writes the provided `haxe.io.Bytes` data and calls `onSave(path)` when done. * Browses for a single file location, then writes the provided `haxe.io.Bytes` data and calls `onSave(path)` when done.
* Works great on desktop and HTML5. * Works great on desktop and HTML5.
* *
* @param typeFilter TODO What does this do?
* @return Whether the file dialog was opened successfully. * @return Whether the file dialog was opened successfully.
*/ */
public static function saveFile(data:Bytes, ?onSave:String->Void, ?onCancel:Void->Void, ?defaultFileName:String, ?dialogTitle:String):Bool public static function saveFile(data:Bytes, ?onSave:String->Void, ?onCancel:Void->Void, ?defaultFileName:String, ?dialogTitle:String):Bool
@ -191,6 +193,7 @@ class FileUtil
if (onCancel != null) fileDialog.onCancel.add(onCancel); if (onCancel != null) fileDialog.onCancel.add(onCancel);
fileDialog.save(data, filter, defaultFileName, dialogTitle); fileDialog.save(data, filter, defaultFileName, dialogTitle);
return true;
#else #else
onCancel(); onCancel();
return false; return false;
@ -374,7 +377,11 @@ class FileUtil
*/ */
public static function appendStringToPath(path:String, data:String) public static function appendStringToPath(path:String, data:String)
{ {
#if sys
sys.io.File.append(path, false).writeString(data); sys.io.File.append(path, false).writeString(data);
#else
throw 'Direct file writing by path not supported on this platform.';
#end
} }
/** /**
@ -410,7 +417,7 @@ class FileUtil
{ {
path = Sys.getEnv(envName); path = Sys.getEnv(envName);
if (path == "") path = null; if (path == '') path = null;
if (path != null) break; if (path != null) break;
} }

View file

@ -2,7 +2,7 @@ package funkin.util;
import flixel.util.FlxSignal.FlxTypedSignal; import flixel.util.FlxSignal.FlxTypedSignal;
#if cpp #if (cpp && windows)
@:cppFileCode(' @:cppFileCode('
#include <iostream> #include <iostream>
#include <windows.h> #include <windows.h>
@ -35,8 +35,7 @@ class WindowUtil
// onUpdate is called every frame just before rendering. // onUpdate is called every frame just before rendering.
// onExit is called when the game window is closed. // onExit is called when the game window is closed.
openfl.Lib.current.stage.application.onExit.add(function(exitCode:Int) openfl.Lib.current.stage.application.onExit.add(function(exitCode:Int) {
{
windowExit.dispatch(exitCode); windowExit.dispatch(exitCode);
}); });
} }
@ -46,7 +45,7 @@ class WindowUtil
*/ */
public static function disableCrashHandler() public static function disableCrashHandler()
{ {
#if cpp #if (cpp && windows)
untyped __cpp__('SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);'); untyped __cpp__('SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);');
#else #else
// Do nothing. // Do nothing.