This repository is the working notes and patch context for the Chinese Android build:
- package:
com.popcap.pvz2cthd4399 - version:
4.0.4 - channel family:
4399 / Talkweb
The goal is to make this project easy for another person or AI to pick up quickly without needing the original chat history.
Start with:
docs/BEGINNER_GUIDE.mddocs/PATCH_PRINCIPLES.md
Use them like this:
docs/BEGINNER_GUIDE.md: how to operatedocs/PATCH_PRINCIPLES.md: why the patches work the way they do
This repository is an APK patch workspace.
Input:
- one original APK
Output:
- a patched APK for one of the retained patch modes
The patch workspace is scoped around three retained patch targets:
- external save-data path
- external
PACKAGES/ level JSON override - native hex-based bind bypass experiment
Expected runtime behavior:
- save data should prefer external app files storage when possible
- the game should create
files/levelsautomatically on startup - when native code requests a packaged level JSON, the patch should first check the external
levelsdirectory - if no matching external file exists, it should fall back to packaged assets
- the hex bind work is kept as a native experiment, not as a confirmed finished fix
These are intentionally ignored by Git because they are large or machine-specific:
- decoded APK worktree:
pvz2_patch_work_1/ - generated APKs:
*.apk - signing key:
tools/pvz2_patch.keystore - large unpack/test outputs under
_tmp*,_jadx*,_apk_* - local helper repo snapshot:
rton-github-ready/
docs/BEGINNER_GUIDE.mddocs/PATCH_PRINCIPLES.mdREADME.mddocs/PATCH_STATUS.mddocs/SO_BIND_PATCH_TUTORIAL.mdpatches/bind_hex_experiment.jsonpatches/base_external_files.jsonpatches/bind_support_files.jsonscripts/apply_hex_patch.pyscripts/apply_overlay_files.pyscripts/build_signed_apk.shscripts/build_from_input_apk.shscripts/install_apk_via_pm.shscripts/run_bind_hex_experiment.shscripts/pvz2_patch_tool.sh
Local environment used so far:
apktool.jarintools/- signing via
jarsigner - original input APK stored outside Git
The current patch flow already includes:
- rebuild
- re-sign
- the supporting reference file overlays needed by the retained patch modes
It does not mean every arbitrary APK version will automatically bypass every possible channel-side integrity check.
The latest local signed APK is not committed to Git. It currently lives only on disk.
There is now a dedicated write-up for the native libSrc.so binding experiments:
docs/SO_BIND_PATCH_TUTORIAL.md
That document records:
- the tested ARM64 instruction patch
- why that site was chosen
- exact rebuild/sign/install steps
- the observed side effect that the bind button disappears entirely
The repository includes patch helpers for these workflows:
patches/bind_hex_experiment.jsonrecords the exact hex patch site and replacement bytespatches/base_external_files.jsonlists the reference smali files used for save/package externalizationpatches/bind_support_files.jsonlists the supporting bind-related smali files copied into a fresh decodescripts/apply_hex_patch.pyapplies a JSON-defined hex patch to the decoded workspacescripts/apply_overlay_files.pycopies patched reference files into a newly decoded APK workspacescripts/build_signed_apk.shrebuilds and signs a patched APKscripts/build_from_input_apk.shtakes a raw APK as input, decodes it, applies the selected patch set, then rebuilds and signs itscripts/install_apk_via_pm.shinstalls a signed APK throughadb push+pm installscripts/run_bind_hex_experiment.shruns the committed hex experiment end to endscripts/pvz2_patch_tool.shprovides a simple 1/2 menu for the two retained patch workflows
Keep this repository focused on patch generation only:
- input original APK
- choose patch mode
- output patched APK
When sharing this repo with another AI:
- tell it to read
README.md - tell it to read
docs/PATCH_STATUS.md - if needed, point it at the local decoded worktree
pvz2_patch_work_1/
That is usually enough to give it the full patch context quickly.