Skip to content

Commit 5ea1650

Browse files
ComputerEliteComputerElite
authored andcommitted
add patching options
1 parent 87bf102 commit 5ea1650

6 files changed

Lines changed: 147 additions & 34 deletions

File tree

Assets/html/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,51 @@
2626
<h3>Currently selected game: <div class="inline packageName">some game</div></h3>
2727
<div id="patchStatus">Loading...</div>
2828
<div class="textbox" id="patchingTextBox"></div>
29+
30+
<h2>Patching options</h2>
31+
<label class="option">
32+
<label class="switch normal">
33+
<input id="externalstorage" type="checkbox" checked>
34+
<span class="slider round"></span>
35+
</label>
36+
Add external storage permission
37+
</label>
38+
<br>
39+
<label class="option">
40+
<label class="switch normal">
41+
<input id="handtracking" type="checkbox" checked>
42+
<span class="slider round"></span>
43+
</label>
44+
Add hand tracking permission
45+
</label>
46+
<br>
47+
<label class="option">
48+
Hand tracking version
49+
<select id="handtrackingversion">
50+
<option value="3">V2</option>
51+
<option value="2">V1 high frequency</option>
52+
<option value="1">V1</option>
53+
</select>
54+
</label>
55+
<br>
56+
<br>
57+
<label class="option">
58+
<label class="switch normal">
59+
<input id="debug" type="checkbox" checked>
60+
<span class="slider round"></span>
61+
</label>
62+
Add Debug option
63+
</label>
64+
<br>
65+
<br>
66+
<input type="text" id="otherName" placeholder="permission name">
67+
<br>
68+
<br>
69+
<div class="button" onclick="AddPermission()">Add Permission</div>
70+
<br>
71+
<div id="other">
72+
73+
</div>
2974
</div>
3075
<div class="contentItem hidden" id="mods">
3176
<b>Please note that mod installation is in early access, there may be issues. Feel free to give feedback on the OculusDB Discord Server at <code>discord.gg/zwRfHQN2UY</code></b>

Assets/html/script.js

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function UpdatePatchingStatus() {
4747
document.getElementById("modsButton").style.visibility = "hidden"
4848
}
4949

50-
if(!IsOnQuest() && !res.isPatched) {
50+
if(!IsOnQuest() && !res.isPatched && false) {
5151
patchStatus.innerHTML = "<h2>To mod your game open QuestAppVersionSwitcher on your Quest</h2>"
5252
return;
5353
}
@@ -63,6 +63,14 @@ var operationsOngoing = false
6363
const operationsElement = document.getElementById("operations")
6464
const ongoingCount = document.getElementById("ongoingCount")
6565
const operationsList = document.getElementById("operationsList")
66+
67+
const externalStorageCheckbox = document.getElementById("externalstorage")
68+
const handTrackingCheckbox = document.getElementById("handtracking")
69+
const handTrackingVersion = document.getElementById("handtrackingversion")
70+
const debugCheckbox = document.getElementById("debug")
71+
const otherContainer = document.getElementById("other")
72+
var otherPermissions = []
73+
6674
function UpdateModsAndLibs() {
6775
fetch(`/mods/mods`).then(res => {
6876
res.json().then(res => {
@@ -154,42 +162,78 @@ function FormatMod(mod, active = true) {
154162
`
155163
}
156164

165+
function AddPermission() {
166+
otherPermissions.push(document.getElementById("otherName").value)
167+
document.getElementById("otherName").value = ""
168+
UpdatePermissions()
169+
}
170+
171+
function UpdatePermissions() {
172+
var perms = ""
173+
for(const p of otherPermissions){
174+
perms += `
175+
<div style="padding: 10px; margin-right: 20px; border-radius: 5px; border: 1px #242424 solid;">
176+
${p}
177+
<div class="button" style="display: inline" onclick="RemovePermission('${p}')">X</div>
178+
</div>`
179+
}
180+
otherContainer.innerHTML = perms
181+
}
182+
183+
function RemovePermission(name) {
184+
otherPermissions = otherPermissions.filter(a => a != name)
185+
UpdatePermissions()
186+
}
187+
157188
var patchInProgress = false
158189
var lastApp = ""
159190
function PatchGame() {
160191
patchInProgress = true
161-
fetch("/patching/patchapk").then(res => {
162-
res.text().then(text => {
163-
if (res.status == 202) {
164-
TextBoxText("patchingTextBox", text)
165-
patchStatus.innerHTML = `<h2>Patching game<br><br>${squareLoader}</h2>`
166-
var i = setInterval(() => {
167-
fetch("/patching/patchstatus").then(res => {
168-
res.json().then(text => {
169-
if (res.status == 202) {
170-
TextBoxText("patchingTextBox", text.msg)
171-
} else if (res.status == 200) {
172-
TextBoxGood("patchingTextBox", text.msg)
173-
clearInterval(i)
174-
patchInProgress = false
175-
if(text.value) {
176-
// patching returned a backup name to restore so restore the backup
177-
selectedBackup = text.value
178-
OpenRestorePopup();
192+
var patchOptions = {
193+
otherPermissions: otherPermissions,
194+
debug: debugCheckbox.checked,
195+
handTracking: handTrackingCheckbox.checked,
196+
handTrackingVersion: parseInt(handTrackingVersion.value),
197+
externalStorage: externalStorageCheckbox.checked
198+
}
199+
fetch(`/patching/setpatchoptions?body=${JSON.stringify(patchOptions)}`).then(res => {
200+
fetch("/patching/patchapk").then(res => {
201+
res.text().then(text => {
202+
if (res.status == 202) {
203+
TextBoxText("patchingTextBox", text)
204+
patchStatus.innerHTML = `<h2>Patching game<br><br>${squareLoader}</h2>`
205+
var i = setInterval(() => {
206+
fetch("/patching/patchstatus").then(res => {
207+
res.json().then(text => {
208+
if (res.status == 202) {
209+
TextBoxText("patchingTextBox", text.msg)
210+
} else if (res.status == 200) {
211+
TextBoxGood("patchingTextBox", text.msg)
212+
clearInterval(i)
213+
patchInProgress = false
214+
if(text.value) {
215+
if(!IsOnQuest()) {
216+
alert("Restore the backup with patched in its name from within your Quest to finalize the patching process")
217+
return
218+
}
219+
// patching returned a backup name to restore so restore the backup
220+
selectedBackup = text.value
221+
OpenRestorePopup();
222+
}
223+
UpdateUI()
224+
} else {
225+
TextBoxError("patchingTextBox", text.msg)
226+
clearInterval(i)
227+
patchInProgress = false
228+
UpdateUI()
179229
}
180-
UpdateUI()
181-
} else {
182-
TextBoxError("patchingTextBox", text.msg)
183-
clearInterval(i)
184-
patchInProgress = false
185-
UpdateUI()
186-
}
230+
})
187231
})
188-
})
189-
}, 500);
190-
} else {
191-
TextBoxError("patchingTextBox", text)
192-
}
232+
}, 500);
233+
} else {
234+
TextBoxError("patchingTextBox", text)
235+
}
236+
})
193237
})
194238
})
195239
}

Assets/html/style.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,23 @@ body {
447447
margin-right: 20px
448448
}
449449

450+
#other {
451+
display: flex;
452+
flex-wrap: wrap;
453+
}
454+
450455
.relative {
451456
position: relative;
452457
}
453458

459+
.option {
460+
margin-left: 30px;
461+
}
462+
463+
.normal {
464+
position: relative !important;
465+
}
466+
454467
/* The switch - the box around the slider */
455468
.switch {
456469
position: absolute;

Properties/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.0" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="20">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.1" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="21">
33
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="29" />
44
<uses-permission android:name="oculus.permission.handtracking" />
55
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
// Minor Version
2323
// Build Number
2424
// Revision
25-
[assembly: AssemblyVersion("1.6.0.0")]
26-
[assembly: AssemblyFileVersion("1.6.0.0")]
25+
[assembly: AssemblyVersion("1.6.1.0")]
26+
[assembly: AssemblyFileVersion("1.6.1.0")]

WebServer.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ public void Start()
167167
request.SendString(QAVSModManager.GetMods(), "application/json");
168168
return true;
169169
}));
170+
server.AddRoute("GET", "/patching/getpatchoptions", new Func<ServerRequest, bool>(request =>
171+
{
172+
request.SendString(JsonSerializer.Serialize(CoreService.coreVars.patchingPermissions), "application/json");
173+
return true;
174+
}));
175+
server.AddRoute("GET", "/patching/setpatchoptions", new Func<ServerRequest, bool>(request =>
176+
{
177+
CoreService.coreVars.patchingPermissions = JsonSerializer.Deserialize<PatchingPermissions>(request.queryString.Get("body"));
178+
request.SendString("Set patch options", "application/json");
179+
return true;
180+
}));
170181
server.AddRoute("GET", "/mods/operations", new Func<ServerRequest, bool>(request =>
171182
{
172183
request.SendString(JsonSerializer.Serialize(QAVSModManager.runningOperations), "application/json");

0 commit comments

Comments
 (0)