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

Order in mapping files #883

Open
BaalNetbek opened this issue Nov 21, 2024 · 2 comments
Open

Order in mapping files #883

BaalNetbek opened this issue Nov 21, 2024 · 2 comments

Comments

@BaalNetbek
Copy link

Bring order to exported mapping files

The feature I would like to see is the order of names in exported mapping to be the same as they are declared in a class.

As I was deobfuscating a .jar and commiting updates to the mapping file...

my routine is:

  1. load original .jar
  2. load last mapping
  3. change names
  4. export mapping

...I noticed that order of fileds in exported mapping files changes everytime (I think only in in scope of Classes that just had any fields or methods mapping edited). They shuffle in unknown to me pattern.

PS. Type of mapping (proguard, simlple etc.) doesn't matter they all shuffle.

@BaalNetbek
Copy link
Author

Ofcourse I'm using latest Recaf 4

@Col-E
Copy link
Owner

Col-E commented Nov 24, 2024

The mapping system is designed to be independent of others, so it is not currently aware of the structures of classes mappings are registered for. Currently, it will export classes in natural sorted order by name, and the fields/methods of each class will be written in the order they were added to the mapping. So if you rename fields or methods in a single class such as a -> x, b -> y, and c -> z, you should see those in that exact order.

I looked at your sample and mappings and ran some tests. Reading in a mapping file and writing it back (from an API standpoint using our SimpleMappings class) yields the exact same contents as the input. My best guess at the moment is that the multi-threading in MappingApplier and updates tracked in AggregateMappings are leading to the changes you're seeing.

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

No branches or pull requests

2 participants