Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Updated - FlashGear - SMS in Flash/Actionscript

Reply to topic
Author Message
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Updated - FlashGear - SMS in Flash/Actionscript
Post Posted: Mon Mar 23, 2009 10:41 pm
Last edited by dj_yt on Tue Mar 24, 2009 9:24 pm; edited 1 time in total
I started porting JavaGear to Actionscript/Flash as a little experiment the other day. After all, Java is pretty much dead on the web now.

Unfortunately, the results are pretty dismal, in terms of performance.

You can find a link to a demo here:
http://www.massdestruction.co.uk/jsnes/2009/03/javagear-actionscriptflash-port.h...

I've done the obvious profiling and speed tests, although I haven't really managed to make much headway.

The Java version runs fine on a 400mhz pc last time I tried. So I expected a dual core 2ghz pc to handle the overhead of actionscript.... Unfortunately I was wrong.

Maybe it will be useful to embed simple demos onto web pages...ahem
  View user's profile Send private message Visit poster's website
  • Joined: 09 May 2007
  • Posts: 137
  • Location: Sampa, Brazil
Reply with quote
Post Posted: Tue Mar 24, 2009 12:00 am
Tried it, runs fine, but sluggish on my machine...
Ressembles running JavaGear ME on my old Sony Ericsson Z530i phone...
That ran at about 5 fps on my system, that's an AMD Athlon 64 3200+...

And very great job to port the emulator to Action Script!
  View user's profile Send private message Visit poster's website
  • Joined: 25 Jul 2007
  • Posts: 732
  • Location: Melbourne, Australia
Reply with quote
Post Posted: Tue Mar 24, 2009 8:02 am
Thats pretty darn awesome, probably your most impressive effort to date.

I suspect it is being artificially limited in some way as it runs the same speed on my works' crappy Pentium 233 as it does on my Quad Core2 running at 2.8Ghz.
  View user's profile Send private message
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Post Posted: Tue Mar 24, 2009 10:02 am
djbass wrote
Thats pretty darn awesome, probably your most impressive effort to date.

I suspect it is being artificially limited in some way as it runs the same speed on my works' crappy Pentium 233 as it does on my Quad Core2 running at 2.8Ghz.


Hmm - I wonder if that's promising or not :) Maybe it means something can be done.

I'll have another tinker. I'm capping it to about 15fps (with frame skipping) at the moment. There's no auto throttling like the java version at the moment. Although there probably could be.

If anyone is an Actionscript expert, at the bytecode level, maybe they can help out :)
  View user's profile Send private message Visit poster's website
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Post Posted: Tue Mar 24, 2009 9:26 pm
OK, some promising results

I've now got the emulator running at 30fps on my machine.
http://www.javagear.co.uk/flashgear/

There's no auto frame-skipping yet, so let me know how it runs on your machine.
  View user's profile Send private message Visit poster's website
  • Joined: 09 May 2007
  • Posts: 137
  • Location: Sampa, Brazil
Reply with quote
Post Posted: Tue Mar 24, 2009 9:59 pm
Running much much better now :-D
Great job!
On my machine, now it runs about 25~30fps, runs great most of the time, but sometimes slowdowns, with some effort, i hope that this will be a good emulator...
  View user's profile Send private message Visit poster's website
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Post Posted: Tue Mar 24, 2009 10:04 pm
Cool. How fast is your machine btw?
  View user's profile Send private message Visit poster's website
  • Joined: 09 May 2007
  • Posts: 137
  • Location: Sampa, Brazil
Reply with quote
Post Posted: Tue Mar 24, 2009 11:22 pm
Rony_ket wrote
Tried it, runs fine, but sluggish on my machine...
Ressembles running JavaGear ME on my old Sony Ericsson Z530i phone...
That ran at about 5 fps on my system, that's an AMD Athlon 64 3200+...

And very great job to port the emulator to Action Script!


As already posted, my machine isn't that bad, but is a little oldish... Maybe I should give it a try on my HTC Star Trek Smartphone, as it have Flash Mobile, and runs many SWF files.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Apr 2005
  • Posts: 391
  • Location: London, United Kingdom
