8.6 KiB
Handoff: client source refactor (packages + class names)
Current state
The catastrophic part is done. All 400 obfuscated helper classes have been moved out of the root package into 18 meaningful sub-packages, and the source tree compiles and builds.
- Source tree:
project/client/src/main/java/dev/zprestige/prestige - 543 Java classes total:
- 21 already-named API classes intentionally left at the root (
Module,Setting,SettingHolder, the 9 setting types,EventBus,Category,ModuleManager,MenuModule,Gamemode,Native,Constants,Subscribe,ListenerEntry) client/Prestige- 121 modules under
module/<category>/ - 400 renamed helpers under
event/ hud/ render/ data/ type/ mixin/ world/ math/ combat/ inventory/ network/ reflect/ gui/ config/ util/ social/ annotation/ input/
- 21 already-named API classes intentionally left at the root (
- Zero obfuscated class names remain at the root. Verified by listing the renamed jar: the root contains only the 21 API classes.
./gradlew.bat build -PwithClient=truesucceeds (BUILD SUCCESSFUL, one deprecation warning aboutThreadDeath). Artifacts:project/build/libs/prestige-0.1.0.jar,prestige-0.1.0-sources.jar.- Boot has not been tested yet. That is the first remaining step.
What was changed
New files (project/client/tools/)
gen_class_mapping.py— generatesdocs/classmap.tsv(400C old newrows) from the decompiled source by classifying superclass/interface/mixin target/HUD description/shader path/record components/enum constants/ module references.merge_mapping.py— mergesdocs/mapping.tsv+docs/classmap.tsvintowork/rename.map.tsv, refusing duplicate owners.clsmapping.py— shared lookup used by the fixers:Mapping(srcdir).path(old_source_name)-> real path after renamesMapping.source_to_new-> class-token map for source snippetsrewrite_tokens()— token rewrite that skips string literals and fully-qualified package paths
Changed files
client/tools/rename.sh- now merges
docs/classmap.tsvinto the mapping before running tiny-remapper andrename_manifest.py. - The class map therefore applies to both routes (source regeneration and runtime jar).
- now merges
client/tools/fix_reflect.py- resolves
cU/cW/EventBusthroughclsmappinginstead of hardcoded root paths - uses the renamed
Event.classinstead ofaH.class
- resolves
client/tools/fix_ctor.py- constructor-noise regex accepts both
aH.b();andEvent.b();
- constructor-noise regex accepts both
client/tools/manual_edits.py- uses
clsmapping.Mapping; snippets are token-rewritten outside string literals - removed one obsolete
PostShaderedit (thei_cFbridge no longer exists) - the restored
TextRendererbridge now implementsa_WorldContract(the method name generated after the class rename)
- uses
client/tools/notry.txtConfigManager.a(...)Lcom/google/gson/JsonObject;updated to the new FQN. Without this the config loader fails to decompile again.
docs/classmap.tsv— 400 generated class rows (frozen; treat as source of truth).docs/classmap_src.tsv— source-tree name -> new internal name, used byclsmapping.pyto survive the_-suffixed case-collision twins (cg_is jarcg,d_is jard). Also frozen.
Naming decisions
- Events:
event/Event(baseaH), 70*Eventsubclasses. Fieldless events areTickEvent,TickEvent2, ... - HUD:
hud/HudElement(baseb4), names derived from thesuper("Name", ...)string, e.g.ModuleListElement,WatermarkElement. - Mixins:
mixin/<Target>Mixinfrom@CTransformer, e.g.MinecraftClientMixin,EntityMixin,InGameHudMixin. Duplicate targets get2,3,4. - Shaders:
render/<Name>Shaderfrom the.fragpath (AuraOutlineShader,ChamsOutlineShader, ...). - Enums:
type/*with semantic overrides (BowMode,AnchorState,CartState,GlPrimitive,Easing, ...). - Records/data:
data/*(IntData,LongData,VecIntData, ...). - API classes stay at root on purpose. Moving them would require editing hardcoded FQNs in
src/main/java/dev/prestige/ui/bridge/Bootstrap.javaandBridge.java, and gains nothing for this task.
Important caveats
- Do not blindly re-run
gen_class_mapping.pyon the new tree. It was written for the pre-refactor tree and readsclient/work/renames.tsv, which is overwritten by everybuild_source.shrun. The new live tree already has the final names.docs/classmap.tsv+docs/classmap_src.tsvare the frozen mapping. work/renames.tsvnow reflects the renamed jar, so itsold -> newpairs are for collision handling of the post-classmap jar, not the original obfuscated names.manual_edits.pytoken rewriting deliberately ignores single-letter class tokens (C,I,M,q, ...) because method names are also single letters. Do not weaken that filter.docs/mapping.tsvstill maps old jar names (dV,d_, ...) to API/module names.d_there is the moduleAutoCart; the enum that the tree callsd_is jar classd(type/BowMode). This collision is handled byclassmap_src.tsv; do not "fix" it by hand.- Some generated names are functionally consistent but semantically imperfect:
RenderHelperN,WorldContract(this is the text-renderer interface implemented byTextRenderer),RenderContract*. Renaming them is cosmetic and requires regenerating the decompiled source (method names in these contracts are derived from the class name). - 5 method bodies are still TODO no-ops from the stripping stage. Search for
body lost/unresolved ZKM referencein the tree. - Strings are not restored, and helper member names are still obfuscated. Only class/package names changed.
Next steps (in order)
-
Boot the source route.
cd project .\gradlew.bat runClient -PwithClient=true --console=plainor, for a timed logged run:
cd project/client "C:/Program Files/Git/bin/bash.exe" -lc "bash tools/boot_test.sh 200 -PwithClient=true"Use Git Bash, not the WSL
bashin PATH (WSL has nocygpath/Windows Python). Checkproject/run/logs/latest.logfor[prestige-ui] bridge bound: N modules(expect 121) and forClassNotFoundException/NoClassDefFoundError. The manifest was rewritten (903 setting prop keys), so this primarily validates module + setting binding after the package moves. -
Test the runtime jar route. The class map is applied by
rename.sh, so the boot jar should contain the same renamed classes:cd project/client "C:/Program Files/Git/bin/bash.exe" -lc "bash tools/build_runtime.sh"Then boot through the normal launcher path and compare the bridge line with step 1.
-
Real input test. Open the ClickGUI, HUD editor, toggle modules, change settings, move HUD elements. This was never tested in this refactor; package moves can expose package-private access that
Widenmasked at bytecode level but that no longer matches after decompilation. -
Restore the 5 lost bodies (currently comments with
TODO(compile)):dE.run,av.run,ca.q,cb.q,b4.qin the old names. After renaming, locate with:Get-ChildItem client/src/main/java -Recurse -Filter *.java | Select-String -Pattern 'body lost|unresolved ZKM reference'client/TODO_COMPILE.mdhas the original phase notes. -
Restore strings / member names if desired.
gen_mapping.pyis provenance only; addF/Mrows todocs/mapping.tsvand regenerate. Do not touchdocs/classmap.tsvfor member work. -
Update docs.
client/TODO_COMPILE.mdandliberate/HANDOFF_2.mdstill describe the pre-refactor tree. Record the new package layout, the classmap files, and the boot result.
Useful commands / paths
- Root:
C:\Users\Tyler\Documents\Shared\prestige\liberate\project - Regenerate source into
client/work/src_gen(does not touch live tree):cd client "C:/Program Files/Git/bin/bash.exe" -lc "bash tools/build_source.sh" - Compile generated tree only:
"C:/Program Files/Git/bin/bash.exe" -lc "cd project/client && bash tools/compile.sh work/src_gen work/javac_final.log" - Rename a jar manually:
"C:/Program Files/Git/bin/bash.exe" -lc "cd project/client && bash tools/rename.sh work/strip1.jar work/test.renamed.jar" - Build from source:
.\gradlew.bat build -PwithClient=true - Manifest:
project/src/main/resources/prestige_ui/manifest_live.json - Bridge FQNs (unchanged):
project/src/main/java/dev/prestige/ui/bridge/{Bridge,Bootstrap}.java - Class map:
project/docs/classmap.tsv,project/docs/classmap_src.tsv - Merge check:
python client/tools/merge_mapping.py docs/mapping.tsv docs/classmap.tsv <out>