Jump to content
IGNORED

JStella for Java released


stephena

Recommended Posts

I know some of you have been waiting for this for quite some time, so here it is :)

 

JStella is a Java port of the Stella codebase for Java 6, by John L. Allen. This means that you can embed JStella in a webpage, and let visitors play games online, directly from your own website! It's currently at release 0.5, and functionality is still being added as we speak, but it works very well considering its age.

 

Have a look at the JStella homepage for more info.

 

I'm listed as a maintainer on this project, so you can report bugs to me if you like. But it would be better to send them directly to John, or post them in this thread. Let us know how it works ...

Link to comment
Share on other sites

The embed code example they give is not properly cross-platform. Since IE cluster-f'd their java support, Sun came up with a Java "plugin" (basically an ActiveX control wrapper) to insure that java code uses the proper runtime. I'm having trouble coming up with a single block of HTMl that will work for both IE and Firefox. If someone gets this working cross-browser, let me know. Right now I got it working in IE only.

 

Seriously, the state of embedding plugins is totally broken these days. It's a miracle you can still embed a flash with the EMBED tag and have it work on both IE and Firefox (as long as you have the plugins).

Edited by mos6507
Link to comment
Share on other sites

The embed code example they give is not properly cross-platform. Since IE cluster-f'd their java support, Sun came up with a Java "plugin" (basically an ActiveX control wrapper) to insure that java code uses the proper runtime. I'm having trouble coming up with a single block of HTMl that will work for both IE and Firefox. If someone gets this working cross-browser, let me know. Right now I got it working in IE only.

 

Seriously, the state of embedding plugins is totally broken these days. It's a miracle you can still embed a flash with the EMBED tag and have it work on both IE and Firefox (as long as you have the plugins).

Well, I did say it was a 0.5 release :) And I think the developer is a Windows user, so it's probably more extensively tested in IE. But now that the project is public and posted here, I'm sure it'll get more cross-platform love ...

Link to comment
Share on other sites

Here's what I get:

$ java -jar jstella_0_5.jar

JStella configuration file does not exist

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: java/util/ArrayDeque

at jstella.core.JSAudio.<init>(JSAudio.java:105)

at jstella.core.JSConsole.initializeAudio(JSConsole.java:316)

at jstella.core.JSConsole.<init>(JSConsole.java:123)

at jstella.runner.Intercessor.<init>(Intercessor.java:87)

at jstella.runner.JStellaMain.<init>(JStellaMain.java:61)

at jstella.runner.JStellaMain$20.run(JStellaMain.java:468)

at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:2

9)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190

 

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Link to comment
Share on other sites

Here's what I get:
$ java -jar jstella_0_5.jar

JStella configuration file does not exist

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: java/util/ArrayDeque

at jstella.core.JSAudio.<init>(JSAudio.java:105)

at jstella.core.JSConsole.initializeAudio(JSConsole.java:316)

at jstella.core.JSConsole.<init>(JSConsole.java:123)

at jstella.runner.Intercessor.<init>(Intercessor.java:87)

at jstella.runner.JStellaMain.<init>(JStellaMain.java:61)

at jstella.runner.JStellaMain$20.run(JStellaMain.java:468)

at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:2

9)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190

 

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

It requires Java version 6 (aka 1.6). I don't know if that's the issue.

Link to comment
Share on other sites

It requires Java version 6 (aka 1.6). I don't know if that's the issue.

Looks like that's it. The ArrayDeque class didn't exist until 1.6.

 

However, this means that JStella will not work on OS X, since it appears that Tiger comes with 1.4 and you can only update to 1.5 at this time (which I just did, to no avail.) I looked at Sun's web page and they don't seem to have an OS X version, just Linux, Windows and Sun. I suppose one could build 1.6 from source on their Mac, but I doubt too many people are going to do that.

 

I don't know much about this ArrayDeque class, but I wonder if it would be difficult to rewrite JStella so it isn't required?

Link to comment
Share on other sites

It requires Java version 6 (aka 1.6). I don't know if that's the issue.

Looks like that's it. The ArrayDeque class didn't exist until 1.6.

 

