Added preliminary Adaptec 154x emulation, needs fixing in the Read 10 command.

Made ATAPI derived from SCSI.
Added proper S/G emulation for SCSI DMA.
Added SCSI CD-ROM emulation, preserving all the former ATAPI commands as well.
This commit is contained in:
TC1995
2016-11-12 15:06:38 +01:00
parent acb06e5a17
commit 0f035b42ea
28 changed files with 3163 additions and 789 deletions

View File

@@ -4,13 +4,13 @@ CC = gcc.exe
WINDRES = windres.exe
CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign
DFLAGS = -O3 -march=i686 -fomit-frame-pointer -msse2 -mstackrealign
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o ali1429.o amstrad.o cdrom-ioctl.o cdrom-iso.o \
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o aha154x.o ali1429.o amstrad.o cdrom-ioctl.o cdrom-iso.o \
cdrom-null.o codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86.o compaq.o config.o cpu.o dac.o \
device.o disc.o disc_86f.o disc_fdi.o disc_imd.o disc_img.o disc_random.o disc_td0.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o headland.o i430hx.o i430lx.o i430fx.o \
i430nx.o i430vx.o i440fx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o joystick_tm_fcs.o keyboard.o keyboard_amstrad.o keyboard_at.o \
keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o memregs.o model.o mouse.o mouse_amstrad.o mouse_ps2.o \
mouse_serial.o ne2000.o neat.o nethandler.o nmi.o nvr.o olivetti_m24.o opti.o pc.o pc87306.o pci.o pic.o piix.o pit.o ppi.o ps1.o rom.o rtc.o \
scat.o serial.o sis496.o sis85c471.o sio.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o \
scat.o scattergather.o scsi.o scsi_cdrom.o serial.o sis496.o sis85c471.o sio.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o \
sound_dbopl.o sound_emu8k.o sound_gus.o sound_mpu401_uart.o sound_opl.o sound_pas16.o sound_ps1.o sound_pssj.o sound_resid.o \
sound_sb.o sound_sb_dsp.o sound_sn76489.o sound_speaker.o sound_ssi2001.o sound_wss.o sound_ym7128.o \
soundopenal.o tandy_eeprom.o tandy_rom.o timer.o um8669f.o vid_ati_eeprom.o vid_ati_mach64.o vid_ati18800.o \

View File

@@ -4,13 +4,13 @@ CC = gcc.exe
WINDRES = windres.exe
CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign
DFLAGS = -O3 -fomit-frame-pointer -msse2
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o ali1429.o amstrad.o cdrom-ioctl.o cdrom-iso.o \
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o aha154x.o ali1429.o amstrad.o cdrom-ioctl.o cdrom-iso.o \
cdrom-null.o codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86-64.o compaq.o config.o cpu.o dac.o \
device.o disc.o disc_86f.o disc_fdi.o disc_imd.o disc_img.o disc_random.o disc_td0.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o headland.o i430hx.o i430lx.o i430fx.o \
i430nx.o i430vx.o i440fx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o joystick_tm_fcs.o keyboard.o keyboard_amstrad.o keyboard_at.o \
keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o memregs.o model.o mouse.o mouse_amstrad.o mouse_ps2.o \
mouse_serial.o ne2000.o neat.o nethandler.o nmi.o nvr.o olivetti_m24.o opti.o pc.o pc87306.o pci.o pic.o piix.o pit.o ppi.o ps1.o rom.o rtc.o \
scat.o serial.o sis496.o sis85c471.o sio.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o \
scat.o scattergather.o scsi.o scsi_cdrom.o serial.o sis496.o sis85c471.o sio.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o \
sound_dbopl.o sound_emu8k.o sound_gus.o sound_mpu401_uart.o sound_opl.o sound_pas16.o sound_ps1.o sound_pssj.o sound_resid.o \
sound_sb.o sound_sb_dsp.o sound_sn76489.o sound_speaker.o sound_ssi2001.o sound_wss.o sound_ym7128.o \
soundopenal.o tandy_eeprom.o tandy_rom.o timer.o um8669f.o vid_ati_eeprom.o vid_ati_mach64.o vid_ati18800.o \

1115
src/aha154x.c Normal file

File diff suppressed because it is too large Load Diff

1
src/aha154x.h Normal file
View File

@@ -0,0 +1 @@
extern void AdaptecInit(uint8_t Id);

View File

