mirror of
https://github.com/holub/mame
synced 2025-06-09 22:33:00 +03:00
wd177x: remove tests for head count. add track count test in check_compatibility() becuase it will segfault if disk drive doesn't have enough tracks
This commit is contained in:
parent
ccb2cfac66
commit
a95725f81b
@ -212,11 +212,6 @@ bool wd177x_format::load(io_generic *io, uint32_t form_factor, const std::vector
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(f.head_count > max_heads) {
|
|
||||||
osd_printf_error("wd177x_format: Number of sides in image file too high for floppy drive (%d > %d)\n", f.track_count, max_heads);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int track=0; track < f.track_count; track++)
|
for(int track=0; track < f.track_count; track++)
|
||||||
for(int head=0; head < f.head_count; head++) {
|
for(int head=0; head < f.head_count; head++) {
|
||||||
uint8_t sectdata[40*512];
|
uint8_t sectdata[40*512];
|
||||||
@ -433,6 +428,15 @@ void wd177x_format::check_compatibility(floppy_image *image, std::vector<int> &c
|
|||||||
int *ok_cands = &candidates[0];
|
int *ok_cands = &candidates[0];
|
||||||
for(unsigned int i=0; i < candidates.size(); i++) {
|
for(unsigned int i=0; i < candidates.size(); i++) {
|
||||||
const format &f = formats[candidates[i]];
|
const format &f = formats[candidates[i]];
|
||||||
|
|
||||||
|
int max_tracks, max_heads;
|
||||||
|
image->get_maximal_geometry(max_tracks, max_heads);
|
||||||
|
|
||||||
|
// Fail if floppy drive can't handle track count
|
||||||
|
if(f.track_count > max_tracks) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
for(int track=0; track < f.track_count; track++) {
|
for(int track=0; track < f.track_count; track++) {
|
||||||
for(int head=0; head < f.head_count; head++) {
|
for(int head=0; head < f.head_count; head++) {
|
||||||
const format &tf = get_track_format(f, head, track);
|
const format &tf = get_track_format(f, head, track);
|
||||||
|
Loading…
Reference in New Issue
Block a user