Initial source release
This commit is contained in:
commit
11301fae04
55 files changed
+2652
No files matched your search
@@ -0,0 +1,35 @@
|
||||
# Заливка ia32-картинок (KRD 18) на флешку.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
$work = 'C:\PF\KRD\images'
|
||||
$map = @(
|
||||
@{ png='x86-1'; src='C:\PF\PSD\UEFI\x86\main\main1.bmp'; dst='F:\efi\Boot\1x86.bmp' },
|
||||
@{ png='x86-2'; src='C:\PF\PSD\UEFI\x86\main\main2.bmp'; dst='F:\efi\Boot\2x86.bmp' }
|
||||
)
|
||||
if (Get-Process -Name vmware-vmx -ErrorAction SilentlyContinue) { throw 'VM запущена' }
|
||||
foreach ($m in $map) {
|
||||
$srcBytes = [IO.File]::ReadAllBytes($m.src)
|
||||
$off = [BitConverter]::ToUInt32($srcBytes, 10)
|
||||
$w = [BitConverter]::ToInt32($srcBytes, 18); $h = [BitConverter]::ToInt32($srcBytes, 22)
|
||||
$img = [System.Drawing.Image]::FromFile((Join-Path $work ($m.png + '.png')))
|
||||
$bmp = New-Object System.Drawing.Bitmap $img; $img.Dispose()
|
||||
$rowBytes = $w * 3
|
||||
$pix = New-Object byte[] ($rowBytes * $h)
|
||||
for ($y = 0; $y -lt $h; $y++) {
|
||||
$srcY = $h - 1 - $y
|
||||
for ($x = 0; $x -lt $w; $x++) {
|
||||
$c = $bmp.GetPixel($x, $srcY)
|
||||
$o = $y * $rowBytes + $x * 3
|
||||
$pix[$o] = $c.B; $pix[$o+1] = $c.G; $pix[$o+2] = $c.R
|
||||
}
|
||||
}
|
||||
$bmp.Dispose()
|
||||
$outBytes = New-Object byte[] $srcBytes.Length
|
||||
[Array]::Copy($srcBytes, $outBytes, $srcBytes.Length)
|
||||
[Array]::Copy($pix, 0, $outBytes, [int]$off, $pix.Length)
|
||||
$outPath = Join-Path $work ($m.png + '.bmp')
|
||||
[IO.File]::WriteAllBytes($outPath, $outBytes)
|
||||
Copy-Item $outPath $m.dst -Force
|
||||
' {0} -> {1} {2:N0} байт' -f $m.png, $m.dst, (Get-Item $m.dst).Length
|
||||
}
|
||||
'--- свободно: {0:N0} МБ' -f ((Get-Volume -DriveLetter F).SizeRemaining/1MB)
|
||||
Reference in new issue
Block a user