diff --git a/index.html b/index.html index fcaf20d..0b54334 100644 --- a/index.html +++ b/index.html @@ -15,17 +15,71 @@

Server URL:

- - + + +
+
+
+



diff --git a/loader.js b/loader.js index 7f7f27e..8143e25 100644 --- a/loader.js +++ b/loader.js @@ -1,95 +1,131 @@ function update_status(status) { + console.log(status); document.getElementById("status").innerText = status; } -function init_honoka(file, android, newDomain) { - async function onloaded() { - if (newDomain.endsWith("/")) newDomain = newDomain.slice(0, -1); - if (!file) { - console.log("downloading"); - update_status("Downloading..."); - if (android) { - file = await (await fetch("https://ethanthesleepy.one/public/lovelive/lovelive-community.apk")).blob(); - } else { - file = await (await fetch("https://ethanthesleepy.one/public/lovelive/lovelive-community.ipa")).blob(); +async function patch(file, android, newDomain, patches) { + if (newDomain.endsWith("/")) newDomain = newDomain.slice(0, -1); + + if (!file) { + console.log("downloading"); + update_status("Downloading..."); + file = await (await fetch("https://ethanthesleepy.one/public/lovelive/lovelive-community." + (android ? "apk" : "ipa"))).blob(); + console.log("downloaded"); + } + console.log("loaded"); + update_status("Opening file"); + const zip = new JSZip(); + await zip.loadAsync(file); + update_status("Getting current config"); + + let basePath = android ? "" : "Payload/LoveLive.app/ProjectResources/"; + let server_file; + if (android) { + let server_info = await zip.file("assets/AppAssets.zip").async("arraybuffer"); + const zip2 = new JSZip(); + await zip2.loadAsync(server_info); + server_file = await zip2.file("config/server_info.json").async("arraybuffer"); + } else { + server_file = await zip.file("Payload/LoveLive.app/ProjectResources/config/server_info.json").async("arraybuffer"); + } + + let postPatches = []; + for (let i=0; iuber-apk-signer, sign it with the command `java -jar uber-apk-signer-.jar lovelive.apk`."; - document.body.appendChild(p); + console.log("Downloading patch", file.path); + let res = await fetch(file.path); + if (!res.ok) { + console.warn("Error downloading patch"); + continue; + } + zip.file(basePath + file.outpath, await res.blob()); } } + + //console.log(server_file); + FS.writeFile("/server_info.json", new Uint8Array(server_file)); + update_status("Decrypting"); + Module.callMain(["server_info.json"]); + update_status("Patching domain"); + const data = FS.readFile("/server_info.json", {encoding: 'utf8'}); + const currentData = JSON.parse(data); + const currentDomain = currentData.domain; + const newData = data.split(currentDomain).join(newDomain); + FS.writeFile("/server_info.json", newData); + update_status("Encrypting"); + Module.callMain(["-e", "-j", "server_info.json"]); + const new_server_info = FS.readFile("/server_info.json"); + + let type; + let ext; + update_status("Applying changes"); + if (android) { + let server_info = await zip.file("assets/AppAssets.zip").async("arraybuffer"); + const zip2 = new JSZip(); + await zip2.loadAsync(server_info); + zip2.file("config/server_info.json", new_server_info); + + for (let i=0; iuber-apk-signer, sign it with the command `java -jar uber-apk-signer-.jar -a lovelive.apk`."; + document.body.appendChild(p); + } +} + +function init_honoka(file, android, newDomain, patches) { window.Module = { noInitialRun: true, onRuntimeInitialized: async function() { try { - await onloaded(); + await patch(file, android, newDomain, patches); } catch(e) { + console.warn(e); document.getElementById("status").innerText = "It didnt work. Are your files/options invalid?"; } }, diff --git a/patches.json b/patches.json new file mode 100644 index 0000000..8341b77 --- /dev/null +++ b/patches.json @@ -0,0 +1,49 @@ +[ + { + "id": "english", + "description": "Force the language to english", + "android": false, + "ios": true, + "checked": true, + "files": [ + { + "path": "patches/english/language.lua", + "outpath": "common/language.lua" + } + ] + }, + { + "id": "enable_serial_code", + "description": "Enable serial code in settings menu", + "android": false, + "ios": true, + "checked": true, + "files": [ + { + "path": "patches/serial_code/model.lua", + "outpath": "m_menu/model.lua" + } + ] + }, + { + "id": "restore_title_screen_song", + "description": "Enable the title screen music", + "android": false, + "ios": true, + "checked": true, + "files": [ + { + "path": "patches/restore_title_screen_song/assets/sound/login/startup_aq_1.mp3", + "outpath": "assets/sound/login/startup_aq_1.mp3" + }, + { + "path": "patches/restore_title_screen_song/assets/sound/login/startup_mu_1.mp3", + "outpath": "assets/sound/login/startup_mu_1.mp3" + }, + { + "path": "patches/restore_title_screen_song/m_login/start.lua", + "outpath": "m_login/start.lua" + } + ] + } +] diff --git a/patches/english/language.lua b/patches/english/language.lua new file mode 100644 index 0000000..dca01ff Binary files /dev/null and b/patches/english/language.lua differ diff --git a/patches/restore_title_screen_song/assets/sound/login/startup_aq_1.mp3 b/patches/restore_title_screen_song/assets/sound/login/startup_aq_1.mp3 new file mode 100644 index 0000000..b81695c Binary files /dev/null and b/patches/restore_title_screen_song/assets/sound/login/startup_aq_1.mp3 differ diff --git a/patches/restore_title_screen_song/assets/sound/login/startup_mu_1.mp3 b/patches/restore_title_screen_song/assets/sound/login/startup_mu_1.mp3 new file mode 100644 index 0000000..606382f Binary files /dev/null and b/patches/restore_title_screen_song/assets/sound/login/startup_mu_1.mp3 differ diff --git a/patches/restore_title_screen_song/m_login/start.lua b/patches/restore_title_screen_song/m_login/start.lua new file mode 100644 index 0000000..22ba3de Binary files /dev/null and b/patches/restore_title_screen_song/m_login/start.lua differ diff --git a/patches/serial_code/model.lua b/patches/serial_code/model.lua new file mode 100644 index 0000000..d2bd1a3 Binary files /dev/null and b/patches/serial_code/model.lua differ