47 Commits

Author SHA1 Message Date
LukeFZ
ffb1996252 smaller tweaks, hack around loops in cpp type layouting 2025-02-08 17:40:15 +01:00
Luke
b05c03964a Struct reading and disassembly script overhaul, various misc. loading fixes, bump to .NET 9 (#13)
* Bump projects to .net 9 and update nugets

* add VersionedSerialization + source generator

* migrate versioning to StructVersion class, add handling/detection for 29.2/31.2

* add new struct definitions

* rename serialization methods and add BinaryObjectStreamReader for interop

* Rework metadata struct loading to use new struct versioning

* move 29/31.1/.2 to use tags (-2022,-2023) instead of minor versions

* fix metadata usage validity checks

* rework code registration offsetting a bit and add second 29/31.1 condition

* tweak .1 condition (again)

* 29/31.2 was a psyop

* also remove 29.2 from the readme

* remove loading of packed dlls - this was a very unsafe feature

* support auto-recovering type indices from type handles
fixes loading of memory-dumped v29+ libraries since those replacee their class indices on load with a pointer to the corresponding type

* support loading PEs without an export table

* also read UnresolvedVirtualCallCount on regular v31

* Disable plugin loading for now

* Overhaul disassembler script + add Binary Ninja target (#12)

* Overhaul diassembler scripts:
- No longer defines top level functions
- Split into three classes: StatusHandler (like before), DisassemblerInterface (for interfacing with the used program API), ScriptContext (for definiting general functions that use the disassembler interface)
- Add type annotations to all class methods and remove 2.7 compatibility stuff (Ghidra now supports Python 3 so this is unnecessary anymore)
- Disassembler backends are now responsible for launching metadata/script processing, to better support disassembler differences
- String handling is back in the base ScriptContext class, disassembler interfaces opt into the fake string segment creation and fall back to the old method if it isn't supported

* Add Binary Ninja disassembler script backend
This uses the new backend-controlled execution to launch metadata processing on a background thread to keep the ui responsive

* make binary ninja script use own _BINARYNINJA_ define and add define helpers to header

* Update README to account for new script and binary ninja backend

* implement fake string segment functions for binary ninja but don't advertise support

* also cache API function types in binary ninja backend

* fix ida script and disable folders again

* Fix metadata usage issues caused by it being a value type now

* make TryMapVATR overrideable and implement it for ELFs

* Make field offset reading use TryMapVATR to reduce exceptions

* Fix NRE in Assembly ctor on < v24.2

* Update actions workflow to produce cross-platform CLI binaries, update readme to reflect .net 9 changes

* workflow: only restore packages for projects that are being built

* workflow: tweak caching and fix gui compilation

* workflow: remove double .zip in CLI artifact name

* 29/31.2 don't actually exist, this logic is not needed
2024-11-14 14:32:11 +01:00
LukeFZ
87766f6f96 Add support for metadata version 29.2 and 31 2024-06-24 18:41:14 +02:00
LukeFZ
6b060c274a Fix assembly shim output for older Unity versions due to non-explicit class layouts 2023-12-10 21:58:22 +01:00
LukeFZ
5afe295ef0 also set rva value as dnlib InitialValue 2023-12-01 09:39:02 +01:00
LukeFZ
7120970ece Use actual size of static array initializers 2023-12-01 08:14:12 +01:00
LukeFZ
7e7d345c30 Add support for ThreadStatic fields 2023-12-01 07:08:48 +01:00
LukeFZ
227aefedef simplify custom attribute logic a bit by always returning arrays as ConstantBlobArrayElement 2023-12-01 06:46:58 +01:00
LukeFZ
6aa96b431d Support reading and writing custom arguments for v29 2023-12-01 04:43:27 +01:00
Katy Coe
2901b6de26 DLL: Output static field offsets (StaticFieldOffsetAttribute) 2021-01-26 17:50:29 +01:00
Katy Coe
0b8a42d9a2 DLL: Fix AddressAttribute.Slot being empty 2021-01-12 02:29:50 +01:00
Katy Coe
fca91ff556 DLL: Allow suppression of metadata attributes 2021-01-12 02:17:23 +01:00
Katy Coe
34ebd31deb DLL: Fix not outputting 0-offsets on first struct field 2021-01-10 14:41:54 +01:00
Katy Coe
ad7a09021d DLL: Fix RVAs for PE files 2021-01-10 14:31:35 +01:00
Katy Coe
ba1f69540f DLL: Eliminate Il2CppInspector.DLL dependency on System.Private.CoreLib 2021-01-10 13:48:57 +01:00
Katy Coe
1cf0fc8c54 DLL: Fix bug with parameter default values 2021-01-10 12:56:05 +01:00
Katy Coe
7961fc6dab CLI/GUI: Add shim DLL output support 2021-01-10 11:38:45 +01:00
Katy Coe
64119a9dfc DLL: Apply zero-parameter custom attributes directly 2021-01-10 09:11:30 +01:00
Katy Coe
cd7ddf193a Model: Implement MetadataToken property 2021-01-10 08:37:49 +01:00
Katy Coe
8ffff24079 DLL: Add assembly and module tokens 2021-01-10 08:26:12 +01:00
Katy Coe
0cdb028e88 DLL: Fix missing ParameterAttributes 2021-01-10 08:18:43 +01:00
Katy Coe
daa2741b05 DLL: Revert special explicit interface implementation name handling 2021-01-10 08:17:52 +01:00
Katy Coe
15731e60db DLL: Output enum return type method bodies correctly 2021-01-10 07:38:50 +01:00
Katy Coe
96e15a7521 DLL: Don't try to add property tokens if there is no definition 2021-01-10 03:32:30 +01:00
Katy Coe
c56a4c6a3a DLL: Forward declare all assemblies 2021-01-10 03:32:03 +01:00
Katy Coe
57b37711ae DLL: Add static array initializer value preview 2021-01-10 02:38:11 +01:00
Katy Coe
894075d676 DLL: Don't output method body for abstract methods 2021-01-10 02:20:58 +01:00
Katy Coe
7869d7af03 DLL: Output custom attributes 2021-01-09 22:11:06 +01:00
Katy Coe
d4db6666d9 DLL: Output explicit interface implementation names correctly 2021-01-09 21:50:31 +01:00
Katy Coe
900b690d36 DLL: Output events 2021-01-09 21:37:55 +01:00
Katy Coe
75ced39fdc DLL: Ensure all non-extern methods have bodies 2021-01-09 21:21:22 +01:00
Katy Coe
135984bbdd DLL: Fix failure to import some signatures 2021-01-09 04:06:15 +01:00
Katy Coe
5540ba296b DLL: Fix our attribute field references 2021-01-09 03:50:41 +01:00
Katy Coe
09c5c6af23 DLL: Support arrays, pointers, ref types 2021-01-09 03:36:50 +01:00
Katy Coe
3df026c5cb DLL: Don't output offset for static fields 2021-01-09 02:37:45 +01:00
Katy Coe
40fd8d1df1 DLL; Output fields; set static correctly on methods/properties 2021-01-09 02:02:07 +01:00
Katy Coe
3a0c0d59e8 DLL: Output properties 2021-01-09 01:30:29 +01:00
Katy Coe
a30caee1d9 DLL: Complete method output 2021-01-09 01:06:20 +01:00
Katy Coe
f9aae1d367 DLL: Fix TokenAttribute not being formatted as hex 2021-01-08 22:23:29 +01:00
Katy Coe
35378f5065 DLL: Handle nested generic types and methods 2021-01-08 22:23:29 +01:00
Katy Coe
6322246566 DLL: Handle generic type references 2021-01-08 22:23:29 +01:00
Katy Coe
8303038b69 DLL: Fix TypeRefs, add constructor skeletons 2021-01-08 22:23:29 +01:00
Katy Coe
7dbe208656 DLL: Add base type and interfaces to type declarations 2021-01-08 22:23:29 +01:00
Katy Coe
b01be3dda6 DLL: Improve workflow; add generic parameters and constraints 2021-01-08 22:23:29 +01:00
Katy Coe
f84cb97f73 DLL: Add extensions and helper methods; generate TokenAttribute on types 2021-01-08 22:23:29 +01:00
Katy Coe
82e88dae57 DLL: Generate all skeleton assemblies and types 2021-01-08 22:23:29 +01:00
Katy Coe
a5d0ea39e6 DLL: Add initial code to create custom attributes 2021-01-08 22:23:29 +01:00