Saturday, May 18, 2013

Chromebook Pixel gives me an excuse to fork JSNES

For a long time, I have been intrigued by NES emulators. I was extremely excited when Ben Firshman released an NES emulator in JavaScript (JSNES) over three years ago. At the time, I noted that JSNES ran at almost 60fps in Chrome, but barely trickled along in Firefox. It's pretty shocking to see that that is still the case today: in Firefox 21.0 on Ubuntu, I am seeing at most 2fps while sitting idle on the title screen for Dr. Mario. That's pretty sad. (It turns out I was getting 1fps because I had Firebug enabled. Maybe that's why my perception of Firefox has diminished over time. Someone at Mozilla should look into that...) This is the only browser benchmark I care about these days.

When the Gamepad API was first announced for Chrome, I tried to get my USB NES RetroPort controllers to work, but Chrome did not seem to recognize them. I made a mental note to check back later, assuming the API would eventually be more polished. Fast-forward to this week where I was fortunate enough to attend Google I/O and score a Chromebook Pixel. It seemed like it was time to give my controllers another try.

Last night, I plugged a RetroPort into the Pixel and visited the Gamepad API test page, and it worked! Obviously the next thing I had to do was wire this up to JSNES, so that was the first thing I did when I woke up this morning. I now have my own fork of the JSNES project where I added support for the RetroPort controllers as well as loading local ROMs from disk. As I admit in my README.md, there are already outstanding pull requests for these types of things, but I wanted to have the fun of doing it myself (and an excuse to poke around the JSNES code).

Finally, the one outstanding feature I hoped to add was loading ROMs from Dropbox or GDrive using pure JavaScript. Neither product appears to have a simple JavaScript API that will give you access to file data like the W3C File API does. Perhaps I'll host my fork of JSNES if I can ever add such a feature...

P.S. I should admit that one does not need a Pixel to do these types of things. However, having a new piece of hardware and APIs that have been around long enough that you expect them to be stable is certainly a motivating factor. It's nice to have a project that doesn't involve any yak-shaving, such as figuring out how to install a version of Chrome from the Beta channel!

9 comments:

  1. FWIW it's possible to stuff Drive API responses into File/Blob objects, but you're right that it's not easy. Luckily, this blog post has started some internal discussions about adding this as a feature to the JS client library, so this may be easier soon*

    *for some definition of "soon"

    ReplyDelete
  2. I got this working with the Dropbox API now: https://jsnes.bolinfest.com/. It's a bit sloppy because of the self-signed SSL certificate, but it works!

    ReplyDelete
  3. Interesting theory, but I think that all is much easier than u think. Thats why I wanna suggest u to play in ps1 roms https://romsmania.com/roms/playstation and forget about all your problems at least for a minute.

    ReplyDelete
  4. What a nice post! I'm so happy to read this. 토토사이트추천 What you wrote was very helpful to me. Thank you. Actually, I run a site similar to you. If you have time, could you visit my site? Please leave your comments after reading what I wrote. If you do so, I will actively reflect your opinion. I think it will be a great help to run my site. Have a good day.

    ReplyDelete
  5. Hello people! A best college essay editing service like our own will ensure you deliver premier papers, deliver your assignments on time, cope with lots of college assignments and relieve stress associated with an academic workload.

    ReplyDelete
  6. We’ll deliver the first draft of your paper so that you can check and approve https://essaysrescue.com/masterpapers-review/ it. If any of the instructions you laid down during ordering is not followed, you can give it back for revisions. Our revisions are unlimited and can be requested for up to a fortnight.

    ReplyDelete
  7. If you can’t write an essay in any way, then don’t be upset, the fact is that on writemypaper absolutely any written work will be written for you like no one else could because it was written by experts in their field

    ReplyDelete
  8. As a college student juggling multiple assignments and part-time work, I often find it challenging to complete my essays on time. Recently, I came across an online essay writing service https://www.outlookindia.com/ that offers customized papers. Their professional writers provide well-researched and original essays that have helped me meet my deadlines and maintain my academic performance.

    ReplyDelete