avm1: Update movie parameters when loading into _root/_level0

The movie framerate and dimensions should be changed when a movie
is loaded into _root or level 0.
This commit is contained in:
Mike Welsh 2021-04-10 12:44:41 -07:00
parent 5739992f6e
commit aa0707411c
2 changed files with 17 additions and 5 deletions

View File

@ -431,6 +431,8 @@ impl<'gc> Loader<'gc> {
.upgrade()
.expect("Could not upgrade weak reference to player");
let mut replacing_root_movie = false;
Box::pin(async move {
player
.lock()
@ -448,6 +450,10 @@ impl<'gc> Loader<'gc> {
_ => unreachable!(),
};
if let Some(root) = uc.levels.get(&0).copied() {
replacing_root_movie = DisplayObject::ptr_eq(clip, root);
}
clip.as_movie_clip().unwrap().unload(uc);
clip.as_movie_clip()
@ -476,6 +482,10 @@ impl<'gc> Loader<'gc> {
});
if let Ok((length, movie)) = data {
let movie = Arc::new(movie);
if replacing_root_movie {
player.lock().unwrap().set_root_movie(movie);
return Ok(());
}
player
.lock()

View File

@ -415,12 +415,14 @@ impl Player {
context.levels.insert(0, root);
// Load and parse the device font.
let device_font =
Self::load_device_font(context.gc_context, DEVICE_FONT_TAG, context.renderer);
if let Err(e) = &device_font {
log::error!("Unable to load device font: {}", e);
if context.library.device_font().is_none() {
let device_font =
Self::load_device_font(context.gc_context, DEVICE_FONT_TAG, context.renderer);
if let Err(e) = &device_font {
log::error!("Unable to load device font: {}", e);
}
context.library.set_device_font(device_font.ok());
}
context.library.set_device_font(device_font.ok());
// Set the version parameter on the root.
let mut activation = Activation::from_stub(