mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(ems) remove deprecated template
This commit is contained in:
parent
2952952169
commit
20999f9952
@ -1,28 +0,0 @@
|
||||
/**
|
||||
* RetroArch Web Player
|
||||
*
|
||||
* This provides the basic styling for the RetroArch web player.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The logging textarea.
|
||||
*/
|
||||
textarea.webplayer {
|
||||
font-family: monospace;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure the background of the player is black.
|
||||
*/
|
||||
.webplayer-container {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the border around the player.
|
||||
*/
|
||||
canvas.webplayer {
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
@ -1,138 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>RetroArch Web Player</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.3/css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="webplayer.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-static-top navbar-light bg-faded">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">RetroArch</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item 2048">
|
||||
<a class="nav-link" href="." onclick=switchCore("2048")>2048</a>
|
||||
</li>
|
||||
<li class="nav-item 4do">
|
||||
<a class="nav-link" href="." onclick=switchCore("4do")>4DO</a>
|
||||
</li>
|
||||
<li class="nav-item bluemsx">
|
||||
<a class="nav-link" href="." onclick=switchCore("bluemsx")>BlueMSX</a>
|
||||
</li>
|
||||
<li class="nav-item fceumm">
|
||||
<a class="nav-link" href="." onclick=switchCore("fceumm")>FCEUmm</a>
|
||||
</li>
|
||||
<li class="nav-item fmsx">
|
||||
<a class="nav-link" href="." onclick=switchCore("fmsx")>fMSX</a>
|
||||
</li>
|
||||
<li class="nav-item gambatte">
|
||||
<a class="nav-link" href="." onclick=switchCore("gambatte")>Gambatte</a>
|
||||
</li>
|
||||
<li class="nav-item genesis_plus_gx">
|
||||
<a class="nav-link" href="." onclick=switchCore("genesis_plus_gx")>Genesis Plus GX</a>
|
||||
</li>
|
||||
<li class="nav-item mame2000">
|
||||
<a class="nav-link" href="." onclick=switchCore("mame2000")>MAME 2000</a>
|
||||
</li>
|
||||
<li class="nav-item mednafen_lynx">
|
||||
<a class="nav-link" href="." onclick=switchCore("mednafen_lynx")>Mednafen Lynx</a>
|
||||
</li>
|
||||
<li class="nav-item mednafen_ngp">
|
||||
<a class="nav-link" href="." onclick=switchCore("mednafen_ngp")>Mednafen NGP</a>
|
||||
</li>
|
||||
<li class="nav-item mednafen_pce_fast">
|
||||
<a class="nav-link" href="." onclick=switchCore("mednafen_pce_fast")>Mednafen PCE Fast</a>
|
||||
</li>
|
||||
<li class="nav-item mednafen_pcfx">
|
||||
<a class="nav-link" href="." onclick=switchCore("mednafen_pcfx")>Mednafen PCFX</a>
|
||||
</li>
|
||||
<li class="nav-item mednafen_vb">
|
||||
<a class="nav-link" href="." onclick=switchCore("mednafen_vb")>Mednafen VB</a>
|
||||
</li>
|
||||
<li class="nav-item mednafen_wswan">
|
||||
<a class="nav-link" href="." onclick=switchCore("mednafen_wswan")>Mednafen Wonderswan</a>
|
||||
</li>
|
||||
<li class="nav-item nestopia">
|
||||
<a class="nav-link" href="." onclick=switchCore("nestopia")>Nestopia</a>
|
||||
</li>
|
||||
<li class="nav-item nxengine">
|
||||
<a class="nav-link" href="." onclick=switchCore("nxengine")>NX Engine</a>
|
||||
</li>
|
||||
<li class="nav-item o2em">
|
||||
<a class="nav-link" href="." onclick=switchCore("o2em")>O2EM</a>
|
||||
</li>
|
||||
<li class="nav-item prboom">
|
||||
<a class="nav-link" href="." onclick=switchCore("prboom")>PrBoom</a>
|
||||
</li>
|
||||
<li class="nav-item quicknes">
|
||||
<a class="nav-link" href="." onclick=switchCore("quicknes")>QuickNES</a>
|
||||
</li>
|
||||
<li class="nav-item snes9x2002">
|
||||
<a class="nav-link" href="." onclick=switchCore("snes9x2002")>Snes9x 2002</a>
|
||||
</li>
|
||||
<li class="nav-item snes9x2005">
|
||||
<a class="nav-link" href="." onclick=switchCore("snes9x2005")>Snes9x 2005</a>
|
||||
</li>
|
||||
<li class="nav-item snes9x2010">
|
||||
<a class="nav-link" href="." onclick=switchCore("snes9x2010")>Snes9x 2010</a>
|
||||
</li>
|
||||
<li class="nav-item snes9x">
|
||||
<a class="nav-link" href="." onclick=switchCore("snes9x")>Snes9x</a>
|
||||
</li>
|
||||
<li class="nav-item stella">
|
||||
<a class="nav-link" href="." onclick=switchCore("stella")>Stella</a>
|
||||
</li>
|
||||
<li class="nav-item tgbdual">
|
||||
<a class="nav-link" href="." onclick=switchCore("tgbdual")>TGB Dual</a>
|
||||
</li>
|
||||
<li class="nav-item tyrquake">
|
||||
<a class="nav-link" href="." onclick=switchCore("tyrquake")>TyrQuake</a>
|
||||
</li>
|
||||
<li class="nav-item vba_next">
|
||||
<a class="nav-link" href="." onclick=switchCore("vba_next")>VBA Next</a>
|
||||
</li>
|
||||
<li class="nav-item virtualjaguar">
|
||||
<a class="nav-link" href="." onclick=switchCore("virtualjaguar")>Virtual Jaguar</a>
|
||||
</li>
|
||||
<li class="nav-item vecx">
|
||||
<a class="nav-link" href="." onclick=switchCore("vecx")>Vecx</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="bg-inverse webplayer-container">
|
||||
<div class="container">
|
||||
<div class="webplayer_border text-xs-center" id="canvas_div" style="display: none">
|
||||
<canvas class="webplayer col-xs-12" id="canvas" tabindex="1" oncontextmenu="event.preventDefault()"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 form-group btn-group text-xs-center p-t-2" id="openrom">
|
||||
<button class="btn btn-primary disabled" id="btnStart" onclick="startRetroArch()">Start RetroArch</button>
|
||||
<button class="btn btn-secondary" id="btnAuth" onclick="dropboxInit()">Sync DropBox</button>
|
||||
<button class="btn btn-secondary" id="btnLoad" disabled=true onclick="document.getElementById('rom').click()">Add Content</button>
|
||||
<input class="btn btn-secondary" style="display: none" type="file" id="rom" name="upload" onclick="document.getElementById('btnLoad').click();" onchange="selectFiles(event.target.files)" multiple />
|
||||
<input class="btn btn-info" type="button" value="Fullscreen" onclick="Module.requestFullScreen()">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<textarea class="webplayer form-control" id="output" rows="15"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//code.jquery.com/jquery-3.1.0.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/tether/1.3.4/js/tether.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.3/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.10.2/dropbox.min.js"></script>
|
||||
<script src="//wzrd.in/standalone/browserfs@0.6.1"></script>
|
||||
<script src="webplayer.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,249 +0,0 @@
|
||||
/**
|
||||
* RetroArch Web Player
|
||||
*
|
||||
* This provides the basic JavaScript for the RetroArch web player.
|
||||
*/
|
||||
var dropbox = false;
|
||||
var client = new Dropbox.Client({ key: "il6e10mfd7pgf8r" });
|
||||
var BrowserFS = browserfs;
|
||||
|
||||
var showError = function(error) {
|
||||
switch (error.status) {
|
||||
case Dropbox.ApiError.INVALID_TOKEN:
|
||||
// If you're using dropbox.js, the only cause behind this error is that
|
||||
// the user token expired.
|
||||
// Get the user through the authentication flow again.
|
||||
break;
|
||||
|
||||
case Dropbox.ApiError.NOT_FOUND:
|
||||
// The file or folder you tried to access is not in the user's Dropbox.
|
||||
// Handling this error is specific to your application.
|
||||
break;
|
||||
|
||||
case Dropbox.ApiError.OVER_QUOTA:
|
||||
// The user is over their Dropbox quota.
|
||||
// Tell them their Dropbox is full. Refreshing the page won't help.
|
||||
break;
|
||||
|
||||
case Dropbox.ApiError.RATE_LIMITED:
|
||||
// Too many API requests. Tell the user to try again later.
|
||||
// Long-term, optimize your code to use fewer API calls.
|
||||
break;
|
||||
|
||||
case Dropbox.ApiError.NETWORK_ERROR:
|
||||
// An error occurred at the XMLHttpRequest layer.
|
||||
// Most likely, the user's network connection is down.
|
||||
// API calls will not succeed until the user gets back online.
|
||||
break;
|
||||
|
||||
case Dropbox.ApiError.INVALID_PARAM:
|
||||
case Dropbox.ApiError.OAUTH_ERROR:
|
||||
case Dropbox.ApiError.INVALID_METHOD:
|
||||
default:
|
||||
// Caused by a bug in dropbox.js, in your application, or in Dropbox.
|
||||
// Tell the user an error occurred, ask them to refresh the page.
|
||||
}
|
||||
};
|
||||
|
||||
function dropboxInit()
|
||||
{
|
||||
document.getElementById('btnStart').disabled = true;
|
||||
document.getElementById('btnAuth').disabled = true;
|
||||
client.authDriver(new Dropbox.AuthDriver.Redirect());
|
||||
client.authenticate({ rememberUser: true }, function(error, client)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
return showError(error);
|
||||
}
|
||||
dropboxSync(client, success);
|
||||
});
|
||||
}
|
||||
function success()
|
||||
{
|
||||
document.getElementById('btnStart').disabled = false;
|
||||
console.log("WEBPLAYER: Sync successful");
|
||||
}
|
||||
function dropboxSync(dropboxClient, cb)
|
||||
{
|
||||
var dbfs = new BrowserFS.FileSystem.Dropbox(dropboxClient);
|
||||
// Wrap in AsyncMirrorFS.
|
||||
var asyncMirror = new BrowserFS.FileSystem.AsyncMirror(
|
||||
new BrowserFS.FileSystem.InMemory(), dbfs);
|
||||
|
||||
asyncMirror.initialize(function(err)
|
||||
{
|
||||
// Initialize it as the root file system.
|
||||
BrowserFS.initialize(asyncMirror);
|
||||
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
function setupFileSystem()
|
||||
{
|
||||
console.log("WEBPLAYER: Initializing Filesystem");
|
||||
if(!client.isAuthenticated())
|
||||
{
|
||||
console.log("WEBPLAYER: Initializing LocalStorage");
|
||||
if(localStorage.getItem("fs_inited")!="true")
|
||||
{
|
||||
var lsfs = new BrowserFS.FileSystem.LocalStorage();
|
||||
|
||||
BrowserFS.initialize(lsfs);
|
||||
var BFS = new BrowserFS.EmscriptenFS();
|
||||
FS.mount(BFS, {root: '/'}, '/home');
|
||||
console.log('WEBPLAYER: Filesystem initialized');
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('WEBPLAYER: Filesystem already initialized');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("WEBPLAYER: Initializing DropBoxFS");
|
||||
// Grab the BrowserFS Emscripten FS plugin.
|
||||
var BFS = new BrowserFS.EmscriptenFS();
|
||||
// Create the folder that we'll turn into a mount point.
|
||||
FS.createPath(FS.root, 'home', true, true);
|
||||
// Mount BFS's root folder into the '/data' folder.
|
||||
console.log('WEBPLAYER: Mounting');
|
||||
FS.mount(BFS, {root: '/'}, '/home');
|
||||
console.log('WEBPLAYER: DropBox initialized');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
FS.createPath('/', '/home/web_user', true, true);
|
||||
FS.createPath('/', '/home/web_user/.config', true, true);
|
||||
FS.createPath('/', '/home/web_user/.config/retroarch', true, true);
|
||||
FS.createPath('/', '/assets', true, true);
|
||||
FS.createPath('/', '/content', true, true);
|
||||
}
|
||||
|
||||
function stat(path)
|
||||
{
|
||||
try{
|
||||
FS.stat(path);
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
console.log("WEBPLAYER: file " + path + " doesn't exist");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function startRetroArch()
|
||||
{
|
||||
document.getElementById('canvas_div').style.display = 'block';
|
||||
document.getElementById('btnLoad').disabled = false;
|
||||
|
||||
setupFileSystem();
|
||||
setupFolderStructure();
|
||||
|
||||
Module['callMain'](Module['arguments']);
|
||||
}
|
||||
|
||||
function selectFiles(files)
|
||||
{
|
||||
count = files.length;
|
||||
|
||||
for (var i = 0; i < files.length; i++)
|
||||
{
|
||||
filereader = new FileReader();
|
||||
filereader.file_name = files[i].name;
|
||||
filereader.readAsArrayBuffer(files[i]);
|
||||
filereader.onload = function(){uploadData(this.result, this.file_name)};
|
||||
}
|
||||
}
|
||||
|
||||
function uploadData(data,name)
|
||||
{
|
||||
var dataView = new Uint8Array(data);
|
||||
FS.createDataFile('/', name, dataView, true, false);
|
||||
|
||||
var data = FS.readFile(name,{ encoding: 'binary' });
|
||||
FS.writeFile('/content/' + name, data ,{ encoding: 'binary' });
|
||||
FS.unlink(name);
|
||||
|
||||
}
|
||||
|
||||
var Module =
|
||||
{
|
||||
noInitialRun: true,
|
||||
arguments: ["-v", "--menu"],
|
||||
preRun: [],
|
||||
postRun: [],
|
||||
print: (function()
|
||||
{
|
||||
var element = document.getElementById('output');
|
||||
element.value = ''; // clear browser cache
|
||||
return function(text)
|
||||
{
|
||||
text = Array.prototype.slice.call(arguments).join(' ');
|
||||
element.value += text + "\n";
|
||||
element.scrollTop = 99999; // focus on bottom
|
||||
};
|
||||
})(),
|
||||
|
||||
printErr: function(text)
|
||||
{
|
||||
var text = Array.prototype.slice.call(arguments).join(' ');
|
||||
var element = document.getElementById('output');
|
||||
element.value += text + "\n";
|
||||
element.scrollTop = 99999; // focus on bottom
|
||||
},
|
||||
canvas: document.getElementById('canvas'),
|
||||
|
||||
totalDependencies: 0,
|
||||
monitorRunDependencies: function(left)
|
||||
{
|
||||
this.totalDependencies = Math.max(this.totalDependencies, left);
|
||||
}
|
||||
};
|
||||
|
||||
function switchCore(corename) {
|
||||
localStorage.setItem("core", corename);
|
||||
}
|
||||
|
||||
// When the browser has loaded everything.
|
||||
$(function() {
|
||||
// Find which core to load.
|
||||
var core = localStorage.getItem("core", 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');
|
||||
|
||||
/**
|
||||
* Attempt to disable some default browser keys.
|
||||
*/
|
||||
|
||||
window.addEventListener('keydown', function(e) {
|
||||
// Space key, arrows, and F1.
|
||||
if([32, 37, 38, 39, 40, 112].indexOf(e.keyCode) > -1) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user