r1-apk-patcher/index.js

29 lines
787 B
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();
functions.functions.forEach(func => {
modifyFunc(`./${base}/`+func.location, func.code)
})
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`
);
2024-06-24 11:26:34 -05:00
fs.rmSync(`./${base}`, { recursive: true, force: true });
2024-05-31 04:27:01 -05:00
fs.rmSync(`${base}_out.apk`);