catastropy averted?
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
# Binary Recovery
|
||||
|
||||
This repo is a plugin feed, not a source repo. The recoverable assets live in `plugins/*/latest.zip`.
|
||||
|
||||
## What already worked
|
||||
|
||||
The current packages decompile cleanly with ILSpy into usable C# projects under `.recovery/decompiled`.
|
||||
|
||||
Recovered assemblies:
|
||||
|
||||
- `AntiDickheadChatmodule`
|
||||
- `CrystallineConflictWinsTracker`
|
||||
- `MultiboxMutexer`
|
||||
- `OmicronMountMusicFixer`
|
||||
- `WorldMapEnhancer`
|
||||
|
||||
Observed runtime targets from shipped `.deps.json` files:
|
||||
|
||||
- `AntiDickheadChatmodule`: `.NETCoreApp,Version=v10.0`
|
||||
- `CrystallineConflictWinsTracker`: `.NETCoreApp,Version=v7.0`
|
||||
- `MultiboxMutexer`: `.NETCoreApp,Version=v7.0`
|
||||
- `OmicronMountMusicFixer`: `.NETCoreApp,Version=v10.0`
|
||||
- `WorldMapEnhancer`: `.NETCoreApp,Version=v10.0`
|
||||
|
||||
## Repeat The Recovery
|
||||
|
||||
Run:
|
||||
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\recovery\recover-plugins.ps1
|
||||
```
|
||||
|
||||
That script will:
|
||||
|
||||
1. Install `ilspycmd` into repo-local `.tools` if it is missing.
|
||||
2. Extract every `plugins/*/latest.zip` into `.recovery/extract`.
|
||||
3. Decompile every top-level DLL into `.recovery/decompiled/<AssemblyName>`.
|
||||
4. Write `.recovery/inventory.csv` with the assembly names, runtime targets, PDB presence, and output paths.
|
||||
|
||||
## What To Expect
|
||||
|
||||
The output is usable, but not production-ready without cleanup:
|
||||
|
||||
- The generated `.csproj` files only contain bare assembly references. You will need to rebuild package references and the Dalamud build setup.
|
||||
- Some unsafe or native interop blocks decompile with `//IL_...` comments and occasional `Unknown result type` notes. Those are normal decompiler artifacts around hooks, pointers, and game structs.
|
||||
- PDB-backed projects retain better type and file names. `CrystallineConflictWinsTracker` and `MultiboxMutexer` shipped PDBs.
|
||||
- `MultiboxMutexer` and `OmicronMountMusicFixer` show Fody/Resourcer-generated artifacts in the decompile output. Those may be easier to replace with simpler source equivalents than to preserve exactly.
|
||||
|
||||
## Recommended Next Pass
|
||||
|
||||
For each recovered project:
|
||||
|
||||
1. Create a fresh plugin project targeting the framework required by your current Dalamud toolchain.
|
||||
2. Copy the decompiled source into that fresh project instead of trying to compile the raw ILSpy `.csproj` unchanged.
|
||||
3. Re-add package references and Dalamud services incrementally until it builds.
|
||||
4. Replace any fragile hook signatures, pointer code, or generated-resource code only where the compiler forces you to.
|
||||
|
||||
If you want, the next step can be to take one recovered plugin and turn it back into a clean, buildable source project in this repo.
|
||||
@@ -0,0 +1,95 @@
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$pluginsRoot = Join-Path $repoRoot "plugins"
|
||||
$toolRoot = Join-Path $repoRoot ".tools"
|
||||
$recoveryRoot = Join-Path $repoRoot ".recovery"
|
||||
$extractRoot = Join-Path $recoveryRoot "extract"
|
||||
$decompileRoot = Join-Path $recoveryRoot "decompiled"
|
||||
$inventoryPath = Join-Path $recoveryRoot "inventory.csv"
|
||||
$toolExe = Join-Path $toolRoot "ilspycmd.exe"
|
||||
|
||||
function Ensure-Directory([string]$Path) {
|
||||
if (-not (Test-Path -LiteralPath $Path)) {
|
||||
New-Item -ItemType Directory -Path $Path | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
function Reset-Directory([string]$Path) {
|
||||
if (Test-Path -LiteralPath $Path) {
|
||||
Remove-Item -LiteralPath $Path -Recurse -Force
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $Path | Out-Null
|
||||
}
|
||||
|
||||
function Get-RuntimeTarget([string]$DepsPath) {
|
||||
if (-not (Test-Path -LiteralPath $DepsPath)) {
|
||||
return $null
|
||||
}
|
||||
|
||||
try {
|
||||
$deps = Get-Content -LiteralPath $DepsPath -Raw | ConvertFrom-Json
|
||||
return $deps.runtimeTarget.name
|
||||
}
|
||||
catch {
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
Ensure-Directory $toolRoot
|
||||
Ensure-Directory $recoveryRoot
|
||||
Ensure-Directory $extractRoot
|
||||
Ensure-Directory $decompileRoot
|
||||
|
||||
if (-not (Test-Path -LiteralPath $toolExe)) {
|
||||
dotnet tool install --tool-path $toolRoot ilspycmd | Out-Host
|
||||
}
|
||||
|
||||
$inventory = New-Object System.Collections.Generic.List[object]
|
||||
|
||||
Get-ChildItem -LiteralPath $pluginsRoot -Directory | Sort-Object Name | ForEach-Object {
|
||||
$pluginDir = $_
|
||||
$zipPath = Join-Path $pluginDir.FullName "latest.zip"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $zipPath)) {
|
||||
return
|
||||
}
|
||||
|
||||
$extractPath = Join-Path $extractRoot $pluginDir.Name
|
||||
Reset-Directory $extractPath
|
||||
Expand-Archive -LiteralPath $zipPath -DestinationPath $extractPath -Force
|
||||
|
||||
$dlls = Get-ChildItem -LiteralPath $extractPath -Filter "*.dll" -File
|
||||
|
||||
foreach ($dll in $dlls) {
|
||||
$assemblyName = [System.IO.Path]::GetFileNameWithoutExtension($dll.Name)
|
||||
$projectPath = Join-Path $decompileRoot $assemblyName
|
||||
Reset-Directory $projectPath
|
||||
|
||||
& $toolExe -p -o $projectPath $dll.FullName | Out-Host
|
||||
|
||||
$depsPath = Join-Path $extractPath ($assemblyName + ".deps.json")
|
||||
$pdbPath = Join-Path $extractPath ($assemblyName + ".pdb")
|
||||
|
||||
$inventory.Add([pscustomobject]@{
|
||||
PluginFolder = $pluginDir.Name
|
||||
AssemblyName = $assemblyName
|
||||
RuntimeTarget = Get-RuntimeTarget $depsPath
|
||||
ZipPath = $zipPath
|
||||
DllPath = $dll.FullName
|
||||
HasPdb = Test-Path -LiteralPath $pdbPath
|
||||
ExtractPath = $extractPath
|
||||
ProjectPath = $projectPath
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$inventory |
|
||||
Sort-Object PluginFolder, AssemblyName |
|
||||
Export-Csv -LiteralPath $inventoryPath -NoTypeInformation
|
||||
|
||||
$inventory |
|
||||
Sort-Object PluginFolder, AssemblyName |
|
||||
Format-Table PluginFolder, AssemblyName, RuntimeTarget, HasPdb, ProjectPath
|
||||
Reference in New Issue
Block a user