-
-
Notifications
You must be signed in to change notification settings - Fork 828
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: Reference display objects indirectly by string path #9447
Conversation
Although the game is far from working, this fixes the panic in #4932! 🎉 |
Unfortunately, Desktop Tower Defense seems not to be the only game with a Mochi preloader that's no longer working. Bloons TD is also affected. |
Testing with a version of Desktop Tower Defense modified not to use a Mochi loader, #8765 is fixed!
|
Testing the games in my collection, here are some more regressions I'm noticing:
|
The SWF provided in #3839 seems to log the correct output now. Some related issues are also fixed: #3604, #6185 But some are not fully resolved yet:
|
Relevant: #6548 (comment) |
I can confirm that Trojan War, Frontline Defense, Monkey Kick Off, Nanaca Crash, and Numballs are working great with the latest changes! 🎉 @ousia No, those two issues are not fixed. They seem to have somewhat different root causes that would likely need to be solved separately from this PR. |
@CUB3D your latest commit seems to have broken most of the tower defense games again to some degree. Vector TD is back to being totally broken, for instance. |
Super Mario 63 is a whole other can of worms that we probably shouldn't touch yet 😆 |
Toad06 commented that some issues may occur because of #3839, and it's one of the more complex AVM1 games, so it would be an interesting test case. |
I'm seeing a regression in Golphysics (#5219). Now when I click the Start button to start the game, it goes to a blank screen instead. Also, I just remembered to test #2732 and that issue is still occurring the same as before. Not sure if that issue is really related though. |
This also fixes #9504. |
If #1029 could be fixed, in #1561 (comment) @Herschel stated that #1561 is a variant of it (although it needs work to consider graphics as well). Just in case it could be considered in this or in a future PR. |
The fixes keyword is picky, but can be used to auto-close issues when used properly. You should probably copy paste the below to auto-close all the issues, as the current phrasing will only close the first listed issue automatically: Fixes #993, fixes #2840, fixes #1513, fixes #1140, fixes #5275, fixes #4793, fixes #4404, fixes #9257, fixes #9135, fixes #5923, fixes #2575, fixes #8765, fixes #7711, fixes #5711, fixes #5095, fixes #7169, fixes #7345, fixes #7362, fixes #6960, fixes #6203, fixes #8872, fixes #1017, fixes #3839, fixes #3604, fixes #6185, fixes #3916, fixes #6336, fixes #4118, fixes #9504 |
With the latest commits, #2732 is actually fixed! 🎉 Also, I can confirm that Bubble Bobble is fixed and the Golphysics regression is resolved. 👍 |
I can confirm that Wuzi Chess is fixed! 😄 And #9514 is fixed as well! |
2206902
to
9153012
Compare
@@ -544,18 +546,30 @@ impl<'a, 'gc> Activation<'a, 'gc> { | |||
} | |||
} | |||
|
|||
fn stack_push(&mut self, mut value: Value<'gc>) { | |||
if let Value::Object(Object::StageObject(s)) = value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the ability to push to the AVM1 stack without this logic running? If not, could we move this logic into the push
method, and have it take an Activation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really need to be able to push without this running, so moving it would be possible, but because we need a mutable borrow of activation inside of push
to create a MovieClipReference
as well as a mutable borrow of self.context.avm1
to call push it would likely be a much more invasive change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a pretty subtle issue, I'd like to make it harder to accidentally skip running this logic (by using avm1.push
instead of stack_push
). However, I don't want to block merging this PR, so I think this could be done as a follow-up refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just adding that the only solution I can think of, would be either removing avm1.push
and switching everything to use activation.push
or using interior mutability so that avm1.push
can take &self
over &mut self
. Did you have another solution in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to make it harder to accidentally skip running this logic (by using avm1.push instead of stack_push).
On the contary, I'd consider minimizing complexity of push whenever it's not needed (say action_add
). In avm2, stack push keeps popping up on profiles with non-trivial %, while on paper it should be one of the cheapest things ever.
@CUB3D Thank you very much. Canyon Defense works like a charm now. Highly appreciate your work! |
This now fixes the problem the swf i used! Good job and I wish y'all the best of luck on getting ruffle completed! |
Thanks, @CUB3D ! |
Not sure if this is related but it seems this issue has semi fixed the invisible ragdoll issue in Free Rider 2 |
Please add that as a comment to the original issue, thanks! |
In AVM1,
MovieClip
s are referenced by their path on the stage, which causes some differences in how they are handled compared toObject
s, namely:Undefined
and the clip itself to become""
(empty string)This pr takes a different approach to #5492, as per https://web.archive.org/web/20051224124649/http://moock.org:80/asdg/technotes/movieclipDatatype/:
"Movie clips are implemented separately from objects internally in the Player, ..."
The combination of this strange behavior and clips having a unique result for
typeof
makes me think that this quote should be taken literally. This pr starts to separatesValue::MovieClip
fromValue::Object
, this new variant stores the path to the targeted object. When coerced to aString
, this variant results in the path if the object is present on the stage, or an empty string if it is not. When coerced to anObject
the result is eitherUndefined
if the clip has been removed or the backingObject
if it is not.(Note that in order to simplify this,
Value::Object
is still used internally, and is only converted to aValue::MovieClip
when pushed onto the avm stack, this isn't clean but it's a lot simpler. I don't intend for this "hack" to be permanent)(This pr also fixes a minor issue with
SuperObject
string coercion found while creating tests)TODO:
SuperObject
)SuperObject
)Deep Breath
Fixes #993, fixes #2840, fixes #1513, fixes #1140, fixes #5275, fixes #4793, fixes #4404, fixes #9257, fixes #9135, fixes #5923, fixes #2575, fixes #8765, fixes #7711, fixes #5711, fixes #5095, fixes #7169, fixes #7345, fixes #7362, fixes #6960, fixes #6203, fixes #8872, fixes #1017, fixes #3839, fixes #3604, fixes #6185, fixes #3916, fixes #6336, fixes #4118, fixes #9504, fixes #1029, fixes #2732, fixes #5277, fixes #8576, fixes #1989, fixes #3118, fixes #9514, fixes #9556, fixes #8857, fixes #8314, fixes #8463, fixes #7728, fixes #7846, fixes #7928, fixes #8498, fixes #8784, fixes #9800
(please link anything else that has the same bug as 993 and isn't in this list or the todos)