mirror of
https://github.com/meowstercatel/r1-apk-patcher.git
synced 2024-12-22 23:25:20 -06:00
comments
This commit is contained in:
parent
e729bff20e
commit
58dfc9ecf3
1 changed files with 14 additions and 23 deletions
37
index.js
37
index.js
|
@ -5,7 +5,7 @@ const { Litterbox } = require("node-catbox");
|
||||||
const litterbox = new Litterbox();
|
const litterbox = new Litterbox();
|
||||||
|
|
||||||
//CHANGE THESE
|
//CHANGE THESE
|
||||||
let decompName = "RabbitLauncher0517";
|
let decompName = "RabbitLauncher0517"; //.apk file name without .apk
|
||||||
let uploadToLitterBox = false;
|
let uploadToLitterBox = false;
|
||||||
//CHANGE THESE ^^^^^^^^^^
|
//CHANGE THESE ^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ modifyFunc(
|
||||||
onKeyDown
|
onKeyDown
|
||||||
);
|
);
|
||||||
|
|
||||||
replaceLib(".\\libbase.so", "libbase.so")
|
replaceLib(".\\libbase.so", "libbase.so");
|
||||||
|
|
||||||
build();
|
build();
|
||||||
|
|
||||||
|
@ -129,8 +129,8 @@ fs.renameSync(
|
||||||
`${decompName}_Patched.apk`
|
`${decompName}_Patched.apk`
|
||||||
);
|
);
|
||||||
|
|
||||||
fs.rmdirSync(`.\\${base}`)
|
fs.rmdirSync(`.\\${base}`);
|
||||||
fs.rmSync(`${base}_out.apk`)
|
fs.rmSync(`${base}_out.apk`);
|
||||||
|
|
||||||
if (uploadToLitterBox) {
|
if (uploadToLitterBox) {
|
||||||
console.log("Uploading to LitterBox");
|
console.log("Uploading to LitterBox");
|
||||||
|
@ -144,6 +144,9 @@ if (uploadToLitterBox) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//these next 2 functions are taken from
|
||||||
|
//https://annabelsandford.github.io/rabbit-r1-imeigen/imei_check_v1.html
|
||||||
|
|
||||||
function calculateChecksum(imeiWithoutChecksum) {
|
function calculateChecksum(imeiWithoutChecksum) {
|
||||||
let imeiArray = imeiWithoutChecksum.split("").map(Number);
|
let imeiArray = imeiWithoutChecksum.split("").map(Number);
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
|
@ -190,7 +193,7 @@ function decomp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function modifyFunc(path, modifyWith) {
|
function modifyFunc(path, modifyWith) {
|
||||||
let start = -1; //so we know what part to modify
|
let start = -1;
|
||||||
let end = -1;
|
let end = -1;
|
||||||
try {
|
try {
|
||||||
let data = fs.readFileSync(path, "utf8");
|
let data = fs.readFileSync(path, "utf8");
|
||||||
|
@ -200,12 +203,10 @@ function modifyFunc(path, modifyWith) {
|
||||||
lineArr.forEach((element) => {
|
lineArr.forEach((element) => {
|
||||||
if (element.includes(modifyWith[0])) {
|
if (element.includes(modifyWith[0])) {
|
||||||
start = lineArr.indexOf(element);
|
start = lineArr.indexOf(element);
|
||||||
//console.log("start ", start);
|
|
||||||
}
|
}
|
||||||
if (start > 0 && end < 0) {
|
if (start > 0 && end < 0) {
|
||||||
if (element.includes(modifyWith[modifyWith.length - 1])) {
|
if (element.includes(modifyWith[modifyWith.length - 1])) {
|
||||||
end = iter;
|
end = iter;
|
||||||
//console.log("end ", end);
|
|
||||||
|
|
||||||
for (let i = start; i <= end; i++) {
|
for (let i = start; i <= end; i++) {
|
||||||
if (modifyWith[i - start] !== undefined)
|
if (modifyWith[i - start] !== undefined)
|
||||||
|
@ -226,26 +227,16 @@ function modifyFunc(path, modifyWith) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceLib(newLibLocation, oldLib) {
|
function replaceLib(newLibLocation, oldLib) {
|
||||||
fs.copyFileSync(newLibLocation, `.\\${base}\\root\\lib\\arm64-v8a\\${oldLib}`)
|
fs.copyFileSync(
|
||||||
|
newLibLocation,
|
||||||
|
`.\\${base}\\root\\lib\\arm64-v8a\\${oldLib}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function build() {
|
function build() {
|
||||||
execSync(`java -jar APKEditor.jar b -i ${base}`, (err, stdout, stderr) => {
|
execSync(`java -jar APKEditor.jar b -i ${base}`);
|
||||||
if (err) {
|
|
||||||
console.error(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log(`stdout: ${stdout}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
execSync(
|
execSync(
|
||||||
`java -jar uber-apk-signer-1.2.1.jar -a ${decompName}_decompile_xml_out.apk`,
|
`java -jar uber-apk-signer-1.2.1.jar -a ${decompName}_decompile_xml_out.apk`
|
||||||
(err, stdout, stderr) => {
|
|
||||||
if (err) {
|
|
||||||
console.error(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log(`stdout: ${stdout}`);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue