Skip to content

Commit

Permalink
Merge pull request #131 from rcelyte/feat/openxr
Browse files Browse the repository at this point in the history
Add OpenXR permission
  • Loading branch information
Lauriethefish authored Dec 19, 2023
2 parents 5a9b7dd + c4d18cb commit 7bdd685
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions QuestPatcher.Core/Models/PatchingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public bool HandTracking

public bool Microphone { get; set; }

public bool OpenXR { get; set; }

public bool FlatScreenSupport { get; set; }

public HandTrackingVersion HandTrackingType { get; set; }
Expand Down
36 changes: 36 additions & 0 deletions QuestPatcher.Core/Patching/PatchingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class PatchingManager : INotifyPropertyChanged
private const int DebuggableAttributeResourceId = 16842767;
private const int LegacyStorageAttributeResourceId = 16844291;
private const int ValueAttributeResourceId = 16842788;
private const int AuthoritiesAttributeResourceId = 16842776;

/// <summary>
/// Compression level to use when adding files to the APK during patching.
Expand Down Expand Up @@ -191,6 +192,41 @@ private async Task PatchManifest(ApkZip apk)
addingFeatures.Add("oculus.software.handtracking");
}

if (permissions.OpenXR)
{
Log.Information("Adding OpenXR permission . . .");

addingPermissions.AddRange(new[] {
"org.khronos.openxr.permission.OPENXR",
"org.khronos.openxr.permission.OPENXR_SYSTEM",
});

AxmlElement providerElement = new("provider") {
Attributes = {new("authorities", AndroidNamespaceUri, AuthoritiesAttributeResourceId, "org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker")},
};
AxmlElement runtimeIntent = new("intent") {
Children = {
new("action") {
Attributes = {new("name", AndroidNamespaceUri, NameAttributeResourceId, "org.khronos.openxr.OpenXRRuntimeService")},
},
},
};
AxmlElement layerIntent = new("intent") {
Children = {
new("action") {
Attributes = {new("name", AndroidNamespaceUri, NameAttributeResourceId, "org.khronos.openxr.OpenXRApiLayerService")},
},
},
};
manifest.Children.Add(new("queries") {
Children = {
providerElement,
runtimeIntent,
layerIntent,
},
});
}

// Find which features and permissions already exist to avoid adding existing ones
var existingPermissions = GetExistingChildren(manifest, "uses-permission");
var existingFeatures = GetExistingChildren(manifest, "uses-feature");
Expand Down
1 change: 1 addition & 0 deletions QuestPatcher/Views/PatchingView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<ToggleSwitch IsChecked="{Binding Config.PatchingOptions.Debuggable}">Allow Debugging</ToggleSwitch>
<ToggleSwitch IsChecked="{Binding Config.PatchingOptions.FlatScreenSupport}">Disable VR Requirement</ToggleSwitch>
<ToggleSwitch IsChecked="{Binding Config.PatchingOptions.Microphone}">Enable Microphone</ToggleSwitch>
<ToggleSwitch IsChecked="{Binding Config.PatchingOptions.OpenXR}">Enable OpenXR</ToggleSwitch>

<StackPanel Orientation="Vertical" Spacing="10">
<TextBlock>Hand Tracking Type</TextBlock>
Expand Down

0 comments on commit 7bdd685

Please sign in to comment.