Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Environment Variables Template
# Copy this file to .env and fill in your values

# Clerk Authentication
PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_example_key_here

# Convex Database
PUBLIC_CONVEX_URL=https://example.convex.cloud
PUBLIC_CLERK_PUBLISHABLE_KEY=pk_something
CONVEX_DEPLOYMENT=dev:something
PUBLIC_CONVEX_URL=https://something.convex.cloud
14 changes: 11 additions & 3 deletions src/lib/components/providers.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@
import { ClerkProvider, GoogleOneTap } from 'svelte-clerk/client';
import { ModeWatcher } from 'mode-watcher';
import { setupConvex } from 'convex-svelte';
import { PUBLIC_CLERK_PUBLISHABLE_KEY, PUBLIC_CONVEX_URL } from '$env/static/public';

// Props
let { children } = $props();

// Setup Convex
setupConvex(PUBLIC_CONVEX_URL);
// Only setup Convex if the URL is provided
if (process.env.PUBLIC_CONVEX_URL) {
try {
setupConvex(process.env.PUBLIC_CONVEX_URL);
} catch (error) {
console.warn('Failed to setup Convex:', error);
}
} else {
console.log('Convex setup skipped: PUBLIC_CONVEX_URL not configured (likely dev build)');
}
</script>

<ClerkProvider publishableKey={PUBLIC_CLERK_PUBLISHABLE_KEY}>
<ClerkProvider publishableKey={process.env.PUBLIC_CLERK_PUBLISHABLE_KEY || ''}>
<GoogleOneTap />
<ModeWatcher disableTransitions={false} defaultMode={'dark'} />
{@render children()}
Expand Down
8 changes: 8 additions & 0 deletions src/lib/gmaes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ const gmaes: Gmae[] = [
tags: [],
links: [],
url: '/_app/tools/thisistheonlylevel/index.html'
},
{
name: 'GBA Emulator',
description: "Nintendo please don't sue us",
category: 'Uncategorized',
tags: [],
links: [],
url: '/_app/tools/gba-emu/index.html'
}
];

Expand Down
1 change: 1 addition & 0 deletions static/_app/tools/gba-emu/data/compression/extract7z.js

Large diffs are not rendered by default.

Binary file not shown.
1 change: 1 addition & 0 deletions static/_app/tools/gba-emu/data/cores/reports/mgba.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "core": "mgba", "buildStart": "2025-06-14T18:10:32+00:00", "buildEnd": "2025-06-14T18:11:47+00:00", "options": {} }
1 change: 1 addition & 0 deletions static/_app/tools/gba-emu/data/emulator.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions static/_app/tools/gba-emu/data/emulator.min.js

Large diffs are not rendered by default.

