How trixarian/nethersx2-classic works
Main Components
• Input APK: The user’s original AetherSX2 3668 APK.
• Patch Control Scripts: The core scripts (e.g., patch-apk.bat, patch-apk.cmd, patch-apk.sh) that orchestrate the patching process.
• Decompilation Module: Located in the “decomp” folder, it contains batch scripts such as Extract.bat, Hackify.bat, and Pack.bat, which are responsible for decompiling the APK, applying hacks, and repackaging it.
• Build/Compilation Module: In the “builder” folder, which contains build scripts (build-nethersx2.cmd/.sh) and associated libraries (including xdelta and md5sum executables) to compile and integrate the patch changes.
• Assets Repository: The “assets” folder contains configuration files (e.g., GameIndex.yaml), cheats, documentation, and scripts for converting game databases.
• External Tool Integrations: Several tools provided under “lib”, “builder/lib”, and “decomp/lib”. These include:
– Executables such as aapt.exe, xdelta.exe, md5sum.exe, and cmdcolor.exe.
– Java components (e.g., apksigner.jar) and keystore files (android.jks, public.jks).
• Patch Distribution Artifacts: The final output, such as the signed patched APK and optionally an xdelta patch (nethersx2-classic.xdelta) for non-Windows systems.
Out Relationships and Data Flow
• From the main control node, branch into two parallel but coordinated flows:
– The Decompilation Module: Illustrating the extraction and hack injection process (using decomp scripts and external tools like apktool).
– The Build Module: Showing how patched data is brought back together—invoking builder scripts and calling build utilities (using xdelta utilities and md5sum for validation).
• Integration of asset/configuration data (from “assets”) which informs the patch’s modifications (e.g., updated GameDB, widescreen and no-interlace patches).
• The output flows from the build module into the final APK creation followed by APK signing using keystore data from “lib” and “decomp/lib”.
Architectural Patterns and Principles
• Modular Design: Each directory—assets, decomp, builder, lib—is responsible for a distinct function in the patching process, making the system highly modular.
• Script-based Automation: The primary execution is controlled by batch/shell scripts, with clear demarcations between decompiling/hacking/decompiling and rebuilding/signing phases.
• Separation of Concerns: The architecture clearly separates the patch preparation (assets and configurations) from the core patch application, decompilation, and build-signing flow.
• External Tool Integration: Emphasize how third-party tools (xdelta, apktool, apksigner, aapt) are seamlessly embedded in the pipeline.
Relevant Technologies & Frameworks
• Scripting languages (Batch and Shell scripts) to manage the automated process.
• Java (via Java SE Development Kit) is implicitly needed since part of the toolchain (apksigner.jar and possibly parts of the APK building) depends on it.
• External utilities:
– xdelta (binary diff and patching)
– apktool (for reverse-engineering and rebuilding APKs)
– md5sum (for integrity checks)
– cmdcolor (for improved command line output)