Merge branch '86Box:master' into master
This commit is contained in:
15
src/86box.c
15
src/86box.c
@@ -385,8 +385,8 @@ pc_init(int argc, char *argv[])
|
|||||||
char temp[128];
|
char temp[128];
|
||||||
struct tm *info;
|
struct tm *info;
|
||||||
time_t now;
|
time_t now;
|
||||||
int c, ng;
|
int c;
|
||||||
int lvmp;
|
int ng = 0, lvmp = 0;
|
||||||
uint32_t *uid, *shwnd;
|
uint32_t *uid, *shwnd;
|
||||||
|
|
||||||
/* Grab the executable's full path. */
|
/* Grab the executable's full path. */
|
||||||
@@ -620,6 +620,7 @@ usage:
|
|||||||
|
|
||||||
/* Make sure we have a trailing backslash. */
|
/* Make sure we have a trailing backslash. */
|
||||||
plat_path_slash(usr_path);
|
plat_path_slash(usr_path);
|
||||||
|
plat_path_slash(rom_path);
|
||||||
|
|
||||||
/* At this point, we can safely create the full path name. */
|
/* At this point, we can safely create the full path name. */
|
||||||
plat_append_filename(cfg_path, usr_path, p);
|
plat_append_filename(cfg_path, usr_path, p);
|
||||||
@@ -647,15 +648,13 @@ usage:
|
|||||||
strftime(temp, sizeof(temp), "%Y/%m/%d %H:%M:%S", info);
|
strftime(temp, sizeof(temp), "%Y/%m/%d %H:%M:%S", info);
|
||||||
pclog("#\n# %ls v%ls logfile, created %s\n#\n",
|
pclog("#\n# %ls v%ls logfile, created %s\n#\n",
|
||||||
EMU_NAME_W, EMU_VERSION_W, temp);
|
EMU_NAME_W, EMU_VERSION_W, temp);
|
||||||
#ifdef _WIN32
|
|
||||||
pclog("# Emulator path: %ls\n", exe_path);
|
|
||||||
pclog("# Userfiles path: %ls\n", usr_path);
|
|
||||||
pclog("# Configuration file: %ls\n#\n\n", cfg_path);
|
|
||||||
#else
|
|
||||||
pclog("# Emulator path: %s\n", exe_path);
|
pclog("# Emulator path: %s\n", exe_path);
|
||||||
pclog("# Userfiles path: %s\n", usr_path);
|
pclog("# Userfiles path: %s\n", usr_path);
|
||||||
|
if (rom_path[0] != '\0')
|
||||||
|
pclog("# ROM path: %s\n", rom_path);
|
||||||
|
else
|
||||||
|
pclog("# ROM path: %sroms\\\n", usr_path);
|
||||||
pclog("# Configuration file: %s\n#\n\n", cfg_path);
|
pclog("# Configuration file: %s\n#\n\n", cfg_path);
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* We are about to read the configuration file, which MAY
|
* We are about to read the configuration file, which MAY
|
||||||
* put data into global variables (the hard- and floppy
|
* put data into global variables (the hard- and floppy
|
||||||
|
@@ -238,6 +238,16 @@ cdrom_seek(cdrom_t *dev, uint32_t pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
cdrom_is_pre(cdrom_t *dev, uint32_t lba)
|
||||||
|
{
|
||||||
|
if (dev->ops && dev->ops->is_track_pre)
|
||||||
|
return dev->ops->is_track_pre(dev, lba);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
cdrom_audio_callback(cdrom_t *dev, int16_t *output, int len)
|
cdrom_audio_callback(cdrom_t *dev, int16_t *output, int len)
|
||||||
{
|
{
|
||||||
|
@@ -155,12 +155,28 @@ image_is_track_audio(cdrom_t *dev, uint32_t pos, int ismsf)
|
|||||||
if (track == -1)
|
if (track == -1)
|
||||||
return 0;
|
return 0;
|
||||||
else {
|
else {
|
||||||
cdi_get_audio_track_info(img, 0, cdi_get_track(img, pos), &number, &tmsf, &attr);
|
cdi_get_audio_track_info(img, 0, track, &number, &tmsf, &attr);
|
||||||
return attr == AUDIO_TRACK;
|
return attr == AUDIO_TRACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
image_is_track_pre(cdrom_t *dev, uint32_t lba)
|
||||||
|
{
|
||||||
|
cd_img_t *img = (cd_img_t *)dev->image;
|
||||||
|
int track;
|
||||||
|
|
||||||
|
/* GetTrack requires LBA. */
|
||||||
|
track = cdi_get_track(img, lba);
|
||||||
|
|
||||||
|
if (track != -1)
|
||||||
|
return cdi_get_audio_track_pre(img, track);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
image_sector_size(struct cdrom *dev, uint32_t lba)
|
image_sector_size(struct cdrom *dev, uint32_t lba)
|
||||||
{
|
{
|
||||||
@@ -231,6 +247,7 @@ static const cdrom_ops_t cdrom_image_ops = {
|
|||||||
image_get_tracks,
|
image_get_tracks,
|
||||||
image_get_track_info,
|
image_get_track_info,
|
||||||
image_get_subchannel,
|
image_get_subchannel,
|
||||||
|
image_is_track_pre,
|
||||||
image_sector_size,
|
image_sector_size,
|
||||||
image_read_sector,
|
image_read_sector,
|
||||||
image_track_type,
|
image_track_type,
|
||||||
|
@@ -272,6 +272,18 @@ cdi_get_audio_tracks_lba(cd_img_t *cdi, int *st_track, int *end, uint32_t *lead_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
cdi_get_audio_track_pre(cd_img_t *cdi, int track)
|
||||||
|
{
|
||||||
|
track_t *trk = &cdi->tracks[track - 1];
|
||||||
|
|
||||||
|
if ((track < 1) || (track > cdi->tracks_num))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return trk->pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This replaces both Info and EndInfo, they are specified by a variable. */
|
/* This replaces both Info and EndInfo, they are specified by a variable. */
|
||||||
int
|
int
|
||||||
cdi_get_audio_track_info(cd_img_t *cdi, int end, int track, int *track_num, TMSF *start, uint8_t *attr)
|
cdi_get_audio_track_info(cd_img_t *cdi, int end, int track, int *track_num, TMSF *start, uint8_t *attr)
|
||||||
@@ -709,6 +721,25 @@ cdi_cue_get_frame(uint64_t *frames, char **line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
cdi_cue_get_flags(track_t *cur, char **line)
|
||||||
|
{
|
||||||
|
char temp[128], temp2[128];
|
||||||
|
int success;
|
||||||
|
|
||||||
|
success = cdi_cue_get_buffer(temp, line, 0);
|
||||||
|
if (! success) return 0;
|
||||||
|
|
||||||
|
memset(temp2, 0x00, sizeof(temp2));
|
||||||
|
success = sscanf(temp, "%s", temp2) == 1;
|
||||||
|
if (! success) return 0;
|
||||||
|
|
||||||
|
cur->pre = (strstr(temp2, "PRE") != NULL);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cdi_add_track(cd_img_t *cdi, track_t *cur, uint64_t *shift, uint64_t prestart, uint64_t *total_pregap, uint64_t cur_pregap)
|
cdi_add_track(cd_img_t *cdi, track_t *cur, uint64_t *shift, uint64_t prestart, uint64_t *total_pregap, uint64_t cur_pregap)
|
||||||
{
|
{
|
||||||
@@ -850,6 +881,8 @@ cdi_load_cue(cd_img_t *cdi, const char *cuefile)
|
|||||||
trk.form = 0;
|
trk.form = 0;
|
||||||
trk.mode2 = 0;
|
trk.mode2 = 0;
|
||||||
|
|
||||||
|
trk.pre = 0;
|
||||||
|
|
||||||
if (!strcmp(type, "AUDIO")) {
|
if (!strcmp(type, "AUDIO")) {
|
||||||
trk.sector_size = RAW_SECTOR_SIZE;
|
trk.sector_size = RAW_SECTOR_SIZE;
|
||||||
trk.attr = AUDIO_TRACK;
|
trk.attr = AUDIO_TRACK;
|
||||||
@@ -964,7 +997,9 @@ cdi_load_cue(cd_img_t *cdi, const char *cuefile)
|
|||||||
}
|
}
|
||||||
} else if (!strcmp(command, "PREGAP"))
|
} else if (!strcmp(command, "PREGAP"))
|
||||||
success = cdi_cue_get_frame(&cur_pregap, &line);
|
success = cdi_cue_get_frame(&cur_pregap, &line);
|
||||||
else if (!strcmp(command, "CATALOG") || !strcmp(command, "CDTEXTFILE") || !strcmp(command, "FLAGS") || !strcmp(command, "ISRC") ||
|
else if (!strcmp(command, "FLAGS"))
|
||||||
|
success = cdi_cue_get_flags(&trk, &line);
|
||||||
|
else if (!strcmp(command, "CATALOG") || !strcmp(command, "CDTEXTFILE") || !strcmp(command, "ISRC") ||
|
||||||
!strcmp(command, "PERFORMER") || !strcmp(command, "POSTGAP") || !strcmp(command, "REM") ||
|
!strcmp(command, "PERFORMER") || !strcmp(command, "POSTGAP") || !strcmp(command, "REM") ||
|
||||||
!strcmp(command, "SONGWRITER") || !strcmp(command, "TITLE") || !strcmp(command, "")) {
|
!strcmp(command, "SONGWRITER") || !strcmp(command, "TITLE") || !strcmp(command, "")) {
|
||||||
/* Ignored commands. */
|
/* Ignored commands. */
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include <86box/timer.h>
|
#include <86box/timer.h>
|
||||||
#include <86box/nvr.h>
|
#include <86box/nvr.h>
|
||||||
#include <86box/acpi.h>
|
#include <86box/acpi.h>
|
||||||
|
#include <86box/ddma.h>
|
||||||
#include <86box/pci.h>
|
#include <86box/pci.h>
|
||||||
#include <86box/pic.h>
|
#include <86box/pic.h>
|
||||||
#include <86box/port_92.h>
|
#include <86box/port_92.h>
|
||||||
@@ -79,6 +80,7 @@ typedef struct
|
|||||||
sff8038i_t *bm[2];
|
sff8038i_t *bm[2];
|
||||||
nvr_t *nvr;
|
nvr_t *nvr;
|
||||||
int nvr_enabled, slot;
|
int nvr_enabled, slot;
|
||||||
|
ddma_t *ddma;
|
||||||
smbus_piix4_t *smbus;
|
smbus_piix4_t *smbus;
|
||||||
usb_t *usb[2];
|
usb_t *usb[2];
|
||||||
acpi_t *acpi;
|
acpi_t *acpi;
|
||||||
@@ -708,6 +710,19 @@ usb_update_io_mapping(pipc_t *dev, int func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
pipc_ddma_update(pipc_t *dev, int addr)
|
||||||
|
{
|
||||||
|
uint32_t base;
|
||||||
|
|
||||||
|
if (dev->local >= VIA_PIPC_8231)
|
||||||
|
return;
|
||||||
|
|
||||||
|
base = (dev->pci_isa_regs[addr] & 0xf0) | (((uint32_t) dev->pci_isa_regs[addr | 0x01]) << 8);
|
||||||
|
ddma_update_io_mapping(dev->ddma, (addr & 0x0e) >> 1, (dev->pci_isa_regs[addr] & 0xf0), dev->pci_isa_regs[addr | 0x01], (dev->pci_isa_regs[addr] & 0x08) && (base != 0x0000));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pipc_write(int func, int addr, uint8_t val, void *priv)
|
pipc_write(int func, int addr, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
@@ -854,19 +869,13 @@ pipc_write(int func, int addr, uint8_t val, void *priv)
|
|||||||
|
|
||||||
case 0x60: case 0x62: case 0x64: case 0x66:
|
case 0x60: case 0x62: case 0x64: case 0x66:
|
||||||
case 0x6a: case 0x6c: case 0x6e:
|
case 0x6a: case 0x6c: case 0x6e:
|
||||||
c = (addr & 0x0e) >> 1;
|
dev->pci_isa_regs[addr] = val & 0xf8;
|
||||||
dma[c].ab = (dma[c].ab & 0xffffff0f) | (val & 0xf0);
|
pipc_ddma_update(dev, addr);
|
||||||
dma[c].ac = (dma[c].ac & 0xffffff0f) | (val & 0xf0);
|
|
||||||
if (val & 0x08)
|
|
||||||
dma_e |= (1 << c);
|
|
||||||
else
|
|
||||||
dma_e &= ~(1 << c);
|
|
||||||
break;
|
break;
|
||||||
case 0x61: case 0x63: case 0x65: case 0x67:
|
case 0x61: case 0x63: case 0x65: case 0x67:
|
||||||
case 0x6b: case 0x6d: case 0x6f:
|
case 0x6b: case 0x6d: case 0x6f:
|
||||||
c = (addr & 0x0e) >> 1;
|
dev->pci_isa_regs[addr] = val;
|
||||||
dma[c].ab = (dma[c].ab & 0xffff00ff) | (val << 8);
|
pipc_ddma_update(dev, addr & 0xfe);
|
||||||
dma[c].ac = (dma[c].ac & 0xffff00ff) | (val << 8);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x70: case 0x71: case 0x72: case 0x73:
|
case 0x70: case 0x71: case 0x72: case 0x73:
|
||||||
@@ -1353,6 +1362,9 @@ pipc_init(const device_t *info)
|
|||||||
pci_enable_mirq(2);
|
pci_enable_mirq(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dev->local < VIA_PIPC_8231)
|
||||||
|
dev->ddma = device_add(&ddma_device);
|
||||||
|
|
||||||
if (dev->acpi) {
|
if (dev->acpi) {
|
||||||
acpi_set_slot(dev->acpi, dev->slot);
|
acpi_set_slot(dev->acpi, dev->slot);
|
||||||
acpi_set_nvr(dev->acpi, dev->nvr);
|
acpi_set_nvr(dev->acpi, dev->nvr);
|
||||||
|
@@ -83,6 +83,7 @@ typedef struct {
|
|||||||
void (*get_tracks)(struct cdrom *dev, int *first, int *last);
|
void (*get_tracks)(struct cdrom *dev, int *first, int *last);
|
||||||
void (*get_track_info)(struct cdrom *dev, uint32_t track, int end, track_info_t *ti);
|
void (*get_track_info)(struct cdrom *dev, uint32_t track, int end, track_info_t *ti);
|
||||||
void (*get_subchannel)(struct cdrom *dev, uint32_t lba, subchannel_t *subc);
|
void (*get_subchannel)(struct cdrom *dev, uint32_t lba, subchannel_t *subc);
|
||||||
|
int (*is_track_pre)(struct cdrom *dev, uint32_t lba);
|
||||||
int (*sector_size)(struct cdrom *dev, uint32_t lba);
|
int (*sector_size)(struct cdrom *dev, uint32_t lba);
|
||||||
int (*read_sector)(struct cdrom *dev, int type, uint8_t *b, uint32_t lba);
|
int (*read_sector)(struct cdrom *dev, int type, uint8_t *b, uint32_t lba);
|
||||||
int (*track_type)(struct cdrom *dev, uint32_t lba);
|
int (*track_type)(struct cdrom *dev, uint32_t lba);
|
||||||
@@ -136,6 +137,7 @@ extern cdrom_t cdrom[CDROM_NUM];
|
|||||||
extern int cdrom_lba_to_msf_accurate(int lba);
|
extern int cdrom_lba_to_msf_accurate(int lba);
|
||||||
extern double cdrom_seek_time(cdrom_t *dev);
|
extern double cdrom_seek_time(cdrom_t *dev);
|
||||||
extern void cdrom_stop(cdrom_t *dev);
|
extern void cdrom_stop(cdrom_t *dev);
|
||||||
|
extern int cdrom_is_pre(cdrom_t *dev, uint32_t lba);
|
||||||
extern int cdrom_audio_callback(cdrom_t *dev, int16_t *output, int len);
|
extern int cdrom_audio_callback(cdrom_t *dev, int16_t *output, int len);
|
||||||
extern uint8_t cdrom_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len, int ismsf);
|
extern uint8_t cdrom_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len, int ismsf);
|
||||||
extern uint8_t cdrom_audio_track_search(cdrom_t *dev, uint32_t pos, int type, uint8_t playbit);
|
extern uint8_t cdrom_audio_track_search(cdrom_t *dev, uint32_t pos, int type, uint8_t playbit);
|
||||||
|
@@ -58,7 +58,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int number, track_number, attr, sector_size,
|
int number, track_number, attr, sector_size,
|
||||||
mode2, form;
|
mode2, form, pre, pad;
|
||||||
uint64_t start, length,
|
uint64_t start, length,
|
||||||
skip;
|
skip;
|
||||||
track_file_t *file;
|
track_file_t *file;
|
||||||
@@ -75,6 +75,7 @@ extern void cdi_close(cd_img_t *cdi);
|
|||||||
extern int cdi_set_device(cd_img_t *cdi, const char *path);
|
extern int cdi_set_device(cd_img_t *cdi, const char *path);
|
||||||
extern int cdi_get_audio_tracks(cd_img_t *cdi, int *st_track, int *end, TMSF *lead_out);
|
extern int cdi_get_audio_tracks(cd_img_t *cdi, int *st_track, int *end, TMSF *lead_out);
|
||||||
extern int cdi_get_audio_tracks_lba(cd_img_t *cdi, int *st_track, int *end, uint32_t *lead_out);
|
extern int cdi_get_audio_tracks_lba(cd_img_t *cdi, int *st_track, int *end, uint32_t *lead_out);
|
||||||
|
extern int cdi_get_audio_track_pre(cd_img_t *cdi, int track);
|
||||||
extern int cdi_get_audio_track_info(cd_img_t *cdi, int end, int track, int *track_num, TMSF *start, uint8_t *attr);
|
extern int cdi_get_audio_track_info(cd_img_t *cdi, int end, int track, int *track_num, TMSF *start, uint8_t *attr);
|
||||||
extern int cdi_get_audio_track_info_lba(cd_img_t *cdi, int end, int track, int *track_num, uint32_t *start, uint8_t *attr);
|
extern int cdi_get_audio_track_info_lba(cd_img_t *cdi, int end, int track, int *track_num, uint32_t *start, uint8_t *attr);
|
||||||
extern int cdi_get_track(cd_img_t *cdi, uint32_t sector);
|
extern int cdi_get_track(cd_img_t *cdi, uint32_t sector);
|
||||||
|
@@ -126,7 +126,7 @@ typedef struct svga_t
|
|||||||
int override;
|
int override;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
uint8_t crtc[256], gdcreg[64], attrregs[32], seqregs[256],
|
uint8_t crtc[256], gdcreg[256], attrregs[32], seqregs[256],
|
||||||
egapal[16],
|
egapal[16],
|
||||||
*vram, *changedvram;
|
*vram, *changedvram;
|
||||||
|
|
||||||
|
@@ -212,7 +212,8 @@ sound_cd_clean_buffers(void)
|
|||||||
static void
|
static void
|
||||||
sound_cd_thread(void *param)
|
sound_cd_thread(void *param)
|
||||||
{
|
{
|
||||||
int c, r, i, channel_select[2];
|
uint32_t lba;
|
||||||
|
int c, r, i, pre, channel_select[2];
|
||||||
double audio_vol_l, audio_vol_r;
|
double audio_vol_l, audio_vol_r;
|
||||||
double cd_buffer_temp[2] = {0.0, 0.0};
|
double cd_buffer_temp[2] = {0.0, 0.0};
|
||||||
|
|
||||||
@@ -231,9 +232,11 @@ sound_cd_thread(void *param)
|
|||||||
if ((cdrom[i].bus_type == CDROM_BUS_DISABLED) ||
|
if ((cdrom[i].bus_type == CDROM_BUS_DISABLED) ||
|
||||||
(cdrom[i].cd_status == CD_STATUS_EMPTY))
|
(cdrom[i].cd_status == CD_STATUS_EMPTY))
|
||||||
continue;
|
continue;
|
||||||
|
lba = cdrom[i].seek_pos;
|
||||||
r = cdrom_audio_callback(&(cdrom[i]), cd_buffer[i], CD_BUFLEN * 2);
|
r = cdrom_audio_callback(&(cdrom[i]), cd_buffer[i], CD_BUFLEN * 2);
|
||||||
if (!cdrom[i].bus_type || !cdrom[i].sound_on || !r)
|
if (!cdrom[i].bus_type || !cdrom[i].sound_on || !r)
|
||||||
continue;
|
continue;
|
||||||
|
pre = cdrom_is_pre(&(cdrom[i]), lba);
|
||||||
|
|
||||||
if (cdrom[i].get_volume) {
|
if (cdrom[i].get_volume) {
|
||||||
audio_vol_l = (float) (cdrom[i].get_volume(cdrom[i].priv, 0));
|
audio_vol_l = (float) (cdrom[i].get_volume(cdrom[i].priv, 0));
|
||||||
@@ -277,6 +280,9 @@ sound_cd_thread(void *param)
|
|||||||
cd_buffer_temp[0] += ((double) cd_buffer[i][c + 1]); /* Channel 1 => Port 0 */
|
cd_buffer_temp[0] += ((double) cd_buffer[i][c + 1]); /* Channel 1 => Port 0 */
|
||||||
|
|
||||||
cd_buffer_temp[0] *= audio_vol_l; /* Multiply Port 0 by Port 0 volume */
|
cd_buffer_temp[0] *= audio_vol_l; /* Multiply Port 0 by Port 0 volume */
|
||||||
|
|
||||||
|
if (pre)
|
||||||
|
cd_buffer_temp[0] = deemph_iir(0, cd_buffer_temp[0]); /* De-emphasize if necessary */
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((audio_vol_r != 0.0) && (channel_select[1] != 0)) {
|
if ((audio_vol_r != 0.0) && (channel_select[1] != 0)) {
|
||||||
@@ -286,6 +292,9 @@ sound_cd_thread(void *param)
|
|||||||
cd_buffer_temp[1] += ((double) cd_buffer[i][c + 1]); /* Channel 1 => Port 1 */
|
cd_buffer_temp[1] += ((double) cd_buffer[i][c + 1]); /* Channel 1 => Port 1 */
|
||||||
|
|
||||||
cd_buffer_temp[1] *= audio_vol_r; /* Multiply Port 1 by Port 1 volume */
|
cd_buffer_temp[1] *= audio_vol_r; /* Multiply Port 1 by Port 1 volume */
|
||||||
|
|
||||||
|
if (pre)
|
||||||
|
cd_buffer_temp[1] = deemph_iir(1, cd_buffer_temp[1]); /* De-emphasize if necessary */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply sound card CD volume and filters */
|
/* Apply sound card CD volume and filters */
|
||||||
|
Reference in New Issue
Block a user