However, this means that JStella will not work on OS X, since it appears that Tiger comes with 1.4 and you can only update to 1.5 at this time (which I just did, to no avail.) I looked at Sun's web page and they don't seem to have an OS X version, just Linux, Windows and Sun. I suppose one could build 1.6 from source on their Mac, but I doubt too many people are going to do that.

 

I don't know much about this ArrayDeque class, but I wonder if it would be difficult to rewrite JStella so it isn't required?

I'll have to look into it. A deque is just a double-ended queue, and I assume ArrayDeque is a double-ended queue implemented using an array (vs. a linked list). Creating a new class that duplicates this functionality would be dead easy. Assuming, of course, that's not the only thing that Java6-specific in the code. I suspect it isn't, though.

Link to comment
Share on other sites

It says on the following page:

 

http://jstella.sourceforge.net/jstelladoc.html

More control options/implementations are planned for future releases.

That sounds like there might be a future version that will allow people to use a controller if they want. :thumbsup:

post-13-1187646300.jpg

Link to comment
Share on other sites

BTW, I assume this is GPL'ed. However, the class files in the jar file are all bytecode instead of human-readable source. Is the source available anywhere?

You can get it from SourceForge's CVS.

 

I'm looking right now at what's required to backport it to Java 5. The ArrayDeque thing is trivial to fix, since the JSAudio class only wants some Queue implementation; you can safely replace it with a LinkedList. There's another line in JStellaConfigurationDialog that affects the modality of one of the dialogs; removing the line gets everything to compile and run under Java 5, but keeps the configuration dialog from working properly.

 

I'll see if there's an easy fix to the latter problem.

Link to comment
Share on other sites

I'll have to look into it. A deque is just a double-ended queue, and I assume ArrayDeque is a double-ended queue implemented using an array (vs. a linked list). Creating a new class that duplicates this functionality would be dead easy. Assuming, of course, that's not the only thing that Java6-specific in the code. I suspect it isn't, though.

Nope, that's the only thing, or at least with the 0.3 version (which has source - the 0.5 version doesn't seem to) so I was able to remove the reference to that class to see if it worked, and it did. The function is in the sound code. Since I didn't actually implement the function, it only works as long as you disable sound.

 

EDIT: some of what I wrote has already been addressed... I'm a little slow at times.

Edited by batari
Link to comment
Share on other sites

BTW, I assume this is GPL'ed. However, the class files in the jar file are all bytecode instead of human-readable source. Is the source available anywhere?

You can get it from SourceForge's CVS.

 

I'm looking right now at what's required to backport it to Java 5. The ArrayDeque thing is trivial to fix, since the JSAudio class only wants some Queue implementation; you can safely replace it with a LinkedList. There's another line in JStellaConfigurationDialog that affects the modality of one of the dialogs; removing the line gets everything to compile and run under Java 5, but keeps the configuration dialog from working properly.

 

I'll see if there's an easy fix to the latter problem.

Just saw this, thanks! Let us know if you find an easy solution.

Link to comment
Share on other sites

It's easier than I thought. As it turns out,

 

DialogControlItem.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);

at JStellaConfigurationDialog.java:452 is equivalent to the Java 5-compatible

 

DialogControlItem.setModal(true)

Swap the latter line of code in, and everything works fine.

Link to comment
Share on other sites

It's easier than I thought. As it turns out,

 

DialogControlItem.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);

at JStellaConfigurationDialog.java:452 is equivalent to the Java 5-compatible

 

DialogControlItem.setModal(true)

Swap the latter line of code in, and everything works fine.

If you get a chance, please forward these findings directly to the author, so it can be fixed upstream. I forget his email address now, but it's on the webpage. Also, for those asking about source code, it is available through CVS from Sourceforge. This port is released under the GPL, and source code will always be available.

Link to comment
Share on other sites

And here's the (trivial) patch against the current CVS HEAD:

 

### Eclipse Workspace Patch 1.0
#P JStella
Index: src/jstella/core/JSAudio.java
===================================================================
RCS file: /cvsroot/jstella/jstella/src/jstella/core/JSAudio.java,v
retrieving revision 1.6
diff -u -r1.6 JSAudio.java
--- src/jstella/core/JSAudio.java	20 Aug 2007 05:11:26 -0000	1.6
+++ src/jstella/core/JSAudio.java	20 Aug 2007 22:52:50 -0000
@@ -102,7 +102,7 @@
 
 
 // Poke/Queue related variables
-	private java.util.Queue<AudioRegisterPoke> myPokeQueue=new java.util.ArrayDeque<AudioRegisterPoke>();
+	private java.util.Queue<AudioRegisterPoke> myPokeQueue=new java.util.LinkedList<AudioRegisterPoke>();
 private int myExcessCycles=0;
 private double myCyclePool=0;
 private int myPreviousCycle=0;
Index: src/jstella/runner/JStellaConfigurationDialog.java
===================================================================
RCS file: /cvsroot/jstella/jstella/src/jstella/runner/JStellaConfigurationDialog.java,v
retrieving revision 1.2
diff -u -r1.2 JStellaConfigurationDialog.java
--- src/jstella/runner/JStellaConfigurationDialog.java	20 Aug 2007 05:11:26 -0000	1.2
+++ src/jstella/runner/JStellaConfigurationDialog.java	20 Aug 2007 22:52:50 -0000
@@ -449,7 +449,7 @@
 
 private void addControlItem()
 {
-	   DialogControlItem.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
+	   DialogControlItem.setModal(true);
	myCurrentControlItem=null;
	setCurrentVKCode(KeyEvent.VK_SPACE);
	ComboBoxVirtualItem.setSelectedIndex(0);

Link to comment
Share on other sites

Nice...

 

The source is indeed there but it is not in archive form. I'm not feeling too warm about downloading all of those files individually.

 

I already tried an automated website downloader tool and it didn't work.

Edited by batari
Link to comment
Share on other sites

Nice...

 

The source is indeed there but it is not in archive form. I'm not feeling too warm about downloading all of those files individually.

 

I already tried an automated website downloader tool and it didn't work.

Don't use the Web frontend for downloading the source tree! That's there for quickly browsing individual files.

 

If you want to grab the whole source tree, use a standalone CVS client. This page has the details you need.

Link to comment
Share on other sites

Nice...

 

The source is indeed there but it is not in archive form. I'm not feeling too warm about downloading all of those files individually.

 

I already tried an automated website downloader tool and it didn't work.

Don't use the Web frontend for downloading the source tree! That's there for quickly browsing individual files.

 

If you want to grab the whole source tree, use a standalone CVS client. This page has the details you need.

Thanks! Got it, and built a jar that should work under java 5

jstella.zip

 

However, there is a much bigger problem than Java compatibility. The 6507 core needs some serious help, as it does not seem to support ANY illegal opcodes, which makes it incompatible with most homebrews, which includes bB games. So much for putting it up on bataribasic.com to let people play bB games online. At least for now.

Link to comment
Share on other sites

This is a real milestone! I've seen arcade emulators on Java for ages. The old Galaxian style stuff, Space Invaders, the games.com emulators. The general concensus in the late 90s was that the processor requirements for Java to emulate the 2600 could not be met with the machines of that day. That's clearly not the case anymore. Stella has improved. Java has improved. CPU speeds have obviously improved a lot.

 

I'd be curious to know how well it runs on older PCs, like ancient 1GHZ celerons laptops with cruddy embedded video. I really want to know where the cutoff is. It runs fine on my PIV 2.4ghz.

 

That being said, Pitfall II sound is a little scratchy, but that's to be expected. Flicker has lots of tearing artefacts. Wish there was a way for Java to lock to the monitor refresh.

 

Solaris still has the glitch on the warp out. Didn't that get fixed yet in the main Stella codebase?

Link to comment
Share on other sites

That being said, Pitfall II sound is a little scratchy, but that's to be expected. Flicker has lots of tearing artefacts. Wish there was a way for Java to lock to the monitor refresh.

Some of the Pitfall II sounds actually sound a little better than Stella itself. I'll have to research that. As for flickering, I don't believe the emulator is using phosphor mode for 30Hz flicker. It is built in, since I've used it when running JStella as a standalone JAR file (it's an option in the menu).

Solaris still has the glitch on the warp out. Didn't that get fixed yet in the main Stella codebase?

No, that hasn't been fixed in Stella yet either.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...