Reply with quote
Post Posted: Wed Mar 25, 2009 2:05 am
That's very cool, and performance seems decent - for a browser plugin (running on a Core 2 Duo here). :-)

Porting Cogwheel to Silverlight was relatively easy, though the result is slower.
  View user's profile Send private message Visit poster's website
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Post Posted: Wed Mar 25, 2009 9:41 am
Cool. I tried to get sound working last night.

Unfortunately there's no native support for streaming audio and generating audio in actionscript. I tried an approach where I was creating a series of sound objects on the fly. It worked, but sounded dreadful. So maybe sound is on hold for the time being.

Will probably get this into a releasable state over the coming, and then release the code and so forth.

It could be cool to embed homebrew demos on smspower or similar sites. The emulator SWF is only around ~35k.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Apr 2005
  • Posts: 391
  • Location: London, United Kingdom
Reply with quote
Post Posted: Wed Mar 25, 2009 12:48 pm
I was under the impression that one of the new super-duper features of Flash 10 was the ability to generate sound on the fly?
  View user's profile Send private message Visit poster's website
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Post Posted: Wed Mar 25, 2009 1:30 pm
benryves wrote
I was under the impression that one of the new super-duper features of Flash 10 was the ability to generate sound on the fly?


Not that I'm aware of. Flash 10 uses ActionScript 3. The API is here:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/

Check out the flash.media package to see what's available.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Apr 2005
  • Posts: 391
  • Location: London, United Kingdom
Reply with quote
Post Posted: Wed Mar 25, 2009 3:23 pm
From the Adobe site, Working with dynamically generated audio
  View user's profile Send private message Visit poster's website
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Post Posted: Wed Mar 25, 2009 3:25 pm
benryves wrote
From the Adobe site, Working with dynamically generated audio


Aha - top work. That looks super-easy as well. I'll implement that tonight and see how I get on.
  View user's profile Send private message Visit poster's website
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Post Posted: Thu Mar 26, 2009 12:29 am
Hmm had a look into the sound stuff.

The main problem is that each realtime sound you generate has to be at least 2048 samples long.

So essentially if you hook the sound generation (which endlessly calls a function you specify) straight to the PSG, you end up omitting sound related details and musical notes because you're not updating the registers for the duration of 2048 samples.

The obvious choice then is to make the PSG output to an intermediary buffer every scanline or whatever, and then play the results of the buffer. This is what JavaGear does.

However, I'm struggling to synchronise the psg writes so they don't overlap the actual audio output from the buffer. This method results in lots of pops in the audio. Grrr.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Aug 2005
  • Posts: 203
  • Location: Italy
Reply with quote
JavaGear extended to SG-1000/SC-3000 Emulation
Post Posted: Wed Apr 08, 2009 9:57 am
Hi,
I have found your JavaGear and it's a really interesting emulator, especially by the fact that can be used on cell phones and webpages...
I would like to know if it is possible to extend the emulation also to SG-1000, SC-3000.
When I try to load for example CongoBongo, I can hear sound, but no video is played... But al the controls seems to work...

Does JavaGear use TMS TMS 9918A emulation ? Is this so much different from the 9929AN ? If they are compatible is there a way to change control ports to drive also 9929AN emulation ?
Thank you very much for help!
  View user's profile Send private message Visit poster's website
  • Joined: 15 Dec 2006
  • Posts: 107
  • Location: UK
Reply with quote
Post Posted: Wed Apr 08, 2009 3:22 pm
It could be done by someone if they have the interest. It would require a reasonable amount of work though.

I have no plans to tackle this myself at this moment in time I'm afraid.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Aug 2005
  • Posts: 203
  • Location: Italy
Reply with quote
Post Posted: Thu Apr 09, 2009 9:17 am
I see, i can imagine the amount of work to do with that... I think I will give up...

Actually I don't think to be able to convert a tms9929 mess or mame source to be compatible in java for Java gear :( Too much for me :(

I just would have liked to have an "online" player of SC-3000 games for the SC-3000 site... anyway, if someday I will have time, I will try out to study c and java :P

Thank you anyway.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!