Open hunter3900 opened 3 months ago
The tile reference appears to be 64-bit. However, in this code, it seems to be reading and writing as 32-bit. This might be causing the tile reference value to be displayed incorrectly. To resolve this issue, the code needs to be modified to correctly read and write the data as 64-bit.
public void Test()
{
const long tileRef = 281474976710656L;
const int dataSize = 344;
byte[] actual;
{
using MemoryStream ms = new MemoryStream();
using BinaryWriter bw = new BinaryWriter(ms);
RcIO.Write(bw, tileRef, RcByteOrder.LITTLE_ENDIAN);
RcIO.Write(bw, dataSize, RcByteOrder.LITTLE_ENDIAN);
bw.Flush();
actual= ms.ToArray();
}
{
using MemoryStream ms = new MemoryStream(actual);
using BinaryReader br = new BinaryReader(ms);
var byteBuffer = RcIO.ToByteBuffer(br);
byteBuffer.Order(RcByteOrder.LITTLE_ENDIAN);
Assert.That(byteBuffer.GetLong(), Is.EqualTo(tileRef));
Assert.That(byteBuffer.GetInt(), Is.EqualTo(dataSize));
}
}
still can not run
Is there a way for me to check?
I use this method to read the data self.navMesh = reader.Read32Bit(br, 6);
DtMeshSetWriter.WriteTiles : tileHeader.tileRef(281474976710656) : tileHeader.dataSize(344)
DtMeshSetReader.ReadTiles : is32Bit(True) : header.numTiles(121) : tileHeader.tileRef(0) : tileHeader.dataSize(65536)