diff --git a/pkg/emscripten/webplayer.html b/pkg/emscripten/webplayer.html index ee031694f8..3b9472207b 100644 --- a/pkg/emscripten/webplayer.html +++ b/pkg/emscripten/webplayer.html @@ -12,8 +12,14 @@
RetroArch
@@ -28,7 +34,7 @@
- + @@ -46,10 +52,9 @@ - + - diff --git a/pkg/emscripten/webplayer.js b/pkg/emscripten/webplayer.js index e26a6c9420..dec03abbfd 100644 --- a/pkg/emscripten/webplayer.js +++ b/pkg/emscripten/webplayer.js @@ -47,8 +47,8 @@ var showError = function(error) { function dropboxInit() { document.getElementById('btnStart').disabled = true; - document.getElementById('btnAuth').disabled = true; - client.authDriver(new Dropbox.AuthDriver.Redirect()); + document.getElementById('btnAuth').disabled = true; + client.authDriver(new Dropbox.AuthDriver.Redirect()); client.authenticate({ rememberUser: true }, function(error, client) { if (error) @@ -114,6 +114,15 @@ function setupFileSystem() } } +/** + * Retrieve the value of the given GET parameter. + */ +function getParam(name) { + var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); + if (results) { + return results[1] || null; + } +} function setupFolderStructure() { @@ -140,7 +149,7 @@ function stat(path) function startRetroArch() { document.getElementById('canvas_div').style.display = 'block'; - document.getElementById('btnLoad').disabled = false; + document.getElementById('btnLoad').disabled = false; setupFileSystem(); setupFolderStructure(); @@ -205,3 +214,21 @@ var Module = this.totalDependencies = Math.max(this.totalDependencies, left); } }; + +// When the browser has loaded everything. +$(function() { + // Find which core to load. + var core = getParam('core'); + if (!core) { + core = 'gambatte'; + } + + // Show the current core as the active core. + $('.nav-item.' + core).addClass('active'); + + // Load the Core's related JavaScript. + $.getScript(core + '_libretro.js', function () { + // Activate the Start RetroArch button. + $('#btnStart').removeClass('disabled'); + }); +});