Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Sep 5, 2023

Conversation

mosirnik
Copy link
Contributor

@mosirnik mosirnik commented Sep 3, 2023

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.

mosirnik and others added 3 commits September 3, 2023 13:43
This is another attempt at 3124e14, which got reverted.

Original commit message:
> 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.

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.
@ManlyMarco ManlyMarco merged commit ba53dc8 into IllusionMods:master Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants