mirror of
https://gitea.tendokyu.moe/beerpsi/x.git
synced 2024-11-24 07:10:11 +01:00
38 lines
1.2 KiB
PowerShell
38 lines
1.2 KiB
PowerShell
param (
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$opt
|
|
)
|
|
|
|
Add-Type -Path "bin/DereTore.Exchange.Audio.HCA.dll"
|
|
|
|
$ccFrom = [DereTore.Exchange.Audio.HCA.CipherConfig]::new()
|
|
$ccFrom.Key1 = 3728959580
|
|
$ccFrom.Key2 = 7782811
|
|
|
|
$ccTo = [DereTore.Exchange.Audio.HCA.CipherConfig]::new()
|
|
$ccTo.Key1 = 3458615040
|
|
$ccTo.Key2 = 7667487
|
|
$ccTo.CipherType = 56
|
|
|
|
Get-ChildItem (Join-Path $opt "cueFile") | ForEach-Object {
|
|
$acb = (Get-ChildItem "$($_.FullName)\*.acb" | Select-Object -First 1).FullName
|
|
$unpacked_folder = "$($_.FullName)\$([IO.Path]::GetFileNameWithoutExtension($acb))"
|
|
|
|
.\bin\AcbEditor.exe "$acb"
|
|
|
|
Get-ChildItem "$unpacked_folder\*.hca" | ForEach-Object {
|
|
$inputStream = [IO.FileStream]::new($_.FullName, [IO.FileMode]::Open, [IO.FileAccess]::Read)
|
|
$outputStream = [IO.FileStream]::new("$($_.FullName).new", [IO.FileMode]::Create, [IO.FileAccess]::Write)
|
|
$converter = [DereTore.Exchange.Audio.HCA.CipherConverter]::new($inputStream, $outputStream, $ccFrom, $ccTo)
|
|
$converter.Convert()
|
|
|
|
$outputStream.Dispose()
|
|
$inputStream.Dispose()
|
|
|
|
Move-Item -Force "$($_.FullName).new" "$($_.FullName)"
|
|
}
|
|
|
|
.\bin\AcbEditor.exe "$unpacked_folder"
|
|
|
|
Remove-Item -Recurse "$unpacked_folder"
|
|
} |