HD loading can now autodetect some 17 sector MFM hard drives. Patch from Greatpsycho.

This commit is contained in:
SarahW 2017-04-28 18:13:03 +01:00
commit b2f018c11e
2 changed files with 51 additions and 6 deletions

View file

@ -68,9 +68,36 @@ static int hdconf_open(int msg, DIALOG *d, int c)
fseeko64(f, -1, SEEK_END);
sz = ftello64(f) + 1;
fclose(f);
sprintf(hd_sectors_new, "63");
sprintf(hd_heads_new, "16");
sprintf(hd_cylinders_new, "%i", (int)((sz / 512) / 16) / 63);
if ((sz % 17) == 0 && sz <= 133693440)
{
sprintf(hd_sectors_new, "17");
if (sz <= 26738688)
{
sprintf(hd_heads_new, "4");
sprintf(hd_cylinders_new, "%i", (int)((sz / 512) / 4) / 17);
}
else if (sz <= 53477376)
{
sprintf(hd_heads_new, "6");
sprintf(hd_cylinders_new, "%i", (int)((sz / 512) / 6) / 17);
}
else if (sz <= 71303168)
{
sprintf(hd_heads_new, "8");
sprintf(hd_cylinders_new, "%i", (int)((sz / 512) / 8) / 17);
}
else
{
sprintf(hd_heads_new, "15");
sprintf(hd_cylinders_new, "%i", (int)((sz / 512) / 15) / 17);
}
}
else
{
sprintf(hd_sectors_new, "63");
sprintf(hd_heads_new, "16");
sprintf(hd_cylinders_new, "%i", (int)((sz / 512) / 16) / 63);
}
while (1)
{

View file

@ -61,9 +61,27 @@ static void check_hd_type(off64_t sz)
}
else
{
hd_new_spt = 63;
hd_new_hpc = 16;
hd_new_cyl = ((sz / 512) / 16) / 63;
if ((sz % 17) == 0 && sz <= 133693440)
{
hd_new_spt = 17;
if (sz <= 26738688)
hd_new_hpc = 4;
else if (sz <= 53477376)
hd_new_hpc = 6;
else if (sz <= 71303168)
hd_new_hpc = 8;
else
hd_new_hpc = 15;
hd_new_cyl = (int)((sz / 512) / hd_new_hpc) / 17;
}
else
{
hd_new_spt = 63;
hd_new_hpc = 16;
hd_new_cyl = ((sz / 512) / 16) / 63;
}
}
}