Merge pull request #3845 from rommapp/feat/flashpoint-launch-action

feat: add "Open in Flashpoint" game action
This commit is contained in:
Georges-Antoine Assi
2026-07-19 22:35:43 -04:00
committed by GitHub
22 changed files with 96 additions and 1 deletions

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Обновена {date}",
"now-playing": "Играна в момента",
"open-game": "Отвори {name}",
"open-in-flashpoint": "Отвори във Flashpoint",
"paused": "На пауза",
"pdf-toggle-sidebar": "Превключи страничната лента",
"personal": "Лично",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Aktualizováno {date}",
"now-playing": "Právě hraje",
"open-game": "Otevřít {name}",
"open-in-flashpoint": "Otevřít ve Flashpointu",
"paused": "Pozastaveno",
"pdf-toggle-sidebar": "Přepnout postranní panel",
"personal": "Osobní",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Aktualisiert {date}",
"now-playing": "Derzeit gespielt",
"open-game": "{name} öffnen",
"open-in-flashpoint": "In Flashpoint öffnen",
"paused": "Pausiert",
"pdf-toggle-sidebar": "Seitenleiste umschalten",
"personal": "Persönlich",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Updated {date}",
"now-playing": "Now playing",
"open-game": "Open {name}",
"open-in-flashpoint": "Open in Flashpoint",
"paused": "Paused",
"pdf-toggle-sidebar": "Toggle sidebar",
"personal": "Personal",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Updated {date}",
"now-playing": "Now playing",
"open-game": "Open {name}",
"open-in-flashpoint": "Open in Flashpoint",
"paused": "Paused",
"pdf-toggle-sidebar": "Toggle sidebar",
"personal": "Personal",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Actualizada {date}",
"now-playing": "Jugando",
"open-game": "Abrir {name}",
"open-in-flashpoint": "Abrir en Flashpoint",
"paused": "Pausado",
"pdf-toggle-sidebar": "Mostrar/ocultar barra lateral",
"personal": "Personal",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Mise à jour le {date}",
"now-playing": "En train de jouer",
"open-game": "Ouvrir {name}",
"open-in-flashpoint": "Ouvrir dans Flashpoint",
"paused": "En pause",
"pdf-toggle-sidebar": "Basculer la barre latérale",
"personal": "Personnel",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Frissítve: {date}",
"now-playing": "Most játszott",
"open-game": "{name} megnyitása",
"open-in-flashpoint": "Megnyitás Flashpointban",
"paused": "Szüneteltetve",
"pdf-toggle-sidebar": "Oldalsáv ki/be",
"personal": "Személyes",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Aggiornata il {date}",
"now-playing": "Stai giocando",
"open-game": "Apri {name}",
"open-in-flashpoint": "Apri in Flashpoint",
"paused": "In pausa",
"pdf-toggle-sidebar": "Mostra/nascondi barra laterale",
"personal": "Personale",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "更新日 {date}",
"now-playing": "プレイ中",
"open-game": "{name}を開く",
"open-in-flashpoint": "Flashpointで開く",
"paused": "一時停止中",
"pdf-toggle-sidebar": "サイドバーを切り替え",
"personal": "マイステータス",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "업데이트: {date}",
"now-playing": "현재 플레이중",
"open-game": "{name} 열기",
"open-in-flashpoint": "Flashpoint에서 열기",
"paused": "일시정지됨",
"pdf-toggle-sidebar": "사이드바 전환",
"personal": "개인",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Zaktualizowano {date}",
"now-playing": "Aktualnie grane",
"open-game": "Otwórz {name}",
"open-in-flashpoint": "Otwórz w Flashpoint",
"paused": "Wstrzymane",
"pdf-toggle-sidebar": "Przełącz pasek boczny",
"personal": "Osobiste",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Atualizada {date}",
"now-playing": "Jogando agora",
"open-game": "Abrir {name}",
"open-in-flashpoint": "Abrir no Flashpoint",
"paused": "Pausado",
"pdf-toggle-sidebar": "Alternar barra lateral",
"personal": "Pessoal",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Actualizată {date}",
"now-playing": "În curs de joc",
"open-game": "Deschide {name}",
"open-in-flashpoint": "Deschide în Flashpoint",
"paused": "În pauză",
"pdf-toggle-sidebar": "Comută bara laterală",
"personal": "Personal",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "Обновлено {date}",
"now-playing": "Сейчас играют",
"open-game": "Открыть {name}",
"open-in-flashpoint": "Открыть в Flashpoint",
"paused": "Пауза",
"pdf-toggle-sidebar": "Переключить боковую панель",
"personal": "Личное",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "{date} tarihinde güncellendi",
"now-playing": "Şu an oynanıyor",
"open-game": "{name} oyununu aç",
"open-in-flashpoint": "Flashpoint'te aç",
"paused": "Duraklatıldı",
"pdf-toggle-sidebar": "Kenar çubuğunu aç/kapat",
"personal": "Kişisel",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "更新于 {date}",
"now-playing": "正在游玩",
"open-game": "打开 {name}",
"open-in-flashpoint": "在 Flashpoint 中打开",
"paused": "已暂停",
"pdf-toggle-sidebar": "切换侧边栏",
"personal": "私人",

View File

@@ -252,6 +252,7 @@
"notes-updated-at": "更新於 {date}",
"now-playing": "正在遊玩",
"open-game": "開啟 {name}",
"open-in-flashpoint": "在 Flashpoint 中開啟",
"paused": "已暫停",
"pdf-toggle-sidebar": "切換側邊欄",
"personal": "私人",

View File

