Page 1 of 2

[Bug] XML Typos in 1.03.3 (Tooltips added)

Posted: Sat Jan 26, 2013 12:55 pm
by Vhati
Mainly incorrect/missing closing tags.



<autofire>Toggle to active/deactive weapons automatically firing.</autoFire>
(closing tag, and "Toggle weapons automatically firing.")


<brawling> appears in both the "sound loops" section and the "crew sounds" section?


DEFAULT shipBlueprint: <shipBlueprint>...</ship>
PLAYER_SHIP_HARD_2 shipBlueprint: <shields>...</slot>
PLAYER_SHIP_STEALTH shipBlueprint: "blah"img="blah"
PLAYER_SHIP_ROCK shipBlueprint: "blah"img="blah"
PLAYER_SHIP_ROCK_2 shipBlueprint: "blah"img="blah"
LONG_ELITE_MED shipBlueprint: img="rebel_long_hard" should be "rebel_long_elite"
LONG_ELITE_HARD shipBlueprint: img="rebel_long_hard" should be "rebel_long_elite"

<!-- sardonyx: Missing closing tag
<?xml ... ?>: This declaration must be the first line, or absent altogether.

AUTO_BASIC: <shipBlueprint>...</ship>
AUTO_ASSAULT: <shipBlueprint>...</ship>
JELLY_CROISSANT: "blah"room="blah"

All the following shipBlueprints: "blah"max="blah"


PIRATE_CIVILIAN_BEACON: <choice hidden="true" hidden="true">
STORE_TEXT: <textList>...</text>

<!-- QUESTS: Missing closing tag
<!-- Neutral: Missing closing tag

I'm not sure if these are valid, needing a space, or worth removing altogether.

FUEL_ON_MANTIS_ATTACK: <textList>...</event>
FUEL_ON_REBEL_ATTACK: <textList>...</event>

DISTRESS_ENGI_REACTOR: <event>...</choice>
DISTRESS_ENGI_REACTOR_LIST1: <text>...</event>
ENGI_UNLOCK_2REAL_SURRENDER: <event>...</missing closing tag>

MANTIS_NAMED_THIEF: <event>...</text>
MANTIS_NAMED_THIEF_DEFEAT: <text>...</event>

NEBULA_SLUG_CHOOSE_DEATH: <choice>...</event>

ZOLTAN_LIFERAFT_HIRE: <eventList>...</event>

PIRATE_ASTEROID: <choice>...</missing closing tag>

NEBULA_REBEL_UNDETECTED: <choice hidden="true" hidden="true">

REBEL_AUTO_HACKSHIELDS: <deadCrew>...</destroyed>


MANTIS_SECTOR: <name>...</text>
MANTIS_HOME: <name>...</text>
Almost every sector: <sectorDescription>...</sectorDescrption>

All event files and sector_data
Section comment blocks: W3C: <!-- No other dashes should touch. -->

Historically, FTL 1.02.6 had them all too - as well as a bunch in blueprints.xml: itemBlueprints (<title>...</ship>), weaponBlueprints (<speed>...</image>), systemBlueprints (<title>...</type>), and an augBlueprint (extra title) - which were fixed at some point.

Further back, FTL 1.01 had those, plus two typos in events_crystal.xml: CRYSTAL_CACHE_BREAK (<text>...</event>).

Edit: Moved FUEL_ON_REBEL_ATTACK to events_fuel.xml. (2013-01-27)
Edit: Added events_ships.xml and blueprints typos. (2013-02-03)
Edit: Relabelled historical glitches that persisted through 1.02.6. (2013-02-21)
Edit: Added sector_data.xml typos under events. (2013-03-04)
Edit: Added sounds.xml under Misc. (2013-03-12)
Edit: Added tooltips.xml under Misc. (2013-03-15)

Re: [Bug] Event XML Typos

Posted: Sat Jan 26, 2013 11:07 pm
by thashepherd
Vhati, how'd you find those?

Re: [Bug] Event XML Typos

