avm1: Expose NativeObjects through SuperObject - fixes g2conline

This commit is contained in:
Nathan Adams 2024-05-16 22:37:26 +02:00
parent dfd9a26a7b
commit b8c1263f9e
4 changed files with 15 additions and 1 deletions

View File

@ -7,7 +7,7 @@ use crate::avm1::error::Error;
use crate::avm1::function::ExecutionReason;
use crate::avm1::object::{search_prototype, ExecutionName};
use crate::avm1::property::Attribute;
use crate::avm1::{Object, ObjectPtr, ScriptObject, TObject, Value};
use crate::avm1::{NativeObject, Object, ObjectPtr, ScriptObject, TObject, Value};
use crate::display_object::DisplayObject;
use crate::string::AvmString;
use gc_arena::{Collect, Gc, Mutation};
@ -282,4 +282,12 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
//`super` actually can be used to invoke MovieClip methods
self.0.this.as_display_object()
}
fn native(&self) -> NativeObject<'gc> {
self.0.this.native()
}
fn set_native(&self, gc_context: &Mutation<'gc>, native: NativeObject<'gc>) {
self.0.this.set_native(gc_context, native);
}
}

View File

@ -0,0 +1,6 @@
class CustomNetConnection extends NetConnection {
public function call() {
// To make sure `super` works for NativeObjects
super.call.apply(super,arguments);
}
}