feat: updated EmulatorJS to v4.0.5 (#36)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@@ -25,6 +26,39 @@ namespace gaseous_server.Controllers
|
|||||||
return Classes.Bios.GetBios(PlatformId, AvailableOnly);
|
return Classes.Bios.GetBios(PlatformId, AvailableOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[HttpHead]
|
||||||
|
[Route("zip/{PlatformId}")]
|
||||||
|
[ProducesResponseType(typeof(FileStreamResult), StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public ActionResult GetBiosCompressed(long PlatformId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IGDB.Models.Platform platform = Classes.Metadata.Platforms.GetPlatform(PlatformId);
|
||||||
|
|
||||||
|
string biosPath = Path.Combine(gaseous_tools.Config.LibraryConfiguration.LibraryBIOSDirectory, platform.Slug);
|
||||||
|
|
||||||
|
string tempFile = Path.GetTempFileName();
|
||||||
|
|
||||||
|
using (FileStream zipFile = System.IO.File.Create(tempFile))
|
||||||
|
using (var zipArchive = new ZipArchive(zipFile, ZipArchiveMode.Create))
|
||||||
|
{
|
||||||
|
foreach (string file in Directory.GetFiles(biosPath))
|
||||||
|
{
|
||||||
|
zipArchive.CreateEntryFromFile(file, Path.GetFileName(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var stream = new FileStream(tempFile, FileMode.Open);
|
||||||
|
return File(stream, "application/zip", platform.Slug + ".zip");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[HttpHead]
|
[HttpHead]
|
||||||
[Route("{PlatformId}/{BiosName}")]
|
[Route("{PlatformId}/{BiosName}")]
|
||||||
|
Submodule gaseous-server/wwwroot/emulators/EmulatorJS updated: f7fa5d4148...109a832ffd
@@ -20,7 +20,7 @@
|
|||||||
// Path to the data directory
|
// Path to the data directory
|
||||||
EJS_pathtodata = '/emulators/EmulatorJS/data/';
|
EJS_pathtodata = '/emulators/EmulatorJS/data/';
|
||||||
|
|
||||||
EJS_DEBUG_XX = true;
|
EJS_DEBUG_XX = false;
|
||||||
|
|
||||||
EJS_startOnLoaded = false;
|
EJS_startOnLoaded = false;
|
||||||
</script>
|
</script>
|
||||||
|
@@ -4,15 +4,6 @@
|
|||||||
|
|
||||||
<div id="emulator"></div>
|
<div id="emulator"></div>
|
||||||
|
|
||||||
<div id="emulatorbios">
|
|
||||||
<table style="width: 100%;">
|
|
||||||
<tr>
|
|
||||||
<td>Firmware:</td>
|
|
||||||
<td><select id="emulatorbiosselector" onchange="loadEmulator();"></select></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
@@ -23,7 +14,6 @@
|
|||||||
var artworksPosition = 0;
|
var artworksPosition = 0;
|
||||||
|
|
||||||
var emuBios = '';
|
var emuBios = '';
|
||||||
var availableEmuBios = [];
|
|
||||||
|
|
||||||
ajaxCall('/api/v1/Games/' + gameId, 'GET', function (result) {
|
ajaxCall('/api/v1/Games/' + gameId, 'GET', function (result) {
|
||||||
gameData = result;
|
gameData = result;
|
||||||
@@ -43,33 +33,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
ajaxCall('/api/v1/Bios/' + platformId, 'GET', function (result) {
|
ajaxCall('/api/v1/Bios/' + platformId, 'GET', function (result) {
|
||||||
var emulatorbiosDiv = document.getElementById('emulatorbios');
|
|
||||||
|
|
||||||
availableEmuBios = result;
|
|
||||||
|
|
||||||
if (result.length == 0) {
|
if (result.length == 0) {
|
||||||
emuBios = '';
|
emuBios = '';
|
||||||
emulatorbiosDiv.setAttribute('style', 'display: none;');
|
|
||||||
} else {
|
} else {
|
||||||
emuBios = '/api/v1/Bios/' + platformId + '/' + availableEmuBios[0].filename;
|
emuBios = '/api/v1/Bios/zip/' + platformId;
|
||||||
|
|
||||||
var emulatorbiosselect = document.getElementById('emulatorbiosselector');
|
|
||||||
|
|
||||||
for (var i = 0; i < availableEmuBios.length; i++) {
|
|
||||||
var biosOption = document.createElement('option');
|
|
||||||
biosOption.value = availableEmuBios[i].filename;
|
|
||||||
biosOption.innerHTML = availableEmuBios[i].description + ' (' + availableEmuBios[i].filename + ')';
|
|
||||||
|
|
||||||
if (availableEmuBios[i].region == "US") {
|
|
||||||
emuBios = '/api/v1/Bios/' + platformId + '/' + availableEmuBios[i].filename;
|
|
||||||
biosOption.setAttribute('selected', 'selected');
|
|
||||||
}
|
|
||||||
|
|
||||||
emulatorbiosselect.appendChild(biosOption);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadEmulator();
|
switch (urlParams.get('engine')) {
|
||||||
|
case 'EmulatorJS':
|
||||||
|
$('#emulator').load('/pages/EmulatorJS.html');
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function rotateBackground() {
|
function rotateBackground() {
|
||||||
@@ -82,19 +56,4 @@
|
|||||||
bg.setAttribute('style', 'background-image: url("/api/v1/Games/' + gameId + '/artwork/' + artworks[artworksPosition] + '/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
|
bg.setAttribute('style', 'background-image: url("/api/v1/Games/' + gameId + '/artwork/' + artworks[artworksPosition] + '/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadEmulator() {
|
|
||||||
if (availableEmuBios.length > 0) {
|
|
||||||
var emulatorbiosselect = document.getElementById('emulatorbiosselector');
|
|
||||||
emuBios = '/api/v1/Bios/' + platformId + '/' + emulatorbiosselect.value;
|
|
||||||
} else {
|
|
||||||
emuBios = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (urlParams.get('engine')) {
|
|
||||||
case 'EmulatorJS':
|
|
||||||
$('#emulator').load('/pages/EmulatorJS.html');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user