projects
/
debian
/
cpmtools
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lose autotools-dev build dep
[debian/cpmtools]
/
device_win32.c
diff --git
a/device_win32.c
b/device_win32.c
index b8aef9b3e584d0eb98f96de5910a07ab766ecd61..1829443242c47233973a24a96e5dbb521d994e69 100644
(file)
--- a/
device_win32.c
+++ b/
device_win32.c
@@
-2,8
+2,8
@@
#include "config.h"
#include <assert.h>
#include "config.h"
#include <assert.h>
-#include <errno.h>
#include <ctype.h>
#include <ctype.h>
+#include <errno.h>
#include <stdio.h>
#include "cpmdir.h"
#include <stdio.h>
#include "cpmdir.h"
@@
-385,18
+385,23
@@
const char *Device_open(struct Device *sb, const char *filename, int mode, const
}
/*}}}*/
/* Device_setGeometry -- Set disk geometry */ /*{{{*/
}
/*}}}*/
/* 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;
{
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 (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;
drvp.bytespersector = secLength;
drvp.sectorspertrack = sectrk;
@@
-443,6
+448,7
@@
void Device_setGeometry(struct Device *this, int secLength, int sectrk, int trac
*/
SetDriveParams( this->hdisk, this->fd, &drvp );
}
*/
SetDriveParams( this->hdisk, this->fd, &drvp );
}
+ return NULL;
}
/*}}}*/
/* Device_close -- Close an image file */ /*{{{*/
}
/*}}}*/
/* Device_close -- Close an image file */ /*{{{*/
@@
-484,7
+490,8
@@
const char *Device_readSector(const struct Device *drive, int track, int sector,
LPVOID iobuffer;
DWORD bytesread;
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 strwin32error();
}
@@
-511,6
+518,7
@@
const char *Device_readSector(const struct Device *drive, int track, int sector,
return NULL;
}
return NULL;
}
+ // Bill Buckels - not sure what to do here
if (drive->drvtype == CPMDRV_WIN95)
{
DIOC_REGISTERS reg;
if (drive->drvtype == CPMDRV_WIN95)
{
DIOC_REGISTERS reg;
@@
-552,7
+560,8
@@
const char *Device_readSector(const struct Device *drive, int track, int sector,
return 0;
}
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);
}
{
return strerror(errno);
}
@@
-585,7
+594,8
@@
const char *Device_writeSector(const struct Device *drive, int track, int sector
LPVOID iobuffer;
DWORD byteswritten;
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 strwin32error();
}
@@
-607,6
+617,7
@@
const char *Device_writeSector(const struct Device *drive, int track, int sector
return NULL;
}
return NULL;
}
+ // Bill Buckels - not sure what to do here
if (drive->drvtype == CPMDRV_WIN95)
{
DIOC_REGISTERS reg;
if (drive->drvtype == CPMDRV_WIN95)
{
DIOC_REGISTERS reg;
@@
-648,7
+659,8
@@
const char *Device_writeSector(const struct Device *drive, int track, int sector
return NULL;
}
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);
}
{
return strerror(errno);
}