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 #47

Closed mosirnik closed 1 year ago

mosirnik commented 1 year ago

This patch caches the 1D and 2D temporary arrays created in UpdateVisible.

The transpiler is a little blunt, replacing all newarr instructions, so I included a check to ensure that we patch exactly 45 places. This should make it a little more robust against other plugins transpiling the same method.

I wrote some code (not included here) to check that all 45 arrays are indeed safe to cache.

mosirnik commented 1 year ago

If number of arrays is known why not use an array and id as index instead of a dictionary and id as key? It would eliminate the overhead.

Good point, changed to use an array instead. (Let me know if you prefer squash + force-push rather than adding new commits)

ManlyMarco commented 1 year ago

I'll most likely squash merge anyways so you can just push separate commits.