Open rogual opened 10 months ago
@torokati44: You noticed an AMF test failing on android/ARM - did you ever open an issue for that?
Yeah, but over there: https://github.com/torokati44/ruffle-android/issues/63
But AFAIK GH now has M1 CI runners, we can try enabling those too.
Oooh, but:
Who can use this feature Larger runners are only available for organizations and enterprises using the GitHub Team or GitHub Enterprise Cloud plans.
How dare they... Lemme fetch my RPi then...
@rogual: Would you mind cloning this repo, and running cargo test --all
in it, and see whether anything fails?
https://github.com/ruffle-rs/rust-flash-lso
All passed.
Thank you!
I went a few circles around this, trying the following ideas:
f64::is_nan()
as a fixed "canonical" sequence of bytes.Number.NaN
in AVM2 to a fixed "canonical" constant (f64::NAN
isn't actually fully defined, especially the sign bit).But neither fixed all tests.
So for now, I'm not sure which way to go next.
If ActionScript 3 source code mentions NaN
, does that not become a reference to the NaN constant in playerglobals.swf? If so, the bytes of that NaN won't be generated from the Rust compiler at all, it'll be compiled into playerglobals by the Java-based Macromedia compiler that's called from ruffle/core/build_playerglobal
. That might be what's behaving differently on different CPUs.
(That's if I understand how playerglobals works... which it's very possible I don't.)
Well the NaN
builtin for AVM2 is set here (AFAIK): https://github.com/ruffle-rs/ruffle/blob/41ddb316a2b0a91c0d32e8f54eb0f020be42831f/core/src/avm2/globals/number.rs#L400-L402
But there are lots of other mentions of f64::NAN
in the AVM2 code too, for example in the native implementations of the Date
and Point
classes.
Yes, if thoseNaN
s are ever observable as bytes, which they probably are, then it might be worth Ruffle defining its own NAN
constant and using that everywhere.
But I don't think that will fix this failing test. I might be wrong, but I couldn't find a similar Rust declaration for the value you get by typing NaN
in AS3, which is why I suspect it's loaded from playerglobals; specifically, here:
Oh, that's a good point, yeah. I did try to look specifically for the builtin NaN
(as opposed to the one in Number
), but I was in a hurry and didn't find the entirely logical place for it, Toplevel.as
. 😅
I'll hopefully get back to experimenting with this in a couple of days.
Describe the bug
The test
avm2/amf_vector
fails on my machine (M2 Mac).Test result:
It's the
NaN
that's serializing differently from in Flash Player.The test is expecting the NaN to be serialized as
0xfff8000000000000
, but Ruffle for me is giving0x7ff8000000000000
.These are both valid NaNs.
I would suggest either:
NaN
(it would still check the encode/decode round-trip), orI'd be surprised if this broke any real content, so would probably lean towards 1?
As for option 2, if we wanted to fix it: I'm not quite sure how the
NaN
is stored in the test SWF. I guess it's probably a reference to the precompiledNaN
inplayerglobals.swf
? In that case it's the compiler that compilesplayerglobals.swf
that's causing the difference. But I didn't look into it much.Expected behavior
NaN serialized with sign bit set.
Content Location
tests/tests/swfs/avm2/amf_vector/test.swf
Affected platform
Desktop app
Operating system
13.5 (22G74)
Browser
No response
Additional information
No response