Commit Graph

165 Commits

Author SHA1 Message Date
md-5
b83f20f9a9 Merge pull request #9 from AbrarSyed/patch-1
Update AccessMap.java
2013-08-04 21:39:58 -07:00
md_5
3aa51660af Fix issue #3 - private and static inheritance 2013-08-05 14:38:18 +10:00
Abrar Syed
c52563e09a Update AccessMap.java 2013-08-01 08:25:54 -05:00
md_5
8d4cabb8d0 Update to use asm-debug-all so we can get line numbers and generic sigs. 2013-07-15 09:45:16 +10:00
md_5
11d057e669 Allow comments anywhere in the line 2013-07-03 11:52:19 +10:00
md_5
6d9552101f Revert "Close issue #3 - static and private inheritance"
This reverts commit 33d8d24d7e.
2013-07-03 11:25:06 +10:00
md_5
33d8d24d7e Close issue #3 - static and private inheritance 2013-07-01 10:39:19 +10:00
md_5
9a0c971c5d Don't verify jars. 2013-06-28 14:11:15 +10:00
Agaricus
a6c2f8ca6b Remove moveClassPackage debug message 2013-06-12 21:14:34 -07:00
md_5
76d73e3c84 Update license headers 2013-06-11 10:49:15 +10:00
md_5
b2ba97e963 protected -> excluded 2013-06-11 10:47:37 +10:00
LexManos
22fdad8e26 Finish up protected packages. Maps now respect protected packages in method invocations and signatures. New argument -p, --ignored-packages to specify protected 2013-06-11 10:46:00 +10:00
Agaricus
09dae7df76 Add package ignore 2013-06-09 18:41:50 -07:00
Agaricus
6640b89354 Add full support for remapping packages with PK: in .srg
- Includes support for the default package, '.'
- Checks package mappings _after_ class mappings
2013-05-30 20:53:55 -07:00
Agaricus
8f87de55e4 Exclude resources from generated API jar 2013-05-18 18:47:22 -07:00
Agaricus
4e703ef09e Add API generation option to JarRemapper
JarRemapper can now be configured to "generate an API", as part of
the remapping process. The output classes will only have the symbol names
(remapped, of course), but no executable code. Useful for projects to
build against this generated API.
2013-05-18 13:23:20 -07:00
Agaricus
78494b5ff1 Add support for remapping class name prefixes
Adds support for interpreting "CL: xxx/* yyy/*" in .srg for remapping
all class names beginning with xxx/ to yyy/. Previously this functionality
was only programmatically accessible when SpecialSource was used as a
library, but now you can use it from .srg mappings as well.

May be replaced with "PK: xxx yyy" support in .srg files later,
but needs to be first thoroughly tested for full compatibility,
to ensure identical semantics as in MCP (e.g. remapping ".").

