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

avm1: target_clip behavior difference depending on SWF version #2580

Closed
relrelb opened this issue Jan 16, 2021 · 1 comment · Fixed by #2593
Closed

avm1: target_clip behavior difference depending on SWF version #2580

relrelb opened this issue Jan 16, 2021 · 1 comment · Fixed by #2593
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2)

Comments

@relrelb
Copy link
Contributor

relrelb commented Jan 16, 2021

On SWF6, calling a function changes the active target_clip according to the callee's definition location.
Currently Ruffle handles this behavior as expected:

af.base_clip,

However SWF5 seems to behave differently. Instead of changing the active target_clip, it remains unchanged and same as the caller's target_clip.
Ruffle doesn't handle this behavior and always behaves like SWF6.

The attached examples are identical except for their SWF version (5 vs. 6).
Notice that only the yellow circle moves in target_clip_swf5.zip, but both the yellow circle and the green square move in target_clip_swf6.zip.

target_clip_swf5.zip
target_clip_swf6.zip

Changing the line mentioned above from af.base_clip, to activation.base_clip, (plus making it pub) seem to change the behavior from SWF6 to SWF5. I feel like selecting either af.base_clip or activation.base_clip depending on the SWF version is the proper fix, but I'm not 100% sure about it.

@Herschel Herschel added actionscript A-avm1 Area: AVM1 (ActionScript 1 & 2) labels Jan 16, 2021
@Herschel
Copy link
Member

Seems accurate to me, would you like to make a PR with the fix and test case? Here's another test case using gotoAndPlay (which affects the target clip):
gotoandplay_swf5.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants