mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-03-13 19:39:14 +07:00
Fixed an error in D2 file type
This commit is contained in:
parent
d3529540ca
commit
d6c76d2add
@ -98,20 +98,15 @@ public class D2 {
|
|||||||
|
|
||||||
public String cof;
|
public String cof;
|
||||||
public int framesPerDir;
|
public int framesPerDir;
|
||||||
public short speed;
|
public int speed;
|
||||||
public short unk1;
|
|
||||||
public short zero;
|
|
||||||
public byte data[];
|
public byte data[];
|
||||||
|
|
||||||
Entry(InputStream in) throws IOException {
|
Entry(InputStream in) throws IOException {
|
||||||
ByteBuffer buffer = ByteBuffer.wrap(IOUtils.readFully(in, SIZE)).order(ByteOrder.LITTLE_ENDIAN);
|
ByteBuffer buffer = ByteBuffer.wrap(IOUtils.readFully(in, SIZE)).order(ByteOrder.LITTLE_ENDIAN);
|
||||||
cof = BufferUtils.readString2(buffer, 8);
|
cof = BufferUtils.readString2(buffer, 8);
|
||||||
framesPerDir = buffer.getInt();
|
framesPerDir = buffer.getInt();
|
||||||
speed = (short) (buffer.get() & 0xFF);
|
speed = buffer.getInt();
|
||||||
unk1 = (short) (buffer.get() & 0xFF);
|
|
||||||
zero = buffer.getShort();
|
|
||||||
data = BufferUtils.readBytes(buffer, 144);
|
data = BufferUtils.readBytes(buffer, 144);
|
||||||
assert zero == 0;
|
|
||||||
assert !buffer.hasRemaining();
|
assert !buffer.hasRemaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,8 +116,6 @@ public class D2 {
|
|||||||
.append("cof", cof)
|
.append("cof", cof)
|
||||||
.append("framesPerDir", framesPerDir)
|
.append("framesPerDir", framesPerDir)
|
||||||
.append("speed", speed)
|
.append("speed", speed)
|
||||||
.append("unk1", unk1)
|
|
||||||
.append("zero", zero)
|
|
||||||
//.append("data", data)
|
//.append("data", data)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import com.riiablo.mpq.MPQFileHandleResolver;
|
|||||||
import com.riiablo.util.DebugUtils;
|
import com.riiablo.util.DebugUtils;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@ -79,7 +80,6 @@ public class D2Finder extends ApplicationAdapter {
|
|||||||
writer.println("cof"
|
writer.println("cof"
|
||||||
+ '\t' + "framesPerDir"
|
+ '\t' + "framesPerDir"
|
||||||
+ '\t' + "speed"
|
+ '\t' + "speed"
|
||||||
+ '\t' + "unk1"
|
|
||||||
+ '\t' + "data"
|
+ '\t' + "data"
|
||||||
);
|
);
|
||||||
for (D2.Block block : lib.blocks) {
|
for (D2.Block block : lib.blocks) {
|
||||||
@ -87,9 +87,8 @@ public class D2Finder extends ApplicationAdapter {
|
|||||||
for (D2.Entry entry : block.entries) {
|
for (D2.Entry entry : block.entries) {
|
||||||
writer.println(entry.cof
|
writer.println(entry.cof
|
||||||
+ '\t' + entry.framesPerDir
|
+ '\t' + entry.framesPerDir
|
||||||
+ '\t' + (entry.speed & 0xFF)
|
+ '\t' + entry.speed
|
||||||
+ '\t' + (entry.unk1 & 0xFF)
|
+ '\t' + (ArrayUtils.isSorted(entry.data) ? "" : DebugUtils.toByteArray(entry.data))
|
||||||
+ '\t' + DebugUtils.toByteArray(entry.data)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user