[Tool] FTL Ship Editor: Superluminal [NOT UPDATED TO AE]

Discuss and distribute tools and methods for modding. Moderator - Grognak
medevil
Posts: 1
Joined: Tue Feb 05, 2013 11:20 pm

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u3-2-

Postby medevil » Tue Feb 05, 2013 11:26 pm

I'm having an issue to "start" the program, it tells me that It cannot access jarfile "superluminal_win32.jar" I've been searching around and all of that, but no luck.

Anthing I could do to fix this?
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u3-2-

Postby kartoFlane » Wed Feb 06, 2013 12:28 am

Well, I suppose it's up to me then to get the topic back on track :E Perhaps an update will help with that...

Mostly quality-of-life kind of improvents in this version.
Changes:
  • Changed - UI redesigned, since it didn't really work well stacked vertically.
  • Changed - Shield graphic now stays in the same place while resizing. Also, it is now resized by alt-right-clicking on it and dragging.
  • Changed - Enemy ships' weapons, shields and engines systems can be set to a maximum level of 10.
  • Changed - Hotkeys for Weapon Mounting and Operating Station tools remapped to R and T, respectively.
  • Added - Application window can now be freely resized, the grid area bounds will automatically adjust to fit the entire window.
  • Added - Right clicking on hull, shields, floor, cloak and miniship buttons now opens up a small menu, where you can reset the path (unload the image), or show the image's location in the OS' explorer (opens its parent directory).
  • Added - Selected mounts now display a small number above them, which indicates their order (i.e.: mount with the number one corresponds to the first weapon on the list in Ship Properties, number two to second weapon, etc.).
  • Added - Enemy ships' systems can now be set to be unavailable at start (needs testing to confirm if it actually makes enemies sometimes have those systems available).
  • Added - Hull, floor and shield graphics can now be shown/hidden separately.
  • Added - It is now possible to view the cloaked version of the ship.
  • Added - Nudge function: while an element is selected (except door), pressing arrow keys will move that element one pixel (or one grid cell for rooms). Shift+arrow key will move an element 35 pixels (no change for rooms)
  • Added - Ships can now be converted; player to enemy and enemy to player.
  • Added - In the ship browser, ships can also be loaded by double clicking their name.
  • Fixed - Projects saved in version 2-2 are now be compatible with 6-2.
  • Fixed - Fixed the issue with items selected in precision mode being randomly snapped to the top left corner of the display area.
  • Fixed - Corrected a small typo in exporting function that apparently messed up the exported enemy ships' hull images.
  • Fixed - Enemy ships no longer get system interiors assigned when saving a project.
  • Fixed - Loading a project that had no hull or shield image set no longer crashes the app.
  • Fixed - Browsing for project and graphics should now properly open to last used directory. They also use separate variables to save those directories.
Whew. Also, as far as I've checked, it's not possible to change enemy ships' shield graphic, it'll always default to enemy_shields.png.

Download directory: Superluminal 6-2-13


@Tweevle
I have FTL on Steam too, and updated to version 1.03.1 as well. Though I have unpacked those archives quite some time ago (probably before the patch), and after fiddling with some mods to top that, so that might've been the cause of that.

@medevil
Seems like this caused by the .bat file not being able to find the file it is supposed to execute. So I'd hazard a guess you're using that to start the app... I'm pretty sure that the bat file itself is not the cause (I have to use it myself), unless you've renamed the jar file. Hm.
a) Make sure that the .bat file is in the same directory as the .jar file and the library.
b) If you have files' extensions hidden, "unhide" them (link) and try again. Alternatively, open the bat file with any text editor and delete the ".jar" at the end of second line, save it and then try to run again.
c) If that doesn't help, open the bat file with a text editor. Find the path to superluminal_win32, copy the path, and paste it into the bat file, so that the second line looks like this (include the quotation marks if the path has any spaces):

Code: Select all

start javaw -jar "C:\path\to\superluminal_win32.jar"
Obviously, include the correct path and drive, pointing to where the jar file is located.
d) If none of the above helps, open the bat file with a text editor and in the second line find the word javaw and delete the w, save and try to run again.

If it still doesn't work, then I'm out of ideas :/
Superluminal2 - a ship editor for FTL
Lord0fHam
Posts: 54
Joined: Sat Feb 02, 2013 1:10 am

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u3-2-

Postby Lord0fHam » Wed Feb 06, 2013 5:22 am

kartoFlane wrote:Well, I've no idea about macs, as I've said earlier... Do you get any specific message, anything you could plug into google and find a solution?
Also, take a look at this, first answer: try to open the console app for mac and then run the jar file, maybe some more information can be gathered this way.
Another thing is that, from what I've read, most macs have Java 5 installed, where Superluminal was compiled with Java 7, but I guess you already took care of that.


I got Java 7 installed and I am certain it works on my Mac (just FYI, any current MAC with built-in Java has 6, not 5). The only message I get is "The Java JAR file [the file name] could not be launched. Check the Console for possible error messages." But there are no messages in the Mac console OR in the java console so it doesn't even look like it gets that far. Before I give you some command line output, here's a question: The Mac download gives me 2 files
superluminal_mac_x64\superluminal_mac64.jar
superluminal_mac_x64\superluminal_mac64_lib\swt.jar

Now first of all, the file names are bad because of the backslashes. But which file am I supposed to double-click on?
So if I remove the backslashes and try to open them on the command line, here is what I get. Maybe this will help you troubleshoot:
iMac:~ mike$ java -jar /users/mike/desktop/superluminal_mac_x64superluminal_mac64.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Layout
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
at java.lang.Class.getMethod0(Class.java:2694)
at java.lang.Class.getMethod(Class.java:1622)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Layout
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 6 more
iMac:~ mike$ java -jar /users/mike/desktop/superluminal_mac_x64superluminal_mac64_libswt.jar
no main manifest attribute, in /users/mike/desktop/superluminal_mac_x64superluminal_mac64_libswt.jar
Image
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u3-2-

Postby Vhati » Wed Feb 06, 2013 10:08 am

Lord0fHam wrote:superluminal_mac_x64\superluminal_mac64.jar
superluminal_mac_x64\superluminal_mac64_lib\swt.jar

Now first of all, the file names are bad because of the backslashes.

On your desktop, you should have a dir named "superluminal_mac_x64".
In it, there should be "superluminal_mac64.jar" and a dir named "superluminal_mac64_lib".
And inside "superluminal_mac64_lib", there should be "swt.jar".

Lord0fHam wrote:But which file am I supposed to double-click on?

"superluminal_mac64.jar"

Or via command line...
cd /users/mike/desktop/superluminal_mac_x64/
java -jar superluminal_mac64.jar
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u6-2-

Postby kartoFlane » Wed Feb 06, 2013 12:22 pm

Well, it seems like I did indeed fail to create the Mac version correctly. Guess directories create in windows don't really translate too well to a Mac... I'll have to learn how to make app bundles on windows.
Apart from that, Vhati is correct. Follow everything he's said and it should work.
Superluminal2 - a ship editor for FTL
Lord0fHam
Posts: 54
Joined: Sat Feb 02, 2013 1:10 am

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u6-2-

Postby Lord0fHam » Wed Feb 06, 2013 3:23 pm

OK, made those changes so at least it's set up correctly. Macs are UNIX-based, so you have to use forward slashes, not backslashes. Maybe that's why it didn't unzip correctly.

So now I get the same error if I double-click, but different errors on the command line. Maybe this will be helpful to you. I suspect the first 2-3 lines are the ones that matter:
iMac:superluminal_mac_x64 mike$ java -jar superluminal_mac64.jar
***WARNING: Display must be created on main thread due to Cocoa restrictions.
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Display.error(Unknown Source)
at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source)
at org.eclipse.swt.widgets.Display.create(Unknown Source)
at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.getDefault(Unknown Source)
at org.eclipse.swt.widgets.Display$1.run(Unknown Source)
at org.eclipse.swt.graphics.Device.getDevice(Unknown Source)
at org.eclipse.swt.graphics.Resource.<init>(Unknown Source)
at org.eclipse.swt.graphics.Font.<init>(Unknown Source)
at org.eclipse.wb.swt.SWTResourceManager.getFont(SWTResourceManager.java:361)
at org.eclipse.wb.swt.SWTResourceManager.getFont(SWTResourceManager.java:322)
at com.kartoflane.superluminal.core.Main.<clinit>(Main.java:236)

I do have other jar files that work fine, so the problem is definitely in your package.
Image
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u6-2-

Postby kartoFlane » Wed Feb 06, 2013 4:41 pm

That line (236) is the one that's setting the font variable for use in the entire application:
public static Font appFont = SWTResourceManager.getFont("Segoe UI", 9, SWT.NORMAL);

Seems like SWT for Mac requires programs to be deployed like normal Mac applications, with .app folder and everything. Meh, gotta look it up.

Edit:
One thing I've picked up while searching for a solution is that SWT applications on Mac apparently have to be started with an additional parameter, -XstartOnFirstThread. So the command will have to look like this:
java -XstartOnFirstThread -jar superluminal_mac64.jar
However, I'm pretty sure the cause of the "crash" is that the SWTmanager is looking for the font to retrieve in the superluminal.app bundle, which doesn't exist. That's just pure guessing on my part, though.
Superluminal2 - a ship editor for FTL
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u6-2-

Postby Vhati » Wed Feb 06, 2013 6:30 pm

kartoFlane wrote:That line (236) is the one that's setting the font variable for use in the entire application:
public static Font appFont = SWTResourceManager.getFont("Segoe UI", 9, SWT.NORMAL);

I'm pretty sure the cause of the "crash" is that the SWTmanager is looking for the font to retrieve in the superluminal.app bundle, which doesn't exist. That's just pure guessing on my part, though.

appFont = SWTResourceManager.getFont("", 9, SWT.NORMAL); // Saw this floating around, default face I guess.
appFont = display.getSystemFont(); // System font doesn't like being disposed, but at least it exists. ;)

There are usually few standard names that work across platforms: "Courier", "Times", "Helvetica", "Sans", "Monospaced". That sort of thing. Dunno what that list looks like in SWT though.

Code: Select all

// Dump available unique font names on this system.
String prevName = null;
for (org.eclipse.swt.graphics.FontData f : display.getFontList(null, true) ) {
  if (!f.getName().equals(prevName)) {
    System.out.println(f.getName());
    prevName = f.getName();
  }
}

Article: StackOverflow - SWT OS agnostic way to get monospaced font
Grr. That lib doesn't have safe constants to request. So either ask for common names and/or have some alternatives to try.

- - - - - -

kartoFlane wrote:Seems like SWT for Mac requires programs to be deployed like normal Mac applications, with .app folder and everything. Meh, gotta look it up.


Article: Deploying SWT Applications on Mac OS X
These application bundles are usually distributed inside compressed disk images with the extension .dmg.

Clarification: Creating a dmg isn't required. It's just an archive* like zip.
The dir whose name is "*.app", plist, etc together are the bundle.


* Technically, dmg's are HFS+ formatted disk images. Not fun to create if you aren't on OSX yourself.

- - - - - -

kartoFlane wrote:SWT applications on Mac apparently have to be started with an additional parameter

You can create a double-clickable batch equivalent for linux/OSX.
runme.command

Code: Select all

#!/bin/sh
HERE=$(dirname "$0");
cd "${HERE}";

java -XstartOnFirstThread -jar superluminal_mac64.jar
Save that as an ascii text file with unix-style LF line endings (not dos-style CR-LF).
Last edited by Vhati on Wed Feb 06, 2013 7:11 pm, edited 1 time in total.
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u6-2-

Postby kartoFlane » Wed Feb 06, 2013 7:10 pm

Vhati wrote:appFont = SWTResourceManager.getFont("", 9, SWT.NORMAL); // Saw this floating around, default face I guess.
appFont = display.getSystemFont(); // System font doesn't like being disposed, but at least it exists. ;)

Yeah, the reason I forced the font instead of using system's default was to fix SanGue's issue (the first one the bugs list). Had no idea how to fix it otherwise. Guess my choice of font was rather subpar :/

As for the links, I've stumbled upon them all myself, though they all seem to be outdated (I've found information somewhere that sometime in 2005/2006 SWT went from using Carbon library to Cocoa (or something) for Macs, and that this change was pretty big, requiring some new way to handle app deployment. Most of the documentation I've found was from 2005 or older. I possibly misunderstood the whole affair, though).
I've been googling for like 3 hours, but I still have no idea how to create the bundle for Mac on Windows :/
Superluminal2 - a ship editor for FTL
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Tool] Yet Another FTL Ship Editor: Superluminal - u6-2-

Postby Vhati » Wed Feb 06, 2013 7:29 pm

I was editing my previous post when you replied. :oops: There may be some extra info when you look back at it now.

kartoFlane wrote:Yeah, the reason I forced the font instead of using system's default was to fix SanGue's issue (the first one the bugs list).
Oh. I assume this is just a startup issue of shrinking to the minimum size to fit buttons and such. Since the buttons themselves are sizing appropriately. Should be a layout choice, a fit() method on the window, or something to tally up the button's widths and set the window's size yourself.

I've been googling for like 3 hours, but I still have no idea how to create the bundle for Mac on Windows :/
They do their best to make it mysterious, but it's conceptually not much cleverer than a batch in a folder. I'll write something up and post when I'm done revising this time. ;)