Re: Solved: Re: [hatari-users] ICD hard drive image

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-users Archives ]


Hi,

On 5/20/19 8:47 PM, Charles Curley wrote:
On Mon, 20 May 2019 18:07:58 +0200
Thomas Huth <th.huth@xxxxxxxxx> wrote:
....> This line was a clue:

ERROR: Cannot open HD file read/write!

Bingo!

I had set the image to read only. Allowing writes to it let the desktop
import several of the partitions. So read-only images are not allowed.
Bug? Or if that's a feature, please document it.

Could you test attached patch that changes this?


So here's what I see: I have two other disk images, one partition each.
They show up as C: and D:. Then four partitions from the new image, E:
through H:. I: is my GEMDOS mounted directory. J: to O: are further
partitions from the new image. Is that the drive ordering you want, or
should the GEMDOS drive show up as O:? I was expecting it at O:.

Hatari default for GEMDOS HD partition ID is "skip", i.e. place it
after partitions that Hatari HD code recognizes.

In any of the cases where on-disk HD driver and Hatari interpretation
of the partition tables mismatches, GEMDOS HD won't be the last one.
This mismatch can happen easily because Hatari doesn't know which
HD driver is on the HD image or what partition types that recognizes
/ supports (partition support *does* differ between different drivers).

As a result, GEMDOS HD can mask one of the real HD partitions (or more,
if there are multiple GEMDOS HD partitions specified).

That's why there's an option to explicitly set the GEMDOS HD partition
ID:
	--gemdos-drive X


Relevant portions of debug output from a running instance:

DEBUG: Sound: Disabled
INFO : Mounting hard drive image '/home/charles/projects/hatari/fast.forth.img'
INFO : Mounting hard drive image '/home/charles/projects/hatari/drived.img'
INFO : Mounting hard drive image '/home/charles/projects/hatari/atari.micropolis.img'
DEBUG: Checking GEMDOS I: HDD: /home/charles/projects/hatari/cdrive
INFO : GEMDOS HDD emulation, I: <-> /home/charles/projects/hatari/cdrive.
DEBUG: memory_map_Standard_RAM total=2097152 ram0=2097152 ram1=0 mmu0=131072 mmu1=131072
DEBUG: memory_map_Standard_RAM - enable MMU 2097152 131072 131072


	- Eero
diff --git a/src/hdc.c b/src/hdc.c
index 838a4f3b..a7d307b9 100644
--- a/src/hdc.c
+++ b/src/hdc.c
@@ -828,13 +828,15 @@ int HDC_InitDevice(SCSI_DEV *dev, char *filename, unsigned long blockSize)
 	if (filesize < 0)
 		return filesize;
 
-	fp = fopen(filename, "rb+");
-	if (fp == NULL)
+	if (!(fp = fopen(filename, "rb+")))
 	{
-		Log_Printf(LOG_ERROR, "Cannot open HD file read/write!\n");
-		return -ENOENT;
+		if (!(fp = fopen(filename, "rb")))
+		{
+			Log_Printf(LOG_ERROR, "Cannot open HD file for reading!\n");
+			return -ENOENT;
+		}
 	}
-	if (!File_Lock(fp))
+	else if (!File_Lock(fp))
 	{
 		Log_Printf(LOG_ERROR, "Cannot lock HD file for writing!\n");
 		fclose(fp);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/