Skip to content

Ruffle Flash Player emulator on iOS

License

Notifications You must be signed in to change notification settings

madsmtm/ruffle-ios

Repository files navigation

The Ruffle Flash Player emulator on iOS

Work in progress.

See ruffle.rs for a general introduction.

Design choices

A normal person might have wrapped the Rust in some extern "C" fns, and then used SwiftUI, or at least Objective-C for the UI shell. I would probably recommend that for most use-cases.

I'm developing objc2 though, and I want to improve the user-interface of that, so I decided to be a bit unortodox, and do everything in Rust.

Testing

Run the core player on Mac Catalyst with:

cargo bundle --target=aarch64-apple-ios-macabi --bin run_swf && ./target/aarch64-apple-ios-macabi/debug/bundle/ios/Ruffle.app/run_swf

The proper application can also be launched from the iOS Simulator by opening the Xcode project.

To open an SWF/Ruffle bundle, simply drag and drop the .swf/.ruf onto the simulator window, see: https://developer.apple.com/documentation/xcode/sharing-data-with-simulator

NOTE: The simulator has to have read permissions for the file, you may have to place it outside the Desktop/Documents/... folders, which require special permission setup.

UI

Similar to https://getutm.app/, we should have:

  • A library of "installed" SWFs/bundles/saved links, editable.
  • When selecting an SWF, the navigation bar at the top shows various options
    • Opening keyboard (maybe?)
    • Context menu "play, rewind, forward, back, etc."?
    • Allow changing between scale
    • Back button to go back to library
  • "Add" and "edit" are two different flows, and should show two different UIs
    • "Add" doesn't have to show all the extra settings; it is only about getting the file. The user can edit it later.

Library item settings

Settings are stored per Ruffle Bundle.

Storage

We do not store Ruffle Bundles / SWFs, the user is responsible for doing that themselves in the Files app. We only store "bookmarks" to these, to allow easily re-opening from within the app, and to store user data.

This can be synced to iCloud, though the user may have to re-select the referenced Ruffle Bundle (in case it was stored locally, and not in iCloud).

Goal: Be backwards and forwards compatible with new versions of the Ruffle app.

See [src/storage.rs] for implementation.

Terminology

What do we call an SWF / a Ruffle Bundle? "Game"? "Movie"? "SWF"? "Flash Animation"?

Internally: "movie".

Plan

  1. Get the Ruffle UI running in a UIView
  2. Wire up some way to start it using an SWF on the local device

TODO

Choices

  • Intentionally use public.app-category.games to get better performance ("Game Mode" on macOS).
    • This is not necessarily the correct choice for Ruffle, but it's the closest.
  • It doesn't make sense to have root settings like in the desktop version
  • No tab bar, not really desired, since we generally want the SWF's UI to fill most of the screen
    • Though if we decide to add an easy way to download from "trusted" sources, we could add a tab bar for that
  • A navigation bar is useful though
    • To display some settings for the current swf
    • To go back to library
    • Hide when entering full screen?