diff --git a/justfile b/justfile index 56c28199..0a11dc88 100644 --- a/justfile +++ b/justfile @@ -99,7 +99,6 @@ build-mgba-wasm: build-combo-rom-site: just _build-rom "examples/combo" "AGBGAMES" - cp examples/target/examples/combo.gba website/app/public/game.gba build-site-mgba-wrapper: build-mgba-wasm (cd website/app && npm run build) @@ -109,6 +108,7 @@ build-site: build-combo-rom-site build-site-mgba-wrapper build-book cp website/site website/build -r cp book/book website/build/book -r cp website/app/build website/build/mgba -r + cp examples/target/examples/combo.gba website/build/assets/combo.gba _run-tool +tool: (cd tools && cargo build) diff --git a/website/app/.gitignore b/website/app/.gitignore index 76988392..95f24d71 100644 --- a/website/app/.gitignore +++ b/website/app/.gitignore @@ -24,4 +24,3 @@ yarn-error.log* src/vendor -public/game.gba \ No newline at end of file diff --git a/website/app/src/App.tsx b/website/app/src/App.tsx index d0195515..c04e9e44 100644 --- a/website/app/src/App.tsx +++ b/website/app/src/App.tsx @@ -68,6 +68,8 @@ function App() { useAvoidItchIoScrolling(); + const gameUrl = window.location.hash.slice(1); + const [isPlaying, setIsPlaying] = useState(true); return ( @@ -86,7 +88,7 @@ function App() { {isPlaying ? ( ( const game = await fetch(gameUrl); const gameData = await game.arrayBuffer(); - const gamePath = `${MGBA_ROM_DIRECTORY}/${gameUrl}`; + const gameSplit = gameUrl.split("/"); + const gameBaseName = gameSplit[gameSplit.length - 1]; + + const gamePath = `${MGBA_ROM_DIRECTORY}/${gameBaseName}`; mgbaModule.current.FS.writeFile(gamePath, new Uint8Array(gameData)); mgbaModule.current.loadGame(gamePath); mgbaModule.current.setVolume(0.1); // for some reason you have to do this or you get no sound diff --git a/website/site/index.html b/website/site/index.html index 8b30e690..bfc85f03 100644 --- a/website/site/index.html +++ b/website/site/index.html @@ -100,7 +100,7 @@