Initial commit.
This commit is contained in:
121
public/emulator.html
Normal file
121
public/emulator.html
Normal file
@ -0,0 +1,121 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Test</title>
|
||||
|
||||
<style type="text/css">
|
||||
body,html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.game {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.ejs_menu_bar {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="game" id="game">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
let scriptElement = null;
|
||||
|
||||
EJS_player = "#game";
|
||||
EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/";
|
||||
EJS_language = "en-US";
|
||||
EJS_volume = 0;
|
||||
EJS_startOnLoaded = true;
|
||||
EJS_backgroundColor = '#000';
|
||||
|
||||
EJS_Buttons = {
|
||||
playPause: false,
|
||||
restart: false,
|
||||
mute: false,
|
||||
settings: false,
|
||||
fullscreen: false,
|
||||
saveState: false,
|
||||
loadState: false,
|
||||
screenRecord: false,
|
||||
gamepad: false,
|
||||
cheat: false,
|
||||
volume: false,
|
||||
saveSavFiles: false,
|
||||
loadSavFiles: false,
|
||||
quickSave: false,
|
||||
quickLoad: false,
|
||||
screenshot: false,
|
||||
cacheManager: false,
|
||||
exitEmulation: false
|
||||
}
|
||||
|
||||
EJS_defaultOptions = {
|
||||
};
|
||||
|
||||
const emulatorInit = data => {
|
||||
EJS_gameUrl = data.game;
|
||||
EJS_core = data.core;
|
||||
EJS_gameName = data.gameName;
|
||||
|
||||
scriptElement = document.createElement('script');
|
||||
scriptElement.src = 'https://cdn.emulatorjs.org/stable/data/loader.js';
|
||||
document.body.appendChild(scriptElement);
|
||||
}
|
||||
|
||||
const send = data => {
|
||||
window.parent.postMessage(data, '*');
|
||||
}
|
||||
|
||||
window.onmessage = (e) => {
|
||||
const { data } = e;
|
||||
|
||||
if(!data) {
|
||||
console.error('No data');
|
||||
return;
|
||||
}
|
||||
|
||||
const { message } = data;
|
||||
|
||||
switch(message) {
|
||||
case 'init':
|
||||
emulatorInit(data);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error('Unknown message', message);
|
||||
}
|
||||
};
|
||||
|
||||
EJS_ready = (...args) => {
|
||||
send({ message: 'ready', data: args });
|
||||
}
|
||||
|
||||
EJS_onSaveState = (...args) => {
|
||||
send({ message: 'save', data: args });
|
||||
}
|
||||
|
||||
EJS_onLoadState = (...args) => {
|
||||
send({ message: 'load', data: args });
|
||||
}
|
||||
|
||||
EJS_onGameStart = (...args) => {
|
||||
send({ message: 'start', data: args });
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- <script src="https://cdn.emulatorjs.org/stable/data/loader.js"></script> -->
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user