Posted: Sun Jan 27, 2013 4:54 am
by Vhati
thashepherd wrote:Vhati, how'd you find those?

I'm teaching the Profile/SavedGame Editor to add/modify quest events on the sector map.

But in order to read FTL's resources, I have to fix the XML at runtime to make it parsable, with regexes.
That's the list of things that made my parser cry.*
Each time I hit one, I added a regex to correct it. Then I'd hit another, correct it, and so on until it parsed.

* I only eyeballed the comment typos, because lazily stripping lines between <!-- and --> beforehand (based on which one was last seen) was working well enough.

For the footnote, I used WinMerge to compare extracted resources from 1.01 vs 1.03.1.

Re: [Bug] Event XML Typos

Posted: Sun Jan 27, 2013 8:12 pm
by thashepherd
Was more asking about your parser - and yeah, WinMerge is a godsend. Did you just do it programmatically? I've been lazy...

Re: [Bug] Event XML Typos

Posted: Mon Jan 28, 2013 1:16 pm
by Vhati
thashepherd wrote:Was more asking about your parser [...]. Did you just do it programmatically?

  • I read an events file into a buffer. Then turn it into Java classes with JAXB.
  • When I get an error, I have the logger report the line, and dump the buffer (the XML document as it existed at the time of parsing).
  • I open the log in a text editor and manually look at nearby lines to find what made it invalid.
  • Then, above the code that starts the parsing, I add a regex describing the bad block of text, and how part of it should be replaced to make it valid.
  • Repeat.

I try to make the pattern specific enough that it won't accidentally try to 'fix' modders' tags (or if it does, only tags that needed fixing). If a modder alters one of these typoed events such that the pattern wouldn't recognize it, I'll just expect him/her to correct the tags while they're at it.

Code: Select all

      StringBuilder sb = new StringBuilder();
      String ptn; Pattern p; Matcher m;

[... Map a region of data.dat to an input stream as if it were a file; read into sb buffer...]

      if ( "events_fuel.xml".equals(fileName) ) {
         // events_fuel.xml: FUEL_ON_MANTIS_ATTACK (FTL 1.03.1)
         // events_fuel.xml: FUEL_ON_REBEL_ATTACK (FTL 1.03.1)
         ptn = "";
         ptn += "(<textList *(?: [^>]*)?>\\s*";
         ptn += "(?:<text *(?: [^>]*)?>[^<]*</text>\\s*)*)";
         ptn += "</event>"; // Wrong closing tag.

         p = Pattern.compile(ptn);
         m = p.matcher(sb);
         while ( m.find() ) {
            sb.replace(m.start(), m.end(),"</textList>");
      // Parse cleaned XML
      Encounters evts = (Encounters)unmarshalFromSequence( Encounters.class, sb );

To make an exhaustive typo list, I change that while loop, to only replace the first N matches. Where N is the number of that error I'm aware of. If parsing fails, I check the log for another event name to add to the list, increment N, and repeat.

Re: [Bug] Event XML Typos

Posted: Fri Feb 01, 2013 3:16 am
by Vhati
thashepherd wrote:Was more asking about your parser - and yeah, WinMerge is a godsend. Did you just do it programmatically? I've been lazy...

If you're still curious, the class I'm using to map and clean dats is on github here.

Re: [Bug] Event XML Typos

Posted: Sat Feb 02, 2013 12:15 am
by thashepherd
Thanks a lot!

Re: [Bug] XML Typos in 1.03.1 (Events+Blueprints)

Posted: Sun Feb 03, 2013 6:15 am
by Vhati
I revisited my older regexes and catalogued the blueprint typos that patches have missed so far.
(See first post.)

Re: [Bug] XML Typos in 1.03.1 (Blueprints+Events+SectorData)

Posted: Tue Mar 05, 2013 4:49 am
by Vhati
Added sector_data.xml to the first post, under events.

Re: [Bug] XML Typos in 1.03.1 (Sounds added)

Posted: Tue Mar 12, 2013 10:14 am
by Vhati
Added sounds.xml to the first post.