mcclure / lovr-oculus-mobile

Android app for hosting lovr on oculus mobile platform
https://mcclure.github.io/mermaid-lovr/
Other
32 stars 10 forks source link
lovr oculus-go oculus-quest vr

This is a repository for building LovrApp, a standalone Android app which is based on the LÖVR VR API.

Usage

Most users do not need to build LovrApp themselves. For running your own Lua files you can sideload the LovrTest app, which you can find on the "Releases" section of this github repo, or this page with instructions.

To build (all platforms):

To build (Macintosh)

To build (Windows)

To build (additional notes)

Help would be appreciated if you know how to do any of the following: Make the build work in Android Studio, build on Windows with audio, or make the build work in a single gradle pass without having to invoke gradlew twice.

Adding game code:

You have three options:

  1. Put the game code in LovrApp/assets.
  2. Create a directory on your hard drive with your code in it, and create a file LovrApp/local_assets (or LovrApp/local_assets.txt) containing the path to the code.
  3. Create a directory and add the path to it to the assets.srcDirs = ['../../assets', '../../../your/path/here'] line of LovrApp/Projects/Android/build.gradle.

Files in any of these directories will be uploaded when LovrApp's installDebug runs.

Option #2 is best if you are building from git, since local_assets is in gitignore.

To create your app:

Decide on a name for your app and also an identifier (this is something like "com.companyname.gametitle").

Edit LovrApp/Projects/build.gradle. Change "project.archivesBaseName" and "applicationId" to reflect your identifier.

Edit LovrApp/Projects/Android/AndroidManifest.xml. Change "package=" at the top to your identifier and change "android:label=" partway down (right after YOUR NAME HERE) to your name.

To ship your app:

LovrApp is set up so that a "debug" build uses Oculus's recommended settings for development and a "release" build uses the appropriate settings for store submission on Quest. The store submssion requirements do change from time to time, so you may find the store backend asks for additional configuration changes at upload time. See this page for the most up to date Oculus Store configuration requirements.

Creating a signing key

Before uploading anything to the Oculus Store, you should make sure you are using the right keystore. If you build without specifying a keystore, gradle will create one for you. It is very important you back this up in a safe place before you upload anything to the Oculus dashboard, as you cannot change it later so losing your keystore means getting locked out from updating your own app.

Better than just backing it up would be creating your own keystore, since you can input your business name and a password:

keytool -genkey -v -keystore YOURNAME-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias YOURNAME

The easiest way to install your new keystore is to put a copy at the exact path LovrApp/Projects/Android/android.debug.keystore

If you want to ship on Oculus Go

The build scripts in this repo create release builds for Quest. As of this writing, there are some steps you must perform if you want to submit a release build to the Go store. First, edit VrApp.gradle. There are two instances of v2SigningEnabled true. Change both of these to say

v1SigningEnabled true

Next, edit LovrApp/Projects/Android/AndroidManifest.xml. Delete this line:

<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="false" />

If you want to run on Samsung Gear VR

The build scripts in this repo are set up for Oculus Go and Quest. If you want to ship on Samsung Gear there are additional steps. You must set up an "osig" file as described on the Oculus website. You also may want to search all gradle files for instances of:

abiFilters 'arm64-v8a'

and replace it with:

abiFilters 'armeabi-v7a','arm64-v8a'

and then do another build. This will allow your build to run on 32-bit phones.

To build the autoloader test app:

When built without any changes, this repo produces an "org.lovr.appsample" app that prints a "game not found" message. If you look in the Github "releases" section, however, you'll find a "org.lovr.test" app that loads a game from the SD card where you can easily copy it using adb sync. Run the app for full instructions.

To build the org.lovr.test app yourself:

The command to upload a Lua project to the SD card so org.lovr.test can run it is:

adb push --sync . /sdcard/Android/data/org.lovr.test/files/.lodr

Debugging:

If you get a crash, select the crash report in adb logcat, then run this to extract the crash report and look up line numbers:

pbpaste | ~/Library/Android/sdk/ndk-bundle/prebuilt/darwin-x86_64/bin/ndk-stack -sym ./LovrApp/Projects/Android/build/intermediates/transforms/mergeJniLibs/debug/0/lib/arm64-v8a

Contributing

Upgrading

This repository has a branch "oculus-original-sdk". As commits, this branch has versions of some versions of official Oculus Mobile SDK releases (with those samples which are not necessary, notably the ones with large embedded video samples, deleted).

If you need to upgrade the version of Oculus Mobile SDK used by this release, you should do so by checking out the "oculus-original-sdk" branch, unpacking the latest ovr_sdk_mobile package into the repository, committing, and then merging back into the master branch. This will ensure that changes to the SDK are cleanly incorporated.

TODO

Known limitations and planned improvement for LovrApp and Lovr for Oculus Mobile:

License

This repository is based on the Oculus Mobile SDK, which Oculus has made available under the terms in LICENSE-OCULUS.txt, and Lovr, which is available under the terms in "cmakelib/lovr/LICENSE".

LovrApp (the additional glue built on top) is by Andi McClure <andi.m.mcclure@gmail.com> and is made available under the license below.

Copyright 2020 Andi McClure

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.