# GDPS patcher for Windows (Geometry Dash 2.2). No downloads, no exe. # Usage: put this file next to GeometryDash.exe, right click -> "Run with PowerShell" # or: powershell -ExecutionPolicy Bypass -File gdps_patch.ps1 [path\to\GD folder] param([string]$Dir = $PSScriptRoot) $Url = "gdps.themaster2009sf.ru/db" $OrigHttp = "http://www.boomlings.com/database" $OrigHttps = "https://www.boomlings.com/database" function Fit([string]$scheme, [int]$len) { $hostPart, $path = $Url.Split('/', 2) $u = "${scheme}://${hostPart}/${path}" if ($u.Length -gt $len) { throw "URL too long" } return "${scheme}://${hostPart}" + ('/' * ($len - $u.Length + 1)) + $path } function B64([string]$s) { [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($s)) } $pairs = @() foreach ($p in @(@($OrigHttps, (Fit "https" $OrigHttps.Length)), @($OrigHttp, (Fit "http" $OrigHttp.Length)))) { $o = $p[0]; $n = $p[1] $pairs += ,@($o, $n) $pairs += ,@((B64 $o), (B64 $n)) $pairs += ,@((B64 $o).Replace('+','-').Replace('/','_'), (B64 $n).Replace('+','-').Replace('/','_')) $pairs += ,@((B64 $o).TrimEnd('='), (B64 $n).TrimEnd('=')) } $enc = [Text.Encoding]::GetEncoding(28591) # 1:1 byte <-> char $grand = 0 foreach ($name in @("GeometryDash.exe", "libcocos2d.dll")) { $f = Join-Path $Dir $name if (-not (Test-Path $f)) { Write-Host "skip: $name not found"; continue } $bytes = [IO.File]::ReadAllBytes($f) $text = $enc.GetString($bytes) $count = 0 foreach ($p in $pairs) { $c = ([regex]::Matches($text, [regex]::Escape($p[0]))).Count if ($c -gt 0) { $text = $text.Replace($p[0], $p[1]); $count += $c; Write-Host " $($p[0]) -> $($p[1]) x$c" } } Write-Host "[$name] replacements: $count" if ($count -gt 0) { if (-not (Test-Path "$f.bak")) { Copy-Item $f "$f.bak" } $out = $enc.GetBytes($text) if ($out.Length -ne $bytes.Length) { throw "length mismatch" } [IO.File]::WriteAllBytes($f, $out) } $grand += $count } if ($grand -eq 0) { Write-Host "Nothing replaced (already patched or not GD 2.2)." } else { Write-Host "Done. Backup: *.bak" } if ($Host.Name -eq 'ConsoleHost') { Read-Host "Press Enter" }