#include "config.h"
#include <assert.h>
-#include <errno.h>
#include <ctype.h>
+#include <errno.h>
#include <stdio.h>
#include "cpmdir.h"
}
/*}}}*/
/* Device_setGeometry -- Set disk geometry */ /*{{{*/
-void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks)
+const char * Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry)
{
int n;
this->secLength=secLength;
this->sectrk=sectrk;
this->tracks=tracks;
+ // Bill Buckels - add this->offset
+ this->offset=offset;
+
+
+ // Bill Buckels - not sure what to do here
if (this->drvtype == CPMDRV_WIN95)
{
DRIVEPARAMS drvp;
memset(&drvp, 0, sizeof(drvp));
- if (GetDriveParams( this->hdisk, this->fd, &drvp )) return;
+ if (GetDriveParams( this->hdisk, this->fd, &drvp )) return "GetDriveParams failed";
drvp.bytespersector = secLength;
drvp.sectorspertrack = sectrk;
*/
SetDriveParams( this->hdisk, this->fd, &drvp );
}
+ return NULL;
}
/*}}}*/
/* Device_close -- Close an image file */ /*{{{*/
LPVOID iobuffer;
DWORD bytesread;
- if (SetFilePointer(drive->hdisk, offset, NULL, FILE_BEGIN) == INVALID_FILE_SIZE)
+ // Bill Buckels - add drive->offset
+ if (SetFilePointer(drive->hdisk, offset+drive->offset, NULL, FILE_BEGIN) == INVALID_FILE_SIZE)
{
return strwin32error();
}
return NULL;
}
+ // Bill Buckels - not sure what to do here
if (drive->drvtype == CPMDRV_WIN95)
{
DIOC_REGISTERS reg;
return 0;
}
- if (lseek(drive->fd,offset,SEEK_SET)==-1)
+ // Bill Buckels - add drive->offset
+ if (lseek(drive->fd,offset+drive->offset,SEEK_SET)==-1)
{
return strerror(errno);
}
LPVOID iobuffer;
DWORD byteswritten;
- if (SetFilePointer(drive->hdisk, offset, NULL, FILE_BEGIN) == INVALID_FILE_SIZE)
+ // Bill Buckels - add drive->offset
+ if (SetFilePointer(drive->hdisk, offset+drive->offset, NULL, FILE_BEGIN) == INVALID_FILE_SIZE)
{
return strwin32error();
}
return NULL;
}
+ // Bill Buckels - not sure what to do here
if (drive->drvtype == CPMDRV_WIN95)
{
DIOC_REGISTERS reg;
return NULL;
}
- if (lseek(drive->fd,offset, SEEK_SET)==-1)
+ // Bill Buckels - add drive->offset
+ if (lseek(drive->fd,offset+drive->offset, SEEK_SET)==-1)
{
return strerror(errno);
}