
* feat: EmulatorJS support - importing of BIOS files #15 * feat: added Bios controller to make Bios files available to the emulator, also resolved SNES identification issues (see: #25) * feat: added firmware selector to emulator screen * refactor: moved EmulatorJS to a subfolder * feat: added firmware image availability page
101 lines
3.5 KiB
HTML
101 lines
3.5 KiB
HTML
<div id="bgImage">
|
|
<div id="bgImage_Opacity"></div>
|
|
</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">
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
var gameId = urlParams.get('gameid');
|
|
var platformId = urlParams.get('platformid');
|
|
var gameData;
|
|
var artworks = null;
|
|
var artworksPosition = 0;
|
|
|
|
var emuBios = '';
|
|
var availableEmuBios = [];
|
|
|
|
ajaxCall('/api/v1/Games/' + gameId, 'GET', function (result) {
|
|
gameData = result;
|
|
|
|
// load artwork
|
|
if (result.artworks) {
|
|
artworks = result.artworks.ids;
|
|
var startPos = randomIntFromInterval(0, result.artworks.ids.length);
|
|
artworksPosition = startPos;
|
|
rotateBackground();
|
|
} else {
|
|
if (result.cover) {
|
|
var bg = document.getElementById('bgImage');
|
|
bg.setAttribute('style', 'background-image: url("/api/v1/Games/' + gameId + '/cover/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
|
|
}
|
|
}
|
|
});
|
|
|
|
ajaxCall('/api/v1/Bios/' + platformId, 'GET', function (result) {
|
|
var emulatorbiosDiv = document.getElementById('emulatorbios');
|
|
|
|
availableEmuBios = result;
|
|
|
|
if (result.length == 0) {
|
|
emuBios = '';
|
|
emulatorbiosDiv.setAttribute('style', 'display: none;');
|
|
} else {
|
|
emuBios = '/api/v1/Bios/' + platformId + '/' + availableEmuBios[0].filename;
|
|
|
|
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();
|
|
});
|
|
|
|
function rotateBackground() {
|
|
if (artworks) {
|
|
artworksPosition += 1;
|
|
if (artworks[artworksPosition] == null) {
|
|
artworksPosition = 0;
|
|
}
|
|
var bg = document.getElementById('bgImage');
|
|
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 = emulatorbiosselect.value;
|
|
} else {
|
|
emuBios = '';
|
|
}
|
|
|
|
switch (urlParams.get('engine')) {
|
|
case 'EmulatorJS':
|
|
$('#emulator').load('/pages/EmulatorJS.html');
|
|
break;
|
|
}
|
|
}
|
|
</script>
|