mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
allow upload of SRM files, also allow upload of savestates but it seems saves are not compatible from PC
This commit is contained in:
parent
e55fe20da1
commit
0751939c52
11847
emscripten/browserfs.js
Normal file
11847
emscripten/browserfs.js
Normal file
File diff suppressed because it is too large
Load Diff
6
emscripten/browserfs.min.js
vendored
Normal file
6
emscripten/browserfs.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -33,16 +33,17 @@
|
|||||||
<div id="accordion" class="emscripten">
|
<div id="accordion" class="emscripten">
|
||||||
<h3>Settings</h3>
|
<h3>Settings</h3>
|
||||||
<div class="emscripten">
|
<div class="emscripten">
|
||||||
|
<button id="content" onclick="document.getElementById('rom').click()">Start</button>
|
||||||
|
|
||||||
|
|
||||||
<button id="content" onclick="document.getElementById('rom').click()">Upload content</button>
|
|
||||||
<input style="display: none" type="file" id="rom" name="upload" onclick="document.getElementById('content').click();" onchange="runEmulator(event.target.files);" multiple /></p>
|
<input style="display: none" type="file" id="rom" name="upload" onclick="document.getElementById('content').click();" onchange="runEmulator(event.target.files);" multiple /></p>
|
||||||
<input type="checkbox" id="resize"><label for="resize">Resize canvas</label></p>
|
|
||||||
|
<button id="saves" onclick="document.getElementById('savefiles').click()">Upload Savefiles</button>
|
||||||
|
<input style="display: none" type="file" id="savefiles" name="upload" onclick="document.getElementById('saves').click();" onchange="uploadData(event.target.files,'saves');" multiple /></p>
|
||||||
|
|
||||||
|
<button id="states" onclick="document.getElementById('savestates').click()">Upload Savestates</button>
|
||||||
|
<input style="display: none" type="file" id="savestates" name="upload" onclick="document.getElementById('states').click();" onchange="uploadData(event.target.files,'states');" multiple /></p>
|
||||||
|
|
||||||
<input type="checkbox" id="pointerLock" checked><label for="pointerLock">Lock/hide mouse pointer</label></p>
|
<input type="checkbox" id="pointerLock" checked><label for="pointerLock">Lock/hide mouse pointer</label></p>
|
||||||
<input type="button" value="Fullscreen" onclick="Module.requestFullScreen(document.getElementById('pointerLock').checked, document.getElementById('resize').checked)"></p>
|
<input type="button" value="Fullscreen" onclick="Module.requestFullScreen(document.getElementById('pointerLock').checked, document.getElementById('resize').checked)"></p>
|
||||||
<input type="checkbox" id="vsync"><label for="vsync" id="vsync-label">Enable V-sync (can only be done before loading game)</label></p>
|
|
||||||
<input type="textbox" id="latency" size="3" maxlength="3" value="96"> <label for="latency" id="latency-label">Audio latency (ms) (increase if you hear pops at fullspeed, can only be done before loading game)</label></p>
|
|
||||||
</div>
|
</div>
|
||||||
<h3>Console</h3>
|
<h3>Console</h3>
|
||||||
<div class="emscripten">
|
<div class="emscripten">
|
||||||
|
@ -49,7 +49,7 @@ function createConfig()
|
|||||||
|
|
||||||
function setupFileSystem()
|
function setupFileSystem()
|
||||||
{
|
{
|
||||||
console.log("setupFileSystem");
|
console.log("setupFileSystem");
|
||||||
|
|
||||||
if(localStorage.getItem("fs_inited")!="true")
|
if(localStorage.getItem("fs_inited")!="true")
|
||||||
{
|
{
|
||||||
@ -59,8 +59,11 @@ function setupFileSystem()
|
|||||||
|
|
||||||
FS.mount(BFS, {root: '/'}, '/home');
|
FS.mount(BFS, {root: '/'}, '/home');
|
||||||
|
|
||||||
localStorage.setItem("fs_inited","true");
|
console.log('Filesystem initialized');
|
||||||
console.log('Filesystem initialized: ' + localStorage.getItem("fs_inited"));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.log('Filesystem already initialized');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +72,8 @@ function runEmulator(files)
|
|||||||
|
|
||||||
if (Modernizr.localstorage)
|
if (Modernizr.localstorage)
|
||||||
{
|
{
|
||||||
setupFileSystem();
|
if(firstRun)
|
||||||
|
setupFileSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
setupFolders();
|
setupFolders();
|
||||||
@ -99,7 +103,29 @@ function runEmulator(files)
|
|||||||
function uploadContent(data, name)
|
function uploadContent(data, name)
|
||||||
{
|
{
|
||||||
var dataView = new Uint8Array(data);
|
var dataView = new Uint8Array(data);
|
||||||
Module.FS_createDataFile('/', name, dataView, true, false);
|
FS.createDataFile('/', name, dataView, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyFile(src,dest)
|
||||||
|
{
|
||||||
|
console.log('copying: ' + src + ' to: ' + dest);
|
||||||
|
var contents = FS.readFile(src,{ encoding: 'binary' });
|
||||||
|
console.log(contents);
|
||||||
|
FS.writeFile(dest,contents,{ encoding: 'binary' });
|
||||||
|
}
|
||||||
|
|
||||||
|
function uploadData(files, path)
|
||||||
|
{
|
||||||
|
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(){uploadContent(this.result, '/tmp/' + this.file_name)};
|
||||||
|
filereader.onloadend = function(){copyFile('/tmp/' + this.file_name,'/home/web_user/retroarch/' + path + '/' + this.file_name)};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initFromData()
|
function initFromData()
|
||||||
|
Loading…
Reference in New Issue
Block a user