avm2: Implement fscommand()

This commit is contained in:
Nathan Adams 2023-07-24 23:32:13 +02:00
parent 6b788faa9d
commit 0f4edf9574
2 changed files with 27 additions and 4 deletions

View File

@ -1,7 +1,4 @@
package flash.system {
import __ruffle__.stub_method;
public function fscommand(command:String, args:String = ""):void {
stub_method("flash.system", "fscommand");
}
public native function fscommand(command:String, args:String = ""):void;
}

View File

@ -5,3 +5,29 @@ pub mod application_domain;
pub mod capabilities;
pub mod security;
pub mod system;
use crate::avm2::activation::Activation;
use crate::avm2::object::Object;
use crate::avm2::parameters::ParametersExt;
use crate::avm2::value::Value;
use crate::avm2::Error;
/// Implements `flash.system.fscommand` method
pub fn fscommand<'gc>(
activation: &mut Activation<'_, 'gc>,
_this: Object<'gc>,
args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> {
let command = args.get_string(activation, 0)?;
let args = args.get_string(activation, 1)?;
if !activation
.context
.external_interface
.invoke_fs_command(&command.to_utf8_lossy(), &args.to_utf8_lossy())
{
tracing::warn!("Unknown FSCommand: {}", command);
}
Ok(Value::Undefined)
}