Page 1 of 1
JS-VBA-M: World's First Working Webgl based JS GBA emulator!
Posted: Thu Oct 04, 2012 11:12 am
by ILOVEPIE
Â
Â
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):
Â
Â
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
JS-VBA-M: World's First Working Webgl based JS GBA emulator!
Posted: Fri Oct 05, 2012 3:24 am
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.
JS-VBA-M: World's First Working Webgl based JS GBA emulator!
Posted: Fri Oct 05, 2012 10:35 am
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...
JS-VBA-M: World's First Working Webgl based JS GBA emulator!
Posted: Fri Oct 05, 2012 3:52 pm
by grantgalitz
Emscripten cannot do some risky optimizations due to edge/unsafe logic conditions. See making jump tables in JS.
JS-VBA-M: World's First Working Webgl based JS GBA emulator!
Posted: Sun Oct 07, 2012 3:19 am
by mudlord
Impressive, but I advise to pay attention to what grantg sez
JS-VBA-M: World's First Working Webgl based JS GBA emulator!
Posted: Sun Oct 07, 2012 1:39 pm
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.