avm2: Lock old movies (SWFv8 and earlier) to always use AVM1

This commit is contained in:
David Wendt 2020-10-05 22:25:50 -04:00 committed by Mike Welsh
parent 693e56dc67
commit 1a10f1e004
1 changed files with 19 additions and 15 deletions

View File

@ -246,7 +246,8 @@ impl<'gc> Library<'gc> {
if !self.movie_libraries.contains_key(&movie) { if !self.movie_libraries.contains_key(&movie) {
let slice = SwfSlice::from(movie.clone()); let slice = SwfSlice::from(movie.clone());
let mut reader = slice.read_from(0); let mut reader = slice.read_from(0);
let vm_type = match reader.read_tag_code_and_length() { let vm_type = if movie.header().version > 8 {
match reader.read_tag_code_and_length() {
Ok((tag_code, _tag_len)) Ok((tag_code, _tag_len))
if TagCode::from_u16(tag_code) == Some(TagCode::FileAttributes) => if TagCode::from_u16(tag_code) == Some(TagCode::FileAttributes) =>
{ {
@ -264,6 +265,9 @@ impl<'gc> Library<'gc> {
AvmType::Avm1 AvmType::Avm1
} }
_ => AvmType::Avm1, _ => AvmType::Avm1,
}
} else {
AvmType::Avm1
}; };
self.movie_libraries self.movie_libraries