Commit Graph

48 Commits

Author SHA1 Message Date
Lucaskyy
f4589db3a9 test: fix assert message 2022-03-24 23:31:01 +01:00
Lucaskyy
1af31b2aa3 fix(MethodResolver): fix cd57a8c9a0 2022-03-24 23:29:32 +01:00
Lucaskyy
cd57a8c9a0 fix(MethodResolver): strip labels nodes so opcode patterns match
this commit is also a fix for 8d1bb5f3d9 because it corrupted the stack by completely removing the nodes
2022-03-24 22:48:34 +01:00
Lucaskyy
ddef338631 refactor: log as trace instead of debug
so there's less spam in console
2022-03-24 21:38:13 +01:00
Lucaskyy
8d1bb5f3d9 fix(MethodResolver): strip labels and line numbers so opcode patterns match 2022-03-24 21:27:44 +01:00
Lucaskyy
c8a017a4c0 refactor: only compute maxs and use existing stack frames 2022-03-24 19:45:13 +01:00
Lucaskyy
e8f6973938 fix: give ClassWriter a ClassReader for symtable
removed SafeClassWriter as it was unused
2022-03-23 23:01:13 +01:00
Lucaskyy
ca6b94d943 feat: add SafeClassWriter
the standard ClassWriter implementation uses the ClassLoader to find a common superclass. this won't work for us since we are not loading the JAR into the classpath. using this SafeClassWriter should fix that issue.
2022-03-23 22:32:50 +01:00
Lucaskyy
ab6453ca8a fix: set marklimit to Integer.MAX_VALUE 2022-03-23 22:08:51 +01:00
Lucaskyy
49beec9fc6 refactor: Optimize Signature class (#11)
BREAKING CHANGE: Array<Int> was changed to IntArray. This breaks existing patches.
2022-03-23 20:00:35 +01:00
Lucaskyy
3ab42a932c refactor: Rename net.revanced to app.revanced
BREAKING CHANGE: Package name was changed from "net.revanced" to "app.revanced"
2022-03-23 19:56:37 +01:00
oSumAtrIX
4d98cbc9e8 fix(Io): JAR loading and saving (#8)
* refactor: Complete rewrite of `Io`

* style: format code

* style: rewrite todos

* fix: use lateinit instead of nonnull assert for zipEntry

* fix: use lateinit instead of nonnull assert for jarEntry & reuse zipEntry

* docs: add docs to `Patcher`

* test: match output of patcher

* chore: add todo to `Io` for removing non-class files

Co-authored-by: Sculas <contact@sculas.xyz>
2022-03-23 19:56:35 +01:00
oSumAtrIX
8db8893ab1 fix: nullable signature members (#10)
This commit will allow "partial" signatures, basically we will be allowed to exclude members to match for the signature
2022-03-23 19:56:33 +01:00
oSumAtrIX
00c6ab7faf feat: Add findParentMethod utility method (#4)
* feat: Add `findParentMethod` utitly method

* refactor: add `resolveMethod` to `MethodResolver`

added some assertions and some tests

Co-authored-by: Lucaskyy <contact@sculas.xyz>
2022-03-23 19:56:31 +01:00
Bleuzen
460d62a24c fix(Io): fix finding classes by name 2022-03-23 19:55:40 +01:00
Lucaskyy
a8fd7c00c3 refactor: target java 8 instead of java 17 2022-03-23 19:55:38 +01:00
Lucaskyy
1769132a9e fix: set index for insertAt to 0 by default 2022-03-23 19:55:37 +01:00
Lucaskyy
6c0f0823c9 fix: Patch should have access to the Cache
BREAKING CHANGE: Method signature of execute() was changed to include the cache, this will break existing implementations of the Patch class.
2022-03-23 19:55:35 +01:00
Lucaskyy
23e897a7a9 refactor: convert Patch to abstract class
BREAKING CHANGE: Patch class is now an abstract class. You must implement it. You can use anonymous implements, like done in the tests.
2022-03-23 19:55:34 +01:00
Lucaskyy
593c83f29f style: remove tab 2022-03-20 20:39:47 +01:00
Lucaskyy
6b1cec4a43 test: add test for multiple classes in jar 2022-03-20 19:05:24 +01:00
Lucaskyy
5f12bab5df fix: current must be calculated after increment 2022-03-20 16:57:33 +01:00
Lucaskyy
ec8115f3ac test: improve PatcherTest 2022-03-20 16:28:23 +01:00
Lucaskyy
0e72a6e85f fix: remove broken code
accidentally committed TestUtil in previous commit, this allows it to compile again
2022-03-20 15:57:05 +01:00
Lucaskyy
d5a3c76389 fix: avoid ignoring test resources (fixes #1) 2022-03-20 15:54:41 +01:00
oSumAtrIX
ded2538605 Renamed Jar2ASM to Io due to reader & writer class 2022-03-20 03:19:13 +01:00
oSumAtrIX
5d146c362f Improve example test testPatcher and increase caching speed 2022-03-20 03:06:23 +01:00
Lucaskyy
29f1595183 WIP Saving 2022-03-19 23:58:37 +01:00
Lucaskyy
57d5751b2c Add saveTo test 2022-03-19 23:33:17 +01:00
Lucaskyy
8c56d15823 Finish tests, add InsnList.setAt, sr -> sd
Added some sweet explanation too.
2022-03-19 23:15:20 +01:00
Lucaskyy
61c0541ef5 Add information about test data in PatcherTest 2022-03-19 23:01:10 +01:00
Lucaskyy
f45dd511f3 Cleanup 2022-03-19 22:53:30 +01:00
Lucaskyy
fc64bbc32a Minor things 2022-03-19 22:53:05 +01:00
Lucaskyy
e5f9a42ee6 Convert typed Object & Array types to Object types
Commit name is a bit superfluous, but it means that types such as "Ljava/lang/String;" get converted to "Ljava/lang/Object;". This is so we don't need to know the mappings, which are random in YT's code.

This is done in MethodResolver's "convertObject" and "convertObjects" for arrays.

Also changed ExtraTypes.ArrayAny to Object instead of String, that was a mistake. (which caused the test to pass at first)
2022-03-19 22:34:41 +01:00
Lucaskyy
f9327a2043 executePatches -> applyPatches, made logback a test dep 2022-03-19 21:58:31 +01:00
Lucaskyy
6bd4d80c47 Cache classes with their path & add ScanData for PatchData 2022-03-19 21:30:13 +01:00
Lucaskyy
ae5007ebd1 Fix tests (stupid mistake) & add logging 2022-03-19 19:47:12 +01:00
Lucaskyy
a9e7f19d51 Refactor Patcher 2022-03-19 18:35:41 +01:00
oSumAtrIX
6666c7a4b7 Add: MethodResolver, PatternScanner, SignatureLoader & Cache 2022-03-19 01:37:02 +01:00
Lucaskyy
be18b837ba Add Jar2ASM & loadJar method 2022-03-18 23:08:41 +01:00
oSumAtrIX
d297a3dbf6 Adding more features to the patcher (unfinished) 2022-03-18 22:10:41 +01:00
Lucaskyy
7b40d53bd3 TIL CodeWithMe is ass! 2022-03-18 21:52:00 +01:00
oSumAtrIX
fc41a84aa1 Add more templates 2022-03-18 20:57:14 +01:00
Lucaskyy
675c409a59 Rework patcher 2022-03-18 20:46:24 +01:00
oSumAtrIX
76008acef6 Restructure patcher 2022-03-17 21:52:44 +01:00
Lucaskyy
8ab86312bf Refactor code, add YTVersion, ElementType and signatures for 17.03.38
"signatures" package will be moved to Signatures repository soon.
2022-03-17 20:04:06 +01:00
Lucaskyy
6a3e913a3c Add Sig data class, SigScanner class and Patcher class
SigScanner and Patcher are WIP.
Patcher contains test/debug code.
2022-03-16 22:58:55 +01:00
Lucaskyy
de388c75fa Initial commit 2022-03-16 22:00:41 +01:00