|
|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats Music - Videos - Development - Translations - Homebrew |
![]() |
| Author | Message |
|---|---|
|
JMasterSystem 0.2 release
|
|
Finally found the time to work on JMasterSystem again! There are a few changes this release, mostly minor.
Link to previous release: http://www.smspower.org/forums/viewtopic.php?t=13705 Changes: Fullscreen mode - this can be triggered by using the F key or the View menu and switched off by using the F key again. Sprite fixes - the main fix was getting sprites with Y-positions of 0xF0 to 0xFF to render properly. There were other minor bugs in my sprite rendering code that I've fixed too. Expanded menu system - help menu with controls and about items. With regards to the sound code, although performance is more or less the same this release, my testing leads me to believe (so far) that the JVM garbage collector is the issue - when I run the emu with more RAM than the default, it results in a much more stable audio stream. I plan to combat this by (a) Cutting the sample rate in half (it is currently 44.1 KHz) - this will result in half the number of buffer creations and writes, leading to less memory usage and (b) bundling a launcher script to run the JVM with more RAM. Both of these should result in a much better sounding audio subsystem, and will be addressed in the next release. I have attached the source code this time as well, as promised :-) It is GPLv3 licensed, and currently takes the form of a NetBeans project. I look forward to people using JMasterSystem 0.2, and appreciate any feedback. Thanks :-) Regards, Phil Potter |
|
|
|
|
|
|
| Very nice! I hope to start making an attempt at porting in a few weeks. Just got around to moving so it's been hectic lately. | |
|
|
|
|
|
|
Yeah, the GC is probably going to be your enemy here. I'd advise against just bundling a script that bumps the -Xmx and instead look at where you may be allocating heap memory in your game loop. You should take a look at some of the methods that may be causing hidden allocations.
For example, "panelSize = this.getSize()". The JComponent.getSize() method will allocate a new Dimension object for each call. With this in your paint method you'll be getting a new object with each frame. When the heap usage reaches the threshold the GC will kick in. Also, it might be worth switching to an active rendering approach rather than relying on the EDT (videoPanel.repaint() - which also causes a heap allocation). |
|
|
|
|
|
|
| How do you in install it?? | |
|
|
|
|
|
|
Glitch: Thanks, good point - there are many places I can optimise the code. The reason I do all my GUI code on the EDT is I've seen a few people suggesting that as Swing is not thread safe, all GUI manipulation should be done on the EDT. I'm happy to be shown a better way though :-)
KnightWarrior: No installation, just execute the jar file. |
|
|
|
|
|
|
|
It's a java file..
What kind of program to do this? |
|
|
|
|
|
|
|
If you have Java installed, the file should open with "Java(TM) Platform SE Binary" and will run by double-clicking it. If the file type and Java exe aren't associated for some reason, the exe will probably be located at
C:\Program Files\Java\jre6\bin\javaw.exe |
|
|
|
|
|
|
That's correct. However, in the case of active rendering you *can* take your rendering off of the EDT under specific circumstances: chiefly, when you are not rendering or otherwise manipulating any Swing components. I've attached some source files from a game engine idea that I have been toying with. It uses off-EDT active rendering with an AWT Canvas. Another example can be found here: http://www.cokeandcode.com/index.html?page=tutorials/spaceinvaders101 For the record, you're calling videoPanel.repaint() from your EmuCore thread :). |
|
|
|
|
|
|
| Excellent, I've not used a BufferStrategy myself before, although I've seen others do so - looks like a good idea, will have to put it in the next release. There are many little things in my code that aren't as efficient as they could be - repaint() is one, another that comes to mind is the cloning of the sound buffer on the sound thread - this creates another array object each time and isn't really necessary. I look forward to tightening things up - thanks for your help :-) | |
|
|
|
|
|
| Did some analysis into how often the GC is kicking in - about 8-9 times per second! Once I commented out the sprite rendering and tile rendering routines in my VDP, this dropped to about once every 15-20 seconds. This is clearly where the majority of the allocations are happening - the active rendering approach is a definite for the next release but so is trimming this down somehow - I can't believe how inefficiently I've written these two routines! :-p | |
|
|
![]() |