Mirmire guides

Make a Big Picture app

On this page

Make a Big Picture app

Mirmire’s Big Picture comes in styles. Most are built in or are plugins: web pages Mirmire runs in a sandbox. A Big Picture app is the third kind: a separate Android app, made with anything (Godot, Unity, plain Android), that Mirmire opens as its Big Picture and shares the library with. Mirmire Cartouche, the 3D Big Picture, works this way.

Choose an app when you need what a web page can’t give you: a 3D engine, native speed, your own renderer. Choose a plugin when you don’t: plugins are small, install with one press from the catalog, and can only reach what they ask for.

How it fits together

  1. Your app says it’s a Big Picture, in its manifest.
  2. The player picks it in Settings › Layout › Big Picture style. The first time, Mirmire says what it will share and asks.
  3. When Big Picture opens, Mirmire starts your activity and gives it the library’s address, with permission to read it while your app runs.
  4. Your app draws the library however it likes. To start a game, or to open one of Mirmire’s screens, it asks Mirmire.
  5. Mirmire starts the game (save checks, downloads, play time and achievements all work as usual) and brings your app back when the game ends. When the player leaves your app, Big Picture is over.

Your app never needs storage access, emulator knowledge or the player’s accounts. It is a view of Mirmire’s library.

1. Say you’re a Big Picture

<!-- Lets the app ask Mirmire to start a game or open one of its screens. -->
<uses-permission android:name="com.mirmire.permission.PLAY_GAMES" />

<!-- So those requests can be sent to Mirmire (Android 11 and newer hide other apps by default). -->
<queries>
    <package android:name="com.mirmire" />
</queries>

<application ...>
    <activity android:name=".BigPictureActivity" android:exported="true">
        <intent-filter>
            <action android:name="com.mirmire.action.BIG_PICTURE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>

Mirmire lists every installed app that has an exported activity for com.mirmire.action.BIG_PICTURE, under the app’s own name. A launcher icon is optional: an app that only makes sense inside Mirmire can leave it out.

2. Read what Mirmire sends

Mirmire starts that activity with:

Extra Type Meaning
com.mirmire.extra.LIBRARY String The library’s address, a content:// URI. Read it with ContentResolver.openInputStream().
com.mirmire.extra.BRIDGE_VERSION int The version of this bridge Mirmire speaks. This page describes version 2.
com.mirmire.extra.BACKDROP String, optional A hint for Mirmire Cartouche. Ignore it.

The intent carries a grant to read everything under that address for as long as your app’s task is alive. Don’t build addresses yourself: use the one you were given and the ones inside the library. Without the extra, your app wasn’t opened by Mirmire: say so, and stop.

Mirmire may start the activity again while it’s running, after a game for instance. Handle onNewIntent() and read the library again: play times and favorites will have changed.

3. The library

The library is JSON:

{
  "version": 2,
  "profile": "Main",
  "systems": [
    { "id": "snes", "name": "Super Nintendo", "shortName": "SNES", "maker": "Nintendo",
      "icon": "content://…/icon/snes", "games": 42, "disc": false }
  ],
  "games": [
    { "id": 1287, "title": "Concentration Room", "system": "nes", "local": true, "favorite": false,
      "lastPlayed": 1731580000000, "playCount": 3, "year": "2008", "genre": "Puzzle",
      "art": "content://…/art/1287" }
  ],
  "settings": { "buttonStyle": "xbox", "swapAB": false, "soundLevel": 5, "backdrop": null },
  "achievements": { "user": "player", "points": 2350, "weekUnlocks": 6, "weekPoints": 42, "avatar": "content://…/avatar" },
  "logo": "content://…/logo"
}
Field Meaning
profile The player using Mirmire now. The games are the ones that profile may see: a child’s profile and library cleanup already apply.
systems[].icon The console’s icon as Mirmire draws it, a PNG. disc says whether its games came on discs.
games[].local On the device and ready to play. When false, Mirmire downloads it first, on the game’s page.
games[].lastPlayed Milliseconds since 1970, or absent. year and genre are absent when unknown.
games[].art The game’s cover, a JPEG at most 768 pixels on its long side; absent when the game has none.
settings.buttonStyle xbox, playstation or nintendo: which button names and shapes the player sees in Mirmire.
settings.swapAB The player confirms with B and goes back with A. Follow it.
settings.soundLevel 0 (silent) to 10: how loud the player keeps menu sounds.
achievements, logo RetroAchievements at a glance, when the player is signed in, and Mirmire’s logo, a PNG.

Unknown fields will be added over time: ignore the ones you don’t know, and don’t fail when an optional one is missing. Every content:// address in it is read the same way as the library, under the same grant. Load pictures off the main thread, and only the ones on screen.

