1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00
This commit is contained in:
Fredia Huya-Kouadio
2025-02-10 10:02:48 -08:00
committed by Fredia Huya-Kouadio
parent 5da6deaaca
commit 2a66335ec2
3 changed files with 12 additions and 25 deletions

View File

@@ -300,14 +300,12 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe
} }
} }
@CallSuper override fun getCommandLine(): MutableList<String> {
override fun updateCommandLineParams(args: Array<String>) { val params = super.getCommandLine()
val args = if (BuildConfig.BUILD_TYPE == "dev") { if (BuildConfig.BUILD_TYPE == "dev" && !params.contains("--benchmark")) {
args + "--benchmark" params.add("--benchmark")
} else {
args
} }
super.updateCommandLineParams(args); return params
} }
protected fun retrieveEditorWindowInfo(args: Array<String>, gameEmbedMode: GameEmbedMode): EditorWindowInfo { protected fun retrieveEditorWindowInfo(args: Array<String>, gameEmbedMode: GameEmbedMode): EditorWindowInfo {

View File

@@ -40,18 +40,16 @@ open class GodotXRGame: BaseGodotGame() {
override fun overrideOrientationRequest() = true override fun overrideOrientationRequest() = true
override fun updateCommandLineParams(args: Array<String>) { override fun getCommandLine(): MutableList<String> {
val updatedArgs = ArrayList<String>() val updatedArgs = super.getCommandLine()
if (!args.contains(XRMode.OPENXR.cmdLineArg)) { if (!updatedArgs.contains(XRMode.OPENXR.cmdLineArg)) {
updatedArgs.add(XRMode.OPENXR.cmdLineArg) updatedArgs.add(XRMode.OPENXR.cmdLineArg)
} }
if (!args.contains(XR_MODE_ARG)) { if (!updatedArgs.contains(XR_MODE_ARG)) {
updatedArgs.add(XR_MODE_ARG) updatedArgs.add(XR_MODE_ARG)
updatedArgs.add("on") updatedArgs.add("on")
} }
updatedArgs.addAll(args) return updatedArgs
super.updateCommandLineParams(updatedArgs.toTypedArray())
} }
override fun getEditorWindowInfo() = XR_RUN_GAME_INFO override fun getEditorWindowInfo() = XR_RUN_GAME_INFO

View File

@@ -75,7 +75,7 @@ abstract class GodotActivity : FragmentActivity(), GodotHost {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val params = intent.getStringArrayExtra(EXTRA_COMMAND_LINE_PARAMS) val params = intent.getStringArrayExtra(EXTRA_COMMAND_LINE_PARAMS)
Log.d(TAG, "Starting intent $intent with parameters ${params.contentToString()}") Log.d(TAG, "Starting intent $intent with parameters ${params.contentToString()}")
updateCommandLineParams(params ?: emptyArray()) commandLineParams.addAll(params ?: emptyArray())
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@@ -215,14 +215,5 @@ abstract class GodotActivity : FragmentActivity(), GodotHost {
return GodotFragment() return GodotFragment()
} }
@CallSuper override fun getCommandLine(): MutableList<String> = commandLineParams
protected open fun updateCommandLineParams(args: Array<String>) {
// Update the list of command line params with the new args
commandLineParams.clear()
if (args.isNotEmpty()) {
commandLineParams.addAll(args)
}
}
final override fun getCommandLine() = commandLineParams
} }