> ## Documentation Index
> Fetch the complete documentation index at: https://ej3mplo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Games

> ejg.game: the full page, launch, favorites, rating and state.

```js theme={null}
const d = await ejg.game.details(id)   // + description, screenshots[], trailers[], recentSessions[]
await ejg.game.launch(id)
ejg.game.favorite(id)                  // toggles (or pass true/false)
ejg.game.hide(id, true)
ejg.game.rate(id, 80)
ejg.game.edit(id)                      // opens the host's editor
ejg.game.openFolder(id)
ejg.game.uninstall(id)                 // opens the host's Uninstall dialog
ejg.game.isRunning(id)
ejg.game.onState(({ gameId, state }) => …)   // "launching" | "running" | "stopped"
```

`description` is text with a small markup (`## title`, `- bullet`, paragraphs
separated by a blank line). The kit's `description()` turns it into safe DOM nodes.

Trailers (`d.trailers[i].url`) are HLS (`.m3u8`). Use the kit's `attachStream()`,
which uses native HLS or hls.js as needed.

## Uninstall

`ejg.game.uninstall(id)` does not uninstall anything by itself. It opens a host
dialog that explains what will happen and asks for confirmation.

* **If the game has an uninstaller**, it is opened (the one from its entry in
  Windows' Installed apps, or an `unins000.exe` / `uninstall.exe` in its folder).
  When the game disappears from disk, it leaves the library.
* **If it has nothing**, its folder goes to the recycle bin. A library folder, a
  downloads folder, a system folder, or a folder that contains other games is
  never deleted.
* **If it is a console game**, it is deleted: its folder (if it was downloaded
  from a catalog) or its file, with its DLC and updates, goes to the recycle bin.

It works for any game that is still in place. To know whether to show the option,
use the kit's `canUninstall(game)` (`/_sdk/kit/library.js`).

Emulators installed from ejGames are in `library.all` with `source: "emulator"`.
They are not games. `isSoftware(game)` tells them apart, `visible()` leaves them
out (the same as console games) and `software(library.all)` returns them for
[Homebrew](https://ej3mplo.mintlify.site/referencia/homebrew.md).

Console games (`source: "rom"` or `"homebrew"`) carry `platform` (`"switch"`,
`"vita"`, `"3ds"`, `"ps2"`…), `emulator` (what opens them; `""` if there is none)
and `rom` (what was read from the file: `titleId`, `version`, `region`, `serial`
and `extras`, its updates and DLC). From the kit:

```js theme={null}
import { isRom, romsBySystem, systemName, romParts } from "/_sdk/kit/library.js"
import { emulatorNote } from "/_sdk/kit/emulator.js"

romsBySystem(ejg.library.all)   // [{ id: "switch", name: "Nintendo Switch", games: [...] }, ...]
page.append(emulatorNote(game)) // "Requires an emulator: Eden" plus TitleID, version, region, DLC; nothing for PC games
ejg.ui.open("rom-import")       // Import ROMs
```

> [!NOTE]
>
> When you uninstall, the game leaves the library along with its hours.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.