Add option to disable BPB checking when loading .IMG files - should fix some floppy images on non-DOS/Windows/OS/2 systems.
This commit is contained in:
parent
ed7021a2e1
commit
1cb83a4dc1
6 changed files with 19 additions and 1 deletions
|
|
@ -20,6 +20,8 @@ static uint8_t xdf_track0[5][3];
|
|||
static uint8_t xdf_spt[5];
|
||||
static uint8_t xdf_map[5][24][3];
|
||||
|
||||
int bpb_disable;
|
||||
|
||||
void img_writeback(int drive, int track);
|
||||
|
||||
static int img_sector_size_code(int drive)
|
||||
|
|
@ -163,7 +165,7 @@ void img_load(int drive, char *fn)
|
|||
|
||||
pclog("BPB reports %i sides and %i bytes per sector\n", bpb_sides, bpb_bps);
|
||||
|
||||
if ((bpb_sides < 1) || (bpb_sides > 2) || (bpb_bps < 128) || (bpb_bps > 2048))
|
||||
if (bpb_disable || (bpb_sides < 1) || (bpb_sides > 2) || (bpb_bps < 128) || (bpb_bps > 2048))
|
||||
{
|
||||
/* The BPB is giving us a wacky number of sides and/or bytes per sector, therefore it is most probably
|
||||
not a BPB at all, so we have to guess the parameters from file size. */
|
||||
|
|
|
|||
|
|
@ -9,3 +9,5 @@ void img_format(int drive, int sector, int side, int density);
|
|||
int img_hole(int drive);
|
||||
void img_stop();
|
||||
void img_poll();
|
||||
|
||||
extern int bpb_disable;
|
||||
|
|
|
|||
3
src/pc.c
3
src/pc.c
|
|
@ -8,6 +8,7 @@
|
|||
#include "cdrom-ioctl.h"
|
||||
#include "cdrom-iso.h"
|
||||
#include "disc.h"
|
||||
#include "disc_img.h"
|
||||
#include "mem.h"
|
||||
#include "x86_ops.h"
|
||||
#include "codegen.h"
|
||||
|
|
@ -666,6 +667,7 @@ void loadconfig(char *fn)
|
|||
|
||||
fdd_set_type(0, config_get_int(NULL, "drive_a_type", 7));
|
||||
fdd_set_type(1, config_get_int(NULL, "drive_b_type", 7));
|
||||
bpb_disable = config_get_int(NULL, "bpb_disable", 0);
|
||||
|
||||
window_w = config_get_int(NULL, "window_w", 0);
|
||||
window_h = config_get_int(NULL, "window_h", 0);
|
||||
|
|
@ -759,6 +761,7 @@ void saveconfig()
|
|||
|
||||
config_set_int(NULL, "drive_a_type", fdd_get_type(0));
|
||||
config_set_int(NULL, "drive_b_type", fdd_get_type(1));
|
||||
config_set_int(NULL, "bpb_disable", bpb_disable);
|
||||
|
||||
config_set_int(NULL, "window_w", window_w);
|
||||
config_set_int(NULL, "window_h", window_h);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ BEGIN
|
|||
MENUITEM "Change drive &B:...", IDM_DISC_B
|
||||
MENUITEM "&Eject drive A:", IDM_EJECT_A
|
||||
MENUITEM "Eject drive B:", IDM_EJECT_B
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Disable BPB checking", IDM_BPB_DISABLE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Configure hard discs...",IDM_HDCONF
|
||||
END
|
||||
POPUP "&Settings"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#define IDM_EJECT_A 40012
|
||||
#define IDM_EJECT_B 40013
|
||||
#define IDM_HDCONF 40014
|
||||
#define IDM_BPB_DISABLE 40015
|
||||
#define IDM_CONFIG 40020
|
||||
#define IDM_CONFIG_LOAD 40021
|
||||
#define IDM_CONFIG_SAVE 40022
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "sound.h"
|
||||
#include "thread.h"
|
||||
#include "disc.h"
|
||||
#include "disc_img.h"
|
||||
|
||||
#include "plat-midi.h"
|
||||
#include "plat-keyboard.h"
|
||||
|
|
@ -580,6 +581,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
|||
CheckMenuItem(menu, IDM_VID_DDRAW + vid_api, MF_CHECKED);
|
||||
CheckMenuItem(menu, IDM_VID_FS_FULL + video_fullscreen_scale, MF_CHECKED);
|
||||
CheckMenuItem(menu, IDM_VID_REMEMBER, window_remember ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menu, IDM_BPB_DISABLE, bpb_disable ? MF_CHECKED : MF_UNCHECKED);
|
||||
// set_display_switch_mode(SWITCH_BACKGROUND);
|
||||
|
||||
d=romset;
|
||||
|
|
@ -936,6 +938,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
disc_close(1);
|
||||
saveconfig();
|
||||
break;
|
||||
case IDM_BPB_DISABLE:
|
||||
bpb_disable = !bpb_disable;
|
||||
CheckMenuItem(hmenu, IDM_BPB_DISABLE, bpb_disable ? MF_CHECKED : MF_UNCHECKED);
|
||||
saveconfig();
|
||||
break;
|
||||
case IDM_HDCONF:
|
||||
hdconf_open(hwnd);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue