LiveSplit / asr

Helper crate to write auto splitters for LiveSplit One's auto splitting runtime.
https://livesplit.org/asr/asr
Apache License 2.0
10 stars 10 forks source link

[Unity] Various edits in the Unity code #71

Closed Jujstme closed 9 months ago

Jujstme commented 1 year ago

This fixes automatic pointer path resolution for Unity games by adding 2 features:

  1. caching of resolved offsets If the code is dealing with Classes that didn't run their cctor, automatic pointer path resolution fails. However, caching the offsets already resolved allows the script to skip over them instead of looking for them again. This greatly improves performance, as some functions, especially the get_class() one, are very intensive and slow, requiring hundredths of memory reads in some games and potentially stalling the execution of the autosplitter

  2. looking for child classes through their vtable This also fixes automatic pointer path resolution when traversing arrays or standard C# structures the previous implementation of this function was failing on.

Together with its companion PR https://github.com/LiveSplit/asr/pull/69 , this should fix most if not all the outstanding bugs there were left and I could identify so far with this engine.

A couple of additional commits have also been added in roder to have Copy on the DeepPointer struct, as well as adding a read_pointer() function inside Process.