[Tool] ftldat r7

Discuss and distribute tools and methods for modding. Moderator - Grognak
Icehawk78
Posts: 230
Joined: Tue Sep 18, 2012 4:55 pm

Re: [Tool] ftldat r7

Postby Icehawk78 » Thu Oct 04, 2012 5:57 pm

All4n wrote:Thanks bas!

A feature request would be a .merge file/function.

Example.

sector_data.xml.merge:

Code: Select all

<sectorDescription name="NEBULA_SECTOR" minSector="0" unique="false">
   <event name="YOUR_EVENT" min="1" max="1"/>
</sectorDescrption>


Final output:

Code: Select all

<sectorDescription name="NEBULA_SECTOR" minSector="0" unique="false">
   <nameList>
      <name>Uncharted Nebula</name>
   </nameList>
   <trackList>
      <track>deepspace</track>
      <track>void</track>
   </trackList>
   <rarityList>
      <blueprint name="engi" rarity="4"/>
      <blueprint name="mantis" rarity="4"/>
      <blueprint name="energy" rarity="4"/>
      <blueprint name="slug" rarity="3"/>
      <blueprint name="rock" rarity="4"/>
      <blueprint name="human" rarity="1"/>
   </rarityList>
   <startEvent>START_BEACON_NEBULA</startEvent>
   <event name="STORE" min="0" max="1"/>
   <event name="ITEMS" min="1" max="3"/>
   <event name="NEBULA_STORE" min="1" max="1"/>
   <event name="NEBULA_EMPTY" min="4" max="4"/>
   <event name="NEBULA_HOSTILE" min="5" max="6"/>
   <event name="NEBULA_NEUTRAL" min="7" max="8"/>
   <event name="DISTRESS_BEACON" min="1" max="3"/>
   <event name="YOUR_EVENT" min="1" max="1"/>
</sectorDescrption>

This looks more like a question for Grognak's Mod Manager and similar tools - this tool is essentially just for unpacking/repacking the .dat files, and what you want is neither straightforward nor necessarily straightforward. Consider the following source/mod XML files:

Code: Select all

<!-- Source -->
<event name="FINISH_BEACON">
   <text>You've arrived at the Long-Range Beacon. When the FTL Drive is charged you can jump to the next Sector.</text>
   <choice hidden="true">
      <text>Continue...</text>
      <event load="NON_HOSTILE"/>
   </choice>
</event>

<!-- Mod -->
<event name="FINISH_BEACON">
   <text>This is the end. Prepare yourself!</text>
   <choice hidden="true">
      <text>Continue...</text>
      <event />
   </choice>
   <choice hidden="true">
      <text>Pick a fight!</text>
      <event load="HOSTILE1"/>
   </choice>
   <choice hidden="true">
      <text>Go shopping!</text>
      <store />
   </choice>
</event>


1) What would even expect this to merge to?
2) Why? (It was intentionally ambiguous, for the record.)

Personally, I don't think that this tool should have XML merging, simply because that's outside of the scope,and should be done by other tools which implement this, rather than the ftldat tool itself.
All4n
Posts: 44
Joined: Fri Sep 28, 2012 12:29 pm

Re: [Tool] ftldat r7

Postby All4n » Fri Oct 05, 2012 6:54 am

Icehawk78 wrote:
All4n wrote:bla bla bla...

Personally, I don't think that this tool should have XML merging, simply because that's outside of the scope,and should be done by other tools which implement this, rather than the ftldat tool itself.


You are 100% right, I misunderstood this. ftldat is for unpacking :D
Got a event, alternative text, or maybe a new sector? Add it to the Additional Events & Texts (AET) mod! Credits will be given, and you will help make a big pack of content!
Coolguybest
Posts: 5
Joined: Fri Oct 05, 2012 10:03 pm

Re: [Tool] ftldat r7

Postby Coolguybest » Fri Oct 05, 2012 10:08 pm

Am I missing something?
When I try to execute the ftldat file, a window comes up for a split second and then goes away.
Is that normal, is something wrong, or do I need to look for another way to pack files?
Thanks in advance.
busboybud
Posts: 5
Joined: Sat Oct 06, 2012 9:14 pm

Re: [Tool] ftldat r7

Postby busboybud » Sun Oct 07, 2012 11:32 pm

Coolguybest wrote:Am I missing something?
When I try to execute the ftldat file, a window comes up for a split second and then goes away.
Is that normal, is something wrong, or do I need to look for another way to pack files?
Thanks in advance.


you don't want to execute the fltdat file, you want to use the .bat files from http://www.mediafire.com/download.php?il6j6rg3v9s12ya
or
create your own using the following commands:

Unpack:

Code: Select all

@ECHO OFF
start ftldat unpack mods/original/data.dat dev_data/

ftldat is the call to the program, unpack/pack lets the program know which function to execute. the third parameter is where to grab the .dat file, the second is where to place the unpacked files.

Pack:

Code: Select all

@ECHO OFF
start ftldat pack data.dat dev_data/data

the third parameter is what the file should be called, the fourth is where to locate all the files.
MrAdam
Posts: 7
Joined: Mon Oct 08, 2012 12:56 pm

Re: [Tool] ftldat r7

Postby MrAdam » Mon Oct 08, 2012 12:57 pm

Any chance you might document the data structure to make it easier for others to develop tools like this?

Regards, Adam.
Icehawk78
Posts: 230
Joined: Tue Sep 18, 2012 4:55 pm

Re: [Tool] ftldat r7

Postby Icehawk78 » Mon Oct 08, 2012 1:14 pm

MrAdam wrote:Any chance you might document the data structure to make it easier for others to develop tools like this?

Regards, Adam.

The project is open sourced on Github, so you can view how it's working there: https://github.com/bwesterb/ftldat
MrAdam
Posts: 7
Joined: Mon Oct 08, 2012 12:56 pm

Re: [Tool] ftldat r7

Postby MrAdam » Mon Oct 08, 2012 1:34 pm

Icehawk78 wrote:
MrAdam wrote:Any chance you might document the data structure to make it easier for others to develop tools like this?

Regards, Adam.

The project is open sourced on Github, so you can view how it's working there: https://github.com/bwesterb/ftldat

Ive been looking at that for the past two days. Im coding Java, which handles this in a much different way.
Icehawk78
Posts: 230
Joined: Tue Sep 18, 2012 4:55 pm

Re: [Tool] ftldat r7

Postby Icehawk78 » Mon Oct 08, 2012 2:40 pm

MrAdam wrote:Ive been looking at that for the past two days. Im coding Java, which handles this in a much different way.

Out of curiosity, two questions:

  1. Why? ("Because I want to" or whatnot is a perfectly valid reason, I'm just curious, given that the existing one seems to work flawlessly and is fully cross-platform)
  2. I'm semi-familiar with Python (enough to be able to read and know what's going on, not quite as much to write new code from scratch) and very familiar with Java. Is there anything in particular you're having difficulty with? I may be able to help, or at least offer suggestions on what to look at/for.
MrAdam
Posts: 7
Joined: Mon Oct 08, 2012 12:56 pm

Re: [Tool] ftldat r7

Postby MrAdam » Mon Oct 08, 2012 2:44 pm

Icehawk78 wrote:
MrAdam wrote:Ive been looking at that for the past two days. Im coding Java, which handles this in a much different way.

Out of curiosity, two questions:

  1. Why? ("Because I want to" or whatnot is a perfectly valid reason, I'm just curious, given that the existing one seems to work flawlessly and is fully cross-platform)
  2. I'm semi-familiar with Python (enough to be able to read and know what's going on, not quite as much to write new code from scratch) and very familiar with Java. Is there anything in particular you're having difficulty with? I may be able to help, or at least offer suggestions on what to look at/for.

Why? Well, I was thinking about making a mod manager with a bit more features than the existing one.
Im an Android developer and I don't have much experience with Java desktop development (started programming Java when I started working with Android), so my skillset is mostly for mobile stuff. Anyways, for what I can see, the .dat files are just binary encoded C objects? I would just like to know the basic structure of those objects, as it would make it much easier for me to work with :)
EDIT: Right now Im trying to get the data reading to work using a library called Preon, which enables be to define the structure of the byte-data, and it can then map it to java classes to make it easier to work with, like this:

Code: Select all

public class FTLData {
    @BoundNumber(byteOrder = ByteOrder.LittleEndian, size = "32")
    public long indexSize;
}
Icehawk78
Posts: 230
Joined: Tue Sep 18, 2012 4:55 pm

Re: [Tool] ftldat r7

Postby Icehawk78 » Mon Oct 08, 2012 6:10 pm

MrAdam wrote:Why? Well, I was thinking about making a mod manager with a bit more features than the existing one.

Im an Android developer and I don't have much experience with Java desktop development (started programming Java when I started working with Android), so my skillset is mostly for mobile stuff. Anyways, for what I can see, the .dat files are just binary encoded C objects? I would just like to know the basic structure of those objects, as it would make it much easier for me to work with :)
EDIT: Right now Im trying to get the data reading to work using a library called Preon, which enables be to define the structure of the byte-data, and it can then map it to java classes to make it easier to work with, like this:

Code: Select all

public class FTLData {
    @BoundNumber(byteOrder = ByteOrder.LittleEndian, size = "32")
    public long indexSize;
}

Ah, gotcha. That makes sense (I'm looking into doing something similar with Ruby), then.

From what I can gather, the file format looks to just be this:

Code: Select all

4: Index Size
4*Index Size: Indices
Files: (For each Index)
    4: File Size
    4: Filename Size
    Filename Size: Filename
    File Size: File


Looking up Preon, I'd think you'd want something like this:

Code: Select all

public class BinFile {
    @BoundNumber(size="32", byteOrder=LittleEndian) Integer index_size
    @BoundList(type=Integer.class, size="index_size", byteOrder=LittleEndian)
    @BoundList(type=DataFile.class, size="index_size", byteOrder=LittleEndian)

    public class DataFile {
        @BoundNumber(size="32", byteOrder=LittleEndian) Integer file_size
        @BoundNumber(size="32", byteOrder=LittleEndian) Integer filename_size
        @BoundString(size="filename_size", byteOrder=LittleEndian) String filename
        //@Bound(size="file_size", byteOrder=LittleEndian) ChunkOfData file - not sure offhand how you'd populate this
    }
}


Note: None of this is tested, it's just what I gleaned from the python.