Fixed the floppy-error bug on VC builds (was uninited variable in fdd_img.c)
Made the CD=ROM ioctl support code conditional, as per OBattler's concerns over that code.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* Implementation of the CD-ROM drive with SCSI(-like)
|
||||
* commands, for both ATAPI and SCSI usage.
|
||||
*
|
||||
* Version: @(#)cdrom.c 1.0.14 2018/05/06
|
||||
* Version: @(#)cdrom.c 1.0.15 2018/05/08
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -75,7 +75,9 @@
|
||||
|
||||
cdrom_t *cdrom[CDROM_NUM];
|
||||
cdrom_image_t cdrom_image[CDROM_NUM];
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
cdrom_ioctl_t cdrom_ioctl[CDROM_NUM];
|
||||
#endif
|
||||
cdrom_drive_t cdrom_drives[CDROM_NUM];
|
||||
uint8_t atapi_cdrom_drives[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
uint8_t scsi_cdrom_drives[16][8] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
@@ -3339,10 +3341,13 @@ cdrom_hard_reset(void)
|
||||
if (cdrom_drives[c].host_drive == 200) {
|
||||
image_open(c, cdrom_image[c].image_path);
|
||||
image_reset(c);
|
||||
} else if ((cdrom_drives[c].host_drive>='A') && (cdrom_drives[c].host_drive <= 'Z')) {
|
||||
} else
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
if ((cdrom_drives[c].host_drive>='A') && (cdrom_drives[c].host_drive <= 'Z')) {
|
||||
ioctl_open(c, cdrom_drives[c].host_drive);
|
||||
ioctl_reset(c);
|
||||
} else
|
||||
#endif
|
||||
cdrom_null_open(c, cdrom_drives[c].host_drive);
|
||||
}
|
||||
|
||||
@@ -3362,7 +3367,9 @@ cdrom_close(uint8_t id)
|
||||
image_close(id);
|
||||
break;
|
||||
default:
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
ioctl_close(id);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the CDROM module..
|
||||
*
|
||||
* Version: @(#)cdrom.h 1.0.9 2018/04/30
|
||||
* Version: @(#)cdrom.h 1.0.10 2018/05/08
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -225,6 +225,7 @@ typedef struct {
|
||||
FILE* image;
|
||||
} cdrom_image_t;
|
||||
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
typedef struct {
|
||||
char ioctl_path[8];
|
||||
int actual_requested_blocks;
|
||||
@@ -232,6 +233,7 @@ typedef struct {
|
||||
int last_track_nr;
|
||||
int capacity_read;
|
||||
} cdrom_ioctl_t;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int8_t speed;
|
||||
@@ -245,7 +247,9 @@ extern const cdrom_speed_t cdrom_speeds[];
|
||||
extern cdrom_t *cdrom[CDROM_NUM];
|
||||
extern cdrom_drive_t cdrom_drives[CDROM_NUM];
|
||||
extern cdrom_image_t cdrom_image[CDROM_NUM];
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
extern cdrom_ioctl_t cdrom_ioctl[CDROM_NUM];
|
||||
#endif
|
||||
extern uint8_t atapi_cdrom_drives[8];
|
||||
extern uint8_t scsi_cdrom_drives[16][8];
|
||||
|
||||
@@ -258,7 +262,9 @@ extern uint8_t scsi_cdrom_drives[16][8];
|
||||
extern int (*ide_bus_master_read)(int channel, uint8_t *data, int transfer_length);
|
||||
extern int (*ide_bus_master_write)(int channel, uint8_t *data, int transfer_length);
|
||||
extern void (*ide_bus_master_set_irq)(int channel);
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
extern void ioctl_close(uint8_t id);
|
||||
#endif
|
||||
|
||||
extern int cdrom_speed_idx(int realspeed);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the NEC uPD-765 and compatible floppy disk
|
||||
* controller.
|
||||
*
|
||||
* Version: @(#)fdc.c 1.0.11 2018/05/06
|
||||
* Version: @(#)fdc.c 1.0.12 2018/05/08
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
@@ -645,7 +645,8 @@ void
|
||||
fdc_seek(fdc_t *fdc, int drive, int params)
|
||||
{
|
||||
fdd_seek(real_drive(fdc, drive), params);
|
||||
fdc->time = 5000 * TIMER_SHIFT;
|
||||
|
||||
fdc->time = 5000 * (1LL << TIMER_SHIFT);
|
||||
|
||||
fdc->stat |= (1 << fdc->drive);
|
||||
}
|
||||
|
||||
@@ -2242,8 +2242,9 @@ d86f_sector_is_present(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uin
|
||||
if (dev->last_side_sector[side]) {
|
||||
s = dev->last_side_sector[side];
|
||||
while (s) {
|
||||
if ((s->c == c) && (s->h == h) && (s->r == r) && (s->n == n))
|
||||
if ((s->c == c) && (s->h == h) && (s->r == r) && (s->n == n)) {
|
||||
return 1;
|
||||
}
|
||||
if (! s->prev)
|
||||
break;
|
||||
t = s->prev;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* re-merged with the other files. Much of it is generic to
|
||||
* all formats.
|
||||
*
|
||||
* Version: @(#)fdd_img.c 1.0.8 2018/05/06
|
||||
* Version: @(#)fdd_img.c 1.0.9 2018/05/08
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -55,7 +55,6 @@
|
||||
|
||||
typedef struct {
|
||||
FILE *f;
|
||||
uint8_t track_data[2][50000];
|
||||
int sectors, tracks, sides;
|
||||
uint8_t sector_size;
|
||||
int xdf_type; /* 0 = not XDF, 1-5 = one of the five XDF types */
|
||||
@@ -67,8 +66,6 @@ typedef struct {
|
||||
uint8_t gap3_size;
|
||||
uint16_t disk_flags;
|
||||
uint16_t track_flags;
|
||||
uint8_t sector_pos_side[2][256];
|
||||
uint16_t sector_pos[2][256];
|
||||
uint8_t current_sector_pos_side;
|
||||
uint16_t current_sector_pos;
|
||||
uint8_t *disk_data;
|
||||
@@ -76,6 +73,13 @@ typedef struct {
|
||||
uint8_t disk_at_once;
|
||||
uint8_t interleave;
|
||||
uint8_t skew;
|
||||
char guard1[65536];
|
||||
uint8_t sector_pos_side[2][256];
|
||||
char guard2[65536];
|
||||
uint16_t sector_pos[2][256];
|
||||
char guard3[65536];
|
||||
uint8_t track_data[2][50000];
|
||||
char guard4[65536];
|
||||
} img_t;
|
||||
|
||||
|
||||
@@ -604,7 +608,7 @@ img_load(int drive, const wchar_t *fn)
|
||||
uint8_t bpb_mid; /* Media type ID. */
|
||||
uint8_t bpb_sectors;
|
||||
uint8_t bpb_sides;
|
||||
uint8_t fdi, cqm, fdf;
|
||||
uint8_t cqm, fdf, fdi;
|
||||
uint16_t comment_len = 0;
|
||||
int16_t block_len = 0;
|
||||
uint32_t cur_pos = 0;
|
||||
@@ -644,7 +648,8 @@ img_load(int drive, const wchar_t *fn)
|
||||
writeprot[drive] = 1;
|
||||
fwriteprot[drive] = writeprot[drive];
|
||||
|
||||
fdi = cqm = 0;
|
||||
/* Clear ALL subtypes. */
|
||||
cqm = fdf = fdi = 0;
|
||||
|
||||
dev->interleave = dev->skew = 0;
|
||||
|
||||
@@ -670,9 +675,7 @@ img_load(int drive, const wchar_t *fn)
|
||||
first_byte = fgetc(dev->f);
|
||||
|
||||
fdi = 1;
|
||||
cqm = 0;
|
||||
dev->disk_at_once = 0;
|
||||
fdf = 0;
|
||||
} else {
|
||||
/* Read the first four bytes. */
|
||||
fseek(dev->f, 0x00, SEEK_SET);
|
||||
@@ -693,7 +696,6 @@ img_load(int drive, const wchar_t *fn)
|
||||
dev->f = plat_fopen(fn, L"rb");
|
||||
|
||||
fdf = 1;
|
||||
cqm = 0;
|
||||
dev->disk_at_once = 1;
|
||||
|
||||
fseek(dev->f, 0x50, SEEK_SET);
|
||||
@@ -896,12 +898,12 @@ img_load(int drive, const wchar_t *fn)
|
||||
|
||||
cqm = 1;
|
||||
dev->disk_at_once = 1;
|
||||
fdf = 0;
|
||||
first_byte = *dev->disk_data;
|
||||
} else {
|
||||
dev->disk_at_once = 0;
|
||||
/* Read the BPB */
|
||||
pclog("img_load(): File is a raw image...\n");
|
||||
dev->disk_at_once = 0;
|
||||
|
||||
/* Read the BPB */
|
||||
fseek(dev->f, 0x0B, SEEK_SET);
|
||||
fread(&bpb_bps, 1, 2, dev->f);
|
||||
fseek(dev->f, 0x13, SEEK_SET);
|
||||
@@ -912,8 +914,6 @@ img_load(int drive, const wchar_t *fn)
|
||||
bpb_sectors = fgetc(dev->f);
|
||||
fseek(dev->f, 0x1A, SEEK_SET);
|
||||
bpb_sides = fgetc(dev->f);
|
||||
|
||||
cqm = 0;
|
||||
}
|
||||
|
||||
fseek(dev->f, -1, SEEK_END);
|
||||
@@ -921,7 +921,6 @@ img_load(int drive, const wchar_t *fn)
|
||||
|
||||
jump_if_fdf:
|
||||
dev->base = 0;
|
||||
fdi = 0;
|
||||
}
|
||||
|
||||
dev->sides = 2;
|
||||
@@ -1072,7 +1071,7 @@ jump_if_fdf:
|
||||
} else {
|
||||
if (!cqm && !fdf) {
|
||||
/* Number of tracks = number of total sectors divided by sides times sectors per track. */
|
||||
dev->tracks = ((uint32_t) bpb_total) / (((uint32_t) bpb_sides) * ((uint32_t) bpb_sectors));
|
||||
dev->tracks = ((uint32_t)bpb_total) / (((uint32_t)bpb_sides) * ((uint32_t)bpb_sectors));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
7
src/pc.c
7
src/pc.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Main emulator module where most things are controlled.
|
||||
*
|
||||
* Version: @(#)pc.c 1.0.37 2018/05/07
|
||||
* Version: @(#)pc.c 1.0.38 2018/05/08
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -680,9 +680,12 @@ pc_reload(const wchar_t *fn)
|
||||
|
||||
if (cdrom_drives[i].host_drive == 200)
|
||||
image_open(i, cdrom_image[i].image_path);
|
||||
else if ((cdrom_drives[i].host_drive >= 'A') && (cdrom_drives[i].host_drive <= 'Z'))
|
||||
else
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
if ((cdrom_drives[i].host_drive >= 'A') && (cdrom_drives[i].host_drive <= 'Z'))
|
||||
ioctl_open(i, cdrom_drives[i].host_drive);
|
||||
else
|
||||
#endif
|
||||
cdrom_null_open(i, cdrom_drives[i].host_drive);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* This code is called by the UI frontend modules, and, also,
|
||||
* depends on those same modules for lower-level functions.
|
||||
*
|
||||
* Version: @(#)ui_main.c 1.0.11 2018/05/08
|
||||
* Version: @(#)ui_main.c 1.0.12 2018/05/08
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -147,8 +147,10 @@ ui_menu_set_logging_item(int idm, int val)
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CDROM_IOCTL_LOG
|
||||
# ifdef USE_CDROM_IOCTL
|
||||
case IDM_LOG_CDROM_IOCTL:
|
||||
ptr = &cdrom_ioctl_do_log;
|
||||
# endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Common UI support functions for the Status Bar module.
|
||||
*
|
||||
* Version: @(#)ui_stbar.c 1.0.4 2018/05/06
|
||||
* Version: @(#)ui_stbar.c 1.0.5 2018/05/08
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -917,7 +917,9 @@ ui_sb_menu_command(int idm, int tag)
|
||||
cdrom_drives[drive].prev_host_drive = cdrom_drives[drive].host_drive;
|
||||
cdrom_drives[drive].handler->exit(drive);
|
||||
cdrom_close(drive);
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
ioctl_open(drive, new_cdrom_drive);
|
||||
#endif
|
||||
|
||||
/* Signal media change to the emulated machine. */
|
||||
cdrom_insert(drive);
|
||||
|
||||
@@ -69,7 +69,9 @@
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#ifndef LIBVNCSERVER_HAVE_LIBPTHREAD
|
||||
#define LIBVNCSERVER_HAVE_LIBPTHREAD 1
|
||||
#ifndef _WIN32
|
||||
# define LIBVNCSERVER_HAVE_LIBPTHREAD 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Makefile for Windows using Visual Studio 2015.
|
||||
#
|
||||
# Version: @(#)Makefile.VC 1.0.26 2018/05/06
|
||||
# Version: @(#)Makefile.VC 1.0.27 2018/05/08
|
||||
#
|
||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
@@ -165,10 +165,6 @@ ifeq ($(DEV_BUILD), y)
|
||||
WONDER := y
|
||||
endif
|
||||
|
||||
# Where is the the WinPcap SDK?
|
||||
WPCAP = "C:\Program Files (x86)\WinPcap"
|
||||
WPCAPINC = -I$(WPCAP)\Include
|
||||
WPCAPLIB = $(WPCAP)\Lib
|
||||
|
||||
# WxWidgets basic info. Extract using the config program.
|
||||
ifneq ($(WX), n)
|
||||
@@ -206,12 +202,12 @@ endif
|
||||
#########################################################################
|
||||
# Nothing should need changing from here on.. #
|
||||
#########################################################################
|
||||
VPATH := $(EXPATH) . cpu \
|
||||
VPATH := $(EXPATH) . cpu \
|
||||
devices \
|
||||
devices/cdrom devices/disk devices/floppy \
|
||||
devices/floppy/lzf devices/input devices/input/game \
|
||||
devices/network devices/network/slirp devices/ports \
|
||||
devices/sio devices/system devices/scsi devices\misc \
|
||||
devices/sio devices/system devices/scsi devices/misc \
|
||||
devices/sound \
|
||||
devices/sound/munt devices/sound/munt/c_interface \
|
||||
devices/sound/munt/sha1 devices/sound/munt/srchelper \
|
||||
@@ -371,23 +367,20 @@ OPTS += -DUSE_VNC
|
||||
RFLAGS += -DUSE_VNC
|
||||
ifneq ($(VNC_PATH), )
|
||||
OPTS += -I$(VNC_PATH)\INCLUDE
|
||||
VNCLIB := -L$(VNC_PATH)\LIB
|
||||
LOPTS += $(VNC_PATH)\LIB
|
||||
LIBS += -lvncserver
|
||||
endif
|
||||
VNCLIB += -lvncserver
|
||||
VNCOBJ := vnc.obj vnc_keymap.obj
|
||||
LIBS += $(VNCLIB) -lws2_32
|
||||
endif
|
||||
|
||||
ifeq ($(RDP), y)
|
||||
OPTS += -DUSE_RDP
|
||||
RFLAGS += -DUSE_RDP
|
||||
ifneq ($(RDP_PATH), )
|
||||
OPTS += -I$(RDP_PATH)\INCLUDE
|
||||
RDPLIB := -L$(RDP_PATH)\LIB
|
||||
LOPTS += $(RDP_PATH)\LIB
|
||||
LIBS += -lrdpsrvr
|
||||
endif
|
||||
RDPLIB += -lrdp
|
||||
RDPOBJ := rdp.obj
|
||||
LIBS += $(RDPLIB)
|
||||
endif
|
||||
|
||||
ifeq ($(PNG), y)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform main support module for Windows.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.19 2018/05/07
|
||||
* Version: @(#)win.c 1.0.10 2018/05/08
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -751,7 +751,7 @@ plat_vidapi_reset(void)
|
||||
/* If not defined, assume always OK. */
|
||||
if (vid_apis[vid_api]->reset == NULL) return;
|
||||
|
||||
return(vid_apis[vid_api]->reset(vid_fullscreen));
|
||||
vid_apis[vid_api]->reset(vid_fullscreen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle the platform-side of CDROM drives.
|
||||
*
|
||||
* Version: @(#)win_cdrom.c 1.0.8 2018/05/06
|
||||
* Version: @(#)win_cdrom.c 1.0.9 2018/05/08
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -127,7 +127,9 @@ cdrom_eject(uint8_t id)
|
||||
void
|
||||
cdrom_reload(uint8_t id)
|
||||
{
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
int new_cdrom_drive;
|
||||
#endif
|
||||
|
||||
if ((cdrom_drives[id].host_drive == cdrom_drives[id].prev_host_drive) || (cdrom_drives[id].prev_host_drive == 0) || (cdrom_drives[id].host_drive != 0)) {
|
||||
/* Switch from empty to empty. Do nothing. */
|
||||
@@ -156,6 +158,7 @@ cdrom_reload(uint8_t id)
|
||||
ui_sb_menu_set_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, 1);
|
||||
ui_sb_icon_state(SB_CDROM|id, 0);
|
||||
}
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
} else {
|
||||
new_cdrom_drive = cdrom_drives[id].prev_host_drive;
|
||||
ioctl_open(id, new_cdrom_drive);
|
||||
@@ -167,6 +170,7 @@ cdrom_reload(uint8_t id)
|
||||
cdrom_drives[id].host_drive = new_cdrom_drive;
|
||||
ui_sb_menu_set_item(SB_CDROM|id, IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), 1);
|
||||
ui_sb_icon_state(SB_CDROM|id, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
ui_sb_menu_enable_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, 0);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the CD-ROM host drive IOCTL interface for
|
||||
* Windows using SCSI Passthrough Direct.
|
||||
*
|
||||
* Version: @(#)cdrom_ioctl.c 1.0.9 2018/05/06
|
||||
* Version: @(#)cdrom_ioctl.c 1.0.10 2018/05/08
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -55,6 +55,9 @@
|
||||
#include "../devices/cdrom/cdrom.h"
|
||||
|
||||
|
||||
#ifdef USE_CDROM_IOCTL
|
||||
|
||||
|
||||
#define MSFtoLBA(m,s,f) ((((m*60)+s)*75)+f)
|
||||
|
||||
|
||||
@@ -1363,3 +1366,6 @@ static CDROM ioctl_cdrom=
|
||||
ioctl_stop,
|
||||
ioctl_exit
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user