r1-apk-patcher/index.js

55 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-05-29 11:23:53 -05:00
const fs = require("fs");
2024-05-31 04:27:01 -05:00
const {functions} = require("./functions");
const {decomp, modifyFunc, replaceLib, build} = require("./utils");
const settings = require("./settings.json");
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
const decompName = settings.apkFileName;
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
const base = `${decompName}_decompile_xml`;
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
decomp();
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
functions.functions.forEach(func => {
modifyFunc(`./${base}/`+func.location, func.code)
})
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
// modifyFunc(
// `./${base}/smali/classes/tech/rabbit/r1launcher/RLApp.smali`,
// getOSVersion
// );
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
// modifyFunc(
// `./${base}/smali/classes/tech/rabbit/r1launcher/settings/utils/SystemControllerUtil.smali`,
// getImei
// );
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
// modifyFunc(`./${base}/smali/classes/AppConfig.smali`, getDeviceId);
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
// modifyFunc(
// `./${base}/smali/classes/tech/rabbit/r1launcher/rabbit/KeyEventHandler.smali`,
// onKeyUp
// );
// modifyFunc(
// `./${base}/smali/classes/tech/rabbit/r1launcher/rabbit/KeyEventHandler.smali`,
// onKeyDown
// );
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
// modifyFunc(
// `./${base}/smali/classes/tech/rabbit/r1launcher/initstep/InitStepActivity.smali`,
// gotoConnectNetwork
// );
2024-05-29 11:23:53 -05:00
replaceLib("./libbase.so", "libbase.so");
2024-05-29 11:23:53 -05:00
2024-05-31 04:27:01 -05:00
if(fs.existsSync(`./${decompName}_out.apk`)) fs.rmSync(`./${decompName}_out.apk`);
if(fs.existsSync(`./${decompName}_Patched.apk`)) fs.rmSync(`./${decompName}_Patched.apk`);
2024-05-29 11:23:53 -05:00
build();
fs.renameSync(
`${base}_out-aligned-debugSigned.apk`,
`${decompName}_Patched.apk`
);
fs.rmdirSync(`./${base}`, { recursive: true, force: true });
2024-05-31 04:27:01 -05:00
fs.rmSync(`${base}_out.apk`);