170 changes: 170 additions & 0 deletions static/_app/tools/gba-emu/data/loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
(async function() {
const scripts = [
"emulator.js",
"nipplejs.js",
"shaders.js",
"storage.js",
"gamepad.js",
"GameManager.js",
"socket.io.min.js",
"compression.js"
];

const folderPath = (path) => path.substring(0, path.length - path.split("/").pop().length);
let scriptPath = (typeof window.EJS_pathtodata === "string") ? window.EJS_pathtodata : folderPath((new URL(document.currentScript.src)).pathname);
if (!scriptPath.endsWith("/")) scriptPath += "/";
//console.log(scriptPath);
function loadScript(file) {
return new Promise(function(resolve) {
let script = document.createElement("script");
script.src = function() {
if ("undefined" != typeof EJS_paths && typeof EJS_paths[file] === "string") {
return EJS_paths[file];
} else if (file.endsWith("emulator.min.js")) {
return scriptPath + file;
} else {
return scriptPath + "src/" + file;
}
}();
script.onload = resolve;
script.onerror = () => {
filesmissing(file).then(e => resolve());
}
document.head.appendChild(script);
})
}

function loadStyle(file) {
return new Promise(function(resolve) {
let css = document.createElement("link");
css.rel = "stylesheet";
css.href = function() {
if ("undefined" != typeof EJS_paths && typeof EJS_paths[file] === "string") {
return EJS_paths[file];
} else {
return scriptPath + file;
}
}();
css.onload = resolve;
css.onerror = () => {
filesmissing(file).then(e => resolve());
}
document.head.appendChild(css);
})
}

async function filesmissing(file) {
console.error("Failed to load " + file);
let minifiedFailed = file.includes(".min.") && !file.includes("socket");
console[minifiedFailed ? "warn" : "error"]("Failed to load " + file + " beacuse it's likly that the minified files are missing.\nTo fix this you have 3 options:\n1. You can download the zip from the latest release here: https://github.com/EmulatorJS/EmulatorJS/releases/latest - Stable\n2. You can download the zip from here: https://cdn.emulatorjs.org/latest/data/emulator.min.zip and extract it to the data/ folder. (easiest option) - Beta\n3. You can build the files by running `npm i && npm run build` in the data/minify folder. (hardest option) - Beta\nNote: you will probably need to do the same for the cores, extract them to the data/cores/ folder.");
if (minifiedFailed) {
console.log("Attempting to load non-minified files");
if (file === "emulator.min.js") {
for (let i = 0; i < scripts.length; i++) {
await loadScript(scripts[i]);
}
} else {
await loadStyle("emulator.css");
}
}
}

if (("undefined" != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX)) {
for (let i = 0; i < scripts.length; i++) {
await loadScript(scripts[i]);
}
await loadStyle("emulator.css");
} else {
await loadScript("emulator.min.js");
await loadStyle("emulator.min.css");
}
const config = {};
config.gameUrl = window.EJS_gameUrl;
config.dataPath = scriptPath;
config.system = window.EJS_core;
config.biosUrl = window.EJS_biosUrl;
config.gameName = window.EJS_gameName;
config.color = window.EJS_color;
config.adUrl = window.EJS_AdUrl;
config.adMode = window.EJS_AdMode;
config.adTimer = window.EJS_AdTimer;
config.adSize = window.EJS_AdSize;
config.alignStartButton = window.EJS_alignStartButton;
config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings;
config.buttonOpts = window.EJS_Buttons;
config.volume = window.EJS_volume;
config.defaultControllers = window.EJS_defaultControls;
config.startOnLoad = window.EJS_startOnLoaded;
config.fullscreenOnLoad = window.EJS_fullscreenOnLoaded;
config.filePaths = window.EJS_paths;
config.loadState = window.EJS_loadStateURL;
config.cacheLimit = window.EJS_CacheLimit;
config.cheats = window.EJS_cheats;
config.defaultOptions = window.EJS_defaultOptions;
config.gamePatchUrl = window.EJS_gamePatchUrl;
config.gameParentUrl = window.EJS_gameParentUrl;
config.netplayUrl = window.EJS_netplayServer;
config.gameId = window.EJS_gameID;
config.backgroundImg = window.EJS_backgroundImage;
config.backgroundBlur = window.EJS_backgroundBlur;
config.backgroundColor = window.EJS_backgroundColor;
config.controlScheme = window.EJS_controlScheme;
config.threads = window.EJS_threads;
config.disableCue = window.EJS_disableCue;
config.startBtnName = window.EJS_startButtonName;
config.softLoad = window.EJS_softLoad;
config.capture = window.EJS_screenCapture;
config.externalFiles = window.EJS_externalFiles;
config.dontExtractBIOS = window.EJS_dontExtractBIOS;
config.disableDatabases = window.EJS_disableDatabases;
config.disableLocalStorage = window.EJS_disableLocalStorage;
config.forceLegacyCores = window.EJS_forceLegacyCores;
config.noAutoFocus = window.EJS_noAutoFocus;
config.videoRotation = window.EJS_videoRotation;
config.hideSettings = window.EJS_hideSettings;
config.shaders = Object.assign({}, window.EJS_SHADERS, window.EJS_shaders ? window.EJS_shaders : {});

let systemLang;
try {
systemLang = Intl.DateTimeFormat().resolvedOptions().locale;
} catch(e) {} //Ignore
if ((typeof window.EJS_language === "string" && window.EJS_language !== "en-US") || (systemLang && window.EJS_disableAutoLang !== false)) {
const language = window.EJS_language || systemLang;
try {
let path;
console.log("Loading language", language);
if ("undefined" != typeof EJS_paths && typeof EJS_paths[language] === "string") {
path = EJS_paths[language];
} else {
path = scriptPath + "localization/" + language + ".json";
}
config.language = language;
config.langJson = JSON.parse(await (await fetch(path)).text());
} catch(e) {
console.log("Missing language", language, "!!");
delete config.language;
delete config.langJson;
}
}

window.EJS_emulator = new EmulatorJS(EJS_player, config);
window.EJS_adBlocked = (url, del) => window.EJS_emulator.adBlocked(url, del);
if (typeof window.EJS_ready === "function") {
window.EJS_emulator.on("ready", window.EJS_ready);
}
if (typeof window.EJS_onGameStart === "function") {
window.EJS_emulator.on("start", window.EJS_onGameStart);
}
if (typeof window.EJS_onLoadState === "function") {
window.EJS_emulator.on("loadState", window.EJS_onLoadState);
}
if (typeof window.EJS_onSaveState === "function") {
window.EJS_emulator.on("saveState", window.EJS_onSaveState);
}
if (typeof window.EJS_onLoadSave === "function") {
window.EJS_emulator.on("loadSave", window.EJS_onLoadSave);
}
if (typeof window.EJS_onSaveSave === "function") {
window.EJS_emulator.on("saveSave", window.EJS_onSaveSave);
}
})();
Loading