Skip to content

Commit

Permalink
Fixed ftexs and chunk count for 4096x4096 textures
Browse files Browse the repository at this point in the history
  • Loading branch information
Atvaark committed Sep 11, 2015
1 parent 1a2e7f8 commit 92b3f82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FtexTool/Ftex/FtexFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void UpdateOffsets()
{
FtexFileMipMapInfo ftexMipMapInfo = MipMapInfos.ElementAt(mipMapIndex);
ftexMipMapInfo.CompressedFileSize = ftexsFileMipMap.CompressedDataSize;
ftexMipMapInfo.ChunkCount = Convert.ToByte(ftexsFileMipMap.Chunks.Count());
ftexMipMapInfo.ChunkCount = Convert.ToInt16(ftexsFileMipMap.Chunks.Count());
ftexMipMapInfo.Offset = ftexsFileMipMap.Offset;
++mipMapIndex;
}
Expand Down
6 changes: 4 additions & 2 deletions FtexTool/FtexDdsConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private static List<FtexsFile> GetFtexsFiles(List<FtexFileMipMapInfo> mipMapInfo
private static List<FtexsFileChunk> GetFtexsChunks(FtexFileMipMapInfo mipMapInfo, byte[] mipMapData)
{
List<FtexsFileChunk> ftexsFileChunks = new List<FtexsFileChunk>();
const int maxChunkSize = short.MaxValue;
const int maxChunkSize = short.MaxValue/2 + 1;
int requiredChunks = (int) Math.Ceiling((double) mipMapData.Length/maxChunkSize);
int mipMapDataOffset = 0;
for (int i = 0; i < requiredChunks; i++)
Expand Down Expand Up @@ -180,7 +180,9 @@ private static byte GetFtexsFileNumber(int fileSize)
return 3;
if (fileSize <= 1398128)
return 4;
return 5;
if (fileSize <= 11180000)
return 5;
return 6;
}

private static List<byte[]> GetMipMapData(DdsFile file)
Expand Down

0 comments on commit 92b3f82

Please sign in to comment.