Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SrgToMcpRenamer uses hardcoded path for nested jars #14

Open
Su5eD opened this issue Jul 5, 2023 · 4 comments
Open

SrgToMcpRenamer uses hardcoded path for nested jars #14

Su5eD opened this issue Jul 5, 2023 · 4 comments

Comments

@Su5eD
Copy link

Su5eD commented Jul 5, 2023

The Issue

Currently, only nested jars under the META-INF/jarjar/ directory are deobfuscated by SrgToMcpRenamer.

processors.add(new ZipEntryProcessor(ein -> ein.getName().startsWith("META-INF/jarjar/") && ein.getName().endsWith(".jar"),

While this is the most common folder for nested jars, JarJar metadata defines nested jar paths as paths relative to the outer jar's root, and therefore nested jars can be located anywhere in the jar. This breaks mods that place their nested jars in other paths than the mentioned folder.

Expected behavior

SrgToMcpRenamer is able to deobfuscate any nested jars regardless of their location, as specified by JarJar metadata. Rather than assuming all nested jars are in the META-INF/jarjar/ directory, we should open the jar's JarJar metadata file and read nested jar paths from it.

@KitsuneAlex
Copy link
Contributor

This seems like a good point

@LexManos
Copy link
Member

Just like my other comment, this is used for dev time and dependencies shouldnt be bundled in dev time. Especially not obfuscated ones. But I can't fix this annoyance.
And the metadata is poorly designed/implemented in a lot of things. So if you want to go through and write a metadata parser that finds the correct path, then go for it. Its not important enough for me to care about. As i said, a lot of projects assume this base directory so deviating from it would most likely trigger issues elseware.

@KitsuneAlex
Copy link
Contributor

That is fair, i wouldn't have made that comment after i heard your take on that kinda thing. But there's super rare cases where this might be relevant. I'd actually be down to writing a parser. Just feel like helping out a bit in general during my free time, i use Forge for free, i wanna give back a little, even if its something irrelevant to you :D

@LexManos
Copy link
Member

Feel free, just don't expect me to care much :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants