diff --git a/core/src/avm2/globals.rs b/core/src/avm2/globals.rs index a82a87aa1..9582c55ed 100644 --- a/core/src/avm2/globals.rs +++ b/core/src/avm2/globals.rs @@ -813,6 +813,12 @@ pub fn load_player_globals<'gc>( domain, script ); + class( + activation, + flash::display::ibitmapdrawable::create_interface(mc), + domain, + script, + )?; // package `flash.geom` avm2_system_class!( diff --git a/core/src/avm2/globals/flash/display.rs b/core/src/avm2/globals/flash/display.rs index 48d24584a..2bad624eb 100644 --- a/core/src/avm2/globals/flash/display.rs +++ b/core/src/avm2/globals/flash/display.rs @@ -8,6 +8,7 @@ pub mod displayobject; pub mod displayobjectcontainer; pub mod framelabel; pub mod graphics; +pub mod ibitmapdrawable; pub mod interactiveobject; pub mod jointstyle; pub mod linescalemode; diff --git a/core/src/avm2/globals/flash/display/ibitmapdrawable.rs b/core/src/avm2/globals/flash/display/ibitmapdrawable.rs new file mode 100644 index 000000000..63a372b10 --- /dev/null +++ b/core/src/avm2/globals/flash/display/ibitmapdrawable.rs @@ -0,0 +1,49 @@ +//! `flash.display.IBitmapDrawable` builtin + +use crate::avm2::activation::Activation; +use crate::avm2::class::{Class, ClassAttributes}; +use crate::avm2::method::Method; +use crate::avm2::names::{Namespace, QName}; +use crate::avm2::object::Object; +use crate::avm2::value::Value; +use crate::avm2::Error; +use gc_arena::{GcCell, MutationContext}; + +/// Emulates attempts to execute bodiless methods. +pub fn bodiless_method<'gc>( + _activation: &mut Activation<'_, 'gc, '_>, + _this: Option>, + _args: &[Value<'gc>], +) -> Result, Error> { + Err("Cannot execute non-native method without body".into()) +} + +/// Implements `flash.display.IBitmapDrawable`'s class constructor. +pub fn class_init<'gc>( + _activation: &mut Activation<'_, 'gc, '_>, + _this: Option>, + _args: &[Value<'gc>], +) -> Result, Error> { + Ok(Value::Undefined) +} + +/// Construct `IBitmapDrawable`'s class. +pub fn create_interface<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>> { + let class = Class::new( + QName::new(Namespace::package("flash.display"), "IBitmapDrawable"), + None, + Method::from_builtin( + bodiless_method, + "", + mc, + ), + Method::from_builtin(class_init, "", mc), + mc, + ); + + let mut write = class.write(mc); + + write.set_attributes(ClassAttributes::INTERFACE); + + class +}