Sunday, November 09, 2008

More Java - man I hate java...

So with the release yesterday Minus4j is actually in pretty reasonable shape. Sure it needs the source cleaned a little - theres loads of commented out crap in there, but on the whole not bad. So as I was adding another paramater to it (allowing you to specify the initial frame skip - since Xeo3 runs at 25Hz, you never NEED 50fps drawing), I suddenly realised that these days, Java probably provides image scaling as part of the API!

And sure enough.... there it is. So, I've now removed the software scale I was using and now use the API. This is of couse good for 2 reasons. One... being part of the API means it might be assembler optimised, and not just some tacky code I did, and second it reduces the code I've to maintain. Its all good.

Before I set it all aside again, I'm going to look into sound. I do this every 3 years or so to see how much effort it would be to add sound to Minus4j. When I started, you just couldn't, but there are now a few apps which do what I need to, so chances are its not too hard. All I really need is a buffer or two that plays music at a specific rate through a software buffer. I can then fill this up as I emulate things. This would let me plug in TED and SID music - not to mention samples that Minus4w can play. That would be cool - then all I'd need is some basic D64 support!

Oh... and while I won't release all these little bits, I will update both my blog and Plus4world to use all the latest stuff, then release it when theres enough to package it all up.

10 comments:

Nerdati said...

Don't want to discourage you, Mike, but Java under Linux has some serious issues with Minus4j, it is slow like hell. It is likely a "feature" inherent to Linux rather than anything else, just figured I'd let you know. If it can be fixed i!d be curious to know how though... :)

Mike said...

Is this the new one with the audio, or an older one?

I suspect the JIT just isn't good under Linux though.

Nerdati said...

Whoa, don't even think about audio there, haha :-) For now I get like 5 fps, so imagine that.... :-)

I think IBM had a better JIT than the one shipped with Ubuntu. The one I tried was the latest/greatest official one from Sun (1.6.0? or somesuch)

Mike said...

I'm trying to get a VMWare Linux image so I can test some Linuz stuff. It was running fine on the Mac, although I'll have to try it with the audio now as well.

5fps sounds like its not using a JIT at all! :)

Mike said...

Well, I've just installedMicrosoft Virtual PC 2007, and Ubuntu as a virtual machine.

On top of that I've installed Sun's latest Java VM and I'm getting a solid 50fps in an unscaled window. I can only guess you have a different JavaVM installed or something as this seems fine. :)

Its also running inside firefox... so all seems well there!!

Nerdati said...

That's odd. The last time I checked this out on Linux many moons ago it was also very slow (that time in Netscape) so it's been consistent over the years for me :-)

Mike said...

Could just be netscape under Linux. But with Firefox and Suns JVM it was running fine! So there! ;)

Maarten Storm said...

I'm running on WinXp64 dual core with 4G internal memory. Minus4J eats up 80% off both the cpu's. I have the idea that there are some threading issues. Have you already looked at Java 1.6 and the modified threading stuff in there. Maybe an idea to OpenSource it so we can help you.

Mike said...

I suspect I'll be releasing the source soon as I've pretty much finished everything I wanted to do with it.

If anyone comes back with fixes, I'll do more releases though.

I'm putting most of the slow down firmly in Java's court as things like screen scaling should be virtually free these days and its far from it.

I haven't really moved up from the Java 1.2 API which is what I started on, mainly because I want to done with it. I'll fix bugs and add minor features... but I'm through with adding major stuff.

I may do more later with SilverLight, as I prefer C# for doing things, and it runs properly. But they still need to add sound support so it'll be a while for that.

Maarten Storm said...

If you open source it I can actually help you to move minus4J to Java 1.6. It is my daily work, so that will be no problem. I hioe we can help.