DaZombieKiller / TypeTreeTools

Export type tree information straight from the Unity editor. Superceded by https://github.com/DaZombieKiller/TypeTreeDumper
MIT License
8 stars 4 forks source link

Produce Abstract Objects #8

Open spacehamster opened 4 years ago

spacehamster commented 4 years ago
        // TODO: Support producing abstract types. To do this, the following steps are necessary:
        //       1. Replace T::VirtualRedirectTransfer with T::Transfer. This can be done by either
        //          hooking the method via EasyHook, or modifying the virtual function table.
        //          This works because both methods have compatible signatures.
        //       2. Create a new Factory method for the type, by locating its constructor function
        //          and using that to create a new delegate.
        //       3. Create a new RuntimeTypeInfo based on the original, with the new Factory method.
        //          It also needs to have the IsAbstract field set to false.
        //       4. Hook T::GetTypeVirtualInternal to return the appropriate RuntimeTypeInfo.

I was going through this, and i don't understand step 1. T::VirtualRedirectTransfer does not appear to exist for abstract types and I can't find T::Transfer at all.

I'm also not clear on what the use of the abstract type trees would be.

DaZombieKiller commented 4 years ago

The comments are probably not as clear as I'd hoped they would be. You can find the old code for making abstract types "producible" here, but it's messy and I'm planning to redo it later.

You can find the virtual function table for a type by using DIA to locate the ??_7Name@@6B@ (or ??_7Name@Namespace@@6B@ if the namespace is non-null) symbol.

T::VirtualRedirectTransfer does not appear to exist for abstract types

It's stubbed out for abstract types and will instead output an error.

and I can't find T::Transfer at all.

More accurately, it's T::Transfer<GenerateTypeTreeTransfer>. You can see the symbol name template in the older abstract object production code.

I'm also not clear on what the use of the abstract type trees would be.

It's probably not useful for most tools. I was making use of it in another project to generate cleaner type trees.