@@ -68,6 +68,7 @@ export type GameAction =
| "download"
| "copy-link"
| "qr"
| "flashpoint"
| "favorite"
| "collection"
| "status"
@@ -148,6 +149,8 @@ type Preset = {
activeIcon: string | null;
onClick: (() => void) | null;
active: boolean;
/** Renders an <img> in place of the mdi glyph (e.g. the Flashpoint logo). */
image?: string;
};
// Presentation metadata per action — icon swaps when active, different
@@ -190,6 +193,16 @@ const preset = computed<Preset>(() => {
active: false,
};
}
if (props.action === "flashpoint") {
return {
icon: "mdi-rocket-launch-outline",
image: "/assets/scrappers/flashpoint.png",
label: t("rom.open-in-flashpoint"),
activeIcon: null,
onClick: actions.openInFlashpoint,
active: false,
};
}
if (props.action === "favorite") {
return {
icon: "mdi-heart-outline",
@@ -489,7 +502,13 @@ function onClick(e: MouseEvent) {
:aria-label="preset.label"
@click="onClick"
>
<RIcon :icon="displayedIcon" />
<img
v-if="preset.image"
:src="preset.image"
:alt="preset.label"
class="r-v2-game-btn__img"
/>
<RIcon v-else :icon="displayedIcon" />
<span v-if="withLabel" class="r-v2-game-btn__label">
{{ preset.label }}
</span>
@@ -549,6 +568,10 @@ function onClick(e: MouseEvent) {
.r-v2-game-btn--x-small :deep(.mdi) {
font-size: 14px;
}
.r-v2-game-btn--x-small :deep(img) {
width: 14px;
height: 14px;
}
.r-v2-game-btn--small {
width: 28px;
height: 28px;
@@ -557,6 +580,10 @@ function onClick(e: MouseEvent) {
.r-v2-game-btn--small :deep(.mdi) {
font-size: 16px;
}
.r-v2-game-btn--small :deep(img) {
width: 16px;
height: 16px;
}
.r-v2-game-btn--default {
width: 40px;
height: 40px;
@@ -565,6 +592,10 @@ function onClick(e: MouseEvent) {
.r-v2-game-btn--default :deep(.mdi) {
font-size: 20px;
}
.r-v2-game-btn--default :deep(img) {
width: 20px;
height: 20px;
}
.r-v2-game-btn--large {
width: 44px;
height: 44px;
@@ -573,6 +604,10 @@ function onClick(e: MouseEvent) {
.r-v2-game-btn--large :deep(.mdi) {
font-size: 22px;
}
.r-v2-game-btn--large :deep(img) {
width: 22px;
height: 22px;
}
.r-v2-game-btn--x-large {
width: 52px;
height: 52px;
@@ -581,6 +616,10 @@ function onClick(e: MouseEvent) {
.r-v2-game-btn--x-large :deep(.mdi) {
font-size: 26px;
}
.r-v2-game-btn--x-large :deep(img) {
width: 26px;
height: 26px;
}
/* Labelled — expands to a pill with text. Used by Play in the
GameDetails header. Height stays the same as the circular variant so

View File

@@ -85,6 +85,13 @@ useGridNav(rootEl, {
:size="btnSize"
variant="surface"
/>
<GameActionBtn
v-if="actions.canOpenInFlashpoint.value"
:rom="rom"
action="flashpoint"
:size="btnSize"
variant="surface"
/>
<GameActionBtn
:rom="rom"
action="favorite"

View File

@@ -56,6 +56,12 @@ function run(fn: () => void | Promise<void>) {
icon="mdi-qrcode"
@click="run(actions.shareQR)"
/>
<RMenuItem
v-if="actions.canOpenInFlashpoint.value"
:label="t('rom.open-in-flashpoint')"
icon="mdi-rocket-launch-outline"
@click="run(actions.openInFlashpoint)"
/>
<RDivider />

View File

@@ -39,6 +39,10 @@ export interface GameActionsOptions {
coverEl?: () => HTMLElement | null;
}
// Validate flashpoint game IDs are UUIDs
const FLASHPOINT_ID_RE =
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
export function useGameActions(
getRom: () => SimpleRom | null | undefined,
options: GameActionsOptions = {},
@@ -188,6 +192,13 @@ export function useGameActions(
return rom ? isNintendoDSRom(rom) : false;
});
const canOpenInFlashpoint = computed(() => {
const rom = getRom();
return Boolean(
rom?.flashpoint_id && FLASHPOINT_ID_RE.test(rom.flashpoint_id),
);
});
function play() {
const rom = getRom();
if (!rom) return;
@@ -274,6 +285,18 @@ export function useGameActions(
emitter?.emit("showQRCodeDialog", rom);
}
// Launch the game in installed Flashpoint
function openInFlashpoint() {
const rom = getRom();
if (!rom?.flashpoint_id || !FLASHPOINT_ID_RE.test(rom.flashpoint_id))
return;
const a = document.createElement("a");
a.href = `flashpoint://${rom.flashpoint_id}`;
document.body.appendChild(a);
a.click();
a.remove();
}
// Copies the API download URL (origin + /api/roms/.../content/...) so
// the user can paste it into another device or share it. v1 used this
// for handhelds that can ingest a direct download URL. Falls back to a
@@ -365,6 +388,7 @@ export function useGameActions(
isFavorited,
canManageCollections,
canShareQR,
canOpenInFlashpoint,
canPlay,
canPlayStream,
canRemoveFromContinuePlaying,
@@ -379,6 +403,7 @@ export function useGameActions(
favorite,
share,
shareQR,
openInFlashpoint,
copyDownloadLink,
manageCollections,
refreshMetadata,