Merge remote-tracking branch 'upstream/main' into new-editors-main

# Conflicts:
# commandline/commands/Compiler.hx
# source/funkin/backend/FunkinSprite.hx
# source/funkin/backend/MusicBeatState.hx
# source/funkin/backend/MusicBeatSubstate.hx
# source/funkin/backend/chart/Chart.hx
# source/funkin/backend/chart/EventsData.hx
# source/funkin/backend/scripting/GlobalScript.hx
# source/funkin/backend/system/Controls.hx
# source/funkin/backend/system/MainState.hx
# source/funkin/backend/utils/AudioAnalyzer.hx
# source/funkin/backend/utils/CoolUtil.hx
# source/funkin/editors/character/CharacterInfoScreen.hx
# source/funkin/editors/charter/Charter.hx
# source/funkin/editors/charter/CharterSelection.hx
# source/funkin/editors/charter/CharterStrumline.hx
# source/funkin/editors/charter/CharterStrumlineButton.hx
# source/funkin/editors/charter/SongCreationScreen.hx
# source/funkin/editors/ui/UIDropDown.hx
# source/funkin/editors/ui/UIFileExplorer.hx
# source/funkin/game/Note.hx
# source/funkin/game/PlayState.hx
# source/funkin/game/SplashGroup.hx
# source/funkin/game/Stage.hx
# source/funkin/game/Strum.hx
# source/funkin/menus/FreeplayState.hx
# source/funkin/options/Options.hx
# source/funkin/options/keybinds/KeybindsOptions.hx
This commit is contained in:
Ralty
2025-07-19 00:57:08 +07:00
372 changed files with 3244 additions and 1248 deletions
+23
View File
@@ -24,6 +24,11 @@ enum Control
PAUSE;
//CHEAT;
SWITCHMOD;
// Debugs
DEV_ACCESS;
DEV_CONSOLE;
DEV_RELOAD;
}
enum KeyboardScheme
@@ -150,6 +155,24 @@ class Controls extends FlxActionSet
@:pressed("switchmod") public var SWITCHMOD_HOLD(get, set): Bool;
@:justReleased("switchmod") public var SWITCHMOD_R(get, set): Bool;
@:devModeOnly
@:gamepad([])
@:justPressed("dev-access") public var DEV_ACCESS(get, set): Bool;
@:pressed("dev-access") public var DEV_ACCESS_HOLD(get, set): Bool;
@:justReleased("dev-access") public var DEV_ACCESS_R(get, set): Bool;
@:devModeOnly
@:gamepad([])
@:justPressed("dev-console") public var DEV_CONSOLE(get, set): Bool;
@:pressed("dev-console") public var DEV_CONSOLE_HOLD(get, set): Bool;
@:justReleased("dev-console") public var DEV_CONSOLE_R(get, set): Bool;
@:devModeOnly
@:gamepad([])
@:justPressed("dev-reload") public var DEV_RELOAD(get, set): Bool;
@:pressed("dev-reload") public var DEV_RELOAD_HOLD(get, set): Bool;
@:justReleased("dev-reload") public var DEV_RELOAD_R(get, set): Bool;
@:allow(funkin.backend.utils.ControlsUtil)
var byName:Map<String, FlxActionDigital> = [];
+19 -23
View File
@@ -1,13 +1,12 @@
package funkin.backend.system;
import lime.utils.AssetLibrary as LimeAssetLibrary;
import lime.utils.AssetType;
import flixel.util.FlxColor;
import lime.app.Application;
import funkin.backend.system.macros.GitCommitMacro;
import funkin.backend.assets.IModsAssetLibrary;
import funkin.backend.assets.ScriptedAssetLibrary;
import funkin.backend.system.macros.GitCommitMacro;
import lime.app.Application;
import lime.utils.AssetLibrary as LimeAssetLibrary;
import lime.utils.AssetType;
/**
* A class that reads the `flags.ini` file, allowing to read settable Flags (customs too).
@@ -28,10 +27,6 @@ class Flags {
public static var REPO_OWNER:String = "CodenameCrew";
public static var REPO_URL:String = 'https://github.com/$REPO_OWNER/$REPO_NAME';
// make this empty once you guys are done with the project.
// good luck /gen <3 @crowplexus
public static var RELEASE_CYCLE:String = "Beta";
/**
* Preferred sound extension for the game's audio files.
* Currently is set to `mp3` for web targets, and `ogg` for other targets.
@@ -41,7 +36,7 @@ class Flags {
public static var IMAGE_EXT:String = "png"; // we also support jpg
public static var DEFAULT_DISCORD_LOGO_KEY:String = "icon";
public static var DEFAULT_DISCORD_CLIENT_ID:String = "1027994136193810442";
public static var DEFAULT_DISCORD_CLIENT_ID:String = "1383853614589673472";
public static var DEFAULT_DISCORD_LOGO_TEXT:String = "Codename Engine";
@:also(funkin.game.Character.FALLBACK_CHARACTER)
@@ -59,23 +54,25 @@ class Flags {
public static var WEEKS_LIST_MOD_MODE:Allow<"prepend", "override", "append"> = "override";
public static var DEFAULT_BPM:Float = 100.0;
public static var DEFAULT_BEATS_PER_MEASURE:Float = 4;
public static var DEFAULT_BEATS_PER_MEASURE:Int = 4;
public static var DEFAULT_STEPS_PER_BEAT:Int = 4;
public static var DEFAULT_LOOP_TIME:Float = 0.0;
public static var SUPPORTED_CHART_RUNTIME_FORMATS:Array<String> = ["Legacy", "Psych Engine"];
public static var SUPPORTED_CHART_FORMATS:Array<String> = ["BaseGame"];
public static var BASEGAME_SONG_METADATA_VERSION:String = "2.2.2";
public static var BASEGAME_SONG_CHART_DATA_VERSION:String = "2.0.0";
public static var BASEGAME_DEFAULT_NOTE_STYLE:String = 'funkin';
public static var BASEGAME_DEFAULT_ALBUM_ID:String = 'volume1';
public static var BASEGAME_DEFAULT_PREVIEW_START:Float = 0;
public static var BASEGAME_DEFAULT_PREVIEW_END:Float = 15000;
public static var VSLICE_SONG_METADATA_VERSION:String = "2.2.2";
public static var VSLICE_SONG_CHART_DATA_VERSION:String = "2.0.0";
public static var VSLICE_DEFAULT_NOTE_STYLE:String = 'funkin';
public static var VSLICE_DEFAULT_ALBUM_ID:String = 'volume1';
public static var VSLICE_DEFAULT_PREVIEW_START:Int = 0;
public static var VSLICE_DEFAULT_PREVIEW_END:Int = 15000;
/**
* Default background colors for songs without bg color
* Default background colors for songs or more without bg color
*/
public static var DEFAULT_COLOR:FlxColor = 0xFF9271FD;
public static var DEFAULT_WEEK_COLOR:FlxColor = 0xFFF9CF51;
public static var DEFAULT_COOP_ALLOWED:Bool = false;
public static var DEFAULT_OPPONENT_MODE_ALLOWED:Bool = false;
@@ -97,7 +94,7 @@ class Flags {
public static var DEFAULT_CAM_ZOOM_STRENGTH:Int = 1;
public static var DEFAULT_CAM_ZOOM:Float = 1.05; // what zoom level it defaults to
public static var DEFAULT_HUD_ZOOM:Float = 1.0;
public static var MAX_CAMERA_ZOOM:Float = 1.35;
public static var MAX_CAMERA_ZOOM_MULT:Float = 1.35;
public static var DEFAULT_PAUSE_ITEMS:Array<String> = ['Resume', 'Restart Song', 'Change Controls', 'Change Options', 'Exit to menu', "Exit to charter"];
public static var DEFAULT_CUTSCENE_PAUSE_ITEMS:Array<String> = ['Resume Cutscene', 'Skip Cutscene', 'Restart Cutscene', 'Exit to menu'];
@@ -157,7 +154,7 @@ class Flags {
// -- End of Codename's Default Flags --
/**
* Flags that Codename couldn't recognize as it's own defaults (they can only be `string`!).
* Flags that Codename couldn't recognize as it's own defaults (they can only be `string`! due to them being unparsed).
*/
@:bypass public static var customFlags:Map<String, String> = [];
@@ -187,10 +184,9 @@ class Flags {
}
}
public static function loadFromDatas(files:Array<String>) {
public static function loadFromDatas(datas:Array<String>) {
var flags:Map<String, String> = [];
for(file in files) {
var data:String = Assets.getText(file);
for(data in datas) {
if(data != null)
loadFromData(flags, data);
}
+6 -4
View File
@@ -81,12 +81,12 @@ class Main extends Sprite
public static var audioDisconnected:Bool = false;
public static var changeID:Int = 0;
public static var pathBack = #if windows
public static var pathBack = #if (windows || linux)
"../../../../"
#elseif mac
"../../../../../../../"
#else
""
"../../../../"
#end;
public static var startedFromSource:Bool = #if TEST_BUILD true #else false #end;
@@ -180,6 +180,8 @@ class Main extends Sprite
}
public static function refreshAssets() @:privateAccess {
FunkinCache.instance.clearSecondLayer();
var game = FlxG.game;
var daSndTray = Type.createInstance(game._customSoundTray = funkin.menus.ui.FunkinSoundTray, []);
var index:Int = game.numChildren - 1;
@@ -238,9 +240,9 @@ class Main extends Sprite
Sys.setCwd(haxe.io.Path.directory(Sys.programPath()));
}
#elseif android
Sys.setCwd(Path.addTrailingSlash(VERSION.SDK_INT > 30 ? Context.getObbDir() : Context.getExternalFilesDir()));
Sys.setCwd(haxe.io.Path.addTrailingSlash(VERSION.SDK_INT > 30 ? Context.getObbDir() : Context.getExternalFilesDir()));
#elseif (ios || switch)
Sys.setCwd(Path.addTrailingSlash(openfl.filesystem.File.applicationStorageDirectory.nativePath));
Sys.setCwd(haxe.io.Path.addTrailingSlash(openfl.filesystem.File.applicationStorageDirectory.nativePath));
#end
}
+66 -26
View File
@@ -6,16 +6,21 @@ import sys.FileSystem;
import flixel.FlxState;
import funkin.backend.assets.ModsFolder;
import funkin.backend.chart.EventsData;
import funkin.menus.BetaWarningState;
import funkin.menus.TitleState;
import funkin.backend.system.framerate.Framerate;
import funkin.menus.TitleState;
import haxe.io.Path;
@dox(hide)
typedef AddonInfo = {
var name:String;
var path:String;
}
/**
* Simple state used for loading the game
*/
class MainState extends FlxState {
public static var initiated:Bool = false;
public static var betaWarningShown:Bool = false;
public override function create() {
super.create();
if (!initiated) {
@@ -36,25 +41,64 @@ class MainState extends FlxState {
Paths.assetsTree.reset();
#if MOD_SUPPORT
var _lowPriorityAddons:Array<String> = [];
var _highPriorityAddons:Array<String> = [];
var _noPriorityAddons:Array<String> = [];
if (FileSystem.exists(ModsFolder.addonsPath) && FileSystem.isDirectory(ModsFolder.addonsPath)) {
for(i=>addon in [for(dir in FileSystem.readDirectory(ModsFolder.addonsPath)) if (FileSystem.isDirectory(ModsFolder.addonsPath + dir)) dir]) {
if (addon.startsWith("[LOW]")) _lowPriorityAddons.insert(0, addon);
else if (addon.startsWith("[HIGH]")) _highPriorityAddons.insert(0, addon);
else _noPriorityAddons.insert(0, addon);
}
for (addon in _lowPriorityAddons)
Paths.assetsTree.addLibrary(ModsFolder.loadModLib(ModsFolder.addonsPath + addon, StringTools.ltrim(addon.substr("[LOW]".length))));
}
if (ModsFolder.currentModFolder != null)
Paths.assetsTree.addLibrary(ModsFolder.loadModLib(ModsFolder.modsPath + ModsFolder.currentModFolder, ModsFolder.currentModFolder));
inline function isDirectory(path:String):Bool
return FileSystem.exists(path) && FileSystem.isDirectory(path);
if (FileSystem.exists(ModsFolder.addonsPath) && FileSystem.isDirectory(ModsFolder.addonsPath)){
for (addon in _noPriorityAddons) Paths.assetsTree.addLibrary(ModsFolder.loadModLib(ModsFolder.addonsPath + addon, addon));
for (addon in _highPriorityAddons) Paths.assetsTree.addLibrary(ModsFolder.loadModLib(ModsFolder.addonsPath + addon, StringTools.ltrim(addon.substr("[HIGH]".length))));
inline function ltrim(str:String, prefix:String):String
return str.substr(prefix.length).ltrim();
inline function loadLib(path:String, name:String)
Paths.assetsTree.addLibrary(ModsFolder.loadModLib(path, name));
var _lowPriorityAddons:Array<AddonInfo> = [];
var _highPriorityAddons:Array<AddonInfo> = [];
var _noPriorityAddons:Array<AddonInfo> = [];
var addonPaths = [
ModsFolder.addonsPath,
(
ModsFolder.currentModFolder != null ?
ModsFolder.modsPath + ModsFolder.currentModFolder + "/addons/" :
null
)
];
for(path in addonPaths) {
if (path == null) continue;
if (!isDirectory(path)) continue;
for(addon in FileSystem.readDirectory(path)) {
if(!FileSystem.isDirectory(path + addon)) {
switch(Path.extension(addon).toLowerCase()) {
case 'zip':
addon = Path.withoutExtension(addon);
default:
continue;
}
}
var data:AddonInfo = {
name: addon,
path: path + addon
};
if (addon.startsWith("[LOW]")) _lowPriorityAddons.insert(0, data);
else if (addon.startsWith("[HIGH]")) _highPriorityAddons.insert(0, data);
else _noPriorityAddons.insert(0, data);
}
}
for (addon in _lowPriorityAddons)
loadLib(addon.path, ltrim(addon.name, "[LOW]"));
if (ModsFolder.currentModFolder != null)
loadLib(ModsFolder.modsPath + ModsFolder.currentModFolder, ModsFolder.currentModFolder);
for (addon in _noPriorityAddons)
loadLib(addon.path, addon.name);
for (addon in _highPriorityAddons)
loadLib(addon.path, ltrim(addon.name, "[HIGH]"));
#end
Flags.load();
@@ -67,14 +111,10 @@ class MainState extends FlxState {
ControlsUtil.loadCustomControls();
TitleState.initialized = false;
if(Framerate.isLoaded)
if (Framerate.isLoaded)
Framerate.instance.reload();
if (Flags.DISABLE_BETA_WARNING_SCREEN || betaWarningShown)
FlxG.switchState(new TitleState());
else
FlxG.switchState(new BetaWarningState());
betaWarningShown = true;
FlxG.switchState(new TitleState());
#if sys
CoolUtil.safeAddAttributes('./.temp/', NativeAPI.FileAttribute.HIDDEN);
@@ -13,5 +13,5 @@ class CodenameBuildField extends TextField {
}
public function reload()
text = 'Codename Engine ${Flags.RELEASE_CYCLE}\n${Flags.COMMIT_MESSAGE}';
text = '${Flags.VERSION_MESSAGE}\n${Flags.COMMIT_MESSAGE}';
}
@@ -12,9 +12,7 @@ class FlixelInfo extends FramerateCategory {
@:privateAccess {
var c:Int = 0;
for(_ in FlxG.bitmap._cache.keys())
c++;
var c:Int = Lambda.count(FlxG.bitmap._cache);
if((FlxG.state is ModState)) {
var state:ModState = cast FlxG.state;
@@ -27,6 +25,7 @@ class FlixelInfo extends FramerateCategory {
_text += '\nBitmaps Count: ${c}';
_text += '\nSounds Count: ${FlxG.sound.list.length}';
_text += '\nFlxG.game Childs Count: ${FlxG.game.numChildren}';
if(FlxG.renderBlit) _text += '\nBlitting Render: true';
// _text += '\nCached objects count: ${cachedObjects}';
#if FLX_POINT_POOL
//var points = flixel.math.FlxPoint.FlxBasePoint.pool;
@@ -20,7 +20,7 @@ class Framerate extends Sprite {
public static var codenameBuildField:CodenameBuildField;
#end
public static var fontName:String = #if windows '${Sys.getEnv("windir")}\\Fonts\\consola.ttf' #else "_sans" #end;
public static var fontName:String = #if windows '${Sys.getEnv("windir")}\\Fonts\\consola.ttf' #else "_typewriter" #end;
/**
* 0: FPS INVISIBLE
@@ -46,7 +46,7 @@ class Framerate extends Sprite {
super();
if (instance != null) throw "Cannot create another instance";
instance = this;
textFormat = new TextFormat("Consolas", 12, -1);
textFormat = new TextFormat(fontName, 12, -1);
isLoaded = true;
@@ -53,6 +53,25 @@ class SystemInfo extends FramerateCategory {
if (osName != "")
osInfo = '${osName} ${osVersion}'.trim();
}
#elseif windows
var windowsCurrentVersionPath = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
var buildNumber = Std.parseInt(RegistryUtil.get(HKEY_LOCAL_MACHINE, windowsCurrentVersionPath, "CurrentBuildNumber"));
var edition = RegistryUtil.get(HKEY_LOCAL_MACHINE, windowsCurrentVersionPath, "ProductName");
var lcuKey = "WinREVersion"; // Last Cumulative Update Key On Older Windows Versions
if (buildNumber >= 22000) { // Windows 11 Initial Release Build Number
edition = edition.replace("Windows 10", "Windows 11");
lcuKey = "LCUVer"; // Last Cumulative Update Key On Windows 11
}
var lcuVersion = RegistryUtil.get(HKEY_LOCAL_MACHINE, windowsCurrentVersionPath, lcuKey);
osInfo = edition;
if (lcuVersion != null && lcuVersion != "")
osInfo += ' ${lcuVersion}';
else if (lime.system.System.platformVersion != null && lime.system.System.platformVersion != "")
osInfo += ' ${lime.system.System.platformVersion}';
#else
if (lime.system.System.platformLabel != null && lime.system.System.platformLabel != "" && lime.system.System.platformVersion != null && lime.system.System.platformVersion != "")
osInfo = '${lime.system.System.platformLabel.replace(lime.system.System.platformVersion, "").trim()} ${lime.system.System.platformVersion}';
@@ -62,10 +81,7 @@ class SystemInfo extends FramerateCategory {
try {
#if windows
var process = new HiddenProcess("wmic", ["cpu", "get", "name"]);
if (process.exitCode() != 0) throw 'Could not fetch CPU information';
cpuName = process.stdout.readAll().toString().trim().split("\n")[1].trim();
cpuName = RegistryUtil.get(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "ProcessorNameString");
#elseif mac
var process = new HiddenProcess("sysctl -a | grep brand_string"); // Somehow this isn't able to use the args but it still works
if (process.exitCode() != 0) throw 'Could not fetch CPU information';
@@ -86,7 +102,7 @@ class SystemInfo extends FramerateCategory {
Logs.trace('Unable to grab CPU Name: $e', ERROR, RED);
}
@:privateAccess {
@:privateAccess if(FlxG.renderTile) { // Blit doesn't enable the gpu. Idk if we should fix this
if (flixel.FlxG.stage.context3D != null && flixel.FlxG.stage.context3D.gl != null) {
gpuName = Std.string(flixel.FlxG.stage.context3D.gl.getParameter(flixel.FlxG.stage.context3D.gl.RENDERER)).split("/")[0].trim();
#if !flash
@@ -7,6 +7,8 @@ class BuildInfo {
public static function printBuildInfo() {
if(haxe.macro.Context.defined("display")) return;
var haxeVersion = haxe.macro.Context.definedValue("haxe").trim();
var sleepChangeVersion = false;
Sys.println('[ BUILD INFO ]');
Sys.println('Haxe Version: ${haxeVersion}');
try {
@@ -33,8 +35,10 @@ class BuildInfo {
}
}
if(lastBuiltWith != null && lastBuiltWith.length > 0 && lastBuiltWith != haxeVersion)
if(lastBuiltWith != null && lastBuiltWith.length > 0 && lastBuiltWith != haxeVersion) {
Sys.println('Last Built With Haxe: ${lastBuiltWith} [!!!! MAKE SURE IF YOU SWITCHED VERSIONS YOU DELETE EXPORT FOLDERS !!!!]');
sleepChangeVersion = true;
}
} catch(e) {}
var targetPlatform = #if html5 "Web (HTML5)"
#elseif ios "iOS"
@@ -51,6 +55,14 @@ class BuildInfo {
Sys.println('Target Platform: ' + targetPlatform);
Sys.println('Build Date: ${Date.now().toString()}');
Sys.println('');
if(sleepChangeVersion) {
Sys.println('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
Sys.println('!!!! MAKE SURE IF YOU SWITCHED VERSIONS YOU DELETE EXPORT FOLDERS !!!!');
Sys.println('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
Sys.println('');
Sys.sleep(5);
}
}
}
#end
@@ -14,6 +14,7 @@ class ControlsMacro
{
static var _allControls: Array<String> = null;
static var _allInternalControls: Array<String> = null;
static var _allDevModeOnlyControls: Array<String> = null;
static var _currentControls: Map<String, Array<Expr>> = null;
static var _currentGamepadControls: Map<String, Expr> = null;
static var _keySet: Map<String, String> = null;
@@ -29,6 +30,7 @@ class ControlsMacro
_allControls = [];
_allInternalControls = [];
_allDevModeOnlyControls = [];
_currentControls = [];
_currentGamepadControls = [];
_keySet = [];
@@ -154,6 +156,7 @@ class ControlsMacro
_allControls = null;
_allInternalControls = null;
_allDevModeOnlyControls = null;
_currentControls = null;
_currentGamepadControls = null;
_keySet = null;
@@ -289,6 +292,9 @@ class ControlsMacro
case ":justReleased":
keyset = extractString(meta.params[0]);
expr = macro func($i{internalName}, JUST_RELEASED);
case ":devModeOnly":
if (!_allDevModeOnlyControls.contains(shortName))
_allDevModeOnlyControls.push(shortName);
default:
shouldRemove = false;
}
@@ -326,17 +332,16 @@ class ControlsMacro
// Generated Code:
// inline function get_UI_UP(): Bool
// return _uiUp.check();
// return _uiUp.check(); or return Options.devMode && _uiUp.check(); depending if its dev mode
var getField: Field = {
name: "get_" + name,
access: [APrivate, AInline],
kind: FFun({
ret: macro : Bool,
params: [],
expr: macro
{
return $i{internalName}.check();
},
expr: _allDevModeOnlyControls.contains(shortName) ?
(macro return Options.devMode && $i{internalName}.check()) :
(macro return $i{internalName}.check()),
args: []
}),
pos: field.pos,
+1 -1
View File
@@ -18,7 +18,7 @@ class Socket implements IFlxDestroyable {
public function read():String {
try {
return this.socket.input.readUntil(('\n').charCodeAt(0)).replace("\\n", "\n");
return this.socket.input.readUntil('\n'.code).replace("\\n", "\n");
} catch(e) {
}