feat: initial romm web ui architecture, bento grids, and spatial gamepad bindings

This commit is contained in:
roormonger
2026-03-23 15:31:41 -04:00
commit 9e8f148a10
40 changed files with 9935 additions and 0 deletions

32
src/utils/sync.ts Normal file
View File

@@ -0,0 +1,32 @@
export const syncToPC = async (gameId: string, title: string) => {
try {
if (!('showDirectoryPicker' in window)) {
alert("Your browser does not support the File System Access API. Please use a modern Chromium-based browser.");
return;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const dirHandle = await (window as any).showDirectoryPicker();
console.log(`Syncing ${title} (${gameId}) to`, dirHandle.name);
// Placeholder logic for downloading unzipped files sequentially
const fileHandle = await dirHandle.getFileHandle(`${title.replace(/[^a-z0-9]/gi, '_')}.rom`, { create: true });
const writable = await fileHandle.createWritable();
// In a real app, this would fetch the actual parts of the game
// and stream it to the writable. For now, writing a dummy buffer.
const dummyData = new TextEncoder().encode("DUMMY ROM DATA CONTENT - IMPLEMENT NATIVE FETCH HERE");
await writable.write(dummyData);
await writable.close();
console.log(`Successfully synced ${title} to PC.`);
alert(`Successfully synced ${title} to PC.`);
} catch (err) {
if (err instanceof Error && err.name === 'AbortError') {
console.log('User cancelled the directory picker');
} else {
console.error('Failed to sync directory:', err);
alert('Failed to sync to PC. See console for details.');
}
}
};