SARDONYX-sard / serde-hkx

Pure Rust cross-platform Havok behavior (De)Serialization library.(ver. hk_2010.2.0-r1)
https://www.nexusmods.com/skyrimspecialedition/mods/126214/
MIT License
6 stars 0 forks source link

[Bug]: Unknown regularity binaryization of hkArray<hkStringPtr>. #30

Closed SARDONYX-sard closed 3 hours ago

SARDONYX-sard commented 4 hours ago

Version

0.3.1

Reproducible errors

The problem is hkArray<hkStringPtr>. This appears in hkx as a null-terminated string, but I am having a very hard time fixing it because the rules for the correct binary data are not clear at all.

Knowledge of hkStringPtr

The rule I am assuming: String\0String\0 Actual: String\0\0String\0 <- What the heck is this pattern?

No matter how many times I try with hkxcmd, I can't figure out the rule at all, because it separates when \0 comes twice and when it doesn't.The data will be the same no matter how many times it is converted below. In other words, a mysterious rule with reproducibility.

000027c0: 50 49 45 00 4d 43 4f 5f 52 65 63 6f 76 65 72 79  PIE.MCO_Recovery
000027d0: 00 00 4d 43 4f 5f 49 6e 70 75 74 42 75 66 66 65  ..MCO_InputBuffe
000027e0: 72 00 4d 43 4f 5f 44 6f 64 67 65 41 74 74 61 63  r.MCO_DodgeAttac
000027f0: 6b 49 6e 69 74 69 61 74 65 00 4d 43 4f 5f 44 6f  kInitiate.MCO_Do
00002800: 64 67 65 50 6f 77 65 72 41 74 74 61 63 6b 49 6e  dgePowerAttackIn
00002810: 69 74 69 61 74 65 00 00 4d 43 4f 5f 45 6e 64 41  itiate..MCO_EndA
00002820: 6e 69 6d 61 74 69 6f 6e 00 00 43 6f 6c 6c 69 73  nimation..Collis
00002830: 69 6f 6e 5f 41 74 74 61 63 6b 53 74 61 72 74 00  ion_AttackStart.

I don't see how to fix it because I don't know the regularity of it.

Expected behavior

Rule Clarification

Relevant log output

No response

SARDONYX-sard commented 3 hours ago

In the case of hkArray, it is align2. (This is the second bug) Arrays not of type Ptr in hkArray also had to do align16 after serialization was done, but they didn't (this is the third bug).

I'm done now and all hkx in DMCO.hkx are reproducible.