bfriedrichs / switch-gba Goto Github PK
View Code? Open in Web Editor NEWBrowser based Nintendo Switch GBA Emulator
Browser based Nintendo Switch GBA Emulator
The behavior of the B button is awkward. Maybe you should try a different approach than the iframe.
The following snippets was tested on switch browser and worked very well.
Using window.location.hash:
<html>
<script>
var cnt = 0;
window.location.hash = "#1";
function beginHistory() {
window.location.hash = "#2";
setInterval(function(){
if (window.location.hash != "#2") {
window.location.hash = "#2";
++cnt;
document.getElementById('content').innerHTML = 'PRESS #' + cnt;
}
}, 1);
}
setTimeout(function(){beginHistory();}, 1);
</script>
<div id='content'></div>
</html>
Using HTML5 pushState: (dont know why, but this doesn't work on my Chorme)
<html>
<script>
var cnt = 0;
history.pushState("#1", null, "");
function beginHistory() {
history.pushState("#2", null, "");
window.onpopstate = function(event) {
history.pushState("#2", null, "");
++cnt;
document.getElementById('content').innerHTML = 'PRESS #' + cnt;
};
}
setTimeout(function(){beginHistory();}, 1);
</script>
<div id='content'></div>
</html>
the second one is better, because it does not rely on a interval polling the hash value.
When choosing an rom, the screen stays black, only showing slot, turbo, go back, reset and reload page buttons.
EDIT: Issue occurs only when using NGINX as a reverse proxy.
Make a retroarch like web emulator , that can play md/ms/gg/nes/snes/gba in one for the switch
https://github.com/libretro/RetroArch/tree/master/pkg/emscripten example
After playing for a while, I'll often get this message:
"Due to the size of the page, not all content could be displayed. try reloading the page?"
After doing the reload, the "B" button workaround sorta stops working. Every press of B works, but I get a pop up saying:
"You are now leaving this screen. Any information you have entered will not be saved"
I've found that doing a reload using the "Reload page" in the bottom right fixes this though.
Certainly not a huge issue, I more wanted to log an issue in case anyone else is having the issue and hasn't found the workaround.
By choking up the system, any alert can cause a content size warning which stops some functionality if itβs displayed for too long.
Related:
#1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.