IllusionMods / IllusionFixes

A collection of fixes for common issues found in games by Illusion
GNU General Public License v3.0
157 stars 29 forks source link

[KK][GT] Cache temporary arrays in ChaControl.UpdateVisible #48

Closed mosirnik closed 1 year ago

mosirnik commented 1 year ago

This is another attempt at 3124e14, which got reverted.

The previous patch broke ClothesToAccessories when UpdateVisible contained an unexpected number of array allocations. This happened because the transpiler threw an exception, which, depending on the patch order, could prevent the transpiler defined by ClothesToAccessories (or any other plugin that patches the method) from running.

This version avoids the issue by logging an error instead of throwing an exception.

This version also removes the use of CodeMatcher.SetAndAdvance because it looks like it could destructively modify input code.

Tested with ClothesToAccessories 1.0.3.