4. Ask Mirmire to do things

Start a game

startActivity(Intent("com.mirmire.action.PLAY_GAME")
    .setPackage("com.mirmire")
    .putExtra("com.mirmire.extra.GAME_ID", game.id))      // a Long

Mirmire comes to the front on the game’s page and starts it. If the game needs downloading, a save is newer elsewhere, or a parent’s limit applies, the player deals with it there. When the game ends, Mirmire opens your app again.

Open one of Mirmire’s screens

startActivity(Intent("com.mirmire.action.OPEN")
    .setPackage("com.mirmire")
    .putExtra("com.mirmire.extra.SCREEN", "settings"))

The screens are settings, achievements, widgets, all, recent, favorites and apps. When the player leaves the screen, Mirmire opens your app again.

Say what’s selected (optional)

On a handheld with a second screen, Mirmire shows the selected game there. Tell it which:

contentResolver.update(Uri.parse(libraryAddress.replace("/library", "/selected")),
    ContentValues().apply { put("game", game.id) }, null, null)     // or put("system", "snes"); empty for nothing

Leave

Finish your activity. Mirmire sees the player came back without a game and turns Big Picture off. Make sure there is always a way to do that: B or Back on your first screen, and something a finger can tap.

What players see

Before the library is shared, Mirmire shows the app’s name and package and lists what it shares: the games and their art, the console icons, the RetroAchievements name and points, and the ability to start games. It says plainly that an app, unlike a plugin, isn’t sandboxed. The player’s yes is remembered for that app as signed: if a build signed by someone else replaces it, Mirmire asks again.

A complete example

samples/bigpicture-app is a whole Big Picture app in one Kotlin file of about 140 lines: a list of games with the selected one’s cover, A to play, Y for Mirmire’s Settings, B to leave.

From Godot

samples/bigpicture-godot is a Godot 4 project that is already a Big Picture: your games as a row of covers in 3D. Keep its addons/mirmire_bridge folder and replace the scene.

It needs Godot 4.4 or newer and Android 10 or newer. Its README has the steps.

The Mirmire autoload

What a Godot scene can use, from any script:

Signal

Name When
loaded The library was read, or read again after a game or one of Mirmire’s screens. Connect to it, and also read once in _ready().

Data

Name What it holds
connected true when Mirmire opened the app and shared its library. false in the editor and when the app is opened on its own; sample games stand in then.
problem Why it isn’t connected, as text you can show the player. Empty when all is well.
profile The player using Mirmire now.
games An Array of games, each a Dictionary: id, title, system, local (on the device; when false Mirmire downloads it first), favorite, lastPlayed (milliseconds since 1970), playCount, year, genre, art. lastPlayed, year, genre and art are missing when unknown, so read them with game.get("year").
systems An Array of consoles: id, name, shortName, maker, icon, games (how many), disc (its games came on discs).
settings buttonStyle ("xbox", "playstation" or "nintendo"), swapAB (the player confirms with B), soundLevel (0, silent, to 10).
achievements RetroAchievements when the player is signed in: user, points, weekUnlocks, weekPoints, avatar. An empty Dictionary otherwise.
logo The address of Mirmire’s logo, for picture(). Empty when there is none.

Functions

Call What it does
picture(address) -> Texture2D The picture at an address Mirmire shared: a game’s art, a console’s icon, logo, or the avatar in achievements. null when there is none. Read and decoded on the calling thread, then kept, so the second call for the same address is free.
system_of(game) -> Dictionary The console a game is for, or an empty Dictionary.
play(game_id) Asks Mirmire to start the game. Mirmire comes to the front, does its save checks and any download, plays it, and opens your app again when it ends.
open(screen) Opens one of Mirmire’s screens over Big Picture: "settings", "achievements", "widgets", "all", "recent", "favorites" or "apps". Mirmire opens your app again when the player leaves it.
select(game_id) Tells Mirmire which game the player is on, so a handheld’s second screen shows it. 0 for none.
reload() Reads the library again and emits loaded. Called for you when the app comes back to the front.
leave() Closes the app, which ends Big Picture and shows Mirmire’s home.
func _ready() -> void:
    Mirmire.loaded.connect(_show)      # again each time the app comes back from a game
    _show()

func _show() -> void:
    for game in Mirmire.games:
        var cover := Mirmire.picture(game.get("art"))      # null when the game has no art
        print(game.title, " · ", Mirmire.system_of(game).get("name", ""))

func _on_cover_pressed(game: Dictionary) -> void:
    Mirmire.play(game.id)

Sharing your app

A Big Picture app is installed like any Android app, from wherever you publish it. Mirmire lists it as soon as it’s installed. Say in your description that it needs Mirmire, and which bridge version it was made for.

View this page on GitHub