avm2: Make `flash.system.Capabilities#playerType` return "Desktop" within the AIR runtime

Unless the SWF is loaded by an HTML page.
This commit is contained in:
Lv Yitian 2024-01-23 15:45:11 +08:00 committed by GitHub
parent c1fce1106f
commit bebadb450f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
//! `flash.display.Capabilities` native methods
use crate::avm2::{Activation, AvmString, Error, Object, Value};
use crate::player::PlayerRuntime;
/// Implements `flash.system.Capabilities.version`
pub fn get_version<'gc>(
@ -26,7 +27,10 @@ pub fn get_player_type<'gc>(
let player_type = if cfg!(target_family = "wasm") {
"PlugIn"
} else {
"StandAlone"
match activation.context.avm2.player_runtime {
PlayerRuntime::FlashPlayer => "StandAlone",
PlayerRuntime::AIR => "Desktop",
}
};
Ok(AvmString::new_utf8(activation.context.gc_context, player_type).into())