I'm going to try to minimise use of this (as per
https://github.com/google/guice/wiki/Avoid-Injecting-Closable-Resources).
For example, I'm going to inject a pooling DataSource rather than
Connection objects, as per the advice at the end of the page. However,
HikariCP's DataSource implementation is itself Closeable.
Signed-off-by: Graham <gpe@openrs2.org>
This is in preparation for adding a new deob module which invokes the
bytecode deobfuscator, decompiler and AST deobfuscator in turn.
Signed-off-by: Graham <gpe@openrs2.org>
This is slightly per correct than nonfree/lib, as the /lib
directory is for architecture-specific code. The original client code is
not architecture-specific.
Signed-off-by: Graham <gpe@openrs2.org>
Closes#116.
This commit also changes the output directory from
nonfree/var/cache/bundle to nonfree/var/cache/client.
Signed-off-by: Graham <gpe@openrs2.org>
Some static members are not scrambled in the client. Maintaining a
one-to-one mapping between instanced and static classes makes
refactoring easier in these cases.
The browser control filter is removed as we now get the same
functionality for free.
Signed-off-by: Graham <gpe@openrs2.org>
This already caught some cases of public members that should have been
private and one case where the inferred type was too specific.
Signed-off-by: Graham <gpe@openrs2.dev>
We could use LocalVariableTable in theory, but it's more complicated as
we'd need to do live variable analysis and type inference. It's much
easier to leave that for the decompiler.
Signed-off-by: Graham <gpe@openrs2.dev>
The next commit will introduce an ArgRef class which uses a MemberRef
directly, rather than a MemberRef partition.
Signed-off-by: Graham <gpe@openrs2.dev>
This allows two different classes in different modules to be refactored
to the same name - for example, Node in client and unpackclass.
Under the hood, it is implemented by prefixing each class name with the
library name and an exclamation mark (which is highly unlikely to appear
in a class name, as it is invalid Java syntax).
At first, prefixing class names with the library name feels like a bit
of a hack. However, it is much simpler than trying to track libraries
throughout the existing code. Furthermore, it allows us to avoid
forking ASM classes like Remapper.
The Fernflower driver was also changed to deobfuscate each library in
its own context, rather than trying to decompile them all in one go - by
the time classes reach Fernflower, the prefixes have already been
removed and Fernflower can't deal with duplicate class names either.
Signed-off-by: Graham <gpe@openrs2.dev>
I suspect it is excluded on Jagex's end so the client deals correctly
with any class loading failures caused by the absence of the
netscape.javascript.JSObject class.
Signed-off-by: Graham <gpe@openrs2.dev>
This commit adds support for mapping:
* class names
* field names
* field owners
* method names
* method owners
It does not yet support argument names, local variable names or
re-ordering method arguments. Local variable names are blocked on
Fernflower patches and method argument re-ordering is blocked on the IR.
Signed-off-by: Graham <gpe@openrs2.dev>
At the moment, this means hard-coding the HD client but we should
reintroduce support for the SD and unsigned clients in the future.
This change provides a few benefits:
* Performance (~3x faster), as I generally only care about the HD
client.
* Allows us to continue injecting the NameMap for the HD client without
worrying about how to avoid injecting it (or support a different
NameMap) for the SD and unsigned clients.
Signed-off-by: Graham <gpe@openrs2.dev>
volatile is pointless if a field is final - even on arrays/objects, as
it only applies to the reference, not the contents of the target.
Signed-off-by: Graham <gpe@openrs2.dev>
If we don't do this then we incorrectly mark some fields as final, due
to writes present inside if blocks removed by ConstantArgTransformer.
Signed-off-by: Graham <gpe@openrs2.dev>
This fixes a bug where fields could never become static if a class had a
mixture of static and non-static fields and constructors.
Signed-off-by: Graham <gpe@openrs2.dev>
The new entry set functionality allows us to distinguish fields NEVER
written from fields we haven't explored yet. This allows us to find more
EXACTLY_ONCE fields in constructors with loops.
Signed-off-by: Graham <gpe@openrs2.dev>
Propagating them looks a bit silly, because the arguments are unused. I
think this problem mainly occurs in constructors, which the dummy
argument obfuscator doesn't touch.
Signed-off-by: Graham <gpe@openrs2.dev>