use of info.ata4.junity.UnityVersion in project disunity by ata4.
the class BundleProps method read.
static void read(Path propsFile, Bundle bundle) throws IOException {
BundleProps props;
try (Reader reader = Files.newBufferedReader(propsFile, CHARSET)) {
props = new Gson().fromJson(reader, BundleProps.class);
}
BundleHeader header = bundle.header();
header.compressed(props.compressed);
header.streamVersion(props.streamVersion);
header.unityVersion(new UnityVersion(props.unityVersion));
header.unityRevision(new UnityVersion(props.unityRevision));
String bundleName = PathUtils.getBaseName(propsFile);
Path bundleDir = propsFile.resolveSibling(bundleName);
props.files.stream().map(bundleDir::resolve).forEach(file -> {
bundle.entries().add(new BundleExternalEntry(file));
});
}
use of info.ata4.junity.UnityVersion in project disunity by ata4.
the class BundleHeader method read.
@Override
public void read(DataReader in) throws IOException {
signature = in.readStringNull();
streamVersion = in.readInt();
unityVersion = new UnityVersion(in.readStringNull());
unityRevision = new UnityVersion(in.readStringNull());
if (signature.equals(SIGNATURE_FS)) {
// FS signature
// Expect streamVersion == 6
completeFileSize = in.readLong();
compressedDataHeaderSize = in.readInt();
dataHeaderSize = in.readInt();
flags = in.readInt();
headerSize = (int) in.position();
if ((flags & 0x80) == 0) {
// The data header is part of the bundle header
headerSize += compressedDataHeaderSize;
}
// else it's at the end of the file
} else {
// Web or Raw signature
minimumStreamedBytes = in.readUnsignedInt();
headerSize = in.readInt();
numberOfLevelsToDownload = in.readInt();
int numberOfLevels = in.readInt();
levelByteEnd.clear();
for (int i = 0; i < numberOfLevels; i++) {
levelByteEnd.add(new ImmutablePair(in.readUnsignedInt(), in.readUnsignedInt()));
}
if (streamVersion >= 2) {
completeFileSize = in.readUnsignedInt();
}
if (streamVersion >= 3) {
dataHeaderSize = in.readUnsignedInt();
}
in.readByte();
}
}
use of info.ata4.junity.UnityVersion in project disunity by ata4.
the class BundleInfo method buildHeaderTable.
private Table<Integer, Integer, Object> buildHeaderTable(BundleHeader header) {
TableBuilder table = new TableBuilder();
table.row("Field", "Value");
table.row("signature", header.signature());
table.row("streamVersion", header.streamVersion());
table.row("unityVersion", header.unityVersion());
table.row("unityRevision", header.unityRevision());
table.row("minimumStreamedBytes", header.minimumStreamedBytes());
table.row("headerSize", header.headerSize());
table.row("numberOfLevelsToDownload", header.numberOfLevelsToDownload());
table.row("numberOfLevels", header.numberOfLevels());
List<Pair<Long, Long>> levelByteEnds = header.levelByteEnd();
for (int i = 0; i < levelByteEnds.size(); i++) {
Pair<Long, Long> levelByteEnd = levelByteEnds.get(i);
table.row("levelByteEnd[" + i + "][0]", levelByteEnd.getLeft());
table.row("levelByteEnd[" + i + "][1]", levelByteEnd.getRight());
}
if (header.streamVersion() >= 2) {
table.row("completeFileSize", header.completeFileSize());
}
if (header.streamVersion() >= 3) {
table.row("dataHeaderSize", header.dataHeaderSize());
}
return table.get();
}
use of info.ata4.junity.UnityVersion in project disunity by ata4.
the class TypeTreeV3 method read.
@Override
public void read(DataReader in) throws IOException {
revision = new UnityVersion(in.readStringNull(255));
attributes = in.readInt();
embedded = in.readBoolean();
int numBaseClasses = in.readInt();
for (int i = 0; i < numBaseClasses; i++) {
int classID = in.readInt();
TypeRoot typeRoot = new TypeRoot();
typeRoot.classID(classID);
if (classID < 0) {
UnityHash128 scriptID = new UnityHash128();
in.readStruct(scriptID);
typeRoot.scriptID(scriptID);
}
UnityHash128 oldTypeHash = new UnityHash128();
in.readStruct(oldTypeHash);
typeRoot.oldTypeHash(oldTypeHash);
if (embedded) {
Node<T> node = new Node<>();
readNode(in, node);
typeRoot.nodes(node);
}
typeMap.put(classID, typeRoot);
}
}
use of info.ata4.junity.UnityVersion in project disunity by ata4.
the class TypeTreeV2 method read.
@Override
public void read(DataReader in) throws IOException {
revision = new UnityVersion(in.readStringNull(255));
attributes = in.readInt();
super.read(in);
// padding
in.readInt();
}
Aggregations