@@ -688,6 +688,19 @@ private async Task FetchAudioIndex(HttpClient httpClient, List<FilePropertiesRem
688688
689689 private void BuildAudioVersioningFile ( KianaAudioManifest audioManifest , HonkaiRepairAssetIgnore ignoredAssetIDs )
690690 {
691+ // Edit: 2025-05-01
692+ // Starting from 8.2, the hash for the audio asset will be a sequence of MhyMurmurHash2 in UInt64-BE format.
693+ // Also, this version added another file as its "state manifest" for the default audio, "AUDIO_Default_manifest.m"
694+ string gameVersion = $ "{ GameVersion . Major } .{ GameVersion . Minor } ";
695+ ManifestAssetInfo audioDefaultAsset = audioManifest !
696+ . AudioAssets
697+ . FirstOrDefault ( x => x . Name . StartsWith ( "AUDIO_Default" ) ) ;
698+ ulong audioDefaultAssetHash = GetLongFromHashStr ( audioDefaultAsset . HashString ) ;
699+ Span < byte > audioDefaultManifestBuffer = stackalloc byte [ 16 ] ;
700+ audioDefaultAsset . Hash . CopyTo ( audioDefaultManifestBuffer ) ;
701+ File . WriteAllText ( Path . Combine ( GamePath ! , NormalizePath ( AudioBaseLocalPath ) ! , "AUDIO_Default_Version.txt" ) , $ "{ gameVersion } \t { audioDefaultAssetHash } ") ;
702+ File . WriteAllBytes ( Path . Combine ( GamePath ! , NormalizePath ( AudioBaseLocalPath ) ! , "AUDIO_Default_manifest.m" ) , audioDefaultManifestBuffer ) ;
703+
691704 // Build audio versioning file
692705 using StreamWriter sw = new StreamWriter ( Path . Combine ( GamePath ! , NormalizePath ( AudioBaseLocalPath ) ! , "Version.txt" ) , false ) ;
693706 // Edit: 2023-12-09
@@ -696,10 +709,21 @@ private void BuildAudioVersioningFile(KianaAudioManifest audioManifest, HonkaiRe
696709 . AudioAssets !
697710 . Where ( audioInfo => ( audioInfo ! . Language == AudioLanguageType . Common
698711 || audioInfo ! . Language == AudioLanguage )
699- && ! ignoredAssetIDs . IgnoredAudioPCKType . Contains ( audioInfo . PckType ) ) )
712+ && ! ignoredAssetIDs . IgnoredAudioPCKType . Contains ( audioInfo . PckType ) )
713+ . Where ( x => x != audioDefaultAsset ) )
700714 {
701715 // Only add common and language specific audio file
702- sw . WriteLine ( $ "{ audioAsset ! . Name } .pck\t { audioAsset . HashString } ") ;
716+ ulong audioAssetHash = GetLongFromHashStr ( audioAsset . HashString ) ;
717+ sw . WriteLine ( $ "{ audioAsset ! . Name } .pck\t { audioAssetHash } ") ;
718+ }
719+
720+ return ;
721+
722+ static ulong GetLongFromHashStr ( ReadOnlySpan < char > span )
723+ {
724+ Span < byte > spanChar = stackalloc byte [ span . Length ] ;
725+ _ = HexTool . TryHexToBytesUnsafe ( span , spanChar ) ;
726+ return BinaryPrimitives . ReadUInt64BigEndian ( spanChar ) ;
703727 }
704728 }
705729
0 commit comments