2021-01-06 08:42:10 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2024-05-13 19:34:35 +00:00
|
|
|
use std::str::FromStr;
|
2021-01-06 08:42:10 +00:00
|
|
|
|
|
|
|
/// Controls whether the content is letterboxed or pillarboxed when the
|
|
|
|
/// player's aspect ratio does not match the movie's aspect ratio.
|
|
|
|
///
|
|
|
|
/// When letterboxed, black bars will be rendered around the exterior
|
|
|
|
/// margins of the content.
|
2023-02-10 04:39:46 +00:00
|
|
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
2023-08-03 19:57:14 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
2022-02-25 23:27:43 +00:00
|
|
|
#[serde(rename = "letterbox")]
|
2021-01-06 08:42:10 +00:00
|
|
|
pub enum Letterbox {
|
|
|
|
/// The content will never be letterboxed.
|
2022-02-25 23:27:43 +00:00
|
|
|
#[serde(rename = "off")]
|
2021-01-06 08:42:10 +00:00
|
|
|
Off,
|
|
|
|
|
|
|
|
/// The content will only be letterboxed if the content is running fullscreen.
|
2022-02-25 23:27:43 +00:00
|
|
|
#[serde(rename = "fullscreen")]
|
2021-01-06 08:42:10 +00:00
|
|
|
Fullscreen,
|
|
|
|
|
|
|
|
/// The content will always be letterboxed.
|
2022-02-25 23:27:43 +00:00
|
|
|
#[serde(rename = "on")]
|
2021-01-06 08:42:10 +00:00
|
|
|
On,
|
|
|
|
}
|
2023-04-11 23:32:10 +00:00
|
|
|
|
2024-05-13 19:34:35 +00:00
|
|
|
pub struct ParseEnumError;
|
|
|
|
|
|
|
|
impl FromStr for Letterbox {
|
|
|
|
type Err = ParseEnumError;
|
|
|
|
|
|
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
|
|
let letterbox = match s {
|
|
|
|
"off" => Letterbox::Off,
|
|
|
|
"fullscreen" => Letterbox::Fullscreen,
|
|
|
|
"on" => Letterbox::On,
|
|
|
|
_ => return Err(ParseEnumError),
|
|
|
|
};
|
|
|
|
Ok(letterbox)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-12 22:58:56 +00:00
|
|
|
/// The networking API access mode of the Ruffle player.
|
2023-04-11 23:32:10 +00:00
|
|
|
/// This setting is only used on web.
|
2024-06-05 10:25:22 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
2023-04-12 22:58:56 +00:00
|
|
|
pub enum NetworkingAccessMode {
|
2023-04-11 23:32:10 +00:00
|
|
|
/// All networking APIs are permitted in the SWF file.
|
|
|
|
#[serde(rename = "all")]
|
|
|
|
All,
|
|
|
|
|
|
|
|
/// The SWF file may not call browser navigation or browser interaction APIs.
|
2023-05-02 13:52:37 +00:00
|
|
|
///
|
|
|
|
/// The APIs getURL(), navigateToURL(), fscommand() and ExternalInterface.call()
|
|
|
|
/// are prevented in this mode.
|
2023-04-11 23:32:10 +00:00
|
|
|
#[serde(rename = "internal")]
|
|
|
|
Internal,
|
|
|
|
|
|
|
|
/// The SWF file may not call browser navigation or browser interaction APIs
|
|
|
|
/// and it cannot use any SWF-to-SWF communication APIs.
|
2023-05-02 13:52:37 +00:00
|
|
|
///
|
|
|
|
/// Additionally to the ones in internal mode, the APIs sendToURL(),
|
|
|
|
/// FileReference.download(), FileReference.upload(), Loader.load(),
|
|
|
|
/// LocalConnection.connect(), LocalConnection.send(), NetConnection.connect(),
|
|
|
|
/// NetStream.play(), Security.loadPolicyFile(), SharedObject.getLocal(),
|
|
|
|
/// SharedObject.getRemote(), Socket.connect(), Sound.load(), URLLoader.load(),
|
|
|
|
/// URLStream.load() and XMLSocket.connect() are prevented in this mode.
|
|
|
|
///
|
|
|
|
/// This mode is not implemented yet.
|
2023-04-11 23:32:10 +00:00
|
|
|
#[serde(rename = "none")]
|
|
|
|
None,
|
|
|
|
}
|