Skip to content

Commit 67312b1

Browse files
authored
Fix last sector bug
1 parent 15e69e7 commit 67312b1

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Program.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -587,24 +587,24 @@ static void Main(string[] args)
587587
Console.WriteLine("[ERROR] Failed writing system update file.");
588588
return;
589589
}
590-
}
591590

592-
// Write final video partition sector
593-
videoFS.Seek(-SECTOR_SIZE, SeekOrigin.End);
594-
numBytes = 0;
595-
while (numBytes < SECTOR_SIZE)
596-
{
597-
int bytesRead = videoFS.Read(buf, 0, (int)Math.Min(buf.Length, SECTOR_SIZE - numBytes));
598-
if (bytesRead == 0)
599-
break;
591+
// Write final video partition sector
592+
videoFS.Seek(-SECTOR_SIZE, SeekOrigin.End);
593+
numBytes = 0;
594+
while (numBytes < SECTOR_SIZE)
595+
{
596+
int bytesRead = videoFS.Read(buf, 0, (int)Math.Min(buf.Length, SECTOR_SIZE - numBytes));
597+
if (bytesRead == 0)
598+
break;
600599

601-
redumpFS.Write(buf, 0, bytesRead);
602-
numBytes += bytesRead;
603-
}
604-
if (numBytes != SECTOR_SIZE)
605-
{
606-
Console.WriteLine("[ERROR] Failed writing last sector of video partition.");
607-
return;
600+
redumpFS.Write(buf, 0, bytesRead);
601+
numBytes += bytesRead;
602+
}
603+
if (numBytes != SECTOR_SIZE)
604+
{
605+
Console.WriteLine("[ERROR] Failed writing last sector of video partition.");
606+
return;
607+
}
608608
}
609609
}
610610
// Mode 3: Extract system update file from video ISO

0 commit comments

Comments
 (0)