Compare commits

..

No commits in common. "master" and "393f92a5d9bf935f5edef1b8bc4790e731b8a9b1" have entirely different histories.

6 changed files with 23 additions and 38 deletions

5
.gitignore vendored
View File

@ -1,4 +1,3 @@
*.xdc
*.nes
*.swp
.DS_Store
.nes
.DS_Store

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,14 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>NES Emulator</title>
<script type="text/javascript" src="jsnes.js"></script>
<script type="text/javascript" src="nes-embed.js"></script>
<script>window.onload = function(){nes_load_url("nes-canvas", "mario.nes");}</script>
</head>
<body>
<div style="margin: auto; width: 75%;">
<canvas id="nes-canvas" width="256" height="240" style="width: 100%"/>
</div>
<p>DPad: Arrow keys<br/>Start: Return, Select: Tab<br/>A Button: A, B Button: S</p>
</body>
</html>
<!-- <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Super Mario Bros. (World)</title>
<script src="webxdc.js"></script>
<script src="jsnes.min.js"></script>
<script src="nes-embed.js"></script>
</head>
<body style="margin: 0;">
<!--
<body>
<input id="input" type="text"/>
<a href="" onclick="sendMsg(); return false;">Send</a>
<p id="output"></p>
@ -24,11 +39,6 @@
window.webxdc.setUpdateListener(receiveUpdate, 0);
</script>
-->
<canvas id="nes-canvas" width="256" height="240" style="width: 100vw; height: 100vh; margin: 0; object-fit: contain;"/>
<p>DPad: Arrow keys<br/>Start: Return, Select: Tab<br/>A Button: A, B Button: S</p>
<script>
nes_load_url("nes-canvas", "Super Mario Bros. (World).nes");
</script>
</body>
</html>
-->

View File

@ -1 +0,0 @@
name = "Super Mario Bros. (World)"

View File

@ -130,26 +130,3 @@ function nes_load_url(canvas_id, path){
document.addEventListener('keydown', (event) => {keyboard(nes.buttonDown, event)});
document.addEventListener('keyup', (event) => {keyboard(nes.buttonUp, event)});
function saveState(){
try{
var saveData = JSON.stringify(nes.toJSON());
localStorage.setItem(romName, saveData);
}catch(oException){
if(oException.name == 'QuotaExceededError'){
console.log('localStorage out of memory');
localStorage.clear();
localStorage.setItem(calcMD5(rompath), saveData);
}
}
}
function loadState(){
var saveData = localStorage.getItem(romName);
if( saveData == null ) {
console.log("nothing to load");
return;
}
var decodedData = JSON.parse(saveData);
nes.fromJSON(decodedData);
}