puae 2.3.1

parent b7de61b2
...@@ -35,6 +35,10 @@ static int delayed[MAX_TOTAL_SCSI_DEVICES]; ...@@ -35,6 +35,10 @@ static int delayed[MAX_TOTAL_SCSI_DEVICES];
static uae_sem_t unitsem[MAX_TOTAL_SCSI_DEVICES]; static uae_sem_t unitsem[MAX_TOTAL_SCSI_DEVICES];
static int unitsem_cnt[MAX_TOTAL_SCSI_DEVICES]; static int unitsem_cnt[MAX_TOTAL_SCSI_DEVICES];
static TCHAR newimagefiles[MAX_TOTAL_SCSI_DEVICES][256];
static int imagechangetime[MAX_TOTAL_SCSI_DEVICES];
static bool cdimagefileinuse[MAX_TOTAL_SCSI_DEVICES], wasopen[MAX_TOTAL_SCSI_DEVICES];
/* convert minutes, seconds and frames -> logical sector number */ /* convert minutes, seconds and frames -> logical sector number */
int msf2lsn (int msf) int msf2lsn (int msf)
{ {
...@@ -449,11 +453,18 @@ void blkdev_cd_change (int unitnum, const TCHAR *name) ...@@ -449,11 +453,18 @@ void blkdev_cd_change (int unitnum, const TCHAR *name)
void device_func_reset (void) void device_func_reset (void)
{ {
unsigned int i;
for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) {
wasopen[i] = false;
waspaused[i] = false;
imagechangetime[i] = 0;
cdimagefileinuse[i] = false;
newimagefiles[i][0] = 0;
}
} }
int device_func_init (int flags) int device_func_init (int flags)
{ {
device_func_reset ();
blkdev_fix_prefs (&currprefs); blkdev_fix_prefs (&currprefs);
install_driver (flags); install_driver (flags);
return 1; return 1;
...@@ -485,12 +496,6 @@ void blkdev_exitgui (void) ...@@ -485,12 +496,6 @@ void blkdev_exitgui (void)
} }
} }
static TCHAR newimagefiles[MAX_TOTAL_SCSI_DEVICES][256];
static int imagechangetime[MAX_TOTAL_SCSI_DEVICES];
static bool cdimagefileinuse[MAX_TOTAL_SCSI_DEVICES], wasopen[MAX_TOTAL_SCSI_DEVICES];
static void check_changes (int unitnum) static void check_changes (int unitnum)
{ {
bool changed = false; bool changed = false;
...@@ -1070,6 +1075,19 @@ static int addtocentry (uae_u8 **dstp, int *len, int point, int newpoint, int ms ...@@ -1070,6 +1075,19 @@ static int addtocentry (uae_u8 **dstp, int *len, int point, int newpoint, int ms
return -1; return -1;
} }
static int scsiemudrv (int unitnum, uae_u8 *cmd)
{
if (failunit (unitnum))
return -1;
if (!getsem (unitnum))
return 0;
int v = 0;
if (device_func[unitnum]->scsiemu)
v = device_func[unitnum]->scsiemu (unitnum, cmd);
freesem (unitnum);
return v;
}
static int scsi_read_cd (int unitnum, uae_u8 *cmd, uae_u8 *data, struct device_info *di) static int scsi_read_cd (int unitnum, uae_u8 *cmd, uae_u8 *data, struct device_info *di)
{ {
int msf = cmd[0] == 0xb9; int msf = cmd[0] == 0xb9;
...@@ -1452,6 +1470,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, ...@@ -1452,6 +1470,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
break; break;
case 0x1b: // START/STOP case 0x1b: // START/STOP
sys_command_cd_stop (unitnum); sys_command_cd_stop (unitnum);
scsiemudrv (unitnum, cmdbuf);
scsi_len = 0; scsi_len = 0;
break; break;
case 0x1e: // PREVENT/ALLOW MEDIA REMOVAL case 0x1e: // PREVENT/ALLOW MEDIA REMOVAL
...@@ -1777,6 +1796,10 @@ uae_u8 *save_cd (int num, int *len) ...@@ -1777,6 +1796,10 @@ uae_u8 *save_cd (int num, int *len)
if (!currprefs.cdslots[num].inuse || num >= MAX_TOTAL_SCSI_DEVICES) if (!currprefs.cdslots[num].inuse || num >= MAX_TOTAL_SCSI_DEVICES)
return NULL; return NULL;
#ifdef CD32
if (!currprefs.cs_cd32cd && !currprefs.cs_cdtvcd && !currprefs.scsi)
return NULL;
#endif
dstbak = dst = xmalloc (uae_u8, 4 + 256 + 4 + 4); dstbak = dst = xmalloc (uae_u8, 4 + 256 + 4 + 4);
save_u32 (4); save_u32 (4);
save_string (currprefs.cdslots[num].name); save_string (currprefs.cdslots[num].name);
......
...@@ -396,169 +396,169 @@ static void *cdda_play_func (void *v) ...@@ -396,169 +396,169 @@ static void *cdda_play_func (void *v)
cda_audio *cda = new cda_audio (num_sectors); cda_audio *cda = new cda_audio (num_sectors);
while (cdu->cdda_play > 0) { while (cdu->cdda_play > 0) {
if (oldplay != cdu->cdda_play) { if (oldplay != cdu->cdda_play) {
struct cdtoc *t; struct cdtoc *t;
int sector, diff; int sector, diff;
struct _timeb tb1, tb2; struct _timeb tb1, tb2;
idleframes = 0; idleframes = 0;
foundsub = false; foundsub = false;
_ftime (&tb1); _ftime (&tb1);
cdda_pos = cdu->cdda_start; cdda_pos = cdu->cdda_start;
oldplay = cdu->cdda_play; oldplay = cdu->cdda_play;
sector = cdu->cd_last_pos = cdda_pos; sector = cdu->cd_last_pos = cdda_pos;
t = findtoc (cdu, &sector); t = findtoc (cdu, &sector);
if (!t) { if (!t) {
write_log ("IMAGE CDDA: illegal sector number %d\n", cdu->cdda_start); write_log ("IMAGE CDDA: illegal sector number %d\n", cdu->cdda_start);
setstate (cdu, AUDIO_STATUS_PLAY_ERROR); setstate (cdu, AUDIO_STATUS_PLAY_ERROR);
} else { } else {
write_log ("IMAGE CDDA: playing from %d to %d, track %d ('%s', offset %d, secoffset %d)\n", write_log ("IMAGE CDDA: playing from %d to %d, track %d ('%s', offset %d, secoffset %d)\n",
cdu->cdda_start, cdu->cdda_end, t->track, t->fname, t->offset, sector); cdu->cdda_start, cdu->cdda_end, t->track, t->fname, t->offset, sector);
// do this even if audio is not compressed, t->handle also could be // do this even if audio is not compressed, t->handle also could be
// compressed and we want to unpack it in background too // compressed and we want to unpack it in background too
while (cdimage_unpack_active == 1) while (cdimage_unpack_active == 1)
Sleep (10);
cdimage_unpack_active = 0;
write_comm_pipe_u32 (&unpack_pipe, cdu - &cdunits[0], 0);
write_comm_pipe_u32 (&unpack_pipe, t - &cdu->toc[0], 1);
while (cdimage_unpack_active == 0)
Sleep (10);
}
idleframes = cdu->cdda_delay_frames;
while (cdu->cdda_paused && cdu->cdda_play > 0) {
Sleep (10); Sleep (10);
idleframes = -1; cdimage_unpack_active = 0;
} write_comm_pipe_u32 (&unpack_pipe, cdu - &cdunits[0], 0);
write_comm_pipe_u32 (&unpack_pipe, t - &cdu->toc[0], 1);
while (cdimage_unpack_active == 0)
Sleep (10);
}
idleframes = cdu->cdda_delay_frames;
while (cdu->cdda_paused && cdu->cdda_play > 0) {
Sleep (10);
idleframes = -1;
}
if (cdu->cdda_scan == 0) { if (cdu->cdda_scan == 0) {
// find possible P-subchannel=1 and fudge starting point so that // find possible P-subchannel=1 and fudge starting point so that
// buggy CD32/CDTV software CD+G handling does not miss any frames // buggy CD32/CDTV software CD+G handling does not miss any frames
bool seenindex = false; bool seenindex = false;
for (sector = cdda_pos - 200; sector < cdda_pos; sector++) { for (sector = cdda_pos - 200; sector < cdda_pos; sector++) {
int sec = sector; int sec = sector;
t = findtoc (cdu, &sec); t = findtoc (cdu, &sec);
if (t) { if (t) {
uae_u8 subbuf[SUB_CHANNEL_SIZE]; uae_u8 subbuf[SUB_CHANNEL_SIZE];
getsub_deinterleaved (subbuf, cdu, t, sector); getsub_deinterleaved (subbuf, cdu, t, sector);
if (seenindex) { if (seenindex) {
for (int i = 2 * SUB_ENTRY_SIZE; i < SUB_CHANNEL_SIZE; i++) { for (int i = 2 * SUB_ENTRY_SIZE; i < SUB_CHANNEL_SIZE; i++) {
if (subbuf[i]) { // non-zero R-W subchannels if (subbuf[i]) { // non-zero R-W subchannels
int diff = cdda_pos - sector + 2; int diff = cdda_pos - sector + 2;
write_log ("-> CD+G start pos fudge -> %d (%d)\n", sector, -diff); write_log ("-> CD+G start pos fudge -> %d (%d)\n", sector, -diff);
idleframes -= diff; idleframes -= diff;
cdda_pos = sector; cdda_pos = sector;
break; break;
}
} }
} else if (subbuf[0] == 0xff) { // P == 1?
seenindex = true;
} }
} else if (subbuf[0] == 0xff) { // P == 1?
seenindex = true;
} }
} }
} }
cdda_pos -= idleframes;
_ftime (&tb2);
diff = (tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm);
diff -= cdu->cdda_delay;
if (idleframes >= 0 && diff < 0 && cdu->cdda_play > 0)
Sleep (-diff);
setstate (cdu, AUDIO_STATUS_IN_PROGRESS);
} }
cdda_pos -= idleframes;
_ftime (&tb2);
diff = (tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm);
diff -= cdu->cdda_delay;
if (idleframes >= 0 && diff < 0 && cdu->cdda_play > 0)
Sleep (-diff);
setstate (cdu, AUDIO_STATUS_IN_PROGRESS);
}
cda->wait(bufnum); cda->wait(bufnum);
bufon[bufnum] = 0; bufon[bufnum] = 0;
if (!cdu->cdda_play) if (!cdu->cdda_play)
goto end; goto end;
if (idleframes <= 0 && !isaudiotrack (&cdu->di.toc, cdda_pos)) { if (idleframes <= 0 && !isaudiotrack (&cdu->di.toc, cdda_pos)) {
setstate (cdu, AUDIO_STATUS_PLAY_ERROR); setstate (cdu, AUDIO_STATUS_PLAY_ERROR);
goto end; // data track? goto end; // data track?
} }
if ((cdda_pos < cdu->cdda_end || cdu->cdda_end == 0xffffffff) && !cdu->cdda_paused && cdu->cdda_play > 0) { if ((cdda_pos < cdu->cdda_end || cdu->cdda_end == 0xffffffff) && !cdu->cdda_paused && cdu->cdda_play > 0) {
struct cdtoc *t; struct cdtoc *t;
int sector, cnt; int sector, cnt;
int dofinish = 0; int dofinish = 0;
gui_flicker_led (LED_CD, cdu->di.unitnum - 1, LED_CD_AUDIO); gui_flicker_led (LED_CD, cdu->di.unitnum - 1, LED_CD_AUDIO);
memset (cda->buffers[bufnum], 0, num_sectors * 2352); memset (cda->buffers[bufnum], 0, num_sectors * 2352);
for (cnt = 0; cnt < num_sectors; cnt++) { for (cnt = 0; cnt < num_sectors; cnt++) {
uae_u8 *dst = cda->buffers[bufnum] + cnt * 2352; uae_u8 *dst = cda->buffers[bufnum] + cnt * 2352;
uae_u8 subbuf[SUB_CHANNEL_SIZE]; uae_u8 subbuf[SUB_CHANNEL_SIZE];
sector = cdda_pos; sector = cdda_pos;
memset (subbuf, 0, SUB_CHANNEL_SIZE); memset (subbuf, 0, SUB_CHANNEL_SIZE);
t = findtoc (cdu, &sector); t = findtoc (cdu, &sector);
if (t) { if (t) {
if (t->handle && !(t->ctrl & 4)) { if (t->handle && !(t->ctrl & 4)) {
int totalsize = t->size + t->skipsize; int totalsize = t->size + t->skipsize;
if ((t->enctype == AUDENC_MP3 || t->enctype == AUDENC_FLAC) && t->data) { if ((t->enctype == AUDENC_MP3 || t->enctype == AUDENC_FLAC) && t->data) {
if (t->filesize >= sector * totalsize + t->offset + t->size) if (t->filesize >= sector * totalsize + t->offset + t->size)
memcpy (dst, t->data + sector * totalsize + t->offset, t->size); memcpy (dst, t->data + sector * totalsize + t->offset, t->size);
} else if (t->enctype == AUDENC_PCM) { } else if (t->enctype == AUDENC_PCM) {
if (sector * totalsize + t->offset + totalsize < t->filesize) { if (sector * totalsize + t->offset + totalsize < t->filesize) {
zfile_fseek (t->handle, sector * totalsize + t->offset, SEEK_SET); zfile_fseek (t->handle, sector * totalsize + t->offset, SEEK_SET);
zfile_fread (dst, t->size, 1, t->handle); zfile_fread (dst, t->size, 1, t->handle);
}
} }
} }
getsub_deinterleaved (subbuf, cdu, t, cdda_pos);
} }
getsub_deinterleaved (subbuf, cdu, t, cdda_pos);
}
if (idleframes > 0) { if (idleframes > 0) {
idleframes--; idleframes--;
memset (dst, 0, 2352); memset (dst, 0, 2352);
memset (subbuf, 0, SUB_CHANNEL_SIZE); memset (subbuf, 0, SUB_CHANNEL_SIZE);
} }
if (cdda_pos < cdu->cdda_start && cdu->cdda_scan == 0) if (cdda_pos < cdu->cdda_start && cdu->cdda_scan == 0)
memset (dst, 0, 2352); memset (dst, 0, 2352);
dosub (cdu, subbuf); dosub (cdu, subbuf);
if (cdu->cdda_scan) { if (cdu->cdda_scan) {
cdda_pos += cdu->cdda_scan; cdda_pos += cdu->cdda_scan;
if (cdda_pos < 0) if (cdda_pos < 0)
cdda_pos = 0; cdda_pos = 0;
} else { } else {
cdda_pos++; cdda_pos++;
} }
if (cdda_pos - num_sectors < cdu->cdda_end && cdda_pos >= cdu->cdda_end) if (cdda_pos - num_sectors < cdu->cdda_end && cdda_pos >= cdu->cdda_end)
dofinish = 1; dofinish = 1;
} }
if (idleframes <= 0) if (idleframes <= 0)
cdu->cd_last_pos = cdda_pos; cdu->cd_last_pos = cdda_pos;
bufon[bufnum] = 1; bufon[bufnum] = 1;
cda->setvolume (currprefs.sound_volume, cdu->cdda_volume[0], cdu->cdda_volume[1]); cda->setvolume (currprefs.sound_volume, cdu->cdda_volume[0], cdu->cdda_volume[1]);
if (!cda->play (bufnum)) { if (!cda->play (bufnum)) {
setstate (cdu, AUDIO_STATUS_PLAY_ERROR); setstate (cdu, AUDIO_STATUS_PLAY_ERROR);
goto end; goto end;
}
if (dofinish) {
setstate (cdu, AUDIO_STATUS_PLAY_COMPLETE);
cdu->cdda_play = -1;
cdda_pos = cdu->cdda_end + 1;
}
} }
if (bufon[0] == 0 && bufon[1] == 0) { if (dofinish) {
while (cdu->cdda_paused && cdu->cdda_play > 0) setstate (cdu, AUDIO_STATUS_PLAY_COMPLETE);
Sleep (10); cdu->cdda_play = -1;
cdda_pos = cdu->cdda_end + 1;
} }
bufnum = 1 - bufnum; }
if (bufon[0] == 0 && bufon[1] == 0) {
while (cdu->cdda_paused && cdu->cdda_play > 0)
Sleep (10);
}
bufnum = 1 - bufnum;
} }
end: end:
...@@ -1519,7 +1519,7 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img) ...@@ -1519,7 +1519,7 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img)
} }
if (!cdu->tracks) { if (!cdu->tracks) {
uae_u64 siz = zfile_size (zcue); uae_u64 siz = zfile_size (zcue);
if (siz >= 16384 && (siz % 2048) == 0 || (siz % 2352) == 0) { if (siz >= 16384 && ((siz % 2048) == 0 || (siz % 2352) == 0)) {
struct cdtoc *t = &cdu->toc[0]; struct cdtoc *t = &cdu->toc[0];
cdu->tracks = 1; cdu->tracks = 1;
t->ctrl = 4; t->ctrl = 4;
...@@ -1528,12 +1528,15 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img) ...@@ -1528,12 +1528,15 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img)
t->handle = zcue; t->handle = zcue;
t->size = (siz % 2048) == 0 ? 2048 : 2352; t->size = (siz % 2048) == 0 ? 2048 : 2352;
t->filesize = siz; t->filesize = siz;
write_log ("CUE: plain CD image mounted!\n"); write_log ("CD: plain CD image mounted!\n");
cdu->toc[1].address = t->address + t->filesize / t->size; cdu->toc[1].address = t->address + t->filesize / t->size;
zcue = NULL; zcue = NULL;
} }
} }
if (!cdu->tracks)
write_log ("CD: couldn't mount '%s'!\n", img);
for (i = 0; i <= cdu->tracks; i++) { for (i = 0; i <= cdu->tracks; i++) {
struct cdtoc *t = &cdu->toc[i]; struct cdtoc *t = &cdu->toc[i];
uae_u32 msf = lsn2msf (t->address); uae_u32 msf = lsn2msf (t->address);
......
...@@ -1733,47 +1733,47 @@ uae_u8 *restore_cia (int num, uae_u8 *src) ...@@ -1733,47 +1733,47 @@ uae_u8 *restore_cia (int num, uae_u8 *src)
uae_u32 l; uae_u32 l;
/* CIA registers */ /* CIA registers */
b = restore_u8 (); /* 0 PRA */ b = restore_u8 (); /* 0 PRA */
if (num) ciabpra = b; else ciaapra = b; if (num) ciabpra = b; else ciaapra = b;
b = restore_u8 (); /* 1 PRB */ b = restore_u8 (); /* 1 PRB */
if (num) ciabprb = b; else ciaaprb = b; if (num) ciabprb = b; else ciaaprb = b;
b = restore_u8 (); /* 2 DDRA */ b = restore_u8 (); /* 2 DDRA */
if (num) ciabdra = b; else ciaadra = b; if (num) ciabdra = b; else ciaadra = b;
b = restore_u8 (); /* 3 DDRB */ b = restore_u8 (); /* 3 DDRB */
if (num) ciabdrb = b; else ciaadrb = b; if (num) ciabdrb = b; else ciaadrb = b;
w = restore_u16 (); /* 4 TA */ w = restore_u16 (); /* 4 TA */
if (num) ciabta = w; else ciaata = w; if (num) ciabta = w; else ciaata = w;
w = restore_u16 (); /* 6 TB */ w = restore_u16 (); /* 6 TB */
if (num) ciabtb = w; else ciaatb = w; if (num) ciabtb = w; else ciaatb = w;
l = restore_u8 (); /* 8/9/A TOD */ l = restore_u8 (); /* 8/9/A TOD */
l |= restore_u8 () << 8; l |= restore_u8 () << 8;
l |= restore_u8 () << 16; l |= restore_u8 () << 16;
if (num) ciabtod = l; else ciaatod = l; if (num) ciabtod = l; else ciaatod = l;
restore_u8 (); /* B unused */ restore_u8 (); /* B unused */
b = restore_u8 (); /* C SDR */ b = restore_u8 (); /* C SDR */
if (num) ciabsdr = b; else ciaasdr = b; if (num) ciabsdr = b; else ciaasdr = b;
b = restore_u8 (); /* D ICR INFORMATION (not mask!) */ b = restore_u8 (); /* D ICR INFORMATION (not mask!) */
if (num) ciabicr = b; else ciaaicr = b; if (num) ciabicr = b; else ciaaicr = b;
b = restore_u8 (); /* E CRA */ b = restore_u8 (); /* E CRA */
if (num) ciabcra = b; else ciaacra = b; if (num) ciabcra = b; else ciaacra = b;
b = restore_u8 (); /* F CRB */ b = restore_u8 (); /* F CRB */
if (num) ciabcrb = b; else ciaacrb = b; if (num) ciabcrb = b; else ciaacrb = b;
/* CIA internal data */ /* CIA internal data */
b = restore_u8 (); /* ICR MASK */ b = restore_u8 (); /* ICR MASK */
if (num) ciabimask = b; else ciaaimask = b; if (num) ciabimask = b; else ciaaimask = b;
w = restore_u8 (); /* timer A latch */ w = restore_u8 (); /* timer A latch */
w |= restore_u8 () << 8; w |= restore_u8 () << 8;
if (num) ciabla = w; else ciaala = w; if (num) ciabla = w; else ciaala = w;
w = restore_u8 (); /* timer B latch */ w = restore_u8 (); /* timer B latch */
w |= restore_u8 () << 8; w |= restore_u8 () << 8;
if (num) ciablb = w; else ciaalb = w; if (num) ciablb = w; else ciaalb = w;
w = restore_u8 (); /* TOD latched value */ w = restore_u8 (); /* TOD latched value */
w |= restore_u8 () << 8; w |= restore_u8 () << 8;
w |= restore_u8 () << 16; w |= restore_u8 () << 16;
if (num) ciabtol = w; else ciaatol = w; if (num) ciabtol = w; else ciaatol = w;
l = restore_u8 (); /* alarm */ l = restore_u8 (); /* alarm */
l |= restore_u8 () << 8; l |= restore_u8 () << 8;
l |= restore_u8 () << 16; l |= restore_u8 () << 16;
if (num) ciabalarm = l; else ciaaalarm = l; if (num) ciabalarm = l; else ciaaalarm = l;
...@@ -1814,13 +1814,13 @@ uae_u8 *save_cia (int num, int *len, uae_u8 *dstptr) ...@@ -1814,13 +1814,13 @@ uae_u8 *save_cia (int num, int *len, uae_u8 *dstptr)
save_u16 (t); save_u16 (t);
t = (num ? ciabtb - ciabtb_passed : ciaatb - ciaatb_passed);/* 6 TB */ t = (num ? ciabtb - ciabtb_passed : ciaatb - ciaatb_passed);/* 6 TB */
save_u16 (t); save_u16 (t);
b = (num ? ciabtod : ciaatod); /* 8 TODL */ b = (num ? ciabtod : ciaatod); /* 8 TODL */
save_u8 (b); save_u8 (b);
b = (num ? ciabtod >> 8 : ciaatod >> 8); /* 9 TODM */ b = (num ? ciabtod >> 8 : ciaatod >> 8); /* 9 TODM */
save_u8 (b); save_u8 (b);
b = (num ? ciabtod >> 16 : ciaatod >> 16); /* A TODH */ b = (num ? ciabtod >> 16 : ciaatod >> 16); /* A TODH */
save_u8 (b); save_u8 (b);
save_u8 (0); /* B unused */ save_u8 (0); /* B unused */
b = num ? ciabsdr : ciaasdr; /* C SDR */ b = num ? ciabsdr : ciaasdr; /* C SDR */
save_u8 (b); save_u8 (b);
b = num ? ciabicr : ciaaicr; /* D ICR INFORMATION (not mask!) */ b = num ? ciabicr : ciaaicr; /* D ICR INFORMATION (not mask!) */
...@@ -1832,24 +1832,24 @@ uae_u8 *save_cia (int num, int *len, uae_u8 *dstptr) ...@@ -1832,24 +1832,24 @@ uae_u8 *save_cia (int num, int *len, uae_u8 *dstptr)
/* CIA internal data */ /* CIA internal data */
save_u8 (num ? ciabimask : ciaaimask); /* ICR */ save_u8 (num ? ciabimask : ciaaimask); /* ICR */
b = (num ? ciabla : ciaala); /* timer A latch LO */ b = (num ? ciabla : ciaala); /* timer A latch LO */
save_u8 (b); save_u8 (b);
b = (num ? ciabla >> 8 : ciaala >> 8); /* timer A latch HI */ b = (num ? ciabla >> 8 : ciaala >> 8); /* timer A latch HI */
save_u8 (b); save_u8 (b);
b = (num ? ciablb : ciaalb); /* timer B latch LO */ b = (num ? ciablb : ciaalb); /* timer B latch LO */
save_u8 (b); save_u8 (b);
b = (num ? ciablb >> 8 : ciaalb >> 8); /* timer B latch HI */ b = (num ? ciablb >> 8 : ciaalb >> 8); /* timer B latch HI */
save_u8 (b); save_u8 (b);
b = (num ? ciabtol : ciaatol); /* latched TOD LO */ b = (num ? ciabtol : ciaatol); /* latched TOD LO */
save_u8 (b); save_u8 (b);
b = (num ? ciabtol >> 8 : ciaatol >> 8); /* latched TOD MED */ b = (num ? ciabtol >> 8 : ciaatol >> 8); /* latched TOD MED */
save_u8 (b); save_u8 (b);
b = (num ? ciabtol >> 16 : ciaatol >> 16); /* latched TOD HI */ b = (num ? ciabtol >> 16 : ciaatol >> 16); /* latched TOD HI */
save_u8 (b); save_u8 (b);
b = (num ? ciabalarm : ciaaalarm); /* alarm LO */ b = (num ? ciabalarm : ciaaalarm); /* alarm LO */
save_u8 (b); save_u8 (b);
b = (num ? ciabalarm >> 8 : ciaaalarm >> 8); /* alarm MED */ b = (num ? ciabalarm >> 8 : ciaaalarm >> 8);/* alarm MED */
save_u8 (b); save_u8 (b);
b = (num ? ciabalarm >> 16 : ciaaalarm >> 16); /* alarm HI */ b = (num ? ciabalarm >> 16 : ciaaalarm >> 16); /* alarm HI */
save_u8 (b); save_u8 (b);
......
...@@ -2668,7 +2668,6 @@ void vsync_handle_redraw (int long_frame, int lof_changed) ...@@ -2668,7 +2668,6 @@ void vsync_handle_redraw (int long_frame, int lof_changed)
#ifdef SAVESTATE #ifdef SAVESTATE
if (!savestate_state) { if (!savestate_state) {
if (currprefs.quitstatefile[0]) { if (currprefs.quitstatefile[0]) {
write_log ("Draw: Save_State");
savestate_initsave (currprefs.quitstatefile, 1, 1, true); savestate_initsave (currprefs.quitstatefile, 1, 1, true);
save_state (currprefs.quitstatefile, ""); save_state (currprefs.quitstatefile, "");
} }
......
...@@ -1063,7 +1063,7 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz ...@@ -1063,7 +1063,7 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz
expamem_write (0x08, care_addr | no_shutup | force_z3 | (allocated > 0x800000 ? ext_size : Z3_MEM_AUTO)); expamem_write (0x08, care_addr | no_shutup | force_z3 | (allocated > 0x800000 ? ext_size : Z3_MEM_AUTO));
expamem_write (0x04, 3); expamem_write (0x04, currprefs.maprom ? 3 : 83);
expamem_write (0x10, uae_id >> 8); expamem_write (0x10, uae_id >> 8);
expamem_write (0x14, uae_id & 0xff); expamem_write (0x14, uae_id & 0xff);
......
...@@ -60,7 +60,7 @@ extern char *validatedevicename (char *s); ...@@ -60,7 +60,7 @@ extern char *validatedevicename (char *s);
extern char *validatevolumename (char *s); extern char *validatevolumename (char *s);
int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags); int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags);
int filesys_eject(int nr); int filesys_eject (int nr);
int filesys_media_change (const char *rootdir, int inserted, struct uaedev_config_info *uci); int filesys_media_change (const char *rootdir, int inserted, struct uaedev_config_info *uci);
extern char *filesys_createvolname (const char *volname, const char *rootdir, const char *def); extern char *filesys_createvolname (const char *volname, const char *rootdir, const char *def);
......
...@@ -16,28 +16,32 @@ ...@@ -16,28 +16,32 @@
#endif #endif
/* AmigaOS errors */ /* AmigaOS errors */
#define ERROR_BAD_NUMBER 6 #define ERROR_BAD_NUMBER 6
#define ERROR_NO_FREE_STORE 103 #define ERROR_NO_FREE_STORE 103
#define ERROR_OBJECT_IN_USE 202 #define ERROR_OBJECT_IN_USE 202
#define ERROR_OBJECT_EXISTS 203 #define ERROR_OBJECT_EXISTS 203
#define ERROR_DIR_NOT_FOUND 204 #define ERROR_DIR_NOT_FOUND 204
#define ERROR_OBJECT_NOT_AROUND 205 #define ERROR_OBJECT_NOT_AROUND 205
#define ERROR_ACTION_NOT_KNOWN 209 #define ERROR_ACTION_NOT_KNOWN 209
#define ERROR_INVALID_LOCK 211 #define ERROR_INVALID_LOCK 211
#define ERROR_OBJECT_WRONG_TYPE 212 #define ERROR_OBJECT_WRONG_TYPE 212
#define ERROR_DISK_WRITE_PROTECTED 214 #define ERROR_DISK_WRITE_PROTECTED 214
#define ERROR_DIRECTORY_NOT_EMPTY 216 #define ERROR_DIRECTORY_NOT_EMPTY 216
#define ERROR_DEVICE_NOT_MOUNTED 218 #define ERROR_DEVICE_NOT_MOUNTED 218
#define ERROR_SEEK_ERROR 219 #define ERROR_SEEK_ERROR 219
#define ERROR_COMMENT_TOO_BIG 220 #define ERROR_COMMENT_TOO_BIG 220
#define ERROR_DISK_IS_FULL 221 #define ERROR_DISK_IS_FULL 221
#define ERROR_DELETE_PROTECTED 222 #define ERROR_DELETE_PROTECTED 222
#define ERROR_WRITE_PROTECTED 223 #define ERROR_WRITE_PROTECTED 223
#define ERROR_READ_PROTECTED 224 #define ERROR_READ_PROTECTED 224
#define ERROR_NOT_A_DOS_DISK 225 #define ERROR_NOT_A_DOS_DISK 225
#define ERROR_NO_DISK 226 #define ERROR_NO_DISK 226
#define ERROR_NO_MORE_ENTRIES 232 #define ERROR_NO_MORE_ENTRIES 232
#define ERROR_NOT_IMPLEMENTED 236 #define ERROR_NOT_IMPLEMENTED 236
#define ERROR_RECORD_NOT_LOCKED 240
#define ERROR_LOCK_COLLISION 241
#define ERROR_LOCK_TIMEOUT 242
#define ERROR_UNLOCK_ERROR 243
#define A_FIBF_HIDDEN (1<<7) #define A_FIBF_HIDDEN (1<<7)
#define A_FIBF_SCRIPT (1<<6) #define A_FIBF_SCRIPT (1<<6)
......
...@@ -7,7 +7,8 @@ typedef unsigned long u32; ...@@ -7,7 +7,8 @@ typedef unsigned long u32;
extern void S2X_refresh (void); extern void S2X_refresh (void);
extern void S2X_render (void); extern void S2X_render (void);
extern void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd); extern void S2X_init (int dw, int dh, int aw, int ah, int ad, int dd);
extern void S2X_reset (void);
extern void S2X_free (void); extern void S2X_free (void);
extern int S2X_getmult (void); extern int S2X_getmult (void);
...@@ -47,12 +48,14 @@ typedef int bool; ...@@ -47,12 +48,14 @@ typedef int bool;
#define UAE_FILTER_NULL 1 #define UAE_FILTER_NULL 1
#define UAE_FILTER_SCALE2X 2 #define UAE_FILTER_SCALE2X 2
#define UAE_FILTER_HQ 3 #define UAE_FILTER_HQ2X 3
#define UAE_FILTER_SUPEREAGLE 4 #define UAE_FILTER_HQ3X 4
#define UAE_FILTER_SUPER2XSAI 5 #define UAE_FILTER_HQ4X 5
#define UAE_FILTER_2XSAI 6 #define UAE_FILTER_SUPEREAGLE 6
#define UAE_FILTER_PAL 7 #define UAE_FILTER_SUPER2XSAI 7
#define UAE_FILTER_LAST 7 #define UAE_FILTER_2XSAI 8
#define UAE_FILTER_PAL 9
#define UAE_FILTER_LAST 9
#define UAE_FILTER_MODE_16 16 #define UAE_FILTER_MODE_16 16
#define UAE_FILTER_MODE_16_16 16 #define UAE_FILTER_MODE_16_16 16
...@@ -66,7 +69,7 @@ struct uae_filter ...@@ -66,7 +69,7 @@ struct uae_filter
{ {
int type, yuv, intmul; int type, yuv, intmul;
char *name, *cfgname; char *name, *cfgname;
int x[6]; int flags;
}; };
extern struct uae_filter uaefilters[]; extern struct uae_filter uaefilters[];
......
...@@ -24,4 +24,3 @@ static int td_pos = (TD_RIGHT|TD_BOTTOM); ...@@ -24,4 +24,3 @@ static int td_pos = (TD_RIGHT|TD_BOTTOM);
#define STATUSLINE_TARGET 0x80 #define STATUSLINE_TARGET 0x80
extern void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); extern void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha);
...@@ -27,6 +27,11 @@ extern void target_addtorecent (const TCHAR*, int); ...@@ -27,6 +27,11 @@ extern void target_addtorecent (const TCHAR*, int);
extern void target_run (void); extern void target_run (void);
extern void target_quit (void); extern void target_quit (void);
extern bool get_plugin_path (TCHAR *out, int size, const TCHAR *path); extern bool get_plugin_path (TCHAR *out, int size, const TCHAR *path);
extern void stripslashes (TCHAR *p);
extern void fixtrailing (TCHAR *p);
extern void fullpath (TCHAR *path, int size);
extern void getpathpart (TCHAR *outpath, int size, const TCHAR *inpath);
extern void getfilepart (TCHAR *out, int size, const TCHAR *path);
extern int quit_program; extern int quit_program;
extern bool console_emulation; extern bool console_emulation;
......
...@@ -1921,7 +1921,7 @@ static void Exception_ce000 (int nr) ...@@ -1921,7 +1921,7 @@ static void Exception_ce000 (int nr)
x_put_word (m68k_areg (regs, 7) + 0, mode); x_put_word (m68k_areg (regs, 7) + 0, mode);
x_put_word (m68k_areg (regs, 7) + 2, last_fault_for_exception_3 >> 16); x_put_word (m68k_areg (regs, 7) + 2, last_fault_for_exception_3 >> 16);
x_do_cycles (2 * cpucycleunit); x_do_cycles (2 * cpucycleunit);
write_log ("Exception %d (%x) at %x -> %x!\n", nr, last_addr_for_exception_3, currpc, get_long (4 * nr)); write_log ("Exception CE %d (%x) at %x -> %x!\n", nr, last_addr_for_exception_3, currpc, get_long (4 * nr));
goto kludge_me_do; goto kludge_me_do;
} }
m68k_areg (regs, 7) -= 6; m68k_areg (regs, 7) -= 6;
...@@ -2218,7 +2218,7 @@ static void Exception_normal (int nr) ...@@ -2218,7 +2218,7 @@ static void Exception_normal (int nr)
m68k_areg (regs, 7) -= 2; m68k_areg (regs, 7) -= 2;
x_put_word (m68k_areg (regs, 7), 0xb000 + nr * 4); x_put_word (m68k_areg (regs, 7), 0xb000 + nr * 4);
} }
write_log ("Exception %d (%x) at %x -> %x!\n", nr, regs.instruction_pc, currpc, x_get_long (regs.vbr + 4*nr)); write_log ("Exception 20 %d (%x) at %x -> %x!\n", nr, regs.instruction_pc, currpc, x_get_long (regs.vbr + 4*nr));
} else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) { } else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) {
m68k_areg (regs, 7) -= 4; m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), regs.instruction_pc); x_put_long (m68k_areg (regs, 7), regs.instruction_pc);
...@@ -2253,7 +2253,7 @@ static void Exception_normal (int nr) ...@@ -2253,7 +2253,7 @@ static void Exception_normal (int nr)
x_put_word (m68k_areg (regs, 7) + 6, last_op_for_exception_3); x_put_word (m68k_areg (regs, 7) + 6, last_op_for_exception_3);
x_put_word (m68k_areg (regs, 7) + 8, regs.sr); x_put_word (m68k_areg (regs, 7) + 8, regs.sr);
x_put_long (m68k_areg (regs, 7) + 10, last_addr_for_exception_3); x_put_long (m68k_areg (regs, 7) + 10, last_addr_for_exception_3);
write_log ("Exception %d (%x) at %x -> %x!\n", nr, last_fault_for_exception_3, currpc, x_get_long (regs.vbr + 4*nr)); write_log ("Exception 00 %d (%x) at %x -> %x!\n", nr, last_fault_for_exception_3, currpc, x_get_long (regs.vbr + 4*nr));
goto kludge_me_do; goto kludge_me_do;
} }
} }
...@@ -2894,7 +2894,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) ...@@ -2894,7 +2894,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
if ((opcode & 0xF000) == 0xF000) { if ((opcode & 0xF000) == 0xF000) {
if (warned < 20) { if (warned < 20) {
write_log ("B-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p); //write_log ("B-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p);
warned++; warned++;
} }
Exception (0xB); Exception (0xB);
...@@ -2903,7 +2903,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) ...@@ -2903,7 +2903,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
} }
if ((opcode & 0xF000) == 0xA000) { if ((opcode & 0xF000) == 0xA000) {
if (warned < 20) { if (warned < 20) {
write_log ("A-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p); //write_log ("A-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p);
warned++; warned++;
} }
Exception (0xA); Exception (0xA);
...@@ -2911,7 +2911,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) ...@@ -2911,7 +2911,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
return 4; return 4;
} }
if (warned < 20) { if (warned < 20) {
write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs.vbr + 0x10)); //write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs.vbr + 0x10));
warned++; warned++;
//activate_debugger(); //activate_debugger();
} }
...@@ -3505,6 +3505,7 @@ static void m68k_run_1_ce (void) ...@@ -3505,6 +3505,7 @@ static void m68k_run_1_ce (void)
cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0; cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0;
cputrace.readcounter = cputrace.writecounter = 0; cputrace.readcounter = cputrace.writecounter = 0;
} }
if (inputrecord_debug & 4) { if (inputrecord_debug & 4) {
if (input_record > 0) if (input_record > 0)
inprec_recorddebug_cpu (1); inprec_recorddebug_cpu (1);
...@@ -3831,6 +3832,7 @@ static void m68k_run_2ce (void) ...@@ -3831,6 +3832,7 @@ static void m68k_run_2ce (void)
cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0; cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0;
cputrace.readcounter = cputrace.writecounter = 0; cputrace.readcounter = cputrace.writecounter = 0;
} }
if (inputrecord_debug & 4) { if (inputrecord_debug & 4) {
if (input_record > 0) if (input_record > 0)
inprec_recorddebug_cpu (1); inprec_recorddebug_cpu (1);
...@@ -4049,6 +4051,7 @@ void m68k_go (int may_quit) ...@@ -4049,6 +4051,7 @@ void m68k_go (int may_quit)
if (changed_prefs.inprecfile[0] && input_record) if (changed_prefs.inprecfile[0] && input_record)
inprec_prepare_record (savestate_fname[0] ? savestate_fname : NULL); inprec_prepare_record (savestate_fname[0] ? savestate_fname : NULL);
set_cpu_tracer (false); set_cpu_tracer (false);
#ifdef DEBUGGER #ifdef DEBUGGER
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment