Skip to content

Commit 3b28523

Browse files
committed
Fix most stuff with adb, add guide, everything should work as before now
1 parent 5d86bfc commit 3b28523

10 files changed

Lines changed: 114 additions & 37 deletions

File tree

QuestAppVersionSwitcher/Assets/html/adb.html

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ <h1>Pairing</h1>
3434
<input type="number" placeholder="port" id="port">
3535
<input type="number" placeholder="code" id="code">
3636
<button onclick="pair()">Pair</button>
37+
<h2>Guide</h2>
38+
<div>
39+
<img id="guideImage">
40+
<p id="guideText"></p>
41+
42+
<button onclick="UpdateGuide(-1)">&lt;</button>
43+
<button onclick="UpdateGuide(1)">&gt;</button>
44+
</div>
3745
</div>
3846
<div class="content hidden" id="remember">
3947
<h1>Connect</h1>
@@ -43,6 +51,11 @@ <h1>Connect</h1>
4351
<button onclick="settings()">Open android settings</button>
4452
<input type="number" placeholder="wireless port" id="adbport">
4553
<button onclick="connect()">Connect</button>
54+
<h2>Guide</h2>
55+
<div>
56+
<img src="/images/adb/11.jpg">
57+
<p>You will find the port in the wireless debugging settings.In this screenshot the port is 46137. Input the one from your settings into the wireless port above and hit connect.</p>
58+
</div>
4659
</div>
4760
<div class="content hidden" id="connecting">
4861
<h1>Connecting, please wait a bit</h1>
@@ -76,10 +89,51 @@ <h1>Making connecting persistent, please wait a bit</h1>
7689
FirstOpen()
7790
// get after query string
7891
var urlParams = new URLSearchParams(window.location.search);
79-
var after = urlParams.get('after')
92+
var shouldGoBack = urlParams.get('goback') == true
8093

8194
function AdbConnected() {
82-
location = decodeURIComponent(after || "/");
95+
location = localStorage.redirect || "/";
96+
}
97+
98+
var currentPage = 0
99+
const pages = [{
100+
img: "/images/adb/1.jpg",
101+
txt: "Open the settings on your Quest with the button above"
102+
},{
103+
img: "/images/adb/2.jpg",
104+
txt: "Scroll down and press on 'About headset'"
105+
},{
106+
img: "/images/adb/3.jpg",
107+
txt: "Scroll down and press 'Build number' 7 times"
108+
},{
109+
img: "/images/adb/4.jpg",
110+
txt: "Go back and press on 'System'"
111+
},{
112+
img: "/images/adb/5.jpg",
113+
txt: "Press on 'Developer options'"
114+
},{
115+
img: "/images/adb/6.jpg",
116+
txt: "Enable 'Disable adb authorization timeout'"
117+
},{
118+
img: "/images/adb/7.jpg",
119+
txt: "Click on 'Wireless debugging'. Make sure to click into the blank space"
120+
},{
121+
img: "/images/adb/8.jpg",
122+
txt: "Enable wireless debugging"
123+
},{
124+
img: "/images/adb/9.jpg",
125+
txt: "Click on 'Pair device with pairing code'"
126+
},{
127+
img: "/images/adb/10.jpg",
128+
txt: "Enter the pairing code you see in your pop up ('713691' in picture) and the port from your pop up ('41389' in picture) in the fields above (in QAVS) and press the 'Pair' button"
129+
}]
130+
UpdateGuide(0)
131+
function UpdateGuide(pageIncrement) {
132+
currentPage += pageIncrement
133+
if (currentPage < 0) currentPage = 0
134+
if (currentPage >= pages.length) currentPage = pages.length - 1
135+
document.getElementById('guideImage').src = pages[currentPage].img
136+
document.getElementById('guideText').innerText = pages[currentPage].txt
83137
}
84138

85139
function connect() {

QuestAppVersionSwitcher/Assets/html/flows/beat_saber_modding.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ <h2>Upload logs</h2>
256256
var checkdowngrade = params.get('checkdowngrade');
257257
var startDownload = params.get('startdownload');
258258
var versionSpecified = false
259+
var selectedVersion = ""
259260
if(params.get("version")) {
260261
selectedVersion = params.get("version")
261262
versionSpecified = true
@@ -326,7 +327,7 @@ <h2>Upload logs</h2>
326327
if(tab) {
327328
if(tab == "afterrestore") {
328329
fetch(start + "/api/android/device").then(res => res.json().then(j => {
329-
if (j.device == "eureka") {
330+
if (j.device == "eureka" && false) { // disable device check, qavs has adb now :3
330331
// Logged in
331332
OpenTab("quest3")
332333
} else {
@@ -362,7 +363,8 @@ <h2>Upload logs</h2>
362363
}
363364

364365
function ADBRequest() {
365-
location = start + `/adb?after=${encodeURIComponent(`/flows/beat_saber_modding?tab=${nextTab}`)}`
366+
localStorage.redirect = start + `/flows/beat_saber_modding?tab=${nextTab}`
367+
location = start + `/adb?goback=true`
366368
}
367369

368370

@@ -476,7 +478,7 @@ <h2>Upload logs</h2>
476478
}
477479

478480
function Login() {
479-
localStorage.redirect = start + `/flows/beat_saber_modding?tab=downgrade&checkdowngrade=true`
481+
localStorage.redirect = start + `/flows/beat_saber_modding?tab=downgrade&checkdowngrade=true&version=${selectedVersion}`
480482
location = "/?startlogin=true"
481483
}
482484

@@ -705,7 +707,6 @@ <h2>Upload logs</h2>
705707
document.getElementById("modgamebsversion").innerText = moddedStatus.version;
706708
}
707709

708-
var selectedVersion = ""
709710
var modloader = 0
710711

711712
function FirstOpen() {
@@ -747,7 +748,7 @@ <h2>Upload logs</h2>
747748
OpenTab("alreadymodded")
748749
} else {
749750
// Not modded
750-
if(modloader == 1 && moddedStatus.device.sdkVersion >= 32) {
751+
if(modloader == 1 && moddedStatus.device.sdkVersion >= 32 && false) { // QAVS got adb now :3
751752
OpenTab("sl2")
752753
} else {
753754
OpenTabIfSAFAccess("modgame")

QuestAppVersionSwitcher/Assets/html/script.js

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const squareLoader = `
1111
<div class="loaderSquare"></div>
1212
</div>`
1313
var diffDowngradeEnabled = true
14+
const params = new URLSearchParams(window.location.search)
1415

1516
fetch("/api/downgrade/usediff").then(res => res.json().then(res => {
1617
diffDowngradeEnabled = res.useDiff
@@ -298,7 +299,7 @@ function UpdateMods() {
298299
document.getElementById("libsList").innerHTML = libs
299300
}
300301
function IsOnQuest() {
301-
return location.host.startsWith("127.0.0.1") ||location.host.startsWith("localhost")
302+
return location.host.startsWith("127.0.0.1") || location.host.startsWith("localhost") || (params ? params.has("dev") : false)
302303
}
303304

304305
function GetPort() {
@@ -804,7 +805,6 @@ function PatchGame() {
804805
UpdateUI()
805806
TokenUIUpdate()
806807
const oculusLink = "https://auth.oculus.com/login/?redirect_uri=https%3A%2F%2Fdeveloper.oculus.com%2Fmanage%2F"
807-
const params = new URLSearchParams(window.location.search)
808808
var afterRestore = ""
809809
var afterDownload = ""
810810

@@ -819,6 +819,10 @@ function CheckStartParams() {
819819
var tab = params.get("tab")
820820
var logout = params.get("logout")
821821
var backuptopatchParam = params.get("backuptopatch")
822+
var selectedbackupParam= params.get("selectedbackup")
823+
if(selectedbackupParam) {
824+
AfterRestoreAdbAccess(selectedbackupParam)
825+
}
822826
afterRestore = params.get("afterrestore")
823827
afterDownload = params.get("afterdownload")
824828

@@ -1411,25 +1415,8 @@ document.getElementById("grantAccess").onclick = () => {
14111415
fetch("/api/android/ispackageinstalled?package=" + config.currentApp).then(res => {
14121416
res.json().then(j => {
14131417
if (j.isAppInstalled) {
1414-
fetch("/api/grantaccess?package=" + config.currentApp, {method: "POST"}).then(res => {
1415-
res.json().then(j => {
1416-
if (j.success) {
1417-
fetch("/api/backupinfo?package=" + config.currentApp + "&backupname=" + selectedBackup).then(res => {
1418-
res.json().then(j => {
1419-
if(j.isPatchedApk) {
1420-
GotoStep("4.2")
1421-
} else {
1422-
if (j.containsAppData || j.containsObbs) {
1423-
GotoStep(4)
1424-
} else {
1425-
GotoStep(5)
1426-
}
1427-
}
1428-
})
1429-
})
1430-
} else TextBoxError("step3box", j.msg)
1431-
})
1432-
})
1418+
localStorage.redirect = `/?selectedbackup=${selectedBackup}`
1419+
location = `/adb?goback=true`
14331420
}
14341421
else {
14351422
TextBoxError("step3box", config.currentApp + " is not installed. Please try again. Disable library sharing and remove all account from your quest except your primary one.")
@@ -1439,6 +1426,23 @@ document.getElementById("grantAccess").onclick = () => {
14391426
})
14401427
}
14411428

1429+
function AfterRestoreAdbAccess(selectedBackup) {
1430+
fetch("/api/backupinfo?package=" + config.currentApp + "&backupname=" + selectedBackup).then(res => {
1431+
res.json().then(j => {
1432+
OpenRestorePopup()
1433+
if(j.isPatchedApk) {
1434+
GotoStep("4.2")
1435+
} else {
1436+
if (j.containsAppData || j.containsObbs) {
1437+
GotoStep(4)
1438+
} else {
1439+
GotoStep(5)
1440+
}
1441+
}
1442+
})
1443+
})
1444+
}
1445+
14421446
document.getElementById("deleteAllMods").onclick = () => {
14431447
TextBoxText("updateTextBox", "Deleting all mods...")
14441448
fetch("/api/mods/deleteallmods", {
@@ -1463,7 +1467,8 @@ document.getElementById("grantAccess2").onclick = () => {
14631467
}
14641468

14651469
document.getElementById("grantAccess3").onclick = () => {
1466-
location = `/adb?after=${encodeURIComponent(start + `/?step16=true`)}`
1470+
localStorage.redirect = `/?step16=true`
1471+
location = `/adb?goback=true`
14671472
}
14681473

14691474
document.getElementById("requestManageStorageAppPermission").onclick = () => {
@@ -1522,7 +1527,7 @@ document.getElementById("skip2").onclick = () => {
15221527

15231528
document.getElementById("restoreBackup").onclick = () => {
15241529
if(!IsOnQuest()) {
1525-
TextBoxError("restoreTextBox", "You can only restore backups in your quest")
1530+
TextBoxError("restoreTextBox", "Backups can only be restored in your Quest directly. Please use QAVS in your quest.")
15261531
return
15271532
}
15281533
if (backupInProgress) {

QuestAppVersionSwitcher/FolderPermission.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,15 @@ public static void DeleteDirectoryContent(string dir)
276276

277277
public static bool NeedsSAF(string from, string to = "")
278278
{
279-
if (Build.VERSION.SdkInt <= BuildVersionCodes.Q) return false;
279+
if (DoesDeviceNeedSAF()) return false;
280280
return from.Contains("/Android/") || to.Contains("/Android/");
281281
}
282282

283+
public static bool DoesDeviceNeedSAF()
284+
{
285+
return Build.VERSION.SdkInt > BuildVersionCodes.Q;
286+
}
287+
283288
public static void DirectoryCopy(string sourceDirName, string destDirName)
284289
{
285290
if (!NeedsSAF(sourceDirName, destDirName))

QuestAppVersionSwitcher/Mods/QAVSModManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static async void Update()
160160
}
161161
else
162162
{
163-
modManager.usedModLoader = ModLoader.QuestLoader;
163+
modManager.usedModLoader = ModLoader.Scotland2;
164164
}
165165

166166
PatchingStatus status = PatchingManager.GetPatchingStatus(CoreService.coreVars.currentApp);

QuestAppVersionSwitcher/PatchingManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class PatchingManager
3535
public const string ManifestPath = "AndroidManifest.xml";
3636
public static readonly Uri AndroidNamespaceUri = new Uri("http://schemas.android.com/apk/res/android");
3737

38-
public static readonly string mainScotlandLoaderVersion = "v0.2.0-alpha";
38+
public static readonly string mainScotlandLoaderVersion = "v0.1.0-alpha";
3939
public static readonly string scotland2Version = "v0.1.4";
4040
public static readonly string questLoaderVersion = "v1.3.0";
4141

QuestAppVersionSwitcher/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.16.0" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="145">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.16.1" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="146">
33
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="32" />
44
<uses-permission android:name="oculus.permission.handtracking" />
55
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />

QuestAppVersionSwitcher/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.16.0.0")]
26-
[assembly: AssemblyFileVersion("1.16.0.0")]
25+
[assembly: AssemblyVersion("1.16.1.0")]
26+
[assembly: AssemblyFileVersion("1.16.1.0")]

QuestAppVersionSwitcher/QuestAppVersionSwitcher.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,17 @@
169169
<AndroidAsset Include="Assets\html\diff\diff.html" />
170170
<AndroidAsset Include="Assets\html\flows\beat_saber_modding.html" />
171171
<AndroidAsset Include="Assets\html\hiddenApps.json" />
172+
<AndroidAsset Include="Assets\html\images\adb\1.jpg" />
173+
<AndroidAsset Include="Assets\html\images\adb\10.jpg" />
174+
<AndroidAsset Include="Assets\html\images\adb\11.jpg" />
175+
<AndroidAsset Include="Assets\html\images\adb\2.jpg" />
176+
<AndroidAsset Include="Assets\html\images\adb\3.jpg" />
177+
<AndroidAsset Include="Assets\html\images\adb\4.jpg" />
178+
<AndroidAsset Include="Assets\html\images\adb\5.jpg" />
179+
<AndroidAsset Include="Assets\html\images\adb\6.jpg" />
180+
<AndroidAsset Include="Assets\html\images\adb\7.jpg" />
181+
<AndroidAsset Include="Assets\html\images\adb\8.jpg" />
182+
<AndroidAsset Include="Assets\html\images\adb\9.jpg" />
172183
<AndroidAsset Include="Assets\html\pair.html" />
173184
<AndroidAsset Include="Assets\libadb.so" />
174185
<None Include="Resources\AboutResources.txt" />

QuestAppVersionSwitcher/WebServer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ public void Start()
717717
server.AddRouteFile("/hiddenApps.json", "html/hiddenApps.json");
718718
server.AddRouteFile("/style.css", "html/style.css");
719719
server.AddRouteFile("/newstyle.css", "html/newstyle.css");
720+
server.AddRouteFolderWithFiles("/images", "html/images");
720721
server.AddRoute("GET", "/api/android/installedapps", serverRequest =>
721722
{
722723
serverRequest.SendString(JsonSerializer.Serialize(AndroidService.GetInstalledApps()), "application/json");
@@ -1241,7 +1242,7 @@ public void Start()
12411242
});
12421243
server.AddRoute("GET", "/api/gotaccess", serverRequest =>
12431244
{
1244-
if (!FolderPermission.NeedsSAF(""))
1245+
if (!FolderPermission.DoesDeviceNeedSAF())
12451246
{
12461247
serverRequest.SendString(GotAccess.GetResponse("Device doesn't require SAF. Continue as normal.", true, true),
12471248
"application/json");

0 commit comments

Comments
 (0)