修復 arsc 的正確壓縮和對齊

在 ZFileOptions 中為 .arsc 檔案添加 4 字節對齊規則,並在新增條目時將 resources.arsc 處理為原生程式庫。確保 resources.arsc 的正確對齊。
This commit is contained in:
NkBe 2026-02-10 18:25:52 +08:00
parent 11fc7aa9a2
commit 97a23caa9e
No known key found for this signature in database
GPG Key ID: 9FACEE0DB6DF678E
1 changed files with 3 additions and 2 deletions

View File

@ -120,7 +120,8 @@ public class NPatch {
private static final ZFileOptions Z_FILE_OPTIONS = new ZFileOptions().setAlignmentRule(AlignmentRules.compose(
AlignmentRules.constantForSuffix(".so", 4096),
AlignmentRules.constantForSuffix(ORIGINAL_APK_ASSET_PATH, 4096)
AlignmentRules.constantForSuffix(ORIGINAL_APK_ASSET_PATH, 4096),
AlignmentRules.constantForSuffix(".arsc", 4)
));
private final JCommander jCommander;
@ -368,7 +369,7 @@ public class NPatch {
if (name.startsWith("META-INF") && (name.endsWith(".SF") || name.endsWith(".MF") || name.endsWith(".RSA"))) continue;
try (InputStream is = entry.open()) {
if (name.endsWith(".so")) {
if (name.endsWith(".so") || name.equals("resources.arsc")) {
dstZFile.add(name, is, false);
} else {
dstZFile.add(name, is);