getchsgeometry2 (size, pcyl, phead, psectorspertrack, size <= minsize ? 1 : 2);
}
+// partition hdf default
+void gethdfgeometry(uae_u64 size, struct uaedev_config_info *ci)
+{
+ int head = 1;
+ int sectorspertrack = 32;
+ if (size >= 1048576000) { // >=1000M
+ head = 16;
+ while ((size / 512) / ((uae_u64)head * sectorspertrack) >= 32768 && sectorspertrack < 32768) {
+ sectorspertrack *= 2;
+ }
+ }
+ ci->surfaces = head;
+ ci->sectors = sectorspertrack;
+ ci->reserved = 2;
+ ci->blocksize = 512;
+}
+
void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry)
{
uae_u64 blocks = total / 512;
- if (blocks > 16515072) {
- /* >8G, CHS=16383/16/63 */
- *pcyl = 16383;
- *phead = 16;
- *psectorspertrack = 63;
- return;
- }
if (idegeometry) {
*phead = 16;
*psectorspertrack = 63;
*pcyl = blocks / ((*psectorspertrack) * (*phead));
+ if (blocks > 16515072) {
+ /* >8G, CHS=16383/16/63 */
+ *pcyl = 16383;
+ *phead = 16;
+ *psectorspertrack = 63;
+ return;
+ }
return;
}
getchsgeometry (total, pcyl, phead, psectorspertrack);
extern int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_write_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_resize_target (struct hardfiledata *hfd, uae_u64 newsize);
+
extern void getchsgeometry (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack);
extern void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack);
extern void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry);
+extern void gethdfgeometry(uae_u64 size, struct uaedev_config_info*);
void add_cpuboard_unit(int unit, struct uaedev_config_info *uci, struct romconfig *rc);
bsize = 0;
if (force) {
bool open = false;
+ bool gotrdb = false;
int blocksize = 512;
struct hardfiledata hfd;
memset (id, 0, sizeof id);
current_hfdlg.size = hfd.virtsize;
if (!memcmp (id, "RDSK", 4) || !memcmp (id, "CDSK", 4)) {
blocksize = (id[16] << 24) | (id[17] << 16) | (id[18] << 8) | (id[19] << 0);
+ gotrdb = true;
break;
}
}
} else {
getchspgeometry (bsize, ¤t_hfdlg.ci.pcyls, ¤t_hfdlg.ci.pheads, ¤t_hfdlg.ci.psecs, false);
}
+ if (defaults && !gotrdb) {
+ gethdfgeometry(bsize, ¤t_hfdlg.ci);
+ phys = false;
+ }
} else {
current_hfdlg.forcedcylinders = current_hfdlg.ci.pcyls;
}