Skip to main content

Paths

Kindclass
Packagebackend
Full namebackend.Paths
Sourcesource/backend/Paths.hx
Metadata@:access(openfl.display.BitmapData)

@:nullSafety // not yet

Public fields​

NameTypeStaticDefaultNotes
SOUND_EXT—yes#if (web || flash) "mp3" #else "ogg" #end—
VIDEO_EXT—yes"mp4"—
IMAGE_EXT—yes"png"—
defaultNoteSpriteFlxSpriteyes——
noteSkinFramesMapMap<String, FlxFramesCollection>yesnew Map()—
noteSkinAnimsMapMap<String, FlxAnimationController>yesnew Map()—
splashSkinFramesMapMap<String, FlxFramesCollection>yesnew Map()—
splashSkinAnimsMapMap<String, FlxAnimationController>yesnew Map()—
splashConfigsMap<String, objects.NoteSplash.NoteSplashConfig>yesnew Map()—
splashAnimCountMapMap<String, Int>yesnew Map()—
defaultSkin—yes'noteskins/NOTE_assets' + NoteHelpers.getNoteSkinPostfix()—
dumpExclusionsArray<String>yes[—
localTrackedAssetsArray<String>yes[]define the locally tracked assets
currentLevelStringyes—#if !html5 openfl.Assets.cache.clear("songs"); #end
currentTrackedAssetsMap<String, FlxGraphic>yes[]#if !html5 openfl.Assets.cache.clear("songs"); #end · Loads images.
warnedMissingAssetsMap<String, Bool>yes[]#if !html5 openfl.Assets.cache.clear("songs"); #end · because the trace is so damn annoying sometimes
currentTrackedSoundsMap<String, Sound>yes[]#if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); · completely rewritten asset loading? fuck!

Public methods​

initDefaultSkin​

static function initDefaultSkin(?noteSkin:String, inEditor:Bool = false)

Function that initializes the first note. This way, we can recycle the notes

ParameterTypeDefault
noteSkin (optional)String—
inEditor (optional)Boolfalse

View source

initNote​

static function initNote(?noteSkin:String)
ParameterTypeDefault
noteSkin (optional)String—

View source

initSplash​

static function initSplash(?splashSkin:String)

Note Splash initialization

ParameterTypeDefault
splashSkin (optional)String—

View source

addAnimAndCheck​

static function addAnimAndCheck(name:String, anim:String, framerate:Int = 24, loop:Bool = false)
ParameterTypeDefault
nameString—
animString—
framerate (optional)Int24
loop (optional)Boolfalse

View source

initSplashConfig​

static function initSplashConfig(skin:String)
ParameterTypeDefault
skinString—

View source

excludeAsset​

static function excludeAsset(key:String)
ParameterTypeDefault
keyString—

View source

gc​

static inline function gc(major:Bool = false, repeat:Int = 1)
ParameterTypeDefault
major (optional)Boolfalse
repeat (optional)Int1

View source

clearUnusedMemory​

static function clearUnusedMemory()

/ haya I love you for the base cache dump I took to the max

View source

clearStoredMemory​

static function clearStoredMemory(cleanUnused:Bool = false)
ParameterTypeDefault
cleanUnused (optional)Boolfalse

View source

setCurrentLevel​

static function setCurrentLevel(name:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
nameString—

View source

getPath​

static function getPath(file:String, type:AssetType = TEXT, library:Null<String> = null, modsAllowed:Bool = false):String

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
fileString—
type (optional)AssetTypeTEXT
library (optional)Null<String>null
modsAllowed (optional)Boolfalse

View source

readDirectory​

static inline function readDirectory(path:String):Array<String>

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
pathString—

View source

getLibraryPath​

static function getLibraryPath(file:String, library = "preload")

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
fileString—
library (optional)Dynamic"preload"

View source

getPreloadPath​

static inline function getPreloadPath(file:String = '')

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
file (optional)String''

View source

getSharedPath​

static inline function getSharedPath(file:String = '')

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
file (optional)String''

View source

file​

static inline function file(file:String, type:AssetType = TEXT, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
fileString—
type (optional)AssetTypeTEXT
library (optional)String—

View source

txt​

static inline function txt(key:String, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
library (optional)String—

View source

xml​

static inline function xml(key:String, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
library (optional)String—

View source

json​

static inline function json(key:String, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
library (optional)String—

View source

shaderFragment​

static inline function shaderFragment(key:String, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
library (optional)String—

View source

shaderVertex​

static inline function shaderVertex(key:String, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
library (optional)String—

View source

lua​

static inline function lua(key:String, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
library (optional)String—

View source

video​

static function video(key:String, library:String = null)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

Video loading (part of it)

ParameterTypeDefault
keyString—
library (optional)Stringnull

View source

sound​

static function sound(key:String, ?library:String):Sound

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

Sound loading.

ParameterTypeDefault
keyString—
library (optional)String—

View source

soundRandom​

static inline function soundRandom(key:String, min:Int, max:Int, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

Random sound loading.

ParameterTypeDefault
keyString—
minInt—
maxInt—
library (optional)String—

View source

music​

static inline function music(key:String, ?library:String):Sound

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

Music loading. Loads anything in assets/data/music, OR mods/data/music (if mods are allowed)

ParameterTypeDefault
keyString—
library (optional)String—

View source

voices​

static function voices(song:String, difficulty:String = '', postfix:String = null):Any

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

Loads the Voices. Crucial for generateSong

ParameterTypeDefault
songString—
difficulty (optional)String''
postfix (optional)Stringnull

View source

inst​

static function inst(song:String, difficulty:String = ''):Any

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

Loads the instrumental. Crucial for generateSong

ParameterTypeDefault
songString—
difficulty (optional)String''

View source

instExists​

static function instExists(song:String, difficulty:String = ''):Bool

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

Whether the instrumental for a song can actually be resolved.

inst() hands back a loaded Sound on native builds (an asset URL on web), never a path -- so FileSystem.exists(Paths.inst(...)) was false for every song. Freeplay's "JS Engine Anti-Crash Tool" did exactly that, so picking any song popped a bogus (and, on Windows, modal/blocking) "this song has no JSON or audio" dialog, and mod songs such as bf-clicker never got to load their scripts. Use this Bool helper for existence checks and keep inst() for actually loading the audio.

ParameterTypeDefault
songString—
difficulty (optional)String''

View source

voicesExists​

static function voicesExists(song:String, difficulty:String = ''):Bool

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

Whether the vocal track for a song can actually be resolved. Same rationale as instExists -- voices() returns a Sound, not a path.

ParameterTypeDefault
songString—
difficulty (optional)String''

View source

playMenuMusic​

static function playMenuMusic(force:Bool = false, volume:Float = 1):Void

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
force (optional)Boolfalse
volume (optional)Float1

View source

songEvents​

static function songEvents(song:String, ?difficulty:String, onlyEventsString:Bool = false):String

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

For song events.

ParameterTypeDefault
songString—
difficulty (optional)String—
onlyEventsString (optional)Boolfalse

View source

imagePath​

static inline function imagePath(key:String, ?folder:String):String

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
folder (optional)String—

View source

imageExists​

static inline function imageExists(key:String, ?folder:String):Bool

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
folder (optional)String—

View source

image​

static function image(key:String, parentFolder:String = null):FlxGraphic

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
parentFolder (optional)Stringnull

View source

cacheBitmap​

static function cacheBitmap(key:String, parentFolder:String = null, ?bitmap:BitmapData):FlxGraphic

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end.

ParameterTypeDefault
keyString—
parentFolder (optional)Stringnull
bitmap (optional)BitmapData—

View source

getTextFromFile​

static function getTextFromFile(key:String, ignoreMods:Bool = false):String

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keyString—
ignoreMods (optional)Boolfalse

View source

font​

static inline function font(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keyString—

View source

fileExists​

static function fileExists(key:String, type:AssetType, ignoreMods:Bool = false)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keyString—
typeAssetType—
ignoreMods (optional)Boolfalse

View source

exists​

static inline function exists(key:String, type:AssetType = null, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

temp shit lol

ParameterTypeDefault
keyString—
type (optional)AssetTypenull
library (optional)String—

View source

existsPath​

static inline function existsPath(key:String, type:AssetType = null, ?library:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keyString—
type (optional)AssetTypenull
library (optional)String—

View source

getContent​

static inline function getContent(path:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
pathString—

View source

getAtlas​

static function getAtlas(key:String, parentFolder:String = null):FlxAtlasFrames

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keyString—
parentFolder (optional)Stringnull

View source

getMultiAtlas​

static function getMultiAtlas(keys:Array<String>, parentFolder:String = null):FlxAtlasFrames

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keysArray<String>—
parentFolder (optional)Stringnull

View source

getSparrowAtlas​

static inline function getSparrowAtlas(key:String, parentFolder:String = null):FlxAtlasFrames

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keyString—
parentFolder (optional)Stringnull

View source

getPackerAtlas​

static inline function getPackerAtlas(key:String, parentFolder:String = null):FlxAtlasFrames

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keyString—
parentFolder (optional)Stringnull

View source

getAsepriteAtlas​

static inline function getAsepriteAtlas(key:String, parentFolder:String = null, allowGPU:Bool = true):FlxAtlasFrames

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
keyString—
parentFolder (optional)Stringnull
allowGPU (optional)Booltrue

View source

formatToSongPath​

static inline function formatToSongPath(path:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

ParameterTypeDefault
pathString—

View source

returnSound​

static function returnSound(path:String, key:String, ?library:String, stream:Bool = false)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file);.

Returns sounds which is useful for all the sfx

ParameterTypeDefault
pathString—
keyString—
library (optional)String—
stream (optional)Boolfalse

View source

mods​

static inline function mods(key:String = '')

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

Loads mods.

ParameterTypeDefault
key (optional)String''

View source

modsFont​

static inline function modsFont(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

Loads fonts in mods/fonts.

ParameterTypeDefault
keyString—

View source

modsJson​

static inline function modsJson(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

Loads jsons in mods/data.

ParameterTypeDefault
keyString—

View source

modsVideo​

static inline function modsVideo(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

Loads videos in mods/videos.

ParameterTypeDefault
keyString—

View source

modsSounds​

static inline function modsSounds(path:String, key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

Loads sounds in mods/sounds.

ParameterTypeDefault
pathString—
keyString—

View source

modsImages​

static inline function modsImages(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

Loads images in mods/images.

ParameterTypeDefault
keyString—

View source

modsXml​

static inline function modsXml(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

Loads xml files in mods/images.

ParameterTypeDefault
keyString—

View source

modsTxt​

static inline function modsTxt(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

Loads txt files in mods/images.

ParameterTypeDefault
keyString—

View source

modsImagesJson​

static inline function modsImagesJson(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

ParameterTypeDefault
keyString—

View source

playModMusic​

static function playModMusic(file:String, fallback:String, volume:Float = 1):Void

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

ParameterTypeDefault
fileString—
fallbackString—
volume (optional)Float1

View source

modFolders​

static function modFolders(key:String)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

ParameterTypeDefault
keyString—

View source

getBackupFilePath​

static function getBackupFilePath(songPath:String, diff:String):String

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if MODS_ALLOWED.

ParameterTypeDefault
songPathString—
diffString—

View source

loadAnimateAtlas​

static function loadAnimateAtlas(spr:FlxAnimate, folderOrImg:Dynamic, spriteJson:Dynamic = null, animationJson:Dynamic = null)

Only compiled when #if !html5 openfl.Assets.cache.clear("songs"); #end + #if MODS_ALLOWED if (FileSystem.exists(file)) bitmap = BitmapData.fromFile(file); + #if flxanimate.

ParameterTypeDefault
sprFlxAnimate—
folderOrImgDynamic—
spriteJson (optional)Dynamicnull
animationJson (optional)Dynamicnull

View source

Internals​

Private / internal members
FieldTypeStatic
splashFramesFlxFramesCollectionyes
splashAnimationFlxAnimationControlleryes
Method
static inline function destroyGraphic(graphic:FlxGraphic)
static inline function getLibraryPathForce(file:String, library:String, ?level:String)
static function songAudioExists(song:String, file:String, difficulty:String = ''):Bool