Adding CL: /* class name prefix remapping for now, separate from PK:,
which simply remaps class names matching the given prefix substring.
2013-05-17 21:48:57 -07:00
Agaricus
0cf7f47ce7 Implement class reflection remapping for Class.forName("")
Remaps constant literals passed to Class.forName(""), similar to
the existing class.getDeclaredField("") remapping in RemapperPreprocessor.
Both reflection remappings use the jarMapping, if one is passed in.
Adds new APIs to enable/disable the respective reflection remaps.
2013-05-10 19:56:17 -07:00
md-5
f943b5a6c5 Catch exception not throwable 2013-05-10 14:37:42 +10:00
Agaricus
710ccc6439 Catch all errors in getParents(), improves Java 8 compatibility
If the superclasses cannot be read in ClassLoaderProvider for any reason,
we ignore it and move on. This was the case before but the exception catch
was changed to only include IOError during the 1.5 refactor. This uncovered
an issue where on Java 8 inheritance traversal was hitting the Java 8 classes
in the JRE and throwing IllegalArgumentExceptions from ASM 4.1 since it does
not yet support the 52.0 classfile format.

To restore the previous behavior we change from catching IOException to Throwable,
including IllegalArgumentException. This will prevent correct inheritance trees
to be built on Java 8 classes however this is no worse than before and could be
fixed separately by an ASM 5 or 4.1.1 update once/if it is available.

For background see:
https://github.com/MinecraftPortCentral/MCPC-Plus/issues/841
2013-05-09 19:56:07 -07:00
Agaricus
4fd0cde9d1 Add support for remote URLs in --read-inheritance 2013-05-08 19:27:48 -07:00
md_5
8b5465f36a [maven-release-plugin] prepare for next development iteration 2013-04-27 19:44:38 +10:00
md_5
56dcad5267 [maven-release-plugin] prepare release SpecialSource-1.5 2013-04-27 19:44:22 +10:00
Agaricus
c507342ae0 Fix debug information loss in remapper preprocessor.
Only skip debugging information if not rewriting the class.
Fixes https://github.com/MinecraftPortCentral/MCPC-Plus/issues/802
2013-04-26 18:55:14 -07:00
Agaricus
29104f24d2 Fix null superclass in inheritance map
Object has no superclass, so don't add it to the list.
Also allow InheritanceMap setParents null as a shorthand for none.
2013-04-26 18:46:28 -07:00
Agaricus
d33223562d Fix ClassCastException in tryClimb building inheritance map
The interface uses the generic Collection type but the implementation
an ArrayList. Fix by creating an ArrayList from the Collection. Resolves
this crash observed when updating MCPC+'s plugin loader:

https://gist.github.com/agaricusb/5471423
2013-04-26 18:46:28 -07:00
LexManos
04069fb8b9 Fixup SpecialSource now allowing it to be a replacement for RetroGuard in MCP. The Default RemappingMethodAdaptor 'sorts' the LocalVariables. Which causes things to receive random-ish variable indexes causing FernFlower to decompile them differently.
We now use a modified version of RemappingMethodAdaptor that bpasses the superclass LocalVariablesSorter

In addition I added a few more command line options, Most notibly:
kill-source: Removes the 'SourceFile' attribute
kill-lvt: Removes any LocalVariableTable attributes
kill-generics: Remvoes any LocalVariableTypeTable and Signature attributes
identifier: Tags each class with the specified UTF8 string in the constant pool. This is useful for loaders such as FML to know if the class has been obfusicated to SRG names or not.
2013-04-25 18:04:53 +10:00
Agaricus
66b7fb9269 Fix FileLocator path separator
File.separator is the separator used in subdirectory paths ('/'), whereas
File.pathSeparator is used in $PATH for separating multiple paths (':').
Using the wrong separator worked on OS X since the /var/folders subdir
could be created (":ss-cache") but failed on (Linux?) ci.md-5.net since
/tmp:ss-cache cannot be created (nor it should it be). With this change,
the path should be /tmp/ss-cache, as expected.
2013-04-21 12:10:43 -07:00
Agaricus
dbdfa68975 Always log file downloads and cache hits
Useful since the files can be stored in non-obvious locations (on OS X,
temporary directory is in /var/folders with per-user random subdir) and
may need to be manually removed for testing. Could consider multiple
logging levels instead of always logging these messages.. but they're
more useful to show than most of the other 'verbose' log messages.
2013-04-21 12:07:58 -07:00
Agaricus
36df368ab6 Fix FileLocator temporary directory creation
File.createTempFile() creates a temporary file, so we instead get
the java.io.tmpdir property and use File mkdirs().

There is a Files.createTempDirectory() method in JDK 7, and
Files.createTempDir() in Guava, could possibly use but for caching
its important to use a consistent path (also the path must be unique,
so the full URI is used, since it could refer to specific commit,
where the path disambiguates the resource, beyond the base filename).

Fixes 'no such file or directory' error building MCPC+ via SpecialSourceMP.
2013-04-21 11:47:29 -07:00
md_5
2d06f11347 Refactor downloader into FileLocator and optimize for speed. 2013-04-20 14:00:29 +10:00
md_5
6ea97c26c8 Remove obsolete inheritance providers and globalise verbose setting 2013-04-20 13:33:50 +10:00
md_5
132584eda4 Refactor some of the inheritance providers. 2013-04-20 13:31:42 +10:00
md_5
d846476686 Refactor mapping writers 2013-04-20 13:17:15 +10:00
md_5
1ed5c500b0 Refactor and rename transform classes 2013-04-20 13:08:32 +10:00
md_5
b3934893e0 Rewrite Jar class. 2013-04-20 12:41:16 +10:00
md_5
73b1cfd81c Refactor a few classes into packages. 2013-04-20 12:19:18 +10:00
md_5
3a7ef779bf Update POM & depends 2013-04-20 12:07:55 +10:00
md_5
a318ec4ce6 Quick code format in preparation for repackage. 2013-04-20 12:01:28 +10:00
Agaricus
41244d37e1 Add support for \-style paths in remote mapping file downloads 2013-03-22 11:07:35 -07:00
Agaricus
ef37d9f8e6 Improve exception message on noncomparable jars
Show the mismatched number of symbols
2013-03-16 10:11:47 -07:00
md_5
1b86fa2de3 Reverse-mergecommit 43688dd80b 2013-03-11 16:30:19 +11:00
md_5
43688dd80b Feed in the original ClassReader to ensure the constant pool is not excessively mangled. 2013-03-11 16:10:46 +11:00
Agaricus
44434e8e1b Fix command return status on error 2013-03-10 18:20:19 -07:00
Agaricus
374cb129e2 Add loading of numeric "srg" names from MCP directory
Normally, loadMappingsDir() loads:

    obf -> num -> pkgmcp

but with numericSrgNames, it loads:

    pkgmcp -> num

where:

obf = obfuscated "notch" names
num = numeric "srg" names
pkgmcp = descriptive "csv" names

This implementation could probably be improved further.

Compatibility Note: --numeric used to load these mappings:

    obf -> num

that is, ignoring the fields/methods.csv. But this turned out not to
be too useful. You can still get this mapping with ignoreCsv=true, but
now numericSrgNames and --numeric loads the much more useful mapping:

    pkgmcp -> num

Useful for targetting FML runtime deobfuscation.
2013-03-10 13:45:51 -07:00
Agaricus
65ba1c8053 Add method descriptor to JarMappingLoadTransformer
Again, not used by CSVMappingTransformer, but could be used by other
transformation classes to be written.
2013-03-10 11:40:27 -07:00
Agaricus
f91c319a8b Add class name to JarMappingLoadTransformer field/method
Not used by CSVMappingTransformer, since the CSVs only contain:
    func_###,newname
    field_###,newname
with no class name, but it could be used by other load transformers.
2013-03-10 11:32:08 -07:00
md_5
f7f4290098 [maven-release-plugin] prepare for next development iteration 2013-03-09 18:07:50 +11:00
md_5
d7974083ee [maven-release-plugin] prepare release SpecialSource-1.4 2013-03-09 18:07:39 +11:00
Agaricus
1e3c04f7f1 Add support for access map '**' pattern to match all symbols
Classes, fields, and methods. Also add some documentation of
this ever-expanding file format.
2013-03-08 20:35:36 -08:00