Instantane de reference de la reprise de migration (2026-09-29). Contient GI.uasset tel que trouve (copie UE4 identique a 4.27, MD5 F4550DA5DC05FC005400CDCA2FC123C9). Ajouts de ce commit : .gitattributes (aucune conversion de fin de ligne), regles .gitignore CHG-001, Tools/ (Snapshot, Restore, AssetHeaders), empreintes L0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
2.2 KiB
PowerShell
52 lines
2.2 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Compte les packages .uasset/.umap par format (UE4 ou UE5) en lisant l'en-tete.
|
|
|
|
.DESCRIPTION
|
|
En-tete d'un package : magic 0x9E2A83C1, puis LegacyFileVersion (int32).
|
|
-7 = UE4 (4.27) ; -8 et moins = UE5, avec la version UE5 a l'octet 16.
|
|
Sortie : resume, et la liste des packages UE4 ou illisibles.
|
|
-Csv ecrit le detail complet (chemin, taille, versions, MD5 optionnel).
|
|
|
|
.EXAMPLE
|
|
.\Tools\AssetHeaders.ps1
|
|
.\Tools\AssetHeaders.ps1 -Root Content\BPs -Csv Docs\Migration\etat\headers_BPs.csv -Hash
|
|
#>
|
|
param(
|
|
[string]$Root = 'Content',
|
|
[string]$Csv,
|
|
[switch]$Hash,
|
|
[string]$ProjectRoot = (Split-Path $PSScriptRoot -Parent)
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$base = Join-Path $ProjectRoot $Root
|
|
$buf = New-Object byte[] 24
|
|
|
|
$rows = Get-ChildItem $base -Recurse -File -Include *.uasset, *.umap | ForEach-Object {
|
|
$fs = [IO.File]::OpenRead($_.FullName)
|
|
try { $n = $fs.Read($buf, 0, 24) } finally { $fs.Close() }
|
|
$magic = [BitConverter]::ToUInt32($buf, 0)
|
|
$legacy = [BitConverter]::ToInt32($buf, 4)
|
|
# 0x9E2A83C1 ecrit en decimal : le litteral hexadecimal serait un Int32 negatif
|
|
$fmt = if ($n -lt 24 -or $magic -ne [uint32]2653586369) { 'ILLISIBLE' } elseif ($legacy -le -8) { 'UE5' } else { 'UE4' }
|
|
[pscustomobject]@{
|
|
Rel = $_.FullName.Substring($ProjectRoot.TrimEnd('\').Length + 1)
|
|
Format = $fmt
|
|
Legacy = $legacy
|
|
UE4Ver = if ($fmt -ne 'ILLISIBLE') { [BitConverter]::ToInt32($buf, 12) } else { '' }
|
|
UE5Ver = if ($fmt -eq 'UE5') { [BitConverter]::ToInt32($buf, 16) } else { '' }
|
|
Size = $_.Length
|
|
Date = $_.LastWriteTime.ToString('s')
|
|
MD5 = if ($Hash) { (Get-FileHash $_.FullName -Algorithm MD5).Hash } else { '' }
|
|
}
|
|
}
|
|
|
|
$rows | Group-Object Format | ForEach-Object { '{0,-10} {1,6}' -f $_.Name, $_.Count }
|
|
$bad = $rows | Where-Object Format -ne 'UE5'
|
|
if ($bad) { "--- packages non UE5 ($(@($bad).Count), 50 premiers) :"; $bad | Select-Object -First 50 | ForEach-Object { '{0} {1} legacy={2} ue4={3}' -f $_.Format, $_.Rel, $_.Legacy, $_.UE4Ver } }
|
|
if ($Csv) {
|
|
$out = Join-Path $ProjectRoot $Csv
|
|
New-Item -ItemType Directory -Force (Split-Path $out -Parent) | Out-Null
|
|
$rows | Export-Csv $out -NoTypeInformation -Encoding UTF8
|
|
"detail : $out"
|
|
}
|