@@ -7,16 +7,16 @@
#include <io.h>
#include "ntddcdrm.h"
#include "ibm.h"
#include "ide.h"
#include "cdrom.h"
#include "cdrom-ioctl.h"
int cdrom_drive;
int old_cdrom_drive;
static ATAPI ioctl_atapi;
static CDROM ioctl_cdrom;
static uint32_t last_block = 0;
static uint32_t cdrom_capacity = 0;
uint32_t cdrom_capacity = 0;
static int ioctl_inited = 0;
static char ioctl_path[8];
void ioctl_close(void);
@@ -273,7 +273,6 @@ static int ioctl_get_last_block(unsigned char starttrack, int msf, int maxlen, i
DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL,0,&lbtoc,sizeof(lbtoc),&size,NULL);
ioctl_close();
tocvalid=1;
d=0;
for (c=d;c<=lbtoc.LastTrack;c++)
{
uint32_t address;
@@ -701,7 +700,7 @@ int ioctl_open(char d)
{
//fatal("IOCTL");
}
atapi=&ioctl_atapi;
cdrom=&ioctl_cdrom;
if (!ioctl_inited)
{
ioctl_inited=1;
@@ -727,7 +726,7 @@ static void ioctl_exit(void)
tocvalid=0;
}
static ATAPI ioctl_atapi=
static CDROM ioctl_cdrom=
{
ioctl_ready,
ioctl_medium_changed,

View File

@@ -7,6 +7,8 @@
/* this header file lists the functions provided by
various platform specific cdrom-ioctl files */
extern uint32_t cdrom_capacity;
extern int ioctl_open(char d);
extern void ioctl_reset();

View File

@@ -4,13 +4,13 @@
/*ISO CD-ROM support*/
#include "ibm.h"
#include "ide.h"
#include "cdrom.h"
#include "cdrom-iso.h"
#include <sys/stat.h>
static ATAPI iso_atapi;
static CDROM iso_cdrom;
static uint32_t last_block = 0;
uint32_t last_block = 0;
static uint64_t image_size = 0;
static int iso_inited = 0;
char iso_path[1024];
@@ -157,6 +157,7 @@ static void lba_to_msf(uint8_t *buf, int lba)
static void iso_readsector_raw(uint8_t *b, int sector)
{
uint32_t temp;
if (!cdrom_drive) return;
iso_image = fopen(iso_path, "rb");
fseek(iso_image, sector*2048, SEEK_SET);
@@ -313,7 +314,7 @@ static uint32_t iso_size()
{
unsigned char b[4096];
atapi->readtoc(b, 0, 0, 4096, 0);
cdrom->readtoc(b, 0, 0, 4096, 0);
return last_block;
}
@@ -345,7 +346,7 @@ int iso_open(char *fn)
pclog("Path is %s\n", iso_path);
}
iso_image = fopen(iso_path, "rb");
atapi = &iso_atapi;
cdrom = &iso_cdrom;
if (!iso_inited || iso_changed)
{
if (!iso_inited) iso_inited = 1;
@@ -375,7 +376,7 @@ static int iso_is_track_audio(uint32_t pos, int ismsf)
return 0;
}
static ATAPI iso_atapi =
static CDROM iso_cdrom =
{
iso_ready,
iso_medium_changed,

View File

@@ -7,6 +7,8 @@
/* this header file lists the functions provided by
various platform specific cdrom-ioctl files */
extern uint32_t last_block;
extern char iso_path[1024];
extern int iso_open(char *fn);

View File

@@ -2,12 +2,12 @@
see COPYING for more details
*/
#include "ibm.h"
#include "ide.h"
#include "cdrom.h"
#include "cdrom-ioctl.h"
int cdrom_drive;
static ATAPI null_atapi;
static CDROM null_cdrom;
void cdrom_null_audio_callback(int16_t *output, int len)
{
@@ -101,7 +101,7 @@ void cdrom_null_reset()
int cdrom_null_open(char d)
{
atapi = &null_atapi;
cdrom = &null_cdrom;
return 0;
}
@@ -118,7 +118,7 @@ static int null_is_track_audio(uint32_t pos, int ismsf)
return 0;
}
static ATAPI null_atapi =
static CDROM null_cdrom =
{
null_ready,
null_medium_changed,

30
src/cdrom.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef __CDROM_H__
#define __CDROM_H__
/*CD-ROM stuff*/
typedef struct CDROM
{
int (*ready)(void);
int (*medium_changed)(void);
int (*readtoc)(uint8_t *b, uint8_t starttrack, int msf, int maxlen, int single);
int (*readtoc_session)(uint8_t *b, int msf, int maxlen);
int (*readtoc_raw)(uint8_t *b, int maxlen);
uint8_t (*getcurrentsubchannel)(uint8_t *b, int msf);
void (*readsector)(uint8_t *b, int sector);
void (*readsector_raw)(uint8_t *b, int sector);
void (*playaudio)(uint32_t pos, uint32_t len, int ismsf);
void (*seek)(uint32_t pos);
void (*load)(void);
void (*eject)(void);
void (*pause)(void);
void (*resume)(void);
uint32_t (*size)(void);
int (*status)(void);
int (*is_track_audio)(uint32_t pos, int ismsf);
void (*stop)(void);
void (*exit)(void);
} CDROM;
extern CDROM *cdrom;
#endif

View File

@@ -422,3 +422,16 @@ int dma_channel_write(int channel, uint16_t val)
}
return 0;
}
size_t PageLengthReadWrite(uint32_t Address, size_t TotalSize)
{
size_t l;
uint32_t Page;
Page = Address & 4095;
l = (Page + 4096) - Address;
if (l > TotalSize)
l = TotalSize;
return l;
}

View File

@@ -1,4 +1,4 @@
/* Copyright holders: Sarah Walker
/* Copyright holders: Sarah Walker, SA1988
see COPYING for more details
*/
void dma_init();
@@ -17,3 +17,5 @@ void writedma2(uint8_t temp);
int dma_channel_read(int channel);
int dma_channel_write(int channel, uint16_t val);
size_t PageLengthReadWrite(uint32_t Address, size_t TotalSize);

View File

@@ -351,7 +351,7 @@ int driveempty[2];
#define PCJR (romset == ROM_IBMPCJR)
#define AMIBIOS (romset==ROM_AMI386 || romset==ROM_AMI486 || romset == ROM_WIN486)
int GAMEBLASTER, GUS, SSI2001, voodoo_enabled;
int GAMEBLASTER, GUS, SSI2001, voodoo_enabled, aha154x_enabled;
extern int AMSTRAD, AT, is286, is386, PCI, TANDY;
enum
@@ -571,6 +571,7 @@ extern int cdrom_drive;
extern int old_cdrom_drive;
extern int idecallback[3];
extern int cdrom_enabled;
extern int atapi_cdrom_enabled, scsi_cdrom_enabled;
#define CD_STATUS_EMPTY 0
#define CD_STATUS_DATA_ONLY 1
@@ -578,11 +579,14 @@ extern int cdrom_enabled;
#define CD_STATUS_PAUSED 3
#define CD_STATUS_STOPPED 4
extern uint32_t atapi_get_cd_channel(int channel);
extern uint32_t atapi_get_cd_volume(int channel);
extern uint32_t SCSIGetCDVolume(int channel);
extern uint32_t SCSIGetCDChannel(int channel);
extern int ide_ter_enabled;
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ELEMENTS(Array) (sizeof(Array) / sizeof((Array)[0]))
extern int ui_writeprot[2];
void pclog(const char *format, ...);

774
src/ide.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* Copyright holders: Sarah Walker, Tenshi
/* Copyright holders: Sarah Walker, Tenshi, SA1988
see COPYING for more details
*/
#ifndef __IDE__
@@ -22,42 +22,12 @@ extern void ide_sec_disable();
extern void ide_ter_disable();
extern void ide_set_bus_master(int (*read_sector)(int channel, uint8_t *data), int (*write_sector)(int channel, uint8_t *data), void (*set_irq)(int channel));
/*ATAPI stuff*/
typedef struct ATAPI
{
int (*ready)(void);
int (*medium_changed)(void);
int (*readtoc)(uint8_t *b, uint8_t starttrack, int msf, int maxlen, int single);
int (*readtoc_session)(uint8_t *b, int msf, int maxlen);
int (*readtoc_raw)(uint8_t *b, int maxlen);
uint8_t (*getcurrentsubchannel)(uint8_t *b, int msf);
void (*readsector)(uint8_t *b, int sector);
void (*readsector_raw)(uint8_t *b, int sector);
void (*playaudio)(uint32_t pos, uint32_t len, int ismsf);
void (*seek)(uint32_t pos);
void (*load)(void);
void (*eject)(void);
void (*pause)(void);
void (*resume)(void);
uint32_t (*size)(void);
int (*status)(void);
int (*is_track_audio)(uint32_t pos, int ismsf);
void (*stop)(void);
void (*exit)(void);
} ATAPI;
extern ATAPI *atapi;
void atapi_discchanged();
void atapi_insert_cdrom();
extern int ideboard;
extern int idecallback[3];
extern char ide_fn[4][512];
extern int cdrom_channel;
extern int atapi_cdrom_channel;
#endif //__IDE__

View File

@@ -402,7 +402,7 @@ void at_ali1429_init()
at_init();
ali1429_init();
mouse_serial_init();
if (cdrom_channel <= 1) ide_sec_disable();
if (atapi_cdrom_channel <= 1) ide_sec_disable();
}
/* void at_um8881f_init()
@@ -419,7 +419,7 @@ void at_dtk486_init()
memregs_init();
mouse_serial_init();
sis85c471_init();
if (cdrom_channel <= 1) ide_sec_disable();
if (atapi_cdrom_channel <= 1) ide_sec_disable();
}
void at_sis496_init()
@@ -440,7 +440,7 @@ void at_r418_init()
pci_init(PCI_CONFIG_TYPE_1, 0, 31);
fdc37c665_init();
device_add(&sis496_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
void at_batman_init()
@@ -453,7 +453,7 @@ void at_batman_init()
fdc37c665_init();
intel_batman_init();
device_add(&intel_flash_bxt_ami_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
void at_586mc1_init()
@@ -465,7 +465,7 @@ void at_586mc1_init()
i430lx_init();
sio_init(1);
device_add(&intel_flash_bxt_device);
if (cdrom_channel <= 1) ide_sec_disable();
if (atapi_cdrom_channel <= 1) ide_sec_disable();
}
void at_plato_init()
@@ -479,7 +479,7 @@ void at_plato_init()
/* It seems it uses the same interface as Batman. */
intel_batman_init();
device_add(&intel_flash_bxt_ami_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
void at_advanced_common_init()
@@ -491,7 +491,7 @@ void at_advanced_common_init()
piix_init(7);
// pc87306_init();
intel_endeavor_init();
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
void at_endeavor_init()
@@ -518,7 +518,7 @@ void at_mb500n_init()
fdc37c665_init();
intel_endeavor_init();
device_add(&intel_flash_bxt_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
#if 0
@@ -533,7 +533,7 @@ void at_p54tp4xe_init()
fdc37c665_init();
intel_endeavor_init();
device_add(&intel_flash_bxt_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
#endif
@@ -548,7 +548,7 @@ void at_acerm3a_init()
fdc37c932fr_init();
acerm3a_io_init();
device_add(&intel_flash_bxb_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
void at_acerv35n_init()
@@ -562,7 +562,7 @@ void at_acerv35n_init()
fdc37c932fr_init();
acerm3a_io_init();
device_add(&intel_flash_bxb_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
#if 0
@@ -576,7 +576,7 @@ void at_p55t2p4_init()
piix3_init(7);
w83877f_init();
device_add(&intel_flash_bxt_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
#endif
@@ -590,7 +590,7 @@ void at_i430vx_init()
piix3_init(7);
um8669f_init();
device_add(&intel_flash_bxt_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
// rom_t ami_ec_rom;
@@ -612,7 +612,7 @@ void at_p55tvp4_init()
intel_endeavor_init(); */
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
#endif
@@ -626,7 +626,7 @@ void at_p55va_init()
piix3_init(7);
fdc37c932fr_init();
device_add(&intel_flash_bxt_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
void at_i440fx_init()
@@ -639,7 +639,7 @@ void at_i440fx_init()
piix3_init(7);
fdc37c665_init();
device_add(&intel_flash_bxt_device);
if (cdrom_channel >= 4) ide_ter_init();
if (atapi_cdrom_channel >= 4) ide_ter_init();
}
void model_init()

View File

@@ -24,6 +24,9 @@
#include "fdd.h"
#include "gameport.h"
#include "sound_gus.h"
#include "aha154x.h"
#include "cdrom.h"
#include "scsi.h"
#include "ide.h"
#include "keyboard.h"
#include "keyboard_at.h"
@@ -57,6 +60,7 @@ int window_w, window_h, window_x, window_y, window_remember;
int start_in_fullscreen = 0;
int frame = 0;
int scsi_cdrom_enabled, atapi_cdrom_enabled;
int cdrom_enabled;
int CPUID;
int vid_resize, vid_api;
@@ -289,6 +293,12 @@ void initpc(int argc, char *argv[])
loadnvr();
sound_init();
resetide();
if (aha154x_enabled)
{
SCSIReset(&ScsiDrives[scsi_cdrom_id], scsi_cdrom_id);
AdaptecInit(scsi_cdrom_id);
}
if ((cdrom_drive == -1) || (cdrom_drive == 0))
cdrom_null_open(cdrom_drive);
else
@@ -408,6 +418,12 @@ void resetpchard()
resetide();
if (aha154x_enabled)
{
SCSIReset(&ScsiDrives[scsi_cdrom_id], scsi_cdrom_id);
AdaptecInit(scsi_cdrom_id);
}
loadnvr();
// cpuspeed2 = (AT)?2:1;
@@ -567,7 +583,7 @@ void speedchanged()
void closepc()
{
atapi->exit();
cdrom->exit();
// ioctl_close();
dumppic();
// output=7;
@@ -611,6 +627,7 @@ void loadconfig(char *fn)
GUS = config_get_int(NULL, "gus", 0);
SSI2001 = config_get_int(NULL, "ssi2001", 0);
voodoo_enabled = config_get_int(NULL, "voodoo", 0);
aha154x_enabled = config_get_int(NULL, "aha154x", 0);
//network
ethif = config_get_int(NULL, "netinterface", 1);
@@ -653,7 +670,11 @@ void loadconfig(char *fn)
old_cdrom_drive = cdrom_drive;
cdrom_enabled = config_get_int(NULL, "cdrom_enabled", 0);
cdrom_channel = config_get_int(NULL, "cdrom_channel", 2);
atapi_cdrom_enabled = config_get_int(NULL, "atapi_cdrom_enabled", 1);
atapi_cdrom_channel = config_get_int(NULL, "atapi_cdrom_channel", 2);
scsi_cdrom_enabled = config_get_int(NULL, "scsi_cdrom_enabled", 0);
scsi_cdrom_id = config_get_int(NULL, "scsi_cdrom_id", 3);
p = (char *)config_get_string(NULL, "cdrom_path", "");
if (p) strcpy(iso_path, p);
@@ -769,6 +790,7 @@ void saveconfig()
config_set_int(NULL, "gus", GUS);
config_set_int(NULL, "ssi2001", SSI2001);
config_set_int(NULL, "voodoo", voodoo_enabled);
config_set_int(NULL, "aha154x", aha154x_enabled);
config_set_int(NULL, "netinterface", ethif);
config_set_int(NULL, "netcard", network_card_current);
@@ -793,7 +815,13 @@ void saveconfig()
config_set_int(NULL, "mem_size", mem_size);
config_set_int(NULL, "cdrom_drive", cdrom_drive);
config_set_int(NULL, "cdrom_enabled", cdrom_enabled);
config_set_int(NULL, "cdrom_channel", cdrom_channel);
config_set_int(NULL, "atapi_cdrom_enabled", atapi_cdrom_enabled);
config_set_int(NULL, "atapi_cdrom_channel", atapi_cdrom_channel);
config_set_int(NULL, "scsi_cdrom_enabled", scsi_cdrom_enabled);
config_set_int(NULL, "scsi_cdrom_id", scsi_cdrom_id);
config_set_string(NULL, "cdrom_path", iso_path);
config_set_int(NULL, "vid_resize", vid_resize);
config_set_int(NULL, "vid_api", vid_api);

View File

@@ -54,6 +54,7 @@
#define IDC_CHECKSSI 1015
#define IDC_CHECKVOODOO 1016
#define IDC_CHECKDYNAREC 1017
#define IDC_CHECK_AHA154X 1018
#define IDC_STATIC 1020
#define IDC_CHECKFORCE43 1021
#define IDC_CHECKOVERSCAN 1022

128
src/scattergather.c Normal file
View File

@@ -0,0 +1,128 @@
/* Copyright holders: SA1988
see COPYING for more details
*/
/*Scatter/Gather emulation*/
#include <stdlib.h>
#include <string.h>
#include "ibm.h"
#include "scattergather.h"
static uint8_t *SegmentBufferGet(SGBUF *SegmentBuf, uint32_t Data)
{
uint32_t DataSize;
uint8_t *Buffer;
if (SegmentBuf->SegmentIndex == SegmentBuf->SegmentNum
&& !SegmentBuf->SegmentLeft)
{
Data = 0;
return NULL;
}
DataSize = MIN(Data, SegmentBuf->SegmentLeft);
Buffer = SegmentBuf->SegmentPtrCur;
SegmentBuf->SegmentLeft -= Data;
if (!SegmentBuf->SegmentLeft)
{
SegmentBuf->SegmentIndex++;
if (SegmentBuf->SegmentIndex < SegmentBuf->SegmentNum)
{
SegmentBuf->SegmentPtrCur = SegmentBuf->SegmentPtr[SegmentBuf->SegmentIndex].Address;
SegmentBuf->SegmentLeft = SegmentBuf->SegmentPtr[SegmentBuf->SegmentIndex].Length;
}
Data = DataSize;
}
else
SegmentBuf->SegmentPtrCur = (uint8_t *)SegmentBuf->SegmentPtrCur + DataSize;
return Buffer;
}
uint8_t *SegmentBufferGetNextSegment(SGBUF *SegmentBuf, uint32_t Segment)
{
if (!Segment)
Segment = SegmentBuf->SegmentLeft;
return SegmentBufferGet(SegmentBuf, Segment);
}
uint32_t SegmentBufferCopy(SGBUF *SegmentDst, SGBUF *SegmentSrc, uint32_t Copy)
{
uint32_t Left = Copy;
while (Left)
{
uint32_t ThisCopy = MIN(MIN(SegmentDst->SegmentLeft, Left), SegmentSrc->SegmentLeft);
if (!ThisCopy)
break;
uint32_t Tmp = ThisCopy;
uint8_t *BufDst = SegmentBufferGet(SegmentDst, Tmp);
uint8_t *BufSrc = SegmentBufferGet(SegmentSrc, Tmp);
memcpy(BufSrc, BufDst, ThisCopy);
BufDst += ThisCopy;
BufSrc -= ThisCopy;
Left -= ThisCopy;
}
return Copy - Left;
}
uint32_t SegmentBufferCopyFromBuf(SGBUF *SegmentBuf, uint8_t *BufSrc, uint32_t Copy)
{
uint32_t Left = Copy;
while (Left)
{
uint32_t ThisCopy = Left;
uint8_t *BufDst = SegmentBufferGet(SegmentBuf, ThisCopy);
if (!ThisCopy)
break;
BufDst += ThisCopy;
Left -= ThisCopy;
BufSrc = (void *)((uintptr_t)BufSrc + ThisCopy);
}
return Copy - Left;
}
uint32_t SegmentBufferAdvance(SGBUF *SegmentBuf, uint32_t Advance)
{
uint32_t Left = Advance;
while (Left)
{
uint32_t ThisAdvance = Left;
SegmentBufferGet(SegmentBuf, ThisAdvance);
if (!ThisAdvance)
break;
Left -= ThisAdvance;
}
return Advance - Left;
}
void SegmentBufferInit(SGBUF *SegmentBuf, const SGSEG *SegmentPtr, uint32_t Segments)
{
SegmentBuf->SegmentPtr = SegmentPtr;
SegmentBuf->SegmentNum = (unsigned)Segments;
SegmentBuf->SegmentIndex = 0;
if (Segments && SegmentPtr)
{
SegmentBuf->SegmentPtrCur = SegmentPtr[0].Address;
SegmentBuf->SegmentLeft = SegmentPtr[0].Length;
}
else
{
SegmentBuf->SegmentPtrCur = NULL;
SegmentBuf->SegmentLeft = 0;
}
}

24
src/scattergather.h Normal file
View File

@@ -0,0 +1,24 @@
#ifndef _SCATTERGATHER_H_
#define _SCATTERGATHER_H_
typedef struct SGSEG
{
uint8_t Address[128*512];
uint32_t Length;
} SGSEG;
typedef struct SGBUF
{
const SGSEG *SegmentPtr;
unsigned SegmentNum;
unsigned SegmentIndex;
uint8_t *SegmentPtrCur;
uint32_t SegmentLeft;
} SGBUF;
uint32_t SegmentBufferCopy(SGBUF *SegmentDst, SGBUF *SegmentSrc, uint32_t Copy);
uint8_t *SegmentBufferGetNextSegment(SGBUF *SegmentBuf, uint32_t Segment);
uint32_t SegmentBufferAdvance(SGBUF *SegmentBuf, uint32_t Advance);
void SegmentBufferInit(SGBUF *SegmentBuf, const SGSEG *SegmentPtr, uint32_t Segments);
#endif

149
src/scsi.c Normal file
View File

@@ -0,0 +1,149 @@
/* Copyright holders: SA1988
see COPYING for more details
*/
/*SCSI layer emulation*/
#include <stdlib.h>
#include <string.h>
#include "86box.h"
#include "ibm.h"
#include "device.h"
#include "cdrom.h"
#include "scsi.h"
int ScsiCallback[7] = {0,0,0,0,0,0,0};
uint8_t scsi_cdrom_id = 3; /*common setting*/
uint8_t SCSIDeviceIsPresent(SCSI *Scsi)
{
return (scsi_cdrom_id < 7 && Scsi->LunType != SCSI_NONE);
}
void SCSINoTransfer(SCSI *Scsi, uint8_t Id)
{
pclog("SCSI: No Transfer\n");
SGBUF SegmentBuffer;
SegmentBufferInit(&SegmentBuffer, &Scsi->SegmentData, 1);
pfnIoRequestCopyFromBuffer(0, &SegmentBuffer, Scsi->SegmentData.Length);
}
void SCSIReadTransfer(SCSI *Scsi, uint8_t Id)
{
if (Scsi->LunType == SCSI_CDROM)
{
SCSICDROM_CallRead(Scsi, Id);
}
pclog("SCSI: Read Transfer\n");
SGBUF SegmentBuffer;
SegmentBufferInit(&SegmentBuffer, &Scsi->SegmentData, 1);
pfnIoRequestCopyFromBuffer(0, &SegmentBuffer, Scsi->SegmentData.Length);
}
void SCSIWriteTransfer(SCSI *Scsi, uint8_t Id)
{
if (Scsi->LunType == SCSI_CDROM)
{
if ((Scsi->CdbLength >= prefix_len + 4) && (page_flags[page_current] & PAGE_CHANGEABLE))
{
mode_pages_in[page_current][Scsi->CdbLength - prefix_len - 4] = Scsi->Cdb[Scsi->CdbLength - 2];
mode_pages_in[page_current][Scsi->CdbLength - prefix_len - 3] = Scsi->Cdb[Scsi->CdbLength - 1];
}
}
pclog("SCSI: Write Transfer\n");
SGBUF SegmentBuffer;
SegmentBufferInit(&SegmentBuffer, &Scsi->SegmentData, 1);
pfnIoRequestCopyToBuffer(0, &SegmentBuffer, Scsi->SegmentData.Length);
}
void SCSIQueryResidual(SCSI *Scsi, uint32_t *Residual)
{
*Residual = ScsiStatus == SCSI_STATUS_OK ? 0 : Scsi->SegmentData.Length;
}
static uint32_t SCSICopyFromBuffer(uint32_t OffDst, SGBUF *SegmentBuffer,
uint32_t Copy)
{
const SGSEG *SegmentArray = SegmentBuffer->SegmentPtr;
unsigned SegmentNum = SegmentBuffer->SegmentNum;
uint32_t Copied = 0;
SGBUF SegmentBuffer2;
SegmentBufferInit(&SegmentBuffer2, SegmentArray, SegmentNum);
SegmentBufferAdvance(&SegmentBuffer2, OffDst);
Copied = SegmentBufferCopy(&SegmentBuffer2, SegmentBuffer, Copy);
return Copied;
}
static uint32_t SCSICopyToBuffer(uint32_t OffSrc, SGBUF *SegmentBuffer,
uint32_t Copy)
{
const SGSEG *SegmentArray = SegmentBuffer->SegmentPtr;
unsigned SegmentNum = SegmentBuffer->SegmentNum;
uint32_t Copied = 0;
SGBUF SegmentBuffer2;
SegmentBufferInit(&SegmentBuffer2, SegmentArray, SegmentNum);
SegmentBufferAdvance(&SegmentBuffer2, OffSrc);
Copied = SegmentBufferCopy(&SegmentBuffer2, SegmentBuffer, Copy);
return Copied;
}
void SCSISendCommand(SCSI *Scsi, uint8_t Id, uint8_t *Cdb, uint8_t CdbLength,
uint32_t BufferLength, uint8_t *SenseBufferPointer,
uint8_t SenseBufferLength)
{
uint32_t i;
for (i = 0; i < CdbLength; i++)
pclog("Cdb[%d]=%02X\n", i, Cdb[i]);
Scsi->SegmentData.Length = BufferLength;
Scsi->CdbLength = CdbLength;
if (SCSIDeviceIsPresent(Scsi))
{
if (Scsi->LunType == SCSI_CDROM)
{
pclog("SCSI CD-ROM in ID %d\n", Id);
SCSICDROM_RunCommand(Scsi, Id, Cdb);
}
}
else
{
pclog("SCSI Device not present\n");
ScsiStatus = SCSI_STATUS_CHECK_CONDITION;
SCSISenseCodeError(SENSE_ILLEGAL_REQUEST, 0x00, 0x00);
}
}
void SCSIReset(SCSI *Scsi, uint8_t Id)
{
page_flags[GPMODE_CDROM_AUDIO_PAGE] &= 0xFD; /* Clear changed flag for CDROM AUDIO mode page. */
memset(mode_pages_in[GPMODE_CDROM_AUDIO_PAGE], 0, 256); /* Clear the page itself. */
ScsiCallback[Id] = 0;
if (scsi_cdrom_enabled)
{
if (cdrom_enabled)
{
Scsi->LunType = SCSI_CDROM;
}
}
else
{
Scsi->LunType = SCSI_NONE;
}
pfnIoRequestCopyFromBuffer = SCSICopyFromBuffer;
pfnIoRequestCopyToBuffer = SCSICopyToBuffer;
page_flags[GPMODE_CDROM_AUDIO_PAGE] &= ~PAGE_CHANGED;
}

220
src/scsi.h Normal file
View File

@@ -0,0 +1,220 @@
/* Copyright holders: SA1988
see COPYING for more details
*/
#ifndef __SCSI_H__
#define __SCSI_H__
#include "scattergather.h"
/* SCSI Commands */
#define GPCMD_TEST_UNIT_READY 0x00
#define GPCMD_REQUEST_SENSE 0x03
#define GPCMD_READ_6 0x08
#define GPCMD_INQUIRY 0x12
#define GPCMD_MODE_SELECT_6 0x15
#define GPCMD_MODE_SENSE_6 0x1a
#define GPCMD_START_STOP_UNIT 0x1b
#define GPCMD_PREVENT_REMOVAL 0x1e
#define GPCMD_READ_CDROM_CAPACITY 0x25
#define GPCMD_READ_10 0x28
#define GPCMD_SEEK 0x2b
#define GPCMD_READ_SUBCHANNEL 0x42
#define GPCMD_READ_TOC_PMA_ATIP 0x43
#define GPCMD_READ_HEADER 0x44
#define GPCMD_PLAY_AUDIO_10 0x45
#define GPCMD_GET_CONFIGURATION 0x46
#define GPCMD_PLAY_AUDIO_MSF 0x47
#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
#define GPCMD_PAUSE_RESUME 0x4b
#define GPCMD_STOP_PLAY_SCAN 0x4e
#define GPCMD_READ_DISC_INFORMATION 0x51
#define GPCMD_MODE_SELECT_10 0x55
#define GPCMD_MODE_SENSE_10 0x5a
#define GPCMD_PLAY_AUDIO_12 0xa5
#define GPCMD_READ_12 0xa8
#define GPCMD_READ_DVD_STRUCTURE 0xad /* For reading. */
#define GPCMD_SET_SPEED 0xbb
#define GPCMD_MECHANISM_STATUS 0xbd
#define GPCMD_READ_CD 0xbe
#define GPCMD_SEND_DVD_STRUCTURE 0xbf /* This is for writing only, irrelevant to PCem. */
/* Mode page codes for mode sense/set */
#define GPMODE_R_W_ERROR_PAGE 0x01
#define GPMODE_CDROM_PAGE 0x0d
#define GPMODE_CDROM_AUDIO_PAGE 0x0e
#define GPMODE_CAPABILITIES_PAGE 0x2a
#define GPMODE_ALL_PAGES 0x3f
/* SCSI Status Codes */
#define SCSI_STATUS_OK 0
#define SCSI_STATUS_CHECK_CONDITION 2
/* SCSI Sense Keys */
#define SENSE_NONE 0
#define SENSE_NOT_READY 2
#define SENSE_ILLEGAL_REQUEST 5
#define SENSE_UNIT_ATTENTION 6
/* SCSI Additional Sense Codes */
#define ASC_AUDIO_PLAY_OPERATION 0x00
#define ASC_ILLEGAL_OPCODE 0x20
#define ASC_INV_FIELD_IN_CMD_PACKET 0x24
#define ASC_MEDIUM_MAY_HAVE_CHANGED 0x28
#define ASC_INCOMPATIBLE_FORMAT 0x30
#define ASC_MEDIUM_NOT_PRESENT 0x3a
#define ASC_DATA_PHASE_ERROR 0x4b
#define ASC_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
#define ASCQ_AUDIO_PLAY_OPERATION_IN_PROGRESS 0x11
#define ASCQ_AUDIO_PLAY_OPERATION_PAUSED 0x12
#define ASCQ_AUDIO_PLAY_OPERATION_COMPLETED 0x13
/* Tell RISC OS that we have a 4x CD-ROM drive (600kb/sec data, 706kb/sec raw).
Not that it means anything */
#define CDROM_SPEED 706
/* Some generally useful CD-ROM information */
#define CD_MINS 75 /* max. minutes per CD */
#define CD_SECS 60 /* seconds per minute */
#define CD_FRAMES 75 /* frames per second */
#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */
#define CD_MAX_BYTES (CD_MINS * CD_SECS * CD_FRAMES * CD_FRAMESIZE)
#define CD_MAX_SECTORS (CD_MAX_BYTES / 512)
/* Event notification classes for GET EVENT STATUS NOTIFICATION */
#define GESN_NO_EVENTS 0
#define GESN_OPERATIONAL_CHANGE 1
#define GESN_POWER_MANAGEMENT 2
#define GESN_EXTERNAL_REQUEST 3
#define GESN_MEDIA 4
#define GESN_MULTIPLE_HOSTS 5
#define GESN_DEVICE_BUSY 6
/* Event codes for MEDIA event status notification */
#define MEC_NO_CHANGE 0
#define MEC_EJECT_REQUESTED 1
#define MEC_NEW_MEDIA 2
#define MEC_MEDIA_REMOVAL 3 /* only for media changers */
#define MEC_MEDIA_CHANGED 4 /* only for media changers */
#define MEC_BG_FORMAT_COMPLETED 5 /* MRW or DVD+RW b/g format completed */
#define MEC_BG_FORMAT_RESTARTED 6 /* MRW or DVD+RW b/g format restarted */
#define MS_TRAY_OPEN 1
#define MS_MEDIA_PRESENT 2
/*
* The MMC values are not IDE specific and might need to be moved
* to a common header if they are also needed for the SCSI emulation
*/
/* Profile list from MMC-6 revision 1 table 91 */
#define MMC_PROFILE_NONE 0x0000
#define MMC_PROFILE_CD_ROM 0x0008
#define MMC_PROFILE_CD_R 0x0009
#define MMC_PROFILE_CD_RW 0x000A
#define MMC_PROFILE_DVD_ROM 0x0010
#define MMC_PROFILE_DVD_R_SR 0x0011
#define MMC_PROFILE_DVD_RAM 0x0012
#define MMC_PROFILE_DVD_RW_RO 0x0013
#define MMC_PROFILE_DVD_RW_SR 0x0014
#define MMC_PROFILE_DVD_R_DL_SR 0x0015
#define MMC_PROFILE_DVD_R_DL_JR 0x0016
#define MMC_PROFILE_DVD_RW_DL 0x0017
#define MMC_PROFILE_DVD_DDR 0x0018
#define MMC_PROFILE_DVD_PLUS_RW 0x001A
#define MMC_PROFILE_DVD_PLUS_R 0x001B
#define MMC_PROFILE_DVD_PLUS_RW_DL 0x002A
#define MMC_PROFILE_DVD_PLUS_R_DL 0x002B
#define MMC_PROFILE_BD_ROM 0x0040
#define MMC_PROFILE_BD_R_SRM 0x0041
#define MMC_PROFILE_BD_R_RRM 0x0042
#define MMC_PROFILE_BD_RE 0x0043
#define MMC_PROFILE_HDDVD_ROM 0x0050
#define MMC_PROFILE_HDDVD_R 0x0051
#define MMC_PROFILE_HDDVD_RAM 0x0052
#define MMC_PROFILE_HDDVD_RW 0x0053
#define MMC_PROFILE_HDDVD_R_DL 0x0058
#define MMC_PROFILE_HDDVD_RW_DL 0x005A
#define MMC_PROFILE_INVALID 0xFFFF
#define NONDATA 4
#define CHECK_READY 2
#define ALLOW_UA 1
extern uint8_t SCSICommandTable[0x100];
#define IMPLEMENTED 1
extern uint8_t mode_sense_pages[0x40];
extern int readcdmode;
/* Mode sense/select stuff. */
extern uint8_t mode_pages_in[256][256];
#define PAGE_CHANGEABLE 1
#define PAGE_CHANGED 2
extern uint8_t page_flags[256];
extern uint8_t prefix_len;
extern uint8_t page_current;
uint32_t DataLength;
uint32_t DataPointer;
extern uint8_t ScsiStatus;
extern int ScsiCallback[7];
extern uint8_t scsi_cdrom_id;
struct
{
uint8_t SenseKey;
uint8_t Asc;
uint8_t Ascq;
} SCSISense;
extern int cd_status;
extern int prev_status;
#define SCSI_NONE 0
#define SCSI_HDD 1 /*not present yet*/
#define SCSI_CDROM 2
typedef struct SCSI
{
uint8_t Cdb[32];
uint8_t CdbLength;
SGBUF SegmentBuffer;
int SectorLen;
int SectorLba;
int BufferPosition;
SGSEG SegmentData;
int LunType;
void *p;
} SCSI;
SCSI ScsiDrives[7];
void SCSIQueryResidual(SCSI *Scsi, uint32_t *Residual);
void SCSISendCommand(SCSI *Scsi, uint8_t Id, uint8_t *Cdb, uint8_t CdbLength,
uint32_t BufferLength, uint8_t *SenseBufferPointer,
uint8_t SenseBufferLength);
uint32_t (*pfnIoRequestCopyFromBuffer)(uint32_t OffDst, SGBUF *SegmentBuffer,
uint32_t Copy);
uint32_t (*pfnIoRequestCopyToBuffer)(uint32_t OffSrc, SGBUF *SegmentBuffer,
uint32_t Copy);
void SCSINoTransfer(SCSI *Scsi, uint8_t Id);
void SCSIReadTransfer(SCSI *Scsi, uint8_t Id);
void SCSIWriteTransfer(SCSI *Scsi, uint8_t Id);
extern void SCSIReset(SCSI *Scsi, uint8_t Id);
extern uint32_t SCSICDROMModeSense(uint8_t *buf, uint32_t pos, uint8_t type);
extern uint8_t SCSICDROMSetProfile(uint8_t *buf, uint8_t *index, uint16_t profile);
extern int SCSICDROMReadDVDStructure(int format, const uint8_t *packet, uint8_t *buf);
extern uint32_t SCSICDROMEventStatus(uint8_t *buffer);
extern void SCSICDROM_Insert();
#endif

1215
src/scsi_cdrom.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -110,20 +110,20 @@ static void sound_cd_thread(void *param)
ioctl_audio_callback(cd_buffer, CD_BUFLEN*2);
if (soundon)
{
int32_t atapi_vol_l = atapi_get_cd_volume(0);
int32_t atapi_vol_r = atapi_get_cd_volume(1);
int32_t audio_vol_l = SCSIGetCDVolume(0);
int32_t audio_vol_r = SCSIGetCDVolume(1);
int channel_select[2];
channel_select[0] = atapi_get_cd_channel(0);
channel_select[1] = atapi_get_cd_channel(1);
channel_select[0] = SCSIGetCDChannel(0);
channel_select[1] = SCSIGetCDChannel(1);
for (c = 0; c < CD_BUFLEN*2; c += 2)
{
int32_t cd_buffer_temp[2] = {0, 0};
/*First, adjust input from drive according to ATAPI volume.*/
cd_buffer[c] = ((int32_t)cd_buffer[c] * atapi_vol_l) / 255;
cd_buffer[c+1] = ((int32_t)cd_buffer[c+1] * atapi_vol_r) / 255;
/*First, adjust input from drive according to ATAPI/SCSI volume.*/
cd_buffer[c] = ((int32_t)cd_buffer[c] * audio_vol_l) / 255;
cd_buffer[c+1] = ((int32_t)cd_buffer[c+1] * audio_vol_r) / 255;
/*Apply ATAPI channel select*/
if (channel_select[0] & 1)

View File

@@ -11,8 +11,6 @@
#include "vid_voodoo.h"
#include "vid_voodoo_dither.h"
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define CLAMP(x) (((x) < 0) ? 0 : (((x) > 0xff) ? 0xff : (x)))
#define CLAMP16(x) (((x) < 0) ? 0 : (((x) > 0xffff) ? 0xffff : (x)))

View File

@@ -43,6 +43,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
int temp_network_interface_current;
int temp_always_serial;
int temp_joystick_type;
int temp_aha154x;
UDACCEL accel;
// pclog("Dialog msg %i %08X\n",message,message);
@@ -193,6 +194,9 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
h=GetDlgItem(hdlg, IDC_CHECKVOODOO);
SendMessage(h, BM_SETCHECK, voodoo_enabled, 0);
h=GetDlgItem(hdlg, IDC_CHECK_AHA154X);
SendMessage(h, BM_SETCHECK, aha154x_enabled, 0);
cpu_flags = models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[cpu].cpu_flags;
h=GetDlgItem(hdlg, IDC_CHECKDYNAREC);
if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC))
@@ -349,6 +353,9 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
h = GetDlgItem(hdlg, IDC_CHECKVOODOO);
temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_AHA154X);
temp_aha154x = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBOSND);
temp_sound_card_current = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)];
@@ -370,7 +377,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS ||
temp_SSI2001 != SSI2001 || temp_sound_card_current != sound_card_current ||
temp_voodoo != voodoo_enabled || temp_dynarec != cpu_use_dynarec || temp_always_serial != mouse_always_serial ||
temp_fda_type != fdd_get_type(0) || temp_fdb_type != fdd_get_type(1) || temp_network_card_current != network_card_current)
temp_fda_type != fdd_get_type(0) || temp_fdb_type != fdd_get_type(1) || temp_network_card_current != network_card_current || temp_aha154x != aha154x_enabled)
{
if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL)==IDOK)
{
@@ -386,6 +393,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
SSI2001 = temp_SSI2001;
sound_card_current = temp_sound_card_current;
voodoo_enabled = temp_voodoo;
aha154x_enabled = temp_aha154x;
cpu_use_dynarec = temp_dynarec;
fdd_set_type(0, temp_fda_type);

View File

@@ -488,7 +488,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
sprintf(s, "Size: %" PRIu64 " MB", (hd[3].tracks*hd[3].hpc*hd[3].spt) >> 11);
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
new_cdrom_channel = cdrom_channel;
new_cdrom_channel = atapi_cdrom_channel;
update_hdd_cdrom(hdlg);
return TRUE;
@@ -497,7 +497,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
switch (LOWORD(wParam))
{
case IDOK:
if (hd_changed || cdrom_channel != new_cdrom_channel)
if (hd_changed || atapi_cdrom_channel != new_cdrom_channel)
{
if (MessageBox(NULL, "This will reset 86Box!\nOkay to continue?", "86Box", MB_OKCANCEL) == IDOK)
{
@@ -554,7 +554,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
hdc[2] = hd[2];
hdc[3] = hd[3];
cdrom_channel = new_cdrom_channel;
atapi_cdrom_channel = new_cdrom_channel;
saveconfig();

View File

@@ -25,7 +25,7 @@
#include "video.h"
#include "resources.h"
#include "cpu.h"
#include "ide.h"
#include "cdrom.h"
#include "model.h"
#include "nethandler.h"
#include "nvr.h"
@@ -934,7 +934,7 @@ LRESULT CALLBACK LowLevelKeyboardProc( int nCode, WPARAM wParam, LPARAM lParam )
return CallNextHookEx( hKeyboardHook, nCode, wParam, lParam );
}
void atapi_close(void)
void cdrom_close(void)
{
switch (cdrom_drive)
{
@@ -1142,8 +1142,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
/* Switching from disabled to disabled. Do nothing. */
break;
}
atapi->exit();
atapi_close();
cdrom->exit();
cdrom_close();
cdrom_null_open(0);
CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_UNCHECKED);
CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_CHECKED);
@@ -1173,13 +1173,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
/* Switch from empty to empty. Do nothing. */
break;
}
atapi->exit();
atapi_close();
cdrom->exit();
cdrom_close();
cdrom_null_open(0);
if (cdrom_enabled)
{
/* Signal disc change to the emulated machine. */
atapi_insert_cdrom();
SCSICDROM_Insert();
}
CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_UNCHECKED);
CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED);
@@ -1214,13 +1214,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
/* Switching from ISO to the same ISO. Do nothing. */
break;
}
atapi->exit();
atapi_close();
cdrom->exit();
cdrom_close();
iso_open(temp_iso_path);
if (cdrom_enabled)
{
/* Signal disc change to the emulated machine. */
atapi_insert_cdrom();
SCSICDROM_Insert();
}
CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_UNCHECKED);
CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED);
@@ -1255,13 +1255,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
break;
}
old_cdrom_drive = cdrom_drive;
atapi->exit();
atapi_close();
cdrom->exit();
cdrom_close();
ioctl_open(new_cdrom_drive);
if (cdrom_enabled)
{
/* Signal disc change to the emulated machine. */
atapi_insert_cdrom();
SCSICDROM_Insert();
}
CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_UNCHECKED);
CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED);