From aebee69f261c0473adee48550a24bb02b2c48cec Mon Sep 17 00:00:00 2001 From: ArthurHeitmann <37270165+ArthurHeitmann@users.noreply.github.com> Date: Sat, 13 Jul 2024 21:11:54 +0200 Subject: [PATCH] Show more est fields --- lib/fileTypeUtils/audio/bnkIO.dart | 2 + lib/fileTypeUtils/effects/estEntryTypes.dart | 145 ++++-- .../hierarchy/FileHierarchy.dart | 2 +- .../openFiles/types/EstFileData.dart | 479 +++++++++++++++++- lib/widgets/filesView/FileDetailsEditor.dart | 2 +- .../types/effect/EstEntryDetailsEditor.dart | 110 +++- .../types/effect/EstRecordDetailsEditor.dart | 2 +- .../filesView/types/fonts/mcdEditor.dart | 2 +- lib/widgets/tools/ExtractFileTool.dart | 2 +- 9 files changed, 671 insertions(+), 75 deletions(-) diff --git a/lib/fileTypeUtils/audio/bnkIO.dart b/lib/fileTypeUtils/audio/bnkIO.dart index c71ae65b..2e742664 100644 --- a/lib/fileTypeUtils/audio/bnkIO.dart +++ b/lib/fileTypeUtils/audio/bnkIO.dart @@ -1,6 +1,8 @@ // ignore_for_file: constant_identifier_names +import 'dart:typed_data'; + import '../utils/ByteDataWrapper.dart'; import 'wemIdsToNames.dart'; diff --git a/lib/fileTypeUtils/effects/estEntryTypes.dart b/lib/fileTypeUtils/effects/estEntryTypes.dart index 436077fc..602517df 100644 --- a/lib/fileTypeUtils/effects/estEntryTypes.dart +++ b/lib/fileTypeUtils/effects/estEntryTypes.dart @@ -94,47 +94,86 @@ class EstUnknownTypeEntry extends EstTypeEntry { /* typedef struct { - int16 u_a; - int16 effect_length; - uint32 u_c ; - uint32 u_d; - int16 anchor_bone; - int16 u_e[7]; - uint32 uf[9]; + int16 u_a; + int16 u_b; + uint32 u_c ; + uint32 u_d ; + int16 some_kind_of_count; // 0 - 8 + int16 anchor_bone; + int16 u1; // -1 - 25 + int16 null0; // -1 - 25 + uint16 u2; + int16 u3; + int16 u4; + int16 u5; + int16 u6; + byte null1; + float u7; + ubyte u8; + uint32 null2[7]; } part_s; */ /// EffectParticleGenerationData class EstTypePartEntry extends EstTypeEntry { late int u_a; - late int effect_length; + late int u_b; late int u_c; late int u_d; + late int some_kind_of_count; late int anchor_bone; - late List u_e; - late List uf; + late int u1; + late int null0; + late int u2; + late int u3; + late int u4; + late int u5; + late int u6; + late int null1; + late double u7; + late int u8; + late List null2; EstTypePartEntry.read(ByteDataWrapper bytes, EstTypeHeader header) { this.header = header; u_a = bytes.readInt16(); - effect_length = bytes.readInt16(); + u_b = bytes.readInt16(); u_c = bytes.readUint32(); u_d = bytes.readUint32(); + some_kind_of_count = bytes.readInt16(); anchor_bone = bytes.readInt16(); - u_e = bytes.asInt16List(7); - uf = bytes.asUint32List(9); + u1 = bytes.readInt16(); + null0 = bytes.readInt16(); + u2 = bytes.readUint16(); + u3 = bytes.readInt16(); + u4 = bytes.readInt16(); + u5 = bytes.readInt16(); + u6 = bytes.readInt16(); + null1 = bytes.readUint8(); + u7 = bytes.readFloat32(); + u8 = bytes.readUint8(); + null2 = bytes.asUint32List(7); } @override void write(ByteDataWrapper bytes) { bytes.writeInt16(u_a); - bytes.writeInt16(effect_length); + bytes.writeInt16(u_b); bytes.writeUint32(u_c); bytes.writeUint32(u_d); + bytes.writeInt16(some_kind_of_count); bytes.writeInt16(anchor_bone); - for (var e in u_e) - bytes.writeInt16(e); - for (var f in uf) - bytes.writeUint32(f); + bytes.writeInt16(u1); + bytes.writeInt16(null0); + bytes.writeUint16(u2); + bytes.writeInt16(u3); + bytes.writeInt16(u4); + bytes.writeInt16(u5); + bytes.writeInt16(u6); + bytes.writeUint8(null1); + bytes.writeFloat32(u7); + bytes.writeUint8(u8); + for (var n in null2) + bytes.writeUint32(n); } } @@ -364,12 +403,7 @@ typedef struct { float u_i4[4]; float u_j; float brightness; - float u_n; - float u_o; - uint32 u_p; - uint32 u_q; - uint32 u_r; - float u_s[12]; + float null[17]; } tex_s; */ /// EffectTextureInfoData @@ -396,12 +430,7 @@ class EstTypeTexEntry extends EstTypeEntry { late List u_i4; late double u_j; late double brightness; - late double u_n; - late double u_o; - late int u_p; - late int u_q; - late int u_r; - late List u_s; + late List null0; EstTypeTexEntry.read(ByteDataWrapper bytes, EstTypeHeader header) { this.header = header; @@ -427,12 +456,7 @@ class EstTypeTexEntry extends EstTypeEntry { u_i4 = bytes.readFloat32List(4); u_j = bytes.readFloat32(); brightness = bytes.readFloat32(); - u_n = bytes.readFloat32(); - u_o = bytes.readFloat32(); - u_p = bytes.readUint32(); - u_q = bytes.readUint32(); - u_r = bytes.readUint32(); - u_s = bytes.readFloat32List(12); + null0 = bytes.readFloat32List(17); } @override @@ -461,12 +485,7 @@ class EstTypeTexEntry extends EstTypeEntry { bytes.writeFloat32(i); bytes.writeFloat32(u_j); bytes.writeFloat32(brightness); - bytes.writeFloat32(u_n); - bytes.writeFloat32(u_o); - bytes.writeUint32(u_p); - bytes.writeUint32(u_q); - bytes.writeUint32(u_r); - for (var s in u_s) + for (var s in null0) bytes.writeFloat32(s); } } @@ -753,3 +772,45 @@ class EstTypeMjcmEntry extends EstTypeEntry { bytes.writeFloat32(a); } } + +/* +typedef struct { + float u_a[24]; +} pssa_s; +*/ +/// EffectPosSinAnimation +class EstTypePssaEntry extends EstTypeEntry { + late List u_a; + + EstTypePssaEntry.read(ByteDataWrapper bytes, EstTypeHeader header) { + this.header = header; + u_a = bytes.readFloat32List(24); + } + + @override + void write(ByteDataWrapper bytes) { + for (var a in u_a) + bytes.writeFloat32(a); + } +} + +/* +typedef struct { + float u_a[20]; +} fvwk_s ; +*/ +/// EffectFreeVecWork +class EstTypeFvwkEntry extends EstTypeEntry { + late List u_a; + + EstTypeFvwkEntry.read(ByteDataWrapper bytes, EstTypeHeader header) { + this.header = header; + u_a = bytes.readFloat32List(20); + } + + @override + void write(ByteDataWrapper bytes) { + for (var a in u_a) + bytes.writeFloat32(a); + } +} diff --git a/lib/stateManagement/hierarchy/FileHierarchy.dart b/lib/stateManagement/hierarchy/FileHierarchy.dart index 67e234aa..226c03f6 100644 --- a/lib/stateManagement/hierarchy/FileHierarchy.dart +++ b/lib/stateManagement/hierarchy/FileHierarchy.dart @@ -454,7 +454,7 @@ class OpenHierarchyManager with HasUuid, Undoable, HierarchyEntryBase implements else { wtpPath = join(datDir, wtpName); if (!await File(wtpPath).exists()) { - showToast("Can't find corresponding WTP file"); + // showToast("Can't find corresponding WTP file"); throw Exception("Can't find corresponding WTP file"); } } diff --git a/lib/stateManagement/openFiles/types/EstFileData.dart b/lib/stateManagement/openFiles/types/EstFileData.dart index bfbb7e88..51671eb0 100644 --- a/lib/stateManagement/openFiles/types/EstFileData.dart +++ b/lib/stateManagement/openFiles/types/EstFileData.dart @@ -208,6 +208,8 @@ class EstEntryWrapper with HasUuid, Undoable implements return EstTexEntryWrapper(entry, fileId, isEnabledB) as EstEntryWrapper; else if (entry is EstTypeFwkEntry) return EstFwkEntryWrapper(entry, fileId, isEnabledB) as EstEntryWrapper; + else if (entry is EstTypeEmmvEntry) + return EstEmmvEntryWrapper(entry, fileId, isEnabledB) as EstEntryWrapper; else return EstEntryWrapper.unknown(entry, fileId, isEnabledB); } @@ -286,17 +288,53 @@ class SpecificEstEntryWrapper extends EstEntryWrapper } class EstPartEntryWrapper extends SpecificEstEntryWrapper { - final NumberProp unknown; final NumberProp anchorBone; + final NumberProp u_a; + final NumberProp u_b; + final NumberProp u_c; + final NumberProp u_d; + final NumberProp u_e; + final NumberProp u_1; + final NumberProp u_2; + final NumberProp u_3; + final NumberProp u_4; + final NumberProp u_5; + final NumberProp u_6; + final FloatProp u_7; + final NumberProp u_8; EstPartEntryWrapper(super.entry, super.fileId, [super.isEnabledB = true]) : - unknown = NumberProp(0, true, fileId: fileId), - anchorBone = NumberProp(0, true, fileId: fileId) + anchorBone = NumberProp(0, true, fileId: fileId), + u_a = NumberProp(0, true, fileId: fileId), + u_b = NumberProp(0, true, fileId: fileId), + u_c = NumberProp(0, true, fileId: fileId), + u_d = NumberProp(0, true, fileId: fileId), + u_e = NumberProp(0, true, fileId: fileId), + u_1 = NumberProp(0, true, fileId: fileId), + u_2 = NumberProp(0, true, fileId: fileId), + u_3 = NumberProp(0, true, fileId: fileId), + u_4 = NumberProp(0, true, fileId: fileId), + u_5 = NumberProp(0, true, fileId: fileId), + u_6 = NumberProp(0, true, fileId: fileId), + u_7 = FloatProp(0, fileId: fileId), + u_8 = NumberProp(0, true, fileId: fileId) { _readFromEntry(entry); allProps = [ - unknown, anchorBone, + u_a, + u_b, + u_c, + u_d, + u_e, + u_1, + u_2, + u_3, + u_4, + u_5, + u_6, + u_7, + u_8, ]; for (var prop in allProps) { prop.addListener(onAnyChange.notifyListeners); @@ -305,34 +343,64 @@ class EstPartEntryWrapper extends SpecificEstEntryWrapper { } void _updateEntryValues() { - entry.u_a = unknown.value.toInt(); entry.anchor_bone = anchorBone.value.toInt(); + entry.u_a = u_a.value.toInt(); + entry.u_b = u_b.value.toInt(); + entry.u_c = u_c.value.toInt(); + entry.u_d = u_d.value.toInt(); + entry.some_kind_of_count = u_e.value.toInt(); + entry.u1 = u_1.value.toInt(); + entry.u2 = u_2.value.toInt(); + entry.u3 = u_3.value.toInt(); + entry.u4 = u_4.value.toInt(); + entry.u5 = u_5.value.toInt(); + entry.u6 = u_6.value.toInt(); + entry.u7 = u_7.value; + entry.u8 = u_8.value.toInt(); } @override void _readFromEntry(EstTypePartEntry entry) { - unknown.value = entry.u_a; anchorBone.value = entry.anchor_bone; + u_a.value = entry.u_a; + u_b.value = entry.u_b; + u_c.value = entry.u_c; + u_d.value = entry.u_d; + u_e.value = entry.some_kind_of_count; + u_1.value = entry.u1; + u_2.value = entry.u2; + u_3.value = entry.u3; + u_4.value = entry.u4; + u_5.value = entry.u5; + u_6.value = entry.u6; + u_7.value = entry.u7; + u_8.value = entry.u8; } } class EstMoveEntryWrapper extends SpecificEstEntryWrapper { - final VectorProp offset ; - final VectorProp spawnBoxSize ; - final VectorProp moveSpeed ; - final VectorProp moveSmallSpeed ; - final FloatProp angle ; - final FloatProp scaleX ; - final FloatProp scaleY ; - final FloatProp scaleZ ; - final VectorProp rgb ; - final FloatProp alpha ; - final FloatProp fadeInSpeed ; - final FloatProp fadeOutSpeed ; - final FloatProp effectSizeLimit1 ; - final FloatProp effectSizeLimit2 ; - final FloatProp effectSizeLimit3 ; - final FloatProp effectSizeLimit4 ; + final VectorProp offset; + final VectorProp spawnBoxSize; + final VectorProp moveSpeed; + final VectorProp moveSmallSpeed; + final FloatProp angle; + final FloatProp scaleX; + final FloatProp scaleY; + final FloatProp scaleZ; + final VectorProp rgb; + final FloatProp alpha; + final FloatProp fadeInSpeed; + final FloatProp fadeOutSpeed; + final FloatProp effectSizeLimit1; + final FloatProp effectSizeLimit2; + final FloatProp effectSizeLimit3; + final FloatProp effectSizeLimit4; + final NumberProp u_a; + final List u_b_1; + final List u_b_2; + final List u_c; + final List u_d_1; + final List u_d_2; EstMoveEntryWrapper(super.entry, super.fileId, [super.isEnabledB = true]) : offset = VectorProp([0, 0, 0], fileId: fileId), @@ -350,7 +418,13 @@ class EstMoveEntryWrapper extends SpecificEstEntryWrapper { effectSizeLimit1 = FloatProp(0, fileId: fileId), effectSizeLimit2 = FloatProp(0, fileId: fileId), effectSizeLimit3 = FloatProp(0, fileId: fileId), - effectSizeLimit4 = FloatProp(0, fileId: fileId) + effectSizeLimit4 = FloatProp(0, fileId: fileId), + u_a = NumberProp(0, true, fileId: fileId), + u_b_1 = List.generate(6, (_) => FloatProp(0, fileId: fileId)), + u_b_2 = List.generate(12, (_) => FloatProp(0, fileId: fileId)), + u_c = List.generate(15, (_) => FloatProp(0, fileId: fileId)), + u_d_1 = List.generate(4, (_) => FloatProp(0, fileId: fileId)), + u_d_2 = List.generate(32, (_) => FloatProp(0, fileId: fileId)) { _readFromEntry(entry); allProps = [ @@ -370,6 +444,12 @@ class EstMoveEntryWrapper extends SpecificEstEntryWrapper { effectSizeLimit2, effectSizeLimit3, effectSizeLimit4, + u_a, + ...u_b_1, + ...u_b_2, + ...u_c, + ...u_d_1, + ...u_d_2, ]; for (var prop in allProps) { prop.addListener(onAnyChange.notifyListeners); @@ -404,6 +484,17 @@ class EstMoveEntryWrapper extends SpecificEstEntryWrapper { entry.effect_size_limit_2 = effectSizeLimit2.value; entry.effect_size_limit_3 = effectSizeLimit3.value; entry.effect_size_limit_4 = effectSizeLimit4.value; + entry.u_a = u_a.value.toInt(); + for (int i = 0; i < 6; i++) + entry.u_b_1[i] = u_b_1[i].value; + for (int i = 0; i < 12; i++) + entry.u_b_2[i] = u_b_2[i].value; + for (int i = 0; i < 15; i++) + entry.u_c[i] = u_c[i].value; + for (int i = 0; i < 4; i++) + entry.u_d_1[i] = u_d_1[i].value; + for (int i = 0; i < 32; i++) + entry.u_d_2[i] = u_d_2[i].value; } @override @@ -434,6 +525,17 @@ class EstMoveEntryWrapper extends SpecificEstEntryWrapper { effectSizeLimit2.value = entry.effect_size_limit_2; effectSizeLimit3.value = entry.effect_size_limit_3; effectSizeLimit4.value = entry.effect_size_limit_4; + u_a.value = entry.u_a; + for (int i = 0; i < 6; i++) + u_b_1[i].value = entry.u_b_1[i]; + for (int i = 0; i < 12; i++) + u_b_2[i].value = entry.u_b_2[i]; + for (int i = 0; i < 15; i++) + u_c[i].value = entry.u_c[i]; + for (int i = 0; i < 4; i++) + u_d_1[i].value = entry.u_d_1[i]; + for (int i = 0; i < 32; i++) + u_d_2[i].value = entry.u_d_2[i]; } } @@ -442,12 +544,22 @@ class EstEmifEntryWrapper extends SpecificEstEntryWrapper { final NumberProp playDelay; final NumberProp showAtOnce; final NumberProp size; + final NumberProp u_a; + final NumberProp u_b; + final NumberProp u_c; + final NumberProp unk; + final List u_d; EstEmifEntryWrapper(super.entry, super.fileId, [super.isEnabledB = true]) : count = NumberProp(0, true, fileId: fileId), playDelay = NumberProp(0, true, fileId: fileId), showAtOnce = NumberProp(0, true, fileId: fileId), - size = NumberProp(0, true, fileId: fileId) + size = NumberProp(0, true, fileId: fileId), + u_a = NumberProp(0, true, fileId: fileId), + u_b = NumberProp(0, true, fileId: fileId), + u_c = NumberProp(0, true, fileId: fileId), + unk = NumberProp(0, true, fileId: fileId), + u_d = List.generate(8, (_) => FloatProp(0, fileId: fileId)) { _readFromEntry(entry); allProps = [ @@ -455,6 +567,11 @@ class EstEmifEntryWrapper extends SpecificEstEntryWrapper { playDelay, showAtOnce, size, + u_a, + u_b, + u_c, + unk, + ...u_d, ]; for (var prop in allProps) { prop.addListener(onAnyChange.notifyListeners); @@ -467,6 +584,12 @@ class EstEmifEntryWrapper extends SpecificEstEntryWrapper { entry.play_delay = playDelay.value.toInt(); entry.showAtOnce = showAtOnce.value.toInt(); entry.size = size.value.toInt(); + entry.u_a = u_a.value.toInt(); + entry.u_b = u_b.value.toInt(); + entry.u_c = u_c.value.toInt(); + entry.unk = unk.value.toInt(); + for (int i = 0; i < 8; i++) + entry.u_d[i] = u_d[i].value; } @override @@ -475,6 +598,12 @@ class EstEmifEntryWrapper extends SpecificEstEntryWrapper { playDelay.value = entry.play_delay; showAtOnce.value = entry.showAtOnce; size.value = entry.size; + u_a.value = entry.u_a; + u_b.value = entry.u_b; + u_c.value = entry.u_c; + unk.value = entry.unk; + for (int i = 0; i < 8; i++) + u_d[i].value = entry.u_d[i]; } } @@ -486,6 +615,18 @@ class EstTexEntryWrapper extends SpecificEstEntryWrapper { final HexProp meshId; final NumberProp videoFps; final NumberProp isSingleFrame; + final NumberProp u_c; + final FloatProp u_d2; + final FloatProp u_d3; + final FloatProp u_d4; + final FloatProp u_d5; + final FloatProp u_g; + final NumberProp u_h; + final FloatProp distortion_effect_strength; + final List u_i2; + final NumberProp u_i3; + final List u_i4; + final FloatProp u_j; EstTexEntryWrapper(super.entry, super.fileId, [super.isEnabledB = true]) : speed = FloatProp(0, fileId: fileId), @@ -494,7 +635,19 @@ class EstTexEntryWrapper extends SpecificEstEntryWrapper { textureFileIndex = NumberProp(0, true, fileId: fileId), meshId = HexProp(0, fileId: fileId), videoFps = NumberProp(0, true, fileId: fileId), - isSingleFrame = NumberProp(0, true, fileId: fileId) + isSingleFrame = NumberProp(0, true, fileId: fileId), + u_c = NumberProp(0, true, fileId: fileId), + u_d2 = FloatProp(0, fileId: fileId), + u_d3 = FloatProp(0, fileId: fileId), + u_d4 = FloatProp(0, fileId: fileId), + u_d5 = FloatProp(0, fileId: fileId), + u_g = FloatProp(0, fileId: fileId), + u_h = NumberProp(0, true, fileId: fileId), + distortion_effect_strength = FloatProp(0, fileId: fileId), + u_i2 = List.generate(8, (_) => FloatProp(0, fileId: fileId)), + u_i3 = NumberProp(0, true, fileId: fileId), + u_i4 = List.generate(4, (_) => FloatProp(0, fileId: fileId)), + u_j = FloatProp(0, fileId: fileId) { _readFromEntry(entry); allProps = [ @@ -505,6 +658,18 @@ class EstTexEntryWrapper extends SpecificEstEntryWrapper { meshId, videoFps, isSingleFrame, + u_c, + u_d2, + u_d3, + u_d4, + u_d5, + u_g, + u_h, + distortion_effect_strength, + ...u_i2, + u_i3, + ...u_i4, + u_j, ]; for (var prop in allProps) { prop.addListener(onAnyChange.notifyListeners); @@ -520,6 +685,20 @@ class EstTexEntryWrapper extends SpecificEstEntryWrapper { entry.mesh_id = meshId.value.toInt(); entry.video_fps_maybe = videoFps.value.toInt(); entry.is_single_frame = isSingleFrame.value.toInt(); + entry.u_c = u_c.value.toInt(); + entry.u_d2 = u_d2.value; + entry.u_d3 = u_d3.value; + entry.u_d4 = u_d4.value; + entry.u_d5 = u_d5.value; + entry.u_g = u_g.value; + entry.u_h = u_h.value.toInt(); + entry.distortion_effect_strength = distortion_effect_strength.value; + for (int i = 0; i < 8; i++) + entry.u_i2[i] = u_i2[i].value; + entry.u_i3 = u_i3.value.toInt(); + for (int i = 0; i < 4; i++) + entry.u_i4[i] = u_i4[i].value; + entry.u_j = u_j.value; } @override @@ -531,18 +710,44 @@ class EstTexEntryWrapper extends SpecificEstEntryWrapper { meshId.value = entry.mesh_id; videoFps.value = entry.video_fps_maybe; isSingleFrame.value = entry.is_single_frame; + u_c.value = entry.u_c; + u_d2.value = entry.u_d2; + u_d3.value = entry.u_d3; + u_d4.value = entry.u_d4; + u_d5.value = entry.u_d5; + u_g.value = entry.u_g; + u_h.value = entry.u_h; + distortion_effect_strength.value = entry.distortion_effect_strength; + for (int i = 0; i < 8; i++) + u_i2[i].value = entry.u_i2[i]; + u_i3.value = entry.u_i3; + for (int i = 0; i < 4; i++) + u_i4[i].value = entry.u_i4[i]; + u_j.value = entry.u_j; } } class EstFwkEntryWrapper extends SpecificEstEntryWrapper { final NumberProp importedEffectId; + final NumberProp u_a0; + final NumberProp u_a1; + final List u_b; + final List u_c; EstFwkEntryWrapper(super.entry, super.fileId, [super.isEnabledB = true]) : - importedEffectId = NumberProp(0, true, fileId: fileId) + importedEffectId = NumberProp(0, true, fileId: fileId), + u_a0 = NumberProp(0, true, fileId: fileId), + u_a1 = NumberProp(0, true, fileId: fileId), + u_b = List.generate(3, (_) => NumberProp(0, true, fileId: fileId)), + u_c = List.generate(5, (_) => NumberProp(0, true, fileId: fileId)) { _readFromEntry(entry); allProps = [ importedEffectId, + u_a0, + u_a1, + ...u_b, + ...u_c, ]; for (var prop in allProps) { prop.addListener(onAnyChange.notifyListeners); @@ -552,11 +757,233 @@ class EstFwkEntryWrapper extends SpecificEstEntryWrapper { void _updateEntryValues() { entry.imported_effect_id = importedEffectId.value.toInt(); + entry.u_a0 = u_a0.value.toInt(); + entry.u_a1 = u_a1.value.toInt(); + for (int i = 0; i < 3; i++) + entry.u_b[i] = u_b[i].value.toInt(); + for (int i = 0; i < 5; i++) + entry.u_c[i] = u_c[i].value.toInt(); } @override void _readFromEntry(EstTypeFwkEntry entry) { importedEffectId.value = entry.imported_effect_id; + u_a0.value = entry.u_a0; + u_a1.value = entry.u_a1; + for (int i = 0; i < 3; i++) + u_b[i].value = entry.u_b[i]; + for (int i = 0; i < 5; i++) + u_c[i].value = entry.u_c[i]; + } +} + +class EstEmmvEntryWrapper extends SpecificEstEntryWrapper { + final NumberProp u_a; + final FloatProp leftPos1; + final FloatProp topPos; + final FloatProp unkPos1; + final FloatProp randomPos1; + final FloatProp topBottomRandomPos1; + final FloatProp frontBackRandomPos1; + final FloatProp leftPos2; + final FloatProp frontPos1; + final FloatProp frontPos2; + final FloatProp leftRightRandomPos1; + final FloatProp randomPos2; + final FloatProp frontBackRandomPos2; + final FloatProp unkPos2; + final FloatProp leftPosRandom1; + final FloatProp topPos2; + final FloatProp frontPos3; + final FloatProp unkPos3; + final FloatProp unkPos4; + final FloatProp unkPos5; + final FloatProp unkPos6; + final FloatProp unkPos7; + final FloatProp unkPos8; + final FloatProp unkPos9; + final FloatProp unkPos10; + final FloatProp unkPos11; + final FloatProp unkPos25; + final FloatProp unkPos26; + final FloatProp unkPos27; + final FloatProp unkPos28; + final FloatProp unkPos29; + final FloatProp unkPos30; + final FloatProp unkPos31; + final FloatProp effectSize; + final List u_b_1; + final FloatProp swordPos; + final List u_b_2; + + EstEmmvEntryWrapper(super.entry, super.fileId, [super.isEnabledB = true]) : + u_a = NumberProp(0, true, fileId: fileId), + leftPos1 = FloatProp(0, fileId: fileId), + topPos = FloatProp(0, fileId: fileId), + unkPos1 = FloatProp(0, fileId: fileId), + randomPos1 = FloatProp(0, fileId: fileId), + topBottomRandomPos1 = FloatProp(0, fileId: fileId), + frontBackRandomPos1 = FloatProp(0, fileId: fileId), + leftPos2 = FloatProp(0, fileId: fileId), + frontPos1 = FloatProp(0, fileId: fileId), + frontPos2 = FloatProp(0, fileId: fileId), + leftRightRandomPos1 = FloatProp(0, fileId: fileId), + randomPos2 = FloatProp(0, fileId: fileId), + frontBackRandomPos2 = FloatProp(0, fileId: fileId), + unkPos2 = FloatProp(0, fileId: fileId), + leftPosRandom1 = FloatProp(0, fileId: fileId), + topPos2 = FloatProp(0, fileId: fileId), + frontPos3 = FloatProp(0, fileId: fileId), + unkPos3 = FloatProp(0, fileId: fileId), + unkPos4 = FloatProp(0, fileId: fileId), + unkPos5 = FloatProp(0, fileId: fileId), + unkPos6 = FloatProp(0, fileId: fileId), + unkPos7 = FloatProp(0, fileId: fileId), + unkPos8 = FloatProp(0, fileId: fileId), + unkPos9 = FloatProp(0, fileId: fileId), + unkPos10 = FloatProp(0, fileId: fileId), + unkPos11 = FloatProp(0, fileId: fileId), + unkPos25 = FloatProp(0, fileId: fileId), + unkPos26 = FloatProp(0, fileId: fileId), + unkPos27 = FloatProp(0, fileId: fileId), + unkPos28 = FloatProp(0, fileId: fileId), + unkPos29 = FloatProp(0, fileId: fileId), + unkPos30 = FloatProp(0, fileId: fileId), + unkPos31 = FloatProp(0, fileId: fileId), + effectSize = FloatProp(0, fileId: fileId), + u_b_1 = List.generate(6, (_) => FloatProp(0, fileId: fileId)), + swordPos = FloatProp(0, fileId: fileId), + u_b_2 = List.generate(12, (_) => FloatProp(0, fileId: fileId)) + { + _readFromEntry(entry); + allProps = [ + u_a, + leftPos1, + topPos, + unkPos1, + randomPos1, + topBottomRandomPos1, + frontBackRandomPos1, + leftPos2, + frontPos1, + frontPos2, + leftRightRandomPos1, + randomPos2, + frontBackRandomPos2, + unkPos2, + leftPosRandom1, + topPos2, + frontPos3, + unkPos3, + unkPos4, + unkPos5, + unkPos6, + unkPos7, + unkPos8, + unkPos9, + unkPos10, + unkPos11, + unkPos25, + unkPos26, + unkPos27, + unkPos28, + unkPos29, + unkPos30, + unkPos31, + effectSize, + ...u_b_1, + swordPos, + ...u_b_2, + ]; + for (var prop in allProps) { + prop.addListener(onAnyChange.notifyListeners); + } + onAnyChange.addListener(_updateEntryValues); + } + + void _updateEntryValues() { + entry.u_a = u_a.value.toInt(); + entry.left_pos1 = leftPos1.value; + entry.top_pos = topPos.value; + entry.unk_pos1 = unkPos1.value; + entry.random_pos1 = randomPos1.value; + entry.top_bottom_random_pos1 = topBottomRandomPos1.value; + entry.front_back_random_pos1 = frontBackRandomPos1.value; + entry.left_pos2 = leftPos2.value; + entry.front_pos1 = frontPos1.value; + entry.front_pos2 = frontPos2.value; + entry.left_right_random_pos1 = leftRightRandomPos1.value; + entry.random_pos2 = randomPos2.value; + entry.front_back_random_pos2 = frontBackRandomPos2.value; + entry.unk_pos2 = unkPos2.value; + entry.left_pos_random1 = leftPosRandom1.value; + entry.top_pos2 = topPos2.value; + entry.front_pos3 = frontPos3.value; + entry.unk_pos3 = unkPos3.value; + entry.unk_pos4 = unkPos4.value; + entry.unk_pos5 = unkPos5.value; + entry.unk_pos6 = unkPos6.value; + entry.unk_pos7 = unkPos7.value; + entry.unk_pos8 = unkPos8.value; + entry.unk_pos9 = unkPos9.value; + entry.unk_pos10 = unkPos10.value; + entry.unk_pos11 = unkPos11.value; + entry.unk_pos25 = unkPos25.value; + entry.unk_pos26 = unkPos26.value; + entry.unk_pos27 = unkPos27.value; + entry.unk_pos28 = unkPos28.value; + entry.unk_pos29 = unkPos29.value; + entry.unk_pos30 = unkPos30.value; + entry.unk_pos31 = unkPos31.value; + entry.effect_size = effectSize.value; + for (int i = 0; i < 6; i++) + entry.u_b_1[i] = u_b_1[i].value; + entry.sword_pos = swordPos.value; + for (int i = 0; i < 12; i++) + entry.u_b_2[i] = u_b_2[i].value; + } + + @override + void _readFromEntry(EstTypeEmmvEntry entry) { + u_a.value = entry.u_a; + leftPos1.value = entry.left_pos1; + topPos.value = entry.top_pos; + unkPos1.value = entry.unk_pos1; + randomPos1.value = entry.random_pos1; + topBottomRandomPos1.value = entry.top_bottom_random_pos1; + frontBackRandomPos1.value = entry.front_back_random_pos1; + leftPos2.value = entry.left_pos2; + frontPos1.value = entry.front_pos1; + frontPos2.value = entry.front_pos2; + leftRightRandomPos1.value = entry.left_right_random_pos1; + randomPos2.value = entry.random_pos2; + frontBackRandomPos2.value = entry.front_back_random_pos2; + unkPos2.value = entry.unk_pos2; + leftPosRandom1.value = entry.left_pos_random1; + topPos2.value = entry.top_pos2; + frontPos3.value = entry.front_pos3; + unkPos3.value = entry.unk_pos3; + unkPos4.value = entry.unk_pos4; + unkPos5.value = entry.unk_pos5; + unkPos6.value = entry.unk_pos6; + unkPos7.value = entry.unk_pos7; + unkPos8.value = entry.unk_pos8; + unkPos9.value = entry.unk_pos9; + unkPos10.value = entry.unk_pos10; + unkPos11.value = entry.unk_pos11; + unkPos25.value = entry.unk_pos25; + unkPos26.value = entry.unk_pos26; + unkPos27.value = entry.unk_pos27; + unkPos28.value = entry.unk_pos28; + unkPos29.value = entry.unk_pos29; + unkPos30.value = entry.unk_pos30; + unkPos31.value = entry.unk_pos31; + effectSize.value = entry.effect_size; + for (int i = 0; i < 6; i++) + u_b_1[i].value = entry.u_b_1[i]; + swordPos.value = entry.sword_pos; + for (int i = 0; i < 12; i++) + u_b_2[i].value = entry.u_b_2[i]; } } diff --git a/lib/widgets/filesView/FileDetailsEditor.dart b/lib/widgets/filesView/FileDetailsEditor.dart index 6aee78e5..acd17ef5 100644 --- a/lib/widgets/filesView/FileDetailsEditor.dart +++ b/lib/widgets/filesView/FileDetailsEditor.dart @@ -90,7 +90,7 @@ class _FileDetailsEditorState extends ChangeNotifierState { if (currentFile.selectedEntry.value?.record != null) return EstRecordDetailsEditor(record: currentFile.selectedEntry.value!.record!); if (currentFile.selectedEntry.value?.entry != null) - return EstEntryDetailsEditor(entry: currentFile.selectedEntry.value!.entry!); + return EstEntryDetailsEditor(entry: currentFile.selectedEntry.value!.entry!, showUnknown: true); } return Container(); } diff --git a/lib/widgets/filesView/types/effect/EstEntryDetailsEditor.dart b/lib/widgets/filesView/types/effect/EstEntryDetailsEditor.dart index da35af55..007ce538 100644 --- a/lib/widgets/filesView/types/effect/EstEntryDetailsEditor.dart +++ b/lib/widgets/filesView/types/effect/EstEntryDetailsEditor.dart @@ -10,8 +10,9 @@ import 'RgbPropEditor.dart'; class EstEntryDetailsEditor extends StatefulWidget { final EstEntryWrapper entry; + final bool showUnknown; - EstEntryDetailsEditor({required this.entry}) + EstEntryDetailsEditor({required this.entry, required this.showUnknown}) : super(key: Key(entry.uuid)); @override @@ -39,14 +40,30 @@ class _EstEntryDetailsEditorState extends State { return _getTexWidgets(entry); else if (entry is EstFwkEntryWrapper) return _getFwkWidgets(entry); + else if (entry is EstEmmvEntryWrapper) + return _getEmmvWidgets(entry); else return []; } List _getPartWidgets(EstPartEntryWrapper entry) { return [ - _EntryPropEditor(label: "Unknown", prop: entry.unknown), _EntryPropEditor(label: "Anchor bone ID", prop: entry.anchorBone), + if (widget.showUnknown) ...[ + _EntryPropEditor(label: "u_a (i16)", prop: entry.u_a), + _EntryPropEditor(label: "u_b (i16)", prop: entry.u_b), + _EntryPropEditor(label: "u_c (u32)", prop: entry.u_c), + _EntryPropEditor(label: "u_d (u32)", prop: entry.u_d), + _EntryPropEditor(label: "u_e (i16)", prop: entry.u_e), + _EntryPropEditor(label: "u_1 (i16)", prop: entry.u_1), + _EntryPropEditor(label: "u_2 (i16)", prop: entry.u_2), + _EntryPropEditor(label: "u_3 (i16)", prop: entry.u_3), + _EntryPropEditor(label: "u_4 (i16)", prop: entry.u_4), + _EntryPropEditor(label: "u_5 (i16)", prop: entry.u_5), + _EntryPropEditor(label: "u_6 (i16)", prop: entry.u_6), + _EntryPropEditor(label: "u_7 (f32)", prop: entry.u_7), + _EntryPropEditor(label: "u_8 (u8)", prop: entry.u_8), + ] ]; } @@ -68,6 +85,19 @@ class _EstEntryDetailsEditorState extends State { _EntryPropEditor(label: "Effect size limit 2", prop: entry.effectSizeLimit2), _EntryPropEditor(label: "Effect size limit 3", prop: entry.effectSizeLimit3), _EntryPropEditor(label: "Effect size limit 4", prop: entry.effectSizeLimit4), + if (widget.showUnknown) ...[ + _EntryPropEditor(label: "u_a (u32)", prop: entry.u_a), + for (var i = 0; i < entry.u_b_1.length; i++) + _EntryPropEditor(label: "u_b_1[$i] (f32)", prop: entry.u_b_1[i]), + for (var i = 0; i < entry.u_b_2.length; i++) + _EntryPropEditor(label: "u_b_2[$i] (f32)", prop: entry.u_b_2[i]), + for (var i = 0; i < entry.u_c.length; i++) + _EntryPropEditor(label: "u_c[$i] (f32)", prop: entry.u_c[i]), + for (var i = 0; i < entry.u_d_1.length; i++) + _EntryPropEditor(label: "u_d_1[$i] (f32)", prop: entry.u_d_1[i]), + for (var i = 0; i < entry.u_d_2.length; i++) + _EntryPropEditor(label: "u_d_2[$i] (f32)", prop: entry.u_d_2[i]), + ] ]; } @@ -77,6 +107,14 @@ class _EstEntryDetailsEditorState extends State { _EntryPropEditor(label: "Play delay", prop: entry.playDelay), _EntryPropEditor(label: "Show at once", prop: entry.showAtOnce), _EntryPropEditor(label: "Size", prop: entry.size), + if (widget.showUnknown) ...[ + _EntryPropEditor(label: "u_a (i16)", prop: entry.u_a), + _EntryPropEditor(label: "u_b (i16)", prop: entry.u_b), + _EntryPropEditor(label: "u_c (i16)", prop: entry.u_c), + _EntryPropEditor(label: "unk (i16)", prop: entry.unk), + for (var i = 0; i < entry.u_d.length; i++) + _EntryPropEditor(label: "u_d[$i] (f32)", prop: entry.u_d[i]), + ] ]; } @@ -112,12 +150,80 @@ class _EstEntryDetailsEditorState extends State { ), _EntryPropEditor(label: "Is single frame", prop: entry.isSingleFrame), _EntryPropEditor(label: "Video FPS (?)", prop: entry.videoFps), + if (widget.showUnknown) ...[ + _EntryPropEditor(label: "u_c (i16)", prop: entry.u_c), + _EntryPropEditor(label: "u_d2 (f32)", prop: entry.u_d2), + _EntryPropEditor(label: "u_d3 (f32)", prop: entry.u_d3), + _EntryPropEditor(label: "u_d4 (f32)", prop: entry.u_d4), + _EntryPropEditor(label: "u_d5 (f32)", prop: entry.u_d5), + _EntryPropEditor(label: "u_g (f32)", prop: entry.u_g), + _EntryPropEditor(label: "u_h (i16)", prop: entry.u_h), + _EntryPropEditor(label: "u_i (f32)", prop: entry.distortion_effect_strength), + for (var i = 0; i < entry.u_i2.length; i++) + _EntryPropEditor(label: "u_i2[$i] (f32)", prop: entry.u_i2[i]), + _EntryPropEditor(label: "u_i3 (u32)", prop: entry.u_i3), + for (var i = 0; i < entry.u_i4.length; i++) + _EntryPropEditor(label: "u_i4[$i] (f32)", prop: entry.u_i4[i]), + _EntryPropEditor(label: "u_j (f32)", prop: entry.u_j), + ] + ]; + } + + List _getEmmvWidgets(EstEmmvEntryWrapper entry) { + return [ + _EntryPropEditor(label: "u_a", prop: entry.u_a), + _EntryPropEditor(label: "Left pos 1", prop: entry.leftPos1), + _EntryPropEditor(label: "Top pos", prop: entry.topPos), + _EntryPropEditor(label: "Unk pos 1", prop: entry.unkPos1), + _EntryPropEditor(label: "Random pos 1", prop: entry.randomPos1), + _EntryPropEditor(label: "Top bottom random pos 1", prop: entry.topBottomRandomPos1), + _EntryPropEditor(label: "Front back random pos 1", prop: entry.frontBackRandomPos1), + _EntryPropEditor(label: "Left pos 2", prop: entry.leftPos2), + _EntryPropEditor(label: "Front pos 1", prop: entry.frontPos1), + _EntryPropEditor(label: "Front pos 2", prop: entry.frontPos2), + _EntryPropEditor(label: "Left right random pos 1", prop: entry.leftRightRandomPos1), + _EntryPropEditor(label: "Random pos 2", prop: entry.randomPos2), + _EntryPropEditor(label: "Front back random pos 2", prop: entry.frontBackRandomPos2), + _EntryPropEditor(label: "Unk pos 2", prop: entry.unkPos2), + _EntryPropEditor(label: "Left pos random 1", prop: entry.leftPosRandom1), + _EntryPropEditor(label: "Top pos 2", prop: entry.topPos2), + _EntryPropEditor(label: "Front pos 3", prop: entry.frontPos3), + _EntryPropEditor(label: "Unk pos 3", prop: entry.unkPos3), + _EntryPropEditor(label: "Unk pos 4", prop: entry.unkPos4), + _EntryPropEditor(label: "Unk pos 5", prop: entry.unkPos5), + _EntryPropEditor(label: "Unk pos 6", prop: entry.unkPos6), + _EntryPropEditor(label: "Unk pos 7", prop: entry.unkPos7), + _EntryPropEditor(label: "Unk pos 8", prop: entry.unkPos8), + _EntryPropEditor(label: "Unk pos 9", prop: entry.unkPos9), + _EntryPropEditor(label: "Unk pos 10", prop: entry.unkPos10), + _EntryPropEditor(label: "Unk pos 11", prop: entry.unkPos11), + _EntryPropEditor(label: "Unk pos 25", prop: entry.unkPos25), + _EntryPropEditor(label: "Unk pos 26", prop: entry.unkPos26), + _EntryPropEditor(label: "Unk pos 27", prop: entry.unkPos27), + _EntryPropEditor(label: "Unk pos 28", prop: entry.unkPos28), + _EntryPropEditor(label: "Unk pos 29", prop: entry.unkPos29), + _EntryPropEditor(label: "Unk pos 30", prop: entry.unkPos30), + _EntryPropEditor(label: "Unk pos 31", prop: entry.unkPos31), + _EntryPropEditor(label: "Effect size", prop: entry.effectSize), + for (var i = 0; i < entry.u_b_1.length; i++) + _EntryPropEditor(label: "u_b_1[$i]", prop: entry.u_b_1[i]), + _EntryPropEditor(label: "Sword pos", prop: entry.swordPos), + for (var i = 0; i < entry.u_b_2.length; i++) + _EntryPropEditor(label: "u_b_2[$i]", prop: entry.u_b_2[i]), ]; } List _getFwkWidgets(EstFwkEntryWrapper entry) { return [ _EntryPropEditor(label: "Imported effect EST index", prop: entry.importedEffectId), + if (widget.showUnknown) ...[ + _EntryPropEditor(label: "u_a0 (i16)", prop: entry.u_a0), + _EntryPropEditor(label: "u_a1 (i16)", prop: entry.u_a1), + for (var i = 0; i < entry.u_b.length; i++) + _EntryPropEditor(label: "u_b[$i] (i16)", prop: entry.u_b[i]), + for (var i = 0; i < entry.u_c.length; i++) + _EntryPropEditor(label: "u_c[$i] (f32)", prop: entry.u_c[i]), + ] ]; } } diff --git a/lib/widgets/filesView/types/effect/EstRecordDetailsEditor.dart b/lib/widgets/filesView/types/effect/EstRecordDetailsEditor.dart index aa61ac1f..e67d8626 100644 --- a/lib/widgets/filesView/types/effect/EstRecordDetailsEditor.dart +++ b/lib/widgets/filesView/types/effect/EstRecordDetailsEditor.dart @@ -32,7 +32,7 @@ class _EstRecordDetailsEditorState extends ChangeNotifierState { _McdEditorBody(file: widget.file, mcd: widget.file.mcdData!), FontsManager(mcd: widget.file.mcdData!), McdFontDebugger( - texturePath: widget.file.mcdData!.textureWtpPath.value, + texturePath: widget.file.mcdData!.textureWtpPath!.value, fonts: widget.file.mcdData!.usedFonts.values.toList(), ), ] : List.filled(3, loadingIndicator), diff --git a/lib/widgets/tools/ExtractFileTool.dart b/lib/widgets/tools/ExtractFileTool.dart index 0f1c752e..3f0d6b1c 100644 --- a/lib/widgets/tools/ExtractFileTool.dart +++ b/lib/widgets/tools/ExtractFileTool.dart @@ -38,7 +38,7 @@ class _ExtractFilesToolState extends State { ("Extract DAT", extractDat), ("Extract Textures", extractWta), ("Extract Audio", extractBnk), - ("Convert Scripts", convertScripts), + // ("Convert Scripts", convertScripts), ("Convert BXM", convertBxm), ];