mirror of https://github.com/wwarthen/RomWBW.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.1 KiB
66 lines
1.1 KiB
param([string]$Image)
|
|
|
|
# If a PowerShell exception occurs, just stop the script immediately.
|
|
$ErrorAction = 'Stop'
|
|
|
|
$DefFile = $Image + ".def"
|
|
|
|
$ImgFile = "..\..\Binary\hd1k_" + $Image + ".img"
|
|
|
|
|
|
|
|
|
|
$SliceList = @()
|
|
|
|
ForEach ($Line in Get-Content $DefFile)
|
|
{
|
|
$Line = $Line.Trim()
|
|
|
|
if (($Line.Length -eq 0) -or ($Line[0] -eq "#"))
|
|
{
|
|
continue
|
|
}
|
|
|
|
$SliceList += $Line
|
|
}
|
|
|
|
function CreateImageFile {
|
|
param (
|
|
[string]$Format = "" # hd1k or hd512
|
|
)
|
|
|
|
$ImgFile = "..\..\Binary\" + $Format + "_" + $Image + ".img"
|
|
|
|
$FileList = ""
|
|
|
|
"Generating $ImgFile using $DefFile..."
|
|
|
|
ForEach ($Slice in $SliceList)
|
|
{
|
|
$File = "..\..\Binary\" + $Format + "_" + $Slice + ".img"
|
|
|
|
if (!(Test-Path $File))
|
|
{
|
|
"Slice input file """ + $File + """ not found!!!"
|
|
exit 1
|
|
}
|
|
|
|
if ($FileList.Length -gt 0)
|
|
{
|
|
$FileList += "+"
|
|
}
|
|
|
|
$FileList += $File
|
|
}
|
|
|
|
if ($Format -eq "hd1k")
|
|
{
|
|
$FileList = "hd1k_prefix.dat+" + $FileList
|
|
}
|
|
cmd.exe /c copy /b $FileList $ImgFile
|
|
}
|
|
|
|
CreateImageFile "hd512"
|
|
CreateImageFile "hd1k"
|
|
|
|
exit 0
|
|
|