Skip to content

Instantly share code, notes, and snippets.

@jesux
Last active March 28, 2023 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesux/5c4d72c9d511fad728b9909407cc7154 to your computer and use it in GitHub Desktop.
Save jesux/5c4d72c9d511fad728b9909407cc7154 to your computer and use it in GitHub Desktop.
Hollow Knight 1.4.3.2/1.5.78.11833 NoDeath Patch (No mod)
$file = "C:\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Assembly-CSharp.dll"
Write-Output $file
$bytes = [System.IO.File]::ReadAllBytes($file)
$filehash = (Get-FileHash $file).Hash
$version_1_4_3_2 = [System.Text.Encoding]::Unicode.GetString($bytes[0x335242..0x33524f])
$hash_1_4_3_2 = "52209E09379BCE385473DECA8689369D8843BBBCA5DD93ED9140ED2CE3F48A11"
$hash_patched_1_4_3_2 = "FBC928427818A08DC71B91920C63CD735D41A8C4E139904C907AC6ED0B310DAD"
$version_1_5_78_11833 = [System.Text.Encoding]::Unicode.GetString($bytes[0x2f7284..0x2f729b])
$hash_1_5_78_11833 = "FCC01E0DF1B841A8FAF6B5E39F27030F63204AD02F430B3DEFA262134AE4E8A0"
$hash_patched_1_5_78_11833 = "E53E6F0BA80393199BA8AE4A4C64FD67E15D98D89BDF925F21690DA5478DC0C4"
if ($version_1_4_3_2 -eq "1.4.3.2" -And ($filehash -eq $hash_1_4_3_2 -Or $filehash -eq $hash_patched_1_4_3_2)) {
Write-Output "Version: $version_1_4_3_2"
$offset1 = 0xc5ea1
$original1 = 0x02, 0x02, 0x28, 0x54, 0x21, 0x00, 0x06, 0x28, 0x18, 0x02, 0x00, 0x0a, 0x26, 0x38, 0xac, 0x00, 0x00, 0x00
$patch1 = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
$offset2 = 0xc5fd3
$original2 = 0x02, 0x02, 0x28, 0x54, 0x21, 0x00, 0x06, 0x28, 0x18, 0x02, 0x00, 0x0a, 0x26, 0x38, 0x44, 0x00, 0x00, 0x00
$patch2 = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
$offset3 = 0xc6062
$original3 = 0x02, 0x02, 0x28, 0x54, 0x21, 0x00, 0x06, 0x28, 0x18, 0x02, 0x00, 0x0a, 0x26, 0x38, 0x13, 0x00, 0x00, 0x00
$patch3 = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
} elseif ($version_1_5_78_11833 -eq "1.5.78.11833" -And ($filehash -eq $hash_1_5_78_11833 -Or $filehash -eq $hash_patched_1_5_78_11833)) {
Write-Output "Version: $version_1_5_78_11833"
$offset1 = 0x19596
$original1 = 0x02, 0x02, 0x28, 0xa5, 0x04, 0x00, 0x06, 0x28, 0xe8, 0x00, 0x00, 0x0a, 0x26, 0x2a
$patch1 = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
$offset2 = 0x19691
$original2 = 0x02, 0x02, 0x28, 0xa5, 0x04, 0x00, 0x06, 0x28, 0xe8, 0x00, 0x00, 0x0a, 0x26, 0x2a
$patch2 = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
$offset3 = 0x19708
$original3 = 0x02, 0x02, 0x28, 0xa5, 0x04, 0x00, 0x06, 0x28, 0xe8, 0x00, 0x00, 0x0a, 0x26, 0x2a
$patch3 = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
} else {
Write-Output "[-] Failed. Wrong version?"
return
}
if ($bytes[$offset1] -eq $original1[0]) {
Write-Output "[+] Enabling NoDeath"
foreach ($byte in $patch1) {
$bytes[$offset1++] = $byte
}
foreach ($byte in $patch2) {
$bytes[$offset2++] = $byte
}
foreach ($byte in $patch3) {
$bytes[$offset3++] = $byte
}
$bytes = [System.IO.File]::WriteAllBytes($file, $bytes)
} elseif ($bytes[$offset1] -eq $patch1[0]) {
Write-Output "[+] Disabling NoDeath"
foreach ($byte in $original1) {
$bytes[$offset1++] = $byte
}
foreach ($byte in $original2) {
$bytes[$offset2++] = $byte
}
foreach ($byte in $original3) {
$bytes[$offset3++] = $byte
}
$bytes = [System.IO.File]::WriteAllBytes($file, $bytes)
} else {
Write-Output "[-] Failed. Wrong version?"
}
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment