Skip to content

Commit

Permalink
fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurHeitmann committed Aug 4, 2024
1 parent 637a099 commit 7146c4b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- master
- mgrr
- transformers
- gh-actions

jobs:
Expand Down
14 changes: 10 additions & 4 deletions lib/fileTypeUtils/wta/wtaReader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ class WtaFile {
}

Future<void> writeToFile(String path) async {
var fileSize = header.offsetTextureInfo + textureInfo.length * 0x14;
int fileSize;
if (header.offsetTextureInfo > 0)
fileSize = header.offsetTextureInfo + textureInfo.length * 0x14;
else
fileSize = header.offsetTextureIdx + textureIdx.length * 4;
var bytes = ByteDataWrapper.allocate(fileSize);
header.write(bytes);

Expand All @@ -136,9 +140,11 @@ class WtaFile {
for (var i = 0; i < textureIdx.length; i++)
bytes.writeUint32(textureIdx[i]);

bytes.position = header.offsetTextureInfo;
for (var i = 0; i < textureInfo.length; i++)
textureInfo[i].write(bytes);
if (header.offsetTextureInfo > 0) {
bytes.position = header.offsetTextureInfo;
for (var i = 0; i < textureInfo.length; i++)
textureInfo[i].write(bytes);
}

await bytes.save(path);
}
Expand Down
1 change: 0 additions & 1 deletion lib/stateManagement/openFiles/types/McdFileData.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,6 @@ class McdData extends _McdFilePart {
// update size in wta file
var wta = await WtaFile.readFromFile(textureWtaPath.value);
wta.textureSizes[0] = texFileSize;
wta.updateHeader();
await wta.writeToFile(textureWtaPath.value);

// export dtt
Expand Down

0 comments on commit 7146c4b

Please sign in to comment.