diff --git a/src/loader.gd b/src/loader.gd index c7bfe2b..8c7f43c 100644 --- a/src/loader.gd +++ b/src/loader.gd @@ -90,8 +90,8 @@ func cleanup() -> void: # Parses all arguments func parse_cmdline() -> Dictionary: logger.verb("Parsing command line arguments") - var args: Dictionary = { "shutdown": false, "load_presentation": false, "presentation_path": "", "logger_level": core_config.logger_level, "ui_scale": 1.0 } - var processed: Dictionary = { "presentation": false, "logger_level": false, "ui_scale": false } + var args: Dictionary = { "shutdown": false, "load_presentation": false, "presentation_path": "", "logger_level": core_config.logger_level, "ui_scale": 1.0, "allow_high_ui_scale": false } + var processed: Dictionary = { "presentation": false, "logger_level": false, "ui_scale": false, "allow_high_ui_scale": false } for arg in OS.get_cmdline_user_args(): logger.diag(core.misc.stringify_variables("Parsing cmdline argument %arg%", { "arg": arg })) @@ -112,7 +112,10 @@ Usage (development setup): /path/to/godot.binary -d -v --path . ++ Sets the logger level, defaults to DIAG in debug                                               builds and INFO in release builds. ---ui-scale= Sets how large UI elements should be. +--allow-high-ui-scale Allows setting the ui scale above 5. +                                              Please note that higher --ui-scale values +                                              can cause freezes. +--ui-scale= Sets how large ui elements should be.                                               Does not affect presentations. /path/to/presentation.pcar Path to the presentation Presencode should open.                                               If not supplied, a user interface will appear. @@ -153,8 +156,24 @@ Further arguments: logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Must be a float above 1", { "arg": arg })) continue + var argf: float = arg.replace("--ui-scale=", "").to_float() + + # Check if allowed + if argf > 5.0 and !args["allow_high_ui_scale"]: + logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: High ui scale values (> 5) are not allowed.\nPlease pass --allow-high-ui-scale before --ui-scale= to Presencode if you want high ui scale values.", { "arg": arg })) + continue + # Update 'args' - args["ui_scale"] = arg.replace("--ui-scale=", "").to_float() + args["ui_scale"] = argf + elif arg.contains("--allow-high-ui-scale"): + # Ensure this argument is not overridden + if processed["allow_high_ui_scale"]: + logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Already set", { "arg": arg })) + continue + processed["allow_high_ui_scale"] = true + + # Update 'args' + args["allow_high_ui_scale"] = true else: if arg.begins_with("--"): logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Option not recognized", { "arg": arg })) else: