diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index 025c4b2a940..20c65e128c2 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -98,6 +98,7 @@ jobs: cd platform/android/java ./gradlew generateGodotEditor ./gradlew generateGodotHorizonOSEditor + ./gradlew generateGodotPicoOSEditor cd ../../.. ls -l bin/android_editor_builds/ diff --git a/platform/android/java/build.gradle b/platform/android/java/build.gradle index 9184e8c5d5b..3dd8bbed882 100644 --- a/platform/android/java/build.gradle +++ b/platform/android/java/build.gradle @@ -25,7 +25,7 @@ allprojects { ext { supportedAbis = ["arm32", "arm64", "x86_32", "x86_64"] supportedFlavors = ["editor", "template"] - supportedAndroidDistributions = ["android", "horizonos"] + supportedAndroidDistributions = ["android", "horizonos", "picoos"] supportedFlavorsBuildTypes = [ "editor": ["dev", "debug", "release"], "template": ["dev", "debug", "release"] @@ -96,7 +96,7 @@ def templateExcludedBuildTask() { * Generates the build tasks for the given flavor * @param flavor Must be one of the supported flavors ('template' / 'editor') * @param edition Must be one of the supported editions ('standard' / 'mono') - * @param androidDistro Must be one of the supported Android distributions ('android' / 'horizonos') + * @param androidDistro Must be one of the supported Android distributions ('android' / 'horizonos' / 'picoos') */ def generateBuildTasks(String flavor = "template", String edition = "standard", String androidDistro = "android") { if (!supportedFlavors.contains(flavor)) { @@ -237,6 +237,18 @@ task generateGodotHorizonOSEditor { dependsOn = generateBuildTasks("editor", "standard", "horizonos") } +/** + * Generate the Godot Editor binaries for PicoOS devices. + * + * Note: Unless the 'generateNativeLibs` argument is specified, the Godot 'tools' shared libraries + * must have been generated (via scons) prior to running this gradle task. + * The task will only build the binaries for which the shared libraries is available. + */ +task generateGodotPicoOSEditor { + gradle.startParameter.excludedTaskNames += templateExcludedBuildTask() + dependsOn = generateBuildTasks("editor", "standard", "picoos") +} + /** * Master task used to coordinate the tasks defined above to generate the set of Godot templates. */ diff --git a/platform/android/java/editor/build.gradle b/platform/android/java/editor/build.gradle index 276d74b75b5..32ff4d76f30 100644 --- a/platform/android/java/editor/build.gradle +++ b/platform/android/java/editor/build.gradle @@ -163,6 +163,18 @@ android { minSdkVersion 23 targetSdkVersion 32 } + picoos { + dimension "android_distribution" + missingDimensionStrategy 'products', 'editor' + ndk { + //noinspection ChromeOsAbiSupport + abiFilters "arm64-v8a" + } + applicationIdSuffix ".pico" + versionNameSuffix "-pico" + minSdkVersion 29 + targetSdkVersion 32 + } } } @@ -177,4 +189,6 @@ dependencies { // Meta dependencies horizonosImplementation "org.godotengine:godot-openxr-vendors-meta:3.0.0-stable" + // Pico dependencies + picoosImplementation "org.godotengine:godot-openxr-vendors-pico:3.0.1-stable" } diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt index 11ac4c85ec3..d1f0c427983 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt @@ -53,6 +53,7 @@ import org.godotengine.godot.error.Error import org.godotengine.godot.utils.PermissionsUtil import org.godotengine.godot.utils.ProcessPhoenix import org.godotengine.godot.utils.isHorizonOSDevice +import org.godotengine.godot.utils.isPicoOSDevice import org.godotengine.godot.utils.isNativeXRDevice import java.util.* import kotlin.math.min @@ -540,6 +541,10 @@ abstract class BaseGodotEditor : GodotActivity() { return isHorizonOSDevice() } + if (featureTag == "picoos") { + return isPicoOSDevice() + } + return false } } diff --git a/platform/android/java/editor/src/picoos/AndroidManifest.xml b/platform/android/java/editor/src/picoos/AndroidManifest.xml new file mode 100644 index 00000000000..13ab40f90fc --- /dev/null +++ b/platform/android/java/editor/src/picoos/AndroidManifest.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/android/java/editor/src/picoos/assets/vr_splash.png b/platform/android/java/editor/src/picoos/assets/vr_splash.png new file mode 100644 index 00000000000..7bddd4325a8 Binary files /dev/null and b/platform/android/java/editor/src/picoos/assets/vr_splash.png differ diff --git a/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotEditor.kt b/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotEditor.kt new file mode 100644 index 00000000000..2aee8b0f56a --- /dev/null +++ b/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotEditor.kt @@ -0,0 +1,82 @@ +/**************************************************************************/ +/* GodotEditor.kt */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +package org.godotengine.editor + +import org.godotengine.godot.GodotLib +import org.godotengine.godot.utils.isNativeXRDevice + +/** + * Primary window of the Godot Editor. + * + * This is the implementation of the editor used when running on PicoOS devices. + */ +open class GodotEditor : BaseGodotEditor() { + + companion object { + private val TAG = GodotEditor::class.java.simpleName + + internal val XR_RUN_GAME_INFO = EditorWindowInfo(GodotXRGame::class.java, 1667, ":GodotXRGame") + } + + override fun retrieveEditorWindowInfo(args: Array): EditorWindowInfo { + var hasEditor = false + var xrModeOn = false + + var i = 0 + while (i < args.size) { + when (args[i++]) { + EDITOR_ARG, EDITOR_ARG_SHORT, EDITOR_PROJECT_MANAGER_ARG, EDITOR_PROJECT_MANAGER_ARG_SHORT -> hasEditor = true + XR_MODE_ARG -> { + val argValue = args[i++] + xrModeOn = xrModeOn || ("on" == argValue) + } + } + } + + return if (hasEditor) { + EDITOR_MAIN_INFO + } else { + val openxrEnabled = GodotLib.getGlobal("xr/openxr/enabled").toBoolean() + if (openxrEnabled && isNativeXRDevice()) { + XR_RUN_GAME_INFO + } else { + RUN_GAME_INFO + } + } + } + + override fun getEditorWindowInfoForInstanceId(instanceId: Int): EditorWindowInfo? { + return when (instanceId) { + XR_RUN_GAME_INFO.windowId -> XR_RUN_GAME_INFO + else -> super.getEditorWindowInfoForInstanceId(instanceId) + } + } +} diff --git a/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotXRGame.kt b/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotXRGame.kt new file mode 100644 index 00000000000..2107a82d74c --- /dev/null +++ b/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotXRGame.kt @@ -0,0 +1,59 @@ +/*************************************************************************/ +/* GodotXRGame.kt */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +package org.godotengine.editor + +import org.godotengine.godot.GodotLib +import org.godotengine.godot.xr.XRMode + +/** + * Provide support for running XR apps / games from the editor window. + */ +open class GodotXRGame: GodotGame() { + + override fun overrideOrientationRequest() = true + + override fun updateCommandLineParams(args: List) { + val updatedArgs = ArrayList() + if (!args.contains(XRMode.OPENXR.cmdLineArg)) { + updatedArgs.add(XRMode.OPENXR.cmdLineArg) + } + if (!args.contains(XR_MODE_ARG)) { + updatedArgs.add(XR_MODE_ARG) + updatedArgs.add("on") + } + updatedArgs.addAll(args) + + super.updateCommandLineParams(updatedArgs) + } + + override fun getEditorWindowInfo() = XR_RUN_GAME_INFO + +} diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/DeviceUtils.kt b/platform/android/java/lib/src/org/godotengine/godot/utils/DeviceUtils.kt index dff57581fa3..7b99cce2162 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/DeviceUtils.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/DeviceUtils.kt @@ -44,9 +44,16 @@ fun isHorizonOSDevice(): Boolean { return "Oculus".equals(Build.BRAND, true) } +/** + * Returns true if running on PICO OS. + */ +fun isPicoOSDevice(): Boolean { + return ("Pico".equals(Build.BRAND, true)) +} + /** * Returns true if running on a native Android XR device. */ fun isNativeXRDevice(): Boolean { - return isHorizonOSDevice() + return isHorizonOSDevice() || isPicoOSDevice() }