Graham
d33c03c708
Improve Expression.negate()
...
This commit makes two changes:
* Uses the is operator instead of the isXXX methods provided by
JavaParser, allowing smart casts to be used.
* Wraps unsupported expressions with a unary minus expression, rather
than throwing an exception.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
d305e1f41c
Retain (T[]) casts on a variadic T... argument
...
This prevents IDEA from showing a warning about the method call being
ambiguous.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
d1b8fbd094
Remove redundant casts
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
a87a289c49
Add duplicate class name support to the AST deobfuscator
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
46c0c29559
Set AstDeobfuscator's language level to 11
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
da193ebf52
Use platform class loader to resolve JDK types in the AstDeobfuscator
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Desetude
ce5a0464c7
Only run NewInstanceTransformer on Class references
...
Fixes a problem where `Constructor<?> var0 =
clazz.getDeclaredConstructor(); return var0.newInstance();` was transformed to
`Constructor<?> var0 = clazz.getDeclaredConstructor(); return
var0.getDeclaredConstructor().newInstance();`
Signed-off-by: Desetude <harry@desetude.com>
5 years ago
Graham
d61411571b
Move return outside use block
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
69a27e43d4
Move OpenGL registry to the share/deob folder
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
6d6287c917
Inject GlRegistry
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
3c9edb0291
Use dependency injection in the AST deobfuscator
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
ccf7056a93
Use private companion objects where possible
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Desetude
c99ebcb355
Add logging to the AST deobfuscator
...
Signed-off-by: Desetude <harry@desetude.com>
5 years ago
Graham
3b48e57679
Add Guava dependency to deob-ast
...
Not sure how this worked - perhaps we picked it up transitively.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
9de55399f5
Convert createLong to an extension method on Long
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
4ec4ef84c2
Rename unpacker.jar to unpackclass.jar
...
This is more consistent with the original jar name (unpackclass.pack).
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
465078256f
Rename common module to util again
...
As I'm splitting it up into smaller modules (e.g. compress and crypto) I
think util is a more appropriate name for the remainder.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
c20dad7a5e
Fix DeobfuscateAstCommand class name
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
a52d58e8b5
Use Clikt to implement the command-line interface
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
462ae7cb9c
Improve PrettyPrinterConfiguration
...
Both of these settings are closer to IDEA's code style.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
b9c707782c
Place @Pc annotations on the same line as variable declarations
...
This is much more readable than placing them on a separate line.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
caed5cebce
Remove gl-dri from AstDeobfuscator
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
dae73b667a
Replace !Optional.isPresent() with Optional.isEmpty()
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
2e1c6c22ff
Rename GlConstantTransformer to GlTransformer
...
It transforms more than just constants now.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
c9a3580e11
Allow GlRegistry to be overriden
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
ace76fe9e4
Transform GL_FRAMEBUFFER_COMPLETE literals
...
This is a special case, so I've just hard-coded the GlEnum name and
value. Luckily its value is only used in the client in an OpenGL
context.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
9db5025c41
Output hex literals in upper case
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
59a78bea39
Fix GL_POINT_SIZE_{MIN,MAX} groups
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
784ad9900e
Always use GL_ constants without vendor suffixes where possible
...
It's actually hard to determine whether to use a vendor suffix or not.
For example, the client sometimes uses a bunch of *ARB functions with
_ARB constants. However, it uses the non-_ARB constant with glGetFloat.
It's very hard to fix this inconsistency while still using vendor
suffixes. It seems much easier to just use the constants without the
suffixes all the time.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
a704cf28ef
Add missing PixelType groups for glDrawPixels() calls
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
4fd330a8ac
Transform OpenGL constants inside binary/ternary expressions too
...
We don't make this more general, as we don't want to translate them
inside method call expressions.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
e06e70bc1f
Rename gl* method argument names
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
f4933a2b59
Add support for translating gl calls on the jaggl.opengl object
...
This picks up a glGetString(GL_EXTENSIONS) constant.
Don't translate gl calls within the jaggl.opengl class itself. This
causes failures as there are native methods with 0 and 1 suffixes. These
methods don't exist in the OpenGL registry, causing the transformer to
throw an exception.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
0564bc29b0
Add missing ProgramPropertyARB groups
...
This fixes a GL_OBJECT_COMPILE_STATUS_ARB constant, but I'm doing
everything else in the same set of enums for consistency.
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
133e2fac77
Set glGetObjectParameterivARB's pname group to ProgramPropertyARB
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
530af7628b
Add EnableCap group to GL_TEXTURE_3D
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
1a2f0bd9e5
Add MaterialFace group to GL_FRONT, GL_BACK and GL_FRONT_AND_BACK
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
aaaa0c0c68
Fix appending fields to javax.media.opengl.GL
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
ae9dccf9dd
Add CheckedInt32 group to most enums
...
This is a hacky way to fix the parameter value constants in calls to
methods like glTexEnvi().
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
7e66c024b4
Propagate groups from <enums> to each individual <enum>
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Graham
9b5d4221b1
Fix GL_COORD_REPLACE group
...
Signed-off-by: Graham <gpe@openrs2.dev>
5 years ago
Major
5fa9e9a621
Remove spurious toCollection calls
...
Signed-off-by: Major <major@emulate.rs>
5 years ago
Major
424a2d7a31
Fix compilation errors
...
Signed-off-by: Major <major@emulate.rs>
5 years ago
Graham
b38da58bd5
Add missing groups to the OpenGL registry
5 years ago
Graham
7db0c971ee
Use OpenGL registry to replace magic numbers with constants
5 years ago
Graham
597aa2018e
Add support for whole program AST transforms
5 years ago
Graham
25a6953644
Fix use of deprecated JavaParser methods
5 years ago
Graham
0a988584b7
Convert some deob-ast methods to extension methods
5 years ago
Graham
5487a74eb8
Remove traversal argument from walk extension method
5 years ago
Graham
54aec42f90
Format .kts files
5 years ago