Graham
c03b4af44f
Refactor unpackclass's ArrayUtils class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
327a1f7d4d
Refactor unpackclass's IntHashTable class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
7687a08cf7
Refactor unpackclass's LinkedList class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
856a17bf02
Refactor unpackclass's gzip decompressor
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
887ce06302
Refactor unpackclass's Bzip2 decompressor
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
6a0976193d
Change Resources field names to upper case
...
While the Resource class is technically not quite immutable (as it
contains a byte array), it's close enough as the array is only ever
read.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
e0ebaa1bcd
Refactor unpackclass's Buffer and BufferPool classes
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
af0167ef3e
Refactor unpackclass's TracingException class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
628bdc2e86
Refactor the TracingException class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
28f889fe6a
Refactor the UnpackerClassLoader class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
cd043a7ddc
Refactor the loader class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
d23f694a75
Refactor the Resource class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
8e592431bc
Refactor remaining local variables and arguments in the GL library
4 years ago
Graham
0ec7024c2c
Refactor the AudioSource interface
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
fe76054d83
Refactor the MonotonicClock class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
7ff9343516
Refactor the FileOnDisk class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
6e6297b094
Refactor the CursorManager class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
3549b7d6ea
Refactor the FullScreenManager class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
79d8d9f78c
Refactor the SignLink and PrivilegedRequest classes
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
447e667733
Refactor the Pack200Unpacker class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
64da80403e
Refactor the unpack class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
a75d20f6fd
Refactor the ByteArray and DirectByteArray classes
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
201f4cbd46
Refactor the Node class
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
0e9148af01
Add initial deob maps
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
2acbfdce48
Add divide support to IdentityTransformer
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
222323eaa0
Add AssignExpr support to IdentityTransformer
...
It can now simplify expressions like `x += 0`.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
c98a24bff8
Add left shift support to BitMaskTransformer
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
47325edb72
Fix removal of unused arguments whose local variable slot is re-used
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
1eb423fbf6
Mark sbox as const
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
272b1eb650
Add support for removing an argument whose local variable slot is used
...
This obviously doesn't work if the slot is loaded before something is
stored in it, but it does allow us to remove unused arguments whose slot
is re-used for another purpose.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
2b8aa0c70d
Replace some primitive casts with widening/narrowing conversions
...
There are still some more contexts we can do this in - unary/binary
expressions and invocation contexts. I think Fernflower might handle the
former, but it doesn't handle the latter. Unfortunately, JavaParser's
method resolution code is still a bit too buggy to do the latter at the
moment.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
b642bb17c6
Move literals to the RHS of an add/sub expression
...
The BinaryExprTransformer deals with this to an extent. However, it
requires multiple passes to do so. Adding support to AddSubTransformer
allows it to be done in a single pass.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
c4df34102a
Run IfElseTransformer until we reach a fixed point
...
It'd be nice if we could make it run a single pass (and there are
probably some improvements to reduce the number of required passes, as
I'm not convinced I'm running the transformations in a particularly
sensible order).
However, I think making it run in a single pass would be quite difficult
as some of the transformations need to propagate through else if chains
or nested if blocks. It's much easier to just run all the
transformations until they settle than fixing each individual
transformation.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
0ae1ffb51d
Don't convert integer literals in char arithmetic to char literals
...
On balance, I think in most cases this is harder to read.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
ea9f212fe1
Reduce indentation of if/else blocks where possible
...
IfElseTransformer is getting rather unwieldy now, so I think I'm going
to split it up in a future commit.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
90c21d87cf
Replace nested ifs with &&
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
a75db6122b
Return IfStmt from getIf()
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
1833221bc8
Fix naming of Module constants
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
717d14b489
Rename DeobfuscatorMapModule to DeobfuscatorUtilModule
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
4bc11159d8
Add NotTransformer
...
It's fairly similar to the ComplementTransformer, and translates
expressions like:
!a == !b => a == b
!a == b => a != b
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
b20115f1a7
Simplify IfElseTransformer
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
9c80ff1c6e
Fix conversion of negative integers to char literals
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
d9922da1c5
Add missing @Singleton annotations
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
2aee8523c7
Optimise CharLiteralTransformer
...
calculateResolveType() is much more expensive than checking if an
expression is an integer literal, so swap the conditions around.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
880be759b7
Use smart casts in the AST deobfuscator
...
Many of the old is/as calls were left over from the original Java code.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
bde818230b
Use smart casts in hasSideEffects()
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
8f0dfd2725
Fix FieldAccessExpr's hasSideEffects() implementation
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
919d9c2386
Add ThisExpr to hasSideEffects()
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
1318cce216
Move this keyword to the right-hand side of comparisons
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
9cd19e3708
Add HexLiteralTransformer
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago