Skip to content

Gxgine/NEW

Repository files navigation

PVZ2 4.0.4 Patch Workspace

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.

If You Forget Everything

Start with:

  • docs/BEGINNER_GUIDE.md
  • docs/PATCH_PRINCIPLES.md

Use them like this:

  • docs/BEGINNER_GUIDE.md: how to operate
  • docs/PATCH_PRINCIPLES.md: why the patches work the way they do

What This Repo Is For

This repository is an APK patch workspace.

Input:

  • one original APK

Output:

  • a patched APK for one of the retained patch modes

Current Patch Goal

The patch workspace is scoped around three retained patch targets:

  1. external save-data path
  2. external PACKAGES / level JSON override
  3. native hex-based bind bypass experiment

Expected runtime behavior:

  • save data should prefer external app files storage when possible
  • the game should create files/levels automatically on startup
  • when native code requests a packaged level JSON, the patch should first check the external levels directory
  • 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

Important Local-Only Files

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/

Useful Files To Read First

  • docs/BEGINNER_GUIDE.md
  • docs/PATCH_PRINCIPLES.md
  • README.md
  • docs/PATCH_STATUS.md
  • docs/SO_BIND_PATCH_TUTORIAL.md
  • patches/bind_hex_experiment.json
  • patches/base_external_files.json
  • patches/bind_support_files.json
  • scripts/apply_hex_patch.py
  • scripts/apply_overlay_files.py
  • scripts/build_signed_apk.sh
  • scripts/build_from_input_apk.sh
  • scripts/install_apk_via_pm.sh
  • scripts/run_bind_hex_experiment.sh
  • scripts/pvz2_patch_tool.sh

Current Local Build Notes

Local environment used so far:

  • apktool.jar in tools/
  • 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.

Native Bind Notes

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

Actionable Files

The repository includes patch helpers for these workflows:

  • patches/bind_hex_experiment.json records the exact hex patch site and replacement bytes
  • patches/base_external_files.json lists the reference smali files used for save/package externalization
  • patches/bind_support_files.json lists the supporting bind-related smali files copied into a fresh decode
  • scripts/apply_hex_patch.py applies a JSON-defined hex patch to the decoded workspace
  • scripts/apply_overlay_files.py copies patched reference files into a newly decoded APK workspace
  • scripts/build_signed_apk.sh rebuilds and signs a patched APK
  • scripts/build_from_input_apk.sh takes a raw APK as input, decodes it, applies the selected patch set, then rebuilds and signs it
  • scripts/install_apk_via_pm.sh installs a signed APK through adb push + pm install
  • scripts/run_bind_hex_experiment.sh runs the committed hex experiment end to end
  • scripts/pvz2_patch_tool.sh provides a simple 1/2 menu for the two retained patch workflows

Scope Notes

Keep this repository focused on patch generation only:

  • input original APK
  • choose patch mode
  • output patched APK

Suggested GitHub Usage

When sharing this repo with another AI:

  1. tell it to read README.md
  2. tell it to read docs/PATCH_STATUS.md
  3. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors