JS-VBA-M: World's First Working Webgl based JS GBA emulator!

Non VBA-M Related on-topic discussion goes here, anything posted related to the emulator in this board will either be deleted or the content moved at staff discretion.
Post Reply

What do you think of this?

 
Total votes: 0

ILOVEPIE
Junior Member
Posts: 3
Joined: Tue Oct 02, 2012 10:52 am

JS-VBA-M: World's First Working Webgl based JS GBA emulator!

Post by ILOVEPIE »

JS-VBA-M

 

 

Hey guys just thought I'd share a project I'm working on. I am porting VBA-M to Javascript using the Emscripten C/C++ to javascript compiler and a modified version of the VBA-M SDL code.

 

Runs natively in browser with no plugins required!

 

Development Progress Picture (I am using Pokemon Ruby as the testcase):

Image

 

[video=youtube]

<div><iframe width="480" height="270" src="https://www.youtube.com/embed/pjCuM6pnI ... ure=oembed" frameborder="0" allowfullscreen="true"></iframe></div>

 

 

Progress:

 

  • Get JS-VBA-M to compile. Done.

 

  • Fix the command line arguments parsing code. Done.

 

  • Get it to load a game and run it. Done.

 

  • Get it to display the FPS meter. Done.

 

  • Get it to display the game. Done.

 

  • Get it to run at at least 48% speed (the cross-compiler promises the program will run at most 4x slower than native when the optimization options are configured correctly, so as my computer runs VBA-M at 87% speed, the JS version should run at 48% speed at it's slowest). WIP (still fiddling with compiler optimization options (getting 38% speed on my laptop)).

 

  • Streamline the build system and fix the cmake files to work correctly with emscripten. Todo.

 

Working Version:

http://dl.dropbox.com/u/20328726/vbamjs/index.html

Last edited by ILOVEPIE on Sun Oct 07, 2012 7:06 pm, edited 1 time in total.
grantgalitz
Junior Member
Posts: 5
Joined: Sun Oct 24, 2010 5:33 am

JS-VBA-M: World's First Working Webgl based JS GBA emulator!

Post by grantgalitz »

Nice, although Emscripten does not really mean ported. It means you "compiled" it to JavaScript really. I had been working on my own JS GBA emulator, although I've been AFK on IodineGBA (and github in general) for about a month.

 

Also it's not the first: https://github.com/jpfau/gbajs

 

Problem with emscripten is that there are certain conventions that work on the LLVM level that do not work well on the JS level. Low level heap/stack ops often do not play well when compiled via emscripten to js. Not to mention there are many programming conventions fast in C/C++ that are slow in JS that could be substituted with other conventions in JS.

Last edited by grantgalitz on Fri Oct 05, 2012 3:29 am, edited 1 time in total.
ILOVEPIE
Junior Member
Posts: 3
Joined: Tue Oct 02, 2012 10:52 am

JS-VBA-M: World's First Working Webgl based JS GBA emulator!

Post by ILOVEPIE »

Nice, although Emscripten does not really mean ported. It means you "compiled" it to JavaScript really. I had been working on my own JS GBA emulator, although I've been AFK on IodineGBA (and github in general) for about a month.

 

Also it's not the first: https://github.com/jpfau/gbajs

 

Problem with emscripten is that there are certain conventions that work on the LLVM level that do not work well on the JS level. Low level heap/stack ops often do not play well when compiled via emscripten to js. Not to mention there are many programming conventions fast in C/C++ that are slow in JS that could be substituted with other conventions in JS.

While that is very true, Emscripten when set up correctly will automatically convert those things to the correct faster versions in javascript... I get almost a 20% speedup by compiling with some of the options...

I'm getting 20% of the actual device speed with just the default optimisations... im thinking of trying -02 with some other custom optimisations...

Last edited by ILOVEPIE on Fri Oct 05, 2012 11:04 am, edited 1 time in total.
grantgalitz
Junior Member
Posts: 5
Joined: Sun Oct 24, 2010 5:33 am

JS-VBA-M: World's First Working Webgl based JS GBA emulator!

Post by grantgalitz »

Emscripten cannot do some risky optimizations due to edge/unsafe logic conditions. See making jump tables in JS.

mudlord
Senior Member
Posts: 306
Joined: Sun Feb 08, 2009 7:16 am

JS-VBA-M: World's First Working Webgl based JS GBA emulator!

Post by mudlord »

Impressive, but I advise to pay attention to what grantg sez

ILOVEPIE
Junior Member
Posts: 3
Joined: Tue Oct 02, 2012 10:52 am

JS-VBA-M: World's First Working Webgl based JS GBA emulator!

Post by ILOVEPIE »

Impressive, but I advise to pay attention to what grantg sez

 

I know what I'm doing, the thing is Grant is right that emscripten has these problems... In some cases.

This is not one of them.

 

But thanks!

 

I just found out it works correctly on the Droidx if you use Opra Mobile.

Last edited by ILOVEPIE on Sun Oct 07, 2012 1:41 pm, edited 1 time in total.
Post Reply