Skip to content

Commit

Permalink
fix dat repacker
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurHeitmann committed Aug 9, 2024
1 parent ec80054 commit afd66e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions lib/fileTypeUtils/dat/datHashGenerator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ class HashInfo {
}

int _calculateShift() {
for (int i = 0; i < 31; i++) {
if (1 << i >= inFiles.length)
return 31 - i;
}

return 0;
int count = inFiles.length;
if (count <= 1)
count += 1;
return 32 - count.bitLength;
}

void _generateInfo() {
Expand Down
2 changes: 1 addition & 1 deletion lib/fileTypeUtils/dat/datRepacker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Future<void> repackDat(String datDir, String exportPath) async {
List<int> fileOffsets = [];
var currentOffset = hashMapOffset + hashMapSize;
for (int i = 0; i < fileList.length; i++) {
currentOffset = (currentOffset / 16).ceil() * 16;
currentOffset = (currentOffset / 32).ceil() * 32;
fileOffsets.add(currentOffset);
currentOffset += fileSizes[i];
}
Expand Down

0 comments on commit afd66e9

Please sign in to comment.