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:
public class BinaryFile {
@BoundNumber() public int indexSize;
@BoundList(size = "indexSize") public int[] indexes;
@BoundList(size = "10") public DataFile[] files;
public class DataFile {
@BoundNumber() public int size;
@BoundNumber() public int filenameSize;
@BoundString(size = "filenameSize") public String filename;
@BoundString(size = "size") public String data;
}
}
The problem right now is that it fails if the number of files is not the same as the index size, as it will then try to load empty files.. I will have to find out a way for it to only load if the corresponding file index is not 0, thats why the 10 is hardcoded right now
this is what I need for the size parameter of the file array, but haven't figured out how yet.
public class BinaryFile {
@BoundNumber() public Integer indexSize;
@BoundList(size = "indexSize") public List<Integer> indexes;
@BoundList(size = "indexUsed()") public List<DataFile> files;
public int indexUsed() {
int i = 0;
for (Integer index : indexes) {
if (index != 0) {
i += 1;
}
return i;
}
public class DataFile {
@BoundNumber() public int size;
@BoundNumber() public int filenameSize;
@BoundString(size = "filenameSize") public String filename;
@BoundString(size = "size") public String data;
}
}
public class BinaryFile {
@BoundNumber() public Integer indexSize;
@BoundList(size = "indexSize") public List<Integer> indexes;
@BoundList(size = "indexUsed()") public List<DataFile> files;
public int indexUsed() {
int i = 0;
for (Integer index : indexes) {
if (index != 0) {
i += 1;
}
return i;
}
public class DataFile {
@BoundNumber() public int size;
@BoundNumber() public int filenameSize;
@BoundString(size = "filenameSize") public String filename;
@BoundString(size = "size") public String data;
}
}
Maybe this will work?
You cant reference a function in the size parametre, already tried it
Can someone help me (again)?
I tried editing the file myself... I get a window to pop up for a split second (it has writing, at least!)
Here's what I have on the unpack_data:
@ECHO OFF
ftldat unpack C:/Program Files(x86)/Steam/steamapps/common/FTL Faster Than Light/resources