The groups field is populated with the group capacity, not the group
size. (Thanks Ominious.)
Update the test to cover this case, by adjusting the test index so its
size and capacity are distinct.
Signed-off-by: Graham <gpe@openrs2.org>
I think this dates back to me experimenting with deobfuscating both the
client and HD client at the same time. We don't do that any more.
Signed-off-by: Graham <gpe@openrs2.org>
This improves deobfuscation of a static field initializer in the 667
client that looks like:
a = b = new X()
This transformer translates it to two separate expressions:
b = new X(); a = b
This allows the StaticFieldUnscrambler to move both fields
independently, rather than them both being forced to remain in their
scrambled class.
Signed-off-by: Graham <gpe@openrs2.org>
667 has an initializer like `a = b = new X()`. This broke the previous
version of the unscrambler, as it treated it as two separate
initializers: `a = b = new X()` and `b = new X()`. When the fields were
moved, the overlapping instructions were removed twice from the original
<clinit> method, making its size negative.
Even if this were fixed, it is still not safe to move the initializers,
as `new X()` would end up being executed twice, not once.
This commit fixes the problem by treating any simple initializer that
overlaps with any other simple initializer as a complex initializer.
Signed-off-by: Graham <gpe@openrs2.org>
This commit makes the following improvements:
- Converts the list of instructions in the entry and exit block to a
set, which makes checking for containment more efficient.
- Removes redundant excluded field filtering, which is already handled
by the unscramble() method.
- Treats fields written with PUTSTATIC outside the entry or exit block
as complex, instead of just fields read with GETSTATIC.
- Treats fields with multiple simple initializers as complex.
- Treats fields where we fail to extract a simple initializer as
complex. This fixes a bug where we accidentally thought those fields
had no initializer.
Signed-off-by: Graham <gpe@openrs2.org>
This is a slightly nicer solution than running a combined transformer
until it reaches a fixed point: we know we'd only need two passes,
rather than an arbitrary number of passes.
The 667 client uses various exception types beyond RuntimeException in
ZKM exception obfuscation handlers, including Throwable, Exception,
EOFException and IOException. This separation also allows us to remove
the type constraint for ZKM handlers.
Signed-off-by: Graham <gpe@openrs2.org>
The build 667 client has some ZKM exception handlers inside Jagex's
exeption tracing handlers. In a single pass, the regex is only capable
of matching the former and not the latter. The ZKM exception handlers
were removed, confusingly leaving Jagex exception handlers that do match
the CATCH_MATCHER regex.
Signed-off-by: Graham <gpe@openrs2.org>
Polar posting about these recently in Discord jogged my memory that I'd
missed this flag off, previously I called this FLAG_HIGHLIGHT.
I've also added the official Jagex names to the documentation, thanks to
Polar.
I don't think 550 supports any of the flags after DEDICATEDACTIVITY.
Signed-off-by: Graham <gpe@openrs2.org>
- It's now used for OSRS as well as NXT.
- We retain buildMinor if buildMajor == server_version, so we don't have
to keep retrying minor versions.
Signed-off-by: Graham <gpe@openrs2.org>
removeAll removes all instances of an item in the right list from the
left list, but we only want to remove a single instance.
Signed-off-by: Graham <gpe@openrs2.org>
This previously worked by chance with the PE32 executables we saw, but
it didn't work with the PE32+ executables we saw.
Signed-off-by: Graham <gpe@openrs2.org>
There are still some gaps but I want to get this committed and possibly
deployed before doing further work.
Remaining items include:
- Mach-O support
- New engine loader ArtifactLink support
- Post-668 client support
- FunOrb support
Signed-off-by: Graham <gpe@openrs2.org>