lisongmechlab / lsml

Li Song Mech Lab

Home Page:http://lisongmechlab.github.io/lsml/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve handling of chassis with nonsensical toggles.

sestrand opened this issue · comments

LSML version: 2.0.14
Screen resolution: 3440x1440
Java version: 8u321

Steps to reproduce issue:

  1. Open LSML
  2. Create and save to garage an SMN-G(S) does not need to have anything in it. (might also fail on the SMN-G)
  3. Then close the LSML
  4. Open LSML

Actual result:
Error "Unable to open garage"

-------------------------------
com.thoughtworks.xstream.converters.ConversionException: 
---- Debugging information ----
cause-exception     : java.lang.IllegalArgumentException
cause-message       : Can't toggle anything but HA/LAA
class               : org.lisoft.lsml.model.loadout.ConfiguredComponentStandard
required-type       : org.lisoft.lsml.model.loadout.ConfiguredComponentStandard
converter-type      : org.lisoft.lsml.model.export.garage.ConfiguredComponentConverter
line number         : 69
class[1]            : org.lisoft.lsml.model.loadout.LoadoutStandard
required-type[1]    : org.lisoft.lsml.model.loadout.LoadoutStandard
converter-type[1]   : org.lisoft.lsml.model.export.garage.LoadoutConverter
class[2]            : java.util.ArrayList
required-type[2]    : java.util.ArrayList
converter-type[2]   : com.thoughtworks.xstream.converters.collections.CollectionConverter
class[3]            : org.lisoft.lsml.model.garage.GarageDirectory
required-type[3]    : org.lisoft.lsml.model.garage.GarageDirectory
converter-type[3]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
class[4]            : org.lisoft.lsml.model.garage.Garage
required-type[4]    : org.lisoft.lsml.model.garage.Garage
converter-type[4]   : org.lisoft.lsml.model.export.garage.GarageConverter
version             : 2.0.14
-------------------------------
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:77)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
	at org.lisoft.lsml.model.export.garage.LoadoutConverter.parseV2(LoadoutConverter.java:243)
	at org.lisoft.lsml.model.export.garage.LoadoutConverter.unmarshal(LoadoutConverter.java:138)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readBareItem(AbstractCollectionConverter.java:132)
	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:117)
	at com.thoughtworks.xstream.converters.collections.CollectionConverter.addCurrentElementToCollection(CollectionConverter.java:98)
	at com.thoughtworks.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:91)
	at com.thoughtworks.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:85)
	at com.thoughtworks.xstream.converters.collections.CollectionConverter.unmarshal(CollectionConverter.java:80)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:499)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:425)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:277)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:499)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:425)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:277)
	at org.lisoft.lsml.model.export.garage.GarageConverter.unmarshal(GarageConverter.java:125)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1391)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1376)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1270)
	at org.lisoft.lsml.model.garage.GarageSerialiser.load(GarageSerialiser.java:73)
	at org.lisoft.lsml.view_fx.GlobalGarage.autoLoadLastGarage(GlobalGarage.java:344)
	at org.lisoft.lsml.view_fx.GlobalGarage.loadLastOrNew(GlobalGarage.java:216)
	at org.lisoft.lsml.view_fx.LiSongMechLab.foregroundLoad(LiSongMechLab.java:270)
	at org.lisoft.lsml.view_fx.LiSongMechLab.lambda$start$2(LiSongMechLab.java:223)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.concurrent.EventHelper.fireEvent(EventHelper.java:219)
	at javafx.concurrent.Task.fireEvent(Task.java:1356)
	at javafx.concurrent.Task.setState(Task.java:723)
	at javafx.concurrent.Task$TaskCallable.lambda$call$1(Task.java:1434)
	at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:185)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Can't toggle anything but HA/LAA
	at org.lisoft.lsml.command.CmdToggleItem.<init>(CmdToggleItem.java:51)
	at org.lisoft.lsml.model.export.garage.ConfiguredComponentConverter.parseV2(ConfiguredComponentConverter.java:225)
	at org.lisoft.lsml.model.export.garage.ConfiguredComponentConverter.unmarshal(ConfiguredComponentConverter.java:118)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
	... 55 more

Expected result:
Garage should open.

unfortunately, I have lost my very big garage to this. so if there is a correction that requires an edit to the garage, please let me know so that I can recover my work. the attached garage is a little one I made to reproduce this error.

StorGarage3.zip

Hello and first of all sorry for this.

The good news is that due to the way LSML writes the garage files they are either completely written or not at all. A partial or broken save should be highly unlikely and you will most likely be able to recover your garage I just need to figure out what exactly is wrong with it first.

Ah ok, so PGI has added a new Upper Arm Actuator that can be toggled. This hasn't been present in the game previously so LSML doesn't know how to handle it and instead of doing bad things to your garage it just crashes in a controlled manner with this exception.

To fix this I need to add this Upper Arm Actuator and do a release.

You can manually edit the garage file with a text editor of your choice and remove all loadouts for SMN-G(S) and then avoid saving any SMN-G(S) loadouts to your garage until the next release of LSML. But before you do this MAKE A BACKUP :)

You can identify all loadouts using SMN-G(S) by searching for chassis="881" and then removing the matchin loadout stanza, i.e. the <loadout> and </loadout> tags and everything in between. Like this:

image

Upon further inspection, the SMN-G(S) is not available in the game yet. And I cannot check the ingame mechlab to see if the UAA is actually togglable or if this is a data entry error (which we know happens).

The affected section in smn-gs.mdf:

    <Component Name="right_arm" Slots="12" HP="22" destroyedMeshSuffix="_damaged" OmniSlot="1">
      <Internal ItemID="1908" />
      <!--Shoulder-->
      <Internal ItemID="1912" />
      <!--Upper Arm Actuator-->
    </Component>

Left arm is similar. Matching omnipod from summoner-omnipods.xml:

    <component name="right_arm">
      <Hardpoint ID="30" Type="1" lookAim="1" />
      <Internal ItemID="1909" Toggleable="1" />
      <Internal ItemID="1910" Toggleable="1" />
    </component>

There's a clear mismatch between these, in the sense that the togglable items from the omnipod are missing in the MDF. For reference:

1908 = Shoulder
1909 = UpperArmActuator
1910 = LowerArmActuator
1911 = HandActuator
1912 = FixedArmorSlot

Based on this it seems that the MDF is messed up as the comments do not agree with reality. Not sure how to handle this kind of utter brokenness of a Mech that is not yet in the game.

Compare to smn-prime.mdf:

   <Component Name="right_arm" Slots="12" HP="22" destroyedMeshSuffix="_damaged" OmniSlot="1">
      <Internal ItemID="1908" />
      <!--Shoulder-->
      <Internal ItemID="1909" />
      <Internal ItemID="1912" />
      <!--Upper Arm Actuator-->
    </Component>

and matching omnipod:

    <component name="right_arm">
      <Hardpoint ID="30" Type="1" lookAim="1" />
      <Internal ItemID="1910" Toggleable="1" />
    </component>

The Hand Actuator (HA) allows weapons mounted in the arm to move in both jaw and pitch in relation to the torso. The Lower Arm Actuator (LAA) allows the weapon to move in pitch related to the torso (like the jenner for example), having neither the HA nor LAA means the weapons are fixed relative to torso, i.e. same as if the weapon was mounted in the torso.

The togglability of the Upper Arm Actuator seems pointless as there's no additional dimension of constraint that could be added to the mech's aiming ability by removing it.

The omnipod xml does not seem to a copy-pasta error which could indicate that it was added deliberately

For these reasons, and the general prevelance of such errors, I believe that this is a data entry error by PGI. It is possible that they intended to make the HA togglable and entered 1909 instead of 1911, moving 1 value in the wrong direction. This is an easy enough misstake to make if you're going off memory. However this also wouldn't make sense because omnipods are swappable between different variants of the same chassis. And having one omnipod that disables HA when none of the other variants have HAs and neither does the SMN-G, this leads me to believe that this must have been caused by confusion, possibly someone getting confused over which file they were editing or somesuch.

Based on this, I'm not going to add support to toggle UAA in LSML. However I will add some safe guards to better deal with the broken data PGI keeps putting out...

Ah that explains why I wasn't able to buy one from the store.

LAA missing in KFX-D(C) is different as there are already plenty of mechs with togglable LAA, they just forgot to put <Internal ItemID="1910" Toggleable="1" /> in the relevant OmniPod. But like I said, toggling UAA doesn't have an obvious use so I don't think they're going to make it togglable and I'm more inclined to think they messed up the data entry, again.