99< body >
1010< div class ="content " id ="checking ">
1111 < h1 > Checking your current Beat Saber install</ h1 >
12- < h3 > Please wait a bit. This may take 3 minute </ h3 >
12+ < h3 > Please wait a bit. This may take 3 minutes </ h3 >
1313 < div class ="loaderContainer center ">
1414 < div class ="loaderBarRight "> </ div >
1515 < div class ="loaderBarLeft "> </ div >
@@ -169,6 +169,45 @@ <h1>QAVS can currently not manage mods for Quest 3!</h1>
169169 < br > You can ask for help in the #quest-help channel at discord.gg/beatsabermods (Discord Server).
170170 </ p >
171171</ div >
172+ < div class ="content hidden " id ="sl2 ">
173+ < h1 > QAVS can currently not patch Beat Saber for you!</ h1 >
174+ < p >
175+ QAVS cannot patch Beat Saber. For that you will have to use QuestPatcher on your PC with Scotland2 selected.
176+ < br >
177+ After patching Beat Saber you can come back to QAVS to install and manage mods.
178+ < br >
179+ You can ask for help in the #quest-help channel at discord.gg/beatsabermods (Discord Server).
180+
181+ < br >
182+ < br >
183+ < button onclick ="location.reload() "> I installed Beat Saber. Please check my game again.</ button >
184+ </ p >
185+ </ div >
186+ < div class ="content hidden " id ="notInstalled ">
187+ < h1 > Beat Saber is not installed</ h1 >
188+ < p >
189+ You must install Beat Saber from the store in order to mod it. Please come back after modding Beat Saber
190+ </ p >
191+ < br >
192+ < br >
193+ < button onclick ="location.reload() "> I patched using QuestPatcher. Please check my game again.</ button >
194+ </ div >
195+ < div class ="content hidden " id ="selectVersion ">
196+ < h1 > Select a version</ h1 >
197+ < p >
198+ First you'll need to select one of the recommended game version you want to mod. If you're not sure which to choose just press < code > Next</ code >
199+ </ p >
200+ < br >
201+ < select id ="gameVersions ">
202+
203+ </ select >
204+ < br >
205+ < button onclick ="VersionSelected() "> Next</ button >
206+ < br >
207+ < br >
208+ < br >
209+ < button style ="font-size: 0.7rem " onclick ="SelectVersion(true) "> Show all versions (not recommended> </ button >
210+ </ div >
172211< div style ="position: fixed; bottom: 10px; left: 10px; ">
173212 < button id ="showSupportButton " onclick ="ShowSupport() "> Help</ button >
174213 < div id ="helpSection " style ="display: none; " class ="box ">
@@ -207,6 +246,11 @@ <h2>Upload logs</h2>
207246 var tab = params . get ( 'tab' ) ;
208247 var checkdowngrade = params . get ( 'checkdowngrade' ) ;
209248 var startDownload = params . get ( 'startdownload' ) ;
249+ var versionSpecified = false
250+ if ( params . get ( "version" ) ) {
251+ selectedVersion = params . get ( "version" )
252+ versionSpecified = true
253+ }
210254 const start = ""
211255 const squareLoader = `
212256 <div class="loaderContainer center">
@@ -220,8 +264,37 @@ <h2>Upload logs</h2>
220264 <div class="loaderSquare"></div>
221265 </div>`
222266
267+ function VersionSelected ( ) {
268+ selectedVersion = document . getElementById ( "gameVersions" ) . value
269+ versionSpecified = true
270+ FirstOpen ( )
271+ }
272+
273+ function SelectVersion ( showAll = false ) {
274+ fetch ( "https://raw.githubusercontent.com/ComputerElite/QuestAppVersionSwitcher/main/Assets/downgrade.json" ) . then ( res => res . json ( ) . then ( downgrade => {
275+ UpdateSupportedBeatSaberVersions ( ) . then ( ( ) => {
276+ if ( SupportedBeatSaberVersions . length < 0 ) {
277+ OpenTab ( "offline" )
278+ return
279+ }
280+ versions = downgrade . recommendedVersions
281+ if ( ! versions . includes ( SupportedBeatSaberVersions [ 0 ] ) ) versions . unshift ( SupportedBeatSaberVersions [ 0 ] )
282+ if ( showAll ) versions = SupportedBeatSaberVersions
283+
284+ var html = ""
285+ for ( const v of versions ) {
286+ html += `<option value="${ v } ">${ SupportedBeatSaberVersions [ 0 ] == v ? `${ v } (latest)` : v } </option>`
287+ }
288+ document . getElementById ( "gameVersions" ) . innerHTML = html
289+ OpenTab ( "selectVersion" )
290+ } )
291+ } ) ) . catch ( err => {
292+ console . log ( err )
293+ OpenTab ( "offline" )
294+ } )
295+ }
296+
223297 function InitialStuff ( ) {
224-
225298 if ( tab ) {
226299 if ( tab == "afterrestore" ) {
227300 fetch ( start + "/api/android/device" ) . then ( res => res . json ( ) . then ( j => {
@@ -313,6 +386,7 @@ <h2>Upload logs</h2>
313386 function ModSettings ( ) {
314387 location = start + `/?tab=patching`
315388 }
389+ var patchExtras = ""
316390 function ModDowngradedGame ( ) {
317391 patchExtras = `?package=${ lastDownloadProgress . packageName } &backup=${ lastDownloadProgress . backupName } `
318392 OpenTab ( "modgame" )
@@ -409,7 +483,7 @@ <h2>Upload logs</h2>
409483 return
410484 }
411485 fetch ( start + "/api/cleardownloads" , { method : "POST" } )
412- location = start + `/?download=true&version=${ SupportedBeatSaberVersions [ 0 ] } &noaccesscheck=true&game=2448060205267927&afterdownload=${ encodeURIComponent ( start + `/flows/beat_saber_modding?tab=download&startdownload=true` ) } `
486+ location = start + `/?download=true&version=${ selectedVersion } &noaccesscheck=true&game=2448060205267927&afterdownload=${ encodeURIComponent ( start + `/flows/beat_saber_modding?tab=download&startdownload=true` ) } `
413487 }
414488
415489 function CheckDowngrade ( ) {
@@ -418,12 +492,12 @@ <h2>Upload logs</h2>
418492 el . innerText = moddedStatus . isInstalled ? moddedStatus . version : "Not installed"
419493 }
420494 for ( const el of document . getElementsByClassName ( "supportedBsVersion" ) ) {
421- el . innerText = SupportedBeatSaberVersions [ 0 ]
495+ el . innerText = selectedVersion
422496 }
423497 // Check if the latest version is already downloaded by getting backup list of Beat Saber, then checking
424498 fetch ( start + "/api/backups?package=com.beatgames.beatsaber" ) . then ( res => res . json ( ) . then ( j => {
425499 for ( const b of j . backups ) {
426- if ( b . gameVersion == SupportedBeatSaberVersions [ 0 ] && b . isDownloadedFromOculus ) {
500+ if ( b . gameVersion == selectedVersion && b . isDownloadedFromOculus ) {
427501 // Game version is already downloaded. Show mod game button
428502 console . log ( "Found backup for latest modable version, showing mod game button" )
429503 // emulate finished download
@@ -447,7 +521,9 @@ <h2>Upload logs</h2>
447521 currentSha = json . msg
448522 console . log ( currentSha )
449523 fetch ( "https://raw.githubusercontent.com/ComputerElite/APKDowngrader/main/versions.json" ) . then ( res => res . json ( ) . then ( patches => {
450- patches = patches . versions . filter ( x => x . SSHA256 == currentSha && x . TV == SupportedBeatSaberVersions [ 0 ] )
524+ patches = patches . versions . filter ( x => x . SSHA256 == currentSha && x . TV == selectedVersion )
525+ console . log ( "Apk sha is " + currentSha )
526+ console . log ( )
451527 if ( patches . length <= 0 ) {
452528 // No patches found
453529 OpenTab ( "patcheserror" )
@@ -549,7 +625,7 @@ <h2>Upload logs</h2>
549625 handTrackingVersion : 0 , // Default
550626 externalStorage : true ,
551627 openXR : true ,
552- modloader : moddedStatus . recommendedModloader // QuestLoader = 0, Scotland2 = 1
628+ modloader : modloader // QuestLoader = 0, Scotland2 = 1
553629 }
554630 document . getElementById ( "modgamebutton" ) . style . display = "none"
555631 patchInProgressContainer . style . display = "block"
@@ -601,30 +677,52 @@ <h2>Upload logs</h2>
601677 function UpdateModGamePage ( ) {
602678 document . getElementById ( "modgamebsversion" ) . innerText = moddedStatus . version ;
603679 }
680+
681+ var selectedVersion = ""
682+ var modloader = 0
604683
605684 function FirstOpen ( ) {
606685 // Not logged in
686+ OpenTab ( "checking" )
687+ if ( ! selectedVersion ) {
688+ // let user select the version they want to use
689+ SelectVersion ( )
690+ return
691+ }
607692 UpdateModdedStatus ( ) . then ( ( ) => {
608693 if ( ! moddedStatus . isInstalled ) {
609694 // Downgrade
610- OpenTab ( diffDowngradeEnabled ? "downgradeLoginDiff" : "downgrade" )
611- CheckDowngrade ( )
695+ if ( diffDowngradeEnabled ) {
696+ OpenTab ( "notInstalled" )
697+ } else {
698+ OpenTab ( "downgrade" )
699+ CheckDowngrade ( )
700+ }
612701 } else {
613702 UpdateSupportedBeatSaberVersions ( ) . then ( ( ) => {
703+ if ( selectedVersion == "" && SupportedBeatSaberVersions . length > 0 ) {
704+ selectedVersion = SupportedBeatSaberVersions [ 0 ]
705+ }
614706 if ( SupportedBeatSaberVersions . length <= 0 ) {
615707 // OH NO; USER IS OFFLINE
616708 OpenTab ( "offline" )
617- } else if ( SupportedBeatSaberVersions [ 0 ] == moddedStatus . version ) {
709+ } else if ( selectedVersion == moddedStatus . version ) {
618710 // Continue with modding
619-
620- if ( moddedStatus . isPatched ) {
621- // Already modded
622- OpenTab ( "alreadymodded" )
623- } else {
624- // Not modded
625- OpenTabIfSAFAccess ( "modgame" )
626- UpdateModGamePage ( )
627- }
711+ fetch ( `${ start } /api/patching/recommendmodloader?package=com.beatgames.beatsaber&version=${ selectedVersion } ` ) . then ( res => res . json ( ) . then ( j => {
712+ modloader = j . modloader
713+ if ( moddedStatus . isPatched ) {
714+ // Already modded
715+ OpenTab ( "alreadymodded" )
716+ } else {
717+ // Not modded
718+ if ( modloader == 1 && moddedStatus . device . sdkVersion >= 32 ) {
719+ OpenTab ( "sl2" )
720+ } else {
721+ OpenTabIfSAFAccess ( "modgame" )
722+ UpdateModGamePage ( )
723+ }
724+ }
725+ } ) )
628726 } else {
629727 // Downgrade
630728 CheckDowngrade ( )
@@ -639,6 +737,7 @@ <h2>Upload logs</h2>
639737
640738 function UpdateSupportedBeatSaberVersions ( ) {
641739 return new Promise ( ( resolve , reject ) => {
740+ SupportedBeatSaberVersions = [ ]
642741 fetch ( "https://computerelite.github.io/tools/Beat_Saber/coreMods.json" ) . then ( res => res . json ( ) . then ( j => {
643742 for ( const [ key , value ] of Object . entries ( j ) ) {
644743 SupportedBeatSaberVersions . push ( key ) ;
0 commit comments