syncing 2.3.0

parent bfe77db8
......@@ -133,7 +133,7 @@ EXTRA_DIST = \
uae_SOURCES = \
main.c newcpu.c memory.c rommgr.c custom.c serial.c dongle.c cia.c \
blitter.c autoconf.c traps.c ersatz.c keybuf.c expansion.c \
diskutil.c zfile.c cfgfile.c picasso96.c inputdevice.c \
diskutil.c zfile.c zfile_archive.c cfgfile.c picasso96.c inputdevice.c \
gfxutil.c audio.c sinctable.c drawing.c consolehook.c \
native2amiga.c disk.c crc32.c savestate.c arcadia.c cdtv.c cd32_fmv.c \
uaeexe.c uaelib.c uaeresource.c fdi2raw.c hotkeys.c amax.c \
......
......@@ -79,17 +79,17 @@ am_uae_OBJECTS = main.$(OBJEXT) newcpu.$(OBJEXT) memory.$(OBJEXT) \
dongle.$(OBJEXT) cia.$(OBJEXT) blitter.$(OBJEXT) \
autoconf.$(OBJEXT) traps.$(OBJEXT) ersatz.$(OBJEXT) \
keybuf.$(OBJEXT) expansion.$(OBJEXT) diskutil.$(OBJEXT) \
zfile.$(OBJEXT) cfgfile.$(OBJEXT) picasso96.$(OBJEXT) \
inputdevice.$(OBJEXT) gfxutil.$(OBJEXT) audio.$(OBJEXT) \
sinctable.$(OBJEXT) drawing.$(OBJEXT) consolehook.$(OBJEXT) \
native2amiga.$(OBJEXT) disk.$(OBJEXT) crc32.$(OBJEXT) \
savestate.$(OBJEXT) arcadia.$(OBJEXT) cdtv.$(OBJEXT) \
cd32_fmv.$(OBJEXT) uaeexe.$(OBJEXT) uaelib.$(OBJEXT) \
uaeresource.$(OBJEXT) fdi2raw.$(OBJEXT) hotkeys.$(OBJEXT) \
amax.$(OBJEXT) ar.$(OBJEXT) driveclick.$(OBJEXT) \
enforcer.$(OBJEXT) misc.$(OBJEXT) a2065.$(OBJEXT) \
gayle.$(OBJEXT) ncr_scsi.$(OBJEXT) missing.$(OBJEXT) \
readcpu.$(OBJEXT)
zfile.$(OBJEXT) zfile_archive.$(OBJEXT) cfgfile.$(OBJEXT) \
picasso96.$(OBJEXT) inputdevice.$(OBJEXT) gfxutil.$(OBJEXT) \
audio.$(OBJEXT) sinctable.$(OBJEXT) drawing.$(OBJEXT) \
consolehook.$(OBJEXT) native2amiga.$(OBJEXT) disk.$(OBJEXT) \
crc32.$(OBJEXT) savestate.$(OBJEXT) arcadia.$(OBJEXT) \
cdtv.$(OBJEXT) cd32_fmv.$(OBJEXT) uaeexe.$(OBJEXT) \
uaelib.$(OBJEXT) uaeresource.$(OBJEXT) fdi2raw.$(OBJEXT) \
hotkeys.$(OBJEXT) amax.$(OBJEXT) ar.$(OBJEXT) \
driveclick.$(OBJEXT) enforcer.$(OBJEXT) misc.$(OBJEXT) \
a2065.$(OBJEXT) gayle.$(OBJEXT) ncr_scsi.$(OBJEXT) \
missing.$(OBJEXT) readcpu.$(OBJEXT)
uae_OBJECTS = $(am_uae_OBJECTS)
SCRIPTS = $(dist_noinst_SCRIPTS)
DEFAULT_INCLUDES = -I.@am__isrc@
......@@ -412,7 +412,7 @@ EXTRA_DIST = \
uae_SOURCES = \
main.c newcpu.c memory.c rommgr.c custom.c serial.c dongle.c cia.c \
blitter.c autoconf.c traps.c ersatz.c keybuf.c expansion.c \
diskutil.c zfile.c cfgfile.c picasso96.c inputdevice.c \
diskutil.c zfile.c zfile_archive.c cfgfile.c picasso96.c inputdevice.c \
gfxutil.c audio.c sinctable.c drawing.c consolehook.c \
native2amiga.c disk.c crc32.c savestate.c arcadia.c cdtv.c cd32_fmv.c \
uaeexe.c uaelib.c uaeresource.c fdi2raw.c hotkeys.c amax.c \
......@@ -660,6 +660,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uaeresource.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writelog.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfile_archive.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
......
......@@ -23,6 +23,7 @@
#include "threaddep/thread.h"
#include "akiko.h"
#include "gui.h"
#include "crc32.h"
#include "sleep.h"
#include "custom.h"
#include "newcpu.h"
......@@ -370,7 +371,7 @@ static uae_u32 akiko_c2p_read (int offset)
#define CH_ERR_ABNORMALSEEK 0xf0 // %11110000
#define CH_ERR_NODISK 0xf8 // %11111000
static int framecounter, subcodecounter;
static int subcodecounter;
#define MAX_SUBCODEBUFFER 20
static volatile int subcodebufferoffset, subcodebufferoffsetw;
......@@ -398,7 +399,7 @@ static struct cd_toc_head cdrom_toc_cd_buffer;
static uae_u8 qcode_buf[SUBQ_SIZE];
static int qcode_valid;
static int cdrom_disk, cdrom_paused, cdrom_playing;
static int cdrom_disk, cdrom_paused, cdrom_playing, cdrom_audiostatus;
static int cdrom_command_active;
static int cdrom_command_length;
static int cdrom_checksum_error, cdrom_unknown_command;
......@@ -455,6 +456,7 @@ static void cdaudiostop_do (void)
static void cdaudiostop (void)
{
cdrom_audiostatus = 0;
cdrom_audiotimeout = 0;
cdrom_paused = 0;
cdrom_playing = 0;
......@@ -499,6 +501,25 @@ static void subfunc (uae_u8 *data, int cnt)
uae_sem_post (&sub_sem);
}
static int statusfunc (int status)
{
if (status == -1)
return 0;
if (status == -2)
return 150;
if (cdrom_audiostatus != status) {
if (status == AUDIO_STATUS_IN_PROGRESS) {
cdrom_playing = 1;
cdrom_audiotimeout = 1;
}
if (cdrom_playing && status != AUDIO_STATUS_IN_PROGRESS && status != AUDIO_STATUS_PAUSED) {
cdrom_audiotimeout = -1;
}
}
cdrom_audiostatus = status;
return 0;
}
static void cdaudioplay_do (void)
{
uae_u32 startlsn = read_comm_pipe_u32_blocking (&requests);
......@@ -508,7 +529,7 @@ static void cdaudioplay_do (void)
if (unitnum < 0)
return;
sys_command_cd_pause (unitnum, 0);
sys_command_cd_play2 (unitnum, startlsn, endlsn, scan, subfunc);
sys_command_cd_play2 (unitnum, startlsn, endlsn, scan, statusfunc, subfunc);
}
static bool isaudiotrack (int startlsn)
......@@ -583,9 +604,7 @@ static int cd_qcode (uae_u8 *d)
buf[2] = 0x80;
if (!qcode_valid)
return 0;
if (cdrom_playing) // fake it!
as = AUDIO_STATUS_IN_PROGRESS;
if (as != AUDIO_STATUS_IN_PROGRESS && as != AUDIO_STATUS_PAUSED && as != AUDIO_STATUS_PLAY_COMPLETE && as != AUDIO_STATUS_NO_STATUS) /* audio status ok? */
if (cdrom_audiostatus != AUDIO_STATUS_IN_PROGRESS && cdrom_audiostatus != AUDIO_STATUS_PAUSED)
return 0;
s = buf + 4;
last_play_pos = msf2lsn (fromlongbcd (s + 7));
......@@ -875,11 +894,11 @@ static int cdrom_command_multi (void)
seekpos, msf2lsn (seekpos), endpos, msf2lsn (endpos), scan);
#endif
cdrom_playing = 1;
cdrom_result_buffer[1] |= CDS_PLAYING;
if (!cd_play_audio (seekpos, endpos, 0)) {
// play didn't start, report it in next status packet
// play didn't start, report it in next status packet
cdrom_audiotimeout = -3;
}
cdrom_result_buffer[1] |= CDS_PLAYING;
} else {
#if AKIKO_DEBUG_IO_CMD
write_log ("SEEKTO %06X\n",seekpos);
......@@ -892,10 +911,15 @@ static int cdrom_command_multi (void)
return 2;
}
static int cdrom_playend_notify (int err)
static int cdrom_playend_notify (int status)
{
cdrom_result_buffer[0] = 4;
cdrom_result_buffer[1] = err ? 0x80 : 0x00;
if (status < 0)
cdrom_result_buffer[1] = 0x80; // error
else if (status == 0)
cdrom_result_buffer[1] = 0x08; // play started
else
cdrom_result_buffer[1] = 0x00; // play ended
return 2;
}
......@@ -1089,6 +1113,10 @@ static void akiko_handler (void)
get_cdrom_toc ();
return;
}
if (cdrom_audiotimeout == 1) { // play start
cdrom_start_return_data (cdrom_playend_notify (0));
cdrom_audiotimeout = 0;
}
if (cdrom_audiotimeout == -1) { // play finished (or disk end)
if (cdrom_playing) {
cdaudiostop ();
......@@ -1097,12 +1125,13 @@ static void akiko_handler (void)
cdrom_audiotimeout = 0;
}
}
if (cdrom_audiotimeout == -2 && qcode_buf[1] != AUDIO_STATUS_IN_PROGRESS) {
cdrom_start_return_data (cdrom_playend_notify (0));
if (cdrom_audiotimeout == -2) { // play end notification
cdrom_start_return_data (cdrom_playend_notify (1));
cdrom_audiotimeout = 0;
}
if (cdrom_audiotimeout == -3) {
cdrom_start_return_data (cdrom_playend_notify (1));
// play didn't start notification (illegal address)
if (cdrom_audiotimeout == -3) { // return error status
cdrom_start_return_data (cdrom_playend_notify (-1));
cdrom_audiotimeout = 0;
}
......@@ -1132,6 +1161,7 @@ void AKIKO_hsync_handler (void)
if (!currprefs.cs_cd32cd || !akiko_inited)
return;
static float framecounter;
framecounter--;
if (framecounter <= 0) {
if (cdrom_seek_delay <= 0) {
......@@ -1139,12 +1169,12 @@ void AKIKO_hsync_handler (void)
} else {
cdrom_seek_delay--;
}
framecounter = 1000000 / (63 * 75 * cdrom_speed);
framecounter += (float)maxvpos * vblank_hz / (75.0 * cdrom_speed);
}
subcodecounter--;
if (subcodecounter <= 0) {
if ((cdrom_flags & CDFLAG_SUBCODE) && subcodebufferoffset != subcodebufferoffsetw) {
if ((cdrom_flags & CDFLAG_SUBCODE) && cdrom_playing && subcodebufferoffset != subcodebufferoffsetw) {
uae_sem_wait (&sub_sem);
if (subcodebufferinuse[subcodebufferoffset]) {
if (cdrom_subcodeoffset >= 128)
......@@ -1164,7 +1194,7 @@ void AKIKO_hsync_handler (void)
}
uae_sem_post (&sub_sem);
}
subcodecounter = 1000000 / (70 * 75 * cdrom_speed);
subcodecounter = maxvpos * vblank_hz / (75 * cdrom_speed) - 5;
}
if (frame2counter > 0)
......@@ -1172,12 +1202,6 @@ void AKIKO_hsync_handler (void)
if (mediacheckcounter > 0)
mediacheckcounter--;
if (cdrom_audiotimeout > 0) {
cdrom_audiotimeout--;
if (cdrom_audiotimeout == 0)
cdrom_audiotimeout = -1;
}
akiko_internal ();
akiko_handler ();
}
......@@ -1222,16 +1246,6 @@ static void *akiko_thread (void *null)
if (unitnum >= 0 && sys_command_cd_qcode (unitnum, qcode_buf)) {
uae_u8 as = qcode_buf[1];
qcode_valid = 1;
if (as == AUDIO_STATUS_IN_PROGRESS) {
frame2counter /= 4;
if (cdrom_audiotimeout == 0) {
int lsn = msf2lsn (fromlongbcd (qcode_buf + 4 + 7));
// make sure audio play really ends because not all drives report position accurately
if ((lsn >= cdrom_toc_cd_buffer.lastaddress - 3 * 75 || lsn >= last_play_end - 3 * 75)) {
cdrom_audiotimeout = 3 * 312;
}
}
}
}
}
......
......@@ -394,19 +394,19 @@ bool get_header(struct zfile *fp, LzHeader *hdr)
if (zfile_fread(data + I_HEADER_CHECKSUM,
sizeof(char), header_size - 1, fp) < header_size - 1) {
fatal_error(L"Invalid header (LHarc file ?)");
fatal_error("Invalid header (LHarc file ?)");
return FALSE; /* finish */
}
setup_get(data + I_HEADER_LEVEL);
hdr->header_level = get_byte ();
if (hdr->header_level != 2 &&
zfile_fread(data + header_size, sizeof(char), 2, fp) < 2) {
fatal_error(L"Invalid header (LHarc file ?)");
fatal_error("Invalid header (LHarc file ?)");
return FALSE; /* finish */
}
if (hdr->header_level >= 3) {
fatal_error(L"Unknown level header");
fatal_error("Unknown level header");
return FALSE;
}
......@@ -427,7 +427,7 @@ bool get_header(struct zfile *fp, LzHeader *hdr)
if ((hdr->header_level = get_byte ()) != 2) {
if (calc_sum(data + I_METHOD, header_size) != checksum)
warning(L"Checksum error (LHarc file?)", L"");
warning("Checksum error (LHarc file?)", "");
name_length = get_byte ();
for (i = 0; i < name_length; i++)
hdr->name[i] = (char) get_byte ();
......@@ -450,7 +450,7 @@ bool get_header(struct zfile *fp, LzHeader *hdr)
hdr->extend_type = EXTEND_GENERIC;
hdr->has_crc = FALSE;
} else {
fatal_error(L"Unkonwn header (lha file?)");
fatal_error("Unkonwn header (lha file?)");
return FALSE;
}
} else {
......@@ -500,7 +500,7 @@ bool get_header(struct zfile *fp, LzHeader *hdr)
if (hdr->header_level != 2 &&
((data + LZHEADER_STRAGE - get_ptr < header_size) ||
zfile_fread(get_ptr, sizeof(char), header_size, fp) < header_size)) {
fatal_error(L"Invalid header (LHa file ?)");
fatal_error("Invalid header (LHa file ?)");
return FALSE;
}
switch (get_byte ()) {
......
......@@ -37,7 +37,7 @@ void lha_make_table(short nchar, unsigned char bitlen[], short tablebits, unsign
total += weight[i] * count[i];
}
if ((total & 0xffff) != 0)
error(L"make_table()", L"Bad table (5)\n");
error("make_table()", "Bad table (5)\n");
/* shift data for make table. */
m = 16 - tablebits;
......
......@@ -163,7 +163,7 @@ char *xxrealloc(char *old, int size)
{
char *p = (char *) xrealloc(char, old, size);
if (!p)
fatal_error(L"Not enough memory");
fatal_error("Not enough memory");
return p;
}
......
......@@ -667,7 +667,7 @@ struct zfile *archive_access_lzx (struct znode *zn)
unpsize -= decrunch_length;
crc_calc (pdest, decrunch_length);
} else {
write_log (L"LZX corrupt compressed data %s\n", zn->name);
write_log ("LZX corrupt compressed data %s\n", zn->name);
goto end;
}
}
......@@ -812,7 +812,7 @@ struct zvolume *archive_directory_lzx (struct zfile *in_file)
else
abort = 0; /* continue */
//write_log (L"unp=%6d mrg=%6d pack=%6d off=%6d %s\n", unpack_size, merge_size, pack_size, zn->offset, zai.name);
//write_log ("unp=%6d mrg=%6d pack=%6d off=%6d %s\n", unpack_size, merge_size, pack_size, zn->offset, zai.name);
}
......
......@@ -403,8 +403,8 @@ struct zfile *unwarp(struct zfile *zf)
if (!iswrp (buf))
break;
if (!nf) {
nf = zfile_fopen_empty (zf, L"zipped.wrp", 1760 * 512);
tmpf = zfile_fopen_empty (zf, L"tmp", outsize2);
nf = zfile_fopen_empty (zf, "zipped.wrp", 1760 * 512);
tmpf = zfile_fopen_empty (zf, "tmp", outsize2);
}
track = (buf[10] << 8) | buf[11];
algo = buf[19];
......@@ -447,19 +447,19 @@ struct zfile *unwarp(struct zfile *zf)
}
break;
default:
write_log (L"WRP unknown compression method %d, track=%d,size=%d\n", algo, track, side);
write_log ("WRP unknown compression method %d, track=%d,size=%d\n", algo, track, side);
goto end;
break;
}
if (err) {
write_log (L"WRP corrupt data, track=%d,side=%d,err=%d\n", track, side, err);
write_log ("WRP corrupt data, track=%d,side=%d,err=%d\n", track, side, err);
} else {
uae_u16 crc2;
int os = zfile_ftell (tmpf);
data = zfile_getdata (tmpf, 0, os);
crc2 = wrpcrc16 (wrpcrc16table, data, os);
if (crc != crc2)
write_log (L"WRP crc error %04x<>%04x, track=%d,side=%d\n", crc, crc2, track, side);
write_log ("WRP crc error %04x<>%04x, track=%d,side=%d\n", crc, crc2, track, side);
xfree (data);
}
if (dstpos >= 0) {
......
......@@ -26,7 +26,7 @@ static int scsiemu[MAX_TOTAL_SCSI_DEVICES];
struct device_functions *device_func[MAX_TOTAL_SCSI_DEVICES];
static int openlist[MAX_TOTAL_SCSI_DEVICES];
static int waspaused[MAX_TOTAL_SCSI_DEVICES], wasslow[MAX_TOTAL_SCSI_DEVICES];
static int waspaused[MAX_TOTAL_SCSI_DEVICES];
static int delayed[MAX_TOTAL_SCSI_DEVICES];
/* convert minutes, seconds and frames -> logical sector number */
......@@ -469,7 +469,6 @@ static void check_changes (int unitnum)
struct device_info di;
device_func[unitnum]->info (unitnum, &di, 0);
wasopen[unitnum] = di.open;
wasslow[unitnum] = di.slow_unit;
if (wasopen[unitnum]) {
device_func[unitnum]->closedev (unitnum);
if (currprefs.scsi) {
......@@ -495,7 +494,7 @@ static void check_changes (int unitnum)
write_log ("CD: delayed insert '%s'\n", currprefs.cdslots[unitnum].name[0] ? currprefs.cdslots[unitnum].name : "<EMPTY>");
device_func_init (0);
if (wasopen[unitnum]) {
if (!device_func[unitnum]->opendev (unitnum, currprefs.cdslots[unitnum].name, wasslow[unitnum])) {
if (!device_func[unitnum]->opendev (unitnum, currprefs.cdslots[unitnum].name, 0)) {
write_log ("-> device open failed\n");
}
}
......@@ -622,18 +621,18 @@ int sys_command_cd_play (int unitnum, int startlsn, int endlsn, int scan)
return do_scsi (unitnum, cmd, sizeof cmd) ? 0 : 1;
}
//startlsn = adjustplaypos (unitnum, startlsn);
return device_func[unitnum]->play (unitnum, startlsn, endlsn, scan, NULL);
return device_func[unitnum]->play (unitnum, startlsn, endlsn, scan, NULL, NULL);
}
/* play CD audio with subchannels */
int sys_command_cd_play2 (int unitnum, int startlsn, int endlsn, int scan, play_subchannel_callback subfunc)
int sys_command_cd_play2 (int unitnum, int startlsn, int endlsn, int scan, play_status_callback statusfunc, play_subchannel_callback subfunc)
{
if (failunit (unitnum))
return 0;
if (device_func[unitnum]->play == NULL)
return sys_command_cd_play (unitnum, startlsn, endlsn, scan);
//startlsn = adjustplaypos (unitnum, startlsn);
return device_func[unitnum]->play (unitnum, startlsn, endlsn, scan, subfunc);
return device_func[unitnum]->play (unitnum, startlsn, endlsn, scan, statusfunc, subfunc);
}
/* set CD audio volume */
......@@ -1370,7 +1369,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
goto errreq;
start = toc->toc[toc->first_track_offset + start].paddress;
}
sys_command_cd_play2 (unitnum, start, end, scan, NULL);
sys_command_cd_play (unitnum, start, end, scan);
scsi_len = 0;
}
break;
......@@ -1390,7 +1389,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
goto errreq;
int start = toc->toc[toc->first_track_offset + strack - 1].paddress;
int end = etrack == toc->last_track ? toc->lastaddress : toc->toc[toc->first_track_offset + etrack - 1 + 1].paddress;
if (!sys_command_cd_play2 (unitnum, start, end, 0, NULL))
if (!sys_command_cd_play (unitnum, start, end, 0))
goto notdatatrack;
scsi_len = 0;
}
......@@ -1411,7 +1410,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
if (end > di.toc.lastaddress)
end = di.toc.lastaddress;
if (len > 0) {
if (!sys_command_cd_play2 (unitnum, start, start + len, 0, NULL))
if (!sys_command_cd_play (unitnum, start, start + len, 0))
goto notdatatrack;
}
scsi_len = 0;
......@@ -1434,7 +1433,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
if (start > end)
goto errreq;
if (start < end)
if (!sys_command_cd_play2 (unitnum, start, end, 0, NULL))
if (!sys_command_cd_play (unitnum, start, end, 0))
goto notdatatrack;
scsi_len = 0;
}
......@@ -1459,7 +1458,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
int end = start + len;
if (end > di.toc.lastaddress)
end = di.toc.lastaddress;
if (!sys_command_cd_play2 (unitnum, start, end, 0, NULL))
if (!sys_command_cd_play (unitnum, start, end, 0))
goto notdatatrack;
}
scsi_len = 0;
......@@ -1483,7 +1482,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
if (start > end)
goto errreq;
if (start < end) {
if (!sys_command_cd_play2 (unitnum, start, end, 0, NULL))
if (!sys_command_cd_play (unitnum, start, end, 0))
goto notdatatrack;
}
}
......
......@@ -78,9 +78,9 @@ static volatile uae_u32 dmac_acr;
static volatile int dmac_wtc;
static volatile int dmac_dma;
static volatile int activate_stch, cdrom_command_done, play_state, play_statewait;
static volatile int activate_stch, cdrom_command_done;
static volatile int cdrom_sector, cdrom_sectors, cdrom_length, cdrom_offset;
static volatile int cd_playing, cd_paused, cd_motor, cd_media, cd_error, cd_finished, cd_isready;
static volatile int cd_playing, cd_paused, cd_motor, cd_media, cd_error, cd_finished, cd_isready, cd_audio_finished;
static uae_u32 last_play_pos, last_play_end;
static volatile int cdtv_hsync, dma_finished, cdtv_sectorsize;
......@@ -142,28 +142,10 @@ static int get_toc (void)
return 1;
}
static void finished_cdplay (void)
{
cd_audio_status = AUDIO_STATUS_PLAY_COMPLETE;
cd_playing = 0;
cd_finished = 1;
cd_paused = 0;
do_stch ();
}
static int get_qcode (void)
{
if (!sys_command_cd_qcode (unitnum, cdrom_qcode))
return 0;
if (cd_playing) {
if (cdrom_qcode[1] == AUDIO_STATUS_IN_PROGRESS) {
int end = msf2lsn (fromlongbcd (cdrom_qcode + 4 + 7));
if (end >= play_end - 75)
finished_cdplay ();
} else if (cdrom_qcode[1] == AUDIO_STATUS_PLAY_COMPLETE) {
finished_cdplay ();
}
}
cdrom_qcode[1] = cd_audio_status;
return 1;
}
......@@ -187,6 +169,7 @@ static void cdaudiostop (void)
cd_playing = 0;
cd_paused = 0;
cd_motor = 0;
cd_audio_finished = 0;
write_comm_pipe_u32 (&requests, 0x0104, 1);
}
......@@ -285,7 +268,24 @@ static void subfunc (uae_u8 *data, int cnt)
subcodebufferoffsetw = offset;
uae_sem_post (&sub_sem);
}
static int statusfunc (int status)
{
if (status == -1)
return 500;
if (status == -2)
return 75;
if (cd_audio_status != status) {
if (status == AUDIO_STATUS_PLAY_COMPLETE || status == AUDIO_STATUS_PLAY_ERROR) {
cd_audio_finished = 1;
} else {
if (status == AUDIO_STATUS_IN_PROGRESS)
cd_playing = 1;
activate_stch = 1;
}
}
cd_audio_status = status;
return 0;
}
static void do_play (void)
{
......@@ -294,15 +294,21 @@ static void do_play (void)
uae_u32 scan = read_comm_pipe_u32_blocking (&requests);
subreset ();
sys_command_cd_pause (unitnum, 0);
cd_audio_status = AUDIO_STATUS_PLAY_ERROR;
sys_command_cd_volume (unitnum, (cd_volume_stored << 5) | (cd_volume_stored >> 5), (cd_volume_stored << 5) | (cd_volume_stored >> 5));
if (sys_command_cd_play2 (unitnum, start, end, 0, subfunc)) {
cd_audio_status = AUDIO_STATUS_IN_PROGRESS;
cd_playing = 1;
} else {
cd_error = 1;
sys_command_cd_play2 (unitnum, start, end, 0, statusfunc, subfunc);
}
static void startplay (void)
{
subreset ();
write_comm_pipe_u32 (&requests, 0x0110, 0);
write_comm_pipe_u32 (&requests, play_start, 0);
write_comm_pipe_u32 (&requests, play_end, 0);
write_comm_pipe_u32 (&requests, 0, 1);
if (!cd_motor) {
cd_motor = 1;
activate_stch = 1;
}
activate_stch = 1;
}
static int play_cdtrack (uae_u8 *p)
......@@ -342,11 +348,11 @@ static int play_cdtrack (uae_u8 *p)
play_start = start;
last_play_pos = start;
last_play_end = end;
#ifdef CDTV_DEBUG
#ifdef CDTV_DEBUG_CMD
write_log ("PLAY CD AUDIO from %d-%d, %06X (%d) to %06X (%d)\n",
track_start, track_end, start, start, end, end);
#endif
play_state = 1;
startplay ();
return 0;
}
......@@ -366,11 +372,10 @@ static int play_cd (uae_u8 *p)
cd_playing = 0;
cd_paused = 0;
cd_motor = 0;
cd_audio_status = AUDIO_STATUS_PLAY_COMPLETE;
sys_command_cd_pause (unitnum, 0);
sys_command_cd_stop (unitnum);
cd_isready = 50;
write_comm_pipe_u32 (&requests, 0x0104, 1);
cd_audio_status = AUDIO_STATUS_NO_STATUS;
cd_error = 1;
activate_stch = 1;
return 0;
}
if (p[0] != 0x09) { /* msf */
......@@ -388,7 +393,7 @@ static int play_cd (uae_u8 *p)
write_log ("PLAY CD AUDIO from %06X (%d) to %06X (%d)\n",
lsn2msf (start), start, lsn2msf (end), end);
#endif
play_state = 1;
startplay ();
return 0;
}
......@@ -512,9 +517,10 @@ static void cdrom_command_thread (uae_u8 b)
{
case 0x01: /* seek */
if (cdrom_command_cnt_in == 7) {
uae_msleep (500);
cdrom_command_accepted (0, s, &cdrom_command_cnt_in);
cd_finished = 1;
uae_msleep (500);
activate_stch = 1;
}
break;
case 0x02: /* read */
......@@ -799,8 +805,7 @@ static void init_play (int start, int end)
write_log ("PLAY CD AUDIO from %06X (%d) to %06X (%d)\n",
lsn2msf (start), start, lsn2msf (end), end);
#endif
play_state = 1;
subreset ();
startplay ();
}
bool cdtv_front_panel (int button)
......@@ -1168,7 +1173,17 @@ void CDTV_hsync_handler (void)
sten = 0;
}
if (cd_audio_finished) {
cd_audio_finished = 0;
cd_playing = 0;
cd_finished = 1;
cd_paused = 0;
//cd_error = 1;
activate_stch = 1;
}
static int subchannelcounter;
int cntmax = maxvpos * vblank_hz / 75 - 6;
if (subchannelcounter > 0)
subchannelcounter--;
if (subchannelcounter <= 0) {
......@@ -1193,7 +1208,7 @@ void CDTV_hsync_handler (void)
tp_check_interrupts ();
}
uae_sem_post (&sub_sem);
subchannelcounter = 200;
subchannelcounter = cntmax;
}
}
if (!scor && !cd_playing) {
......@@ -1201,35 +1216,14 @@ void CDTV_hsync_handler (void)
scor = 1;
tp_check_interrupts ();
scor = 0;
subchannelcounter = 200;
subchannelcounter = cntmax;
}
}
if (cdtv_hsync < 200 && cdtv_hsync >= 0)
if (cdtv_hsync < cntmax && cdtv_hsync >= 0)
return;
cdtv_hsync = 0;
if (play_state == 1) {
play_state = 2;
cd_playing = 1;
cd_motor = 1;
activate_stch = 1;
play_statewait = 2;
} else if (play_statewait > 0) {
play_statewait--;
} else if (play_state == 2) {
write_comm_pipe_u32 (&requests, 0x0110, 0);
write_comm_pipe_u32 (&requests, play_start, 0);
write_comm_pipe_u32 (&requests, play_end, 0);
write_comm_pipe_u32 (&requests, 0, 1);
play_state = 0;
}
if (cd_isready > 0) {
cd_isready--;
if (!cd_isready)
do_stch ();
}
if (dmac_dma || dma_finished)
cd_led |= LED_CD_ACTIVE;
else
......@@ -1884,7 +1878,7 @@ uae_u8 *save_cdtv (int *len)
(cd_motor ? 8 : 0) | (cd_error ? 16 : 0) | (cd_finished ? 32 : 0) | (cdrom_command_done ? 64 : 0) |
(activate_stch ? 128 : 0) | (sten ? 256 : 0) | (stch ? 512 : 0) | (frontpanel ? 1024 : 0));
save_u8 (cd_isready);
save_u8 (play_state);
save_u8 (0);
save_u16 (cd_volume_stored);
if (cd_playing)
get_qcode ();
......@@ -1939,7 +1933,7 @@ uae_u8 *restore_cdtv (uae_u8 *src)
stch = (v & 512) ? 1 : 0;
frontpanel = (v & 1024) ? 1 : 0;
cd_isready = restore_u8 ();
play_state = restore_u8 ();
restore_u8 ();
cd_volume_stored = restore_u16 ();
last_play_pos = restore_u32 ();
last_play_end = restore_u32 ();
......
......@@ -1954,13 +1954,11 @@ STATIC_INLINE void do_color_changes (line_draw_func worker_border, line_draw_fun
(*worker_border) (lastpos, nextpos_in_range);
lastpos = nextpos_in_range;
}
if (i != dip_for_drawing->last_color_change) {
if (regno >= 0x1000) {
pfield_expand_dp_bplconx (regno, value);
} else {
color_reg_set (&colors_for_drawing, regno, value);
colors_for_drawing.acolors[regno] = getxcolor (value);
}
if (regno >= 0x1000) {
pfield_expand_dp_bplconx (regno, value);
} else if (regno >= 0) {
color_reg_set (&colors_for_drawing, regno, value);
colors_for_drawing.acolors[regno] = getxcolor (value);
}
if (lastpos >= endpos)
break;
......
......@@ -252,8 +252,8 @@ static void generate_header(void)
{
unsigned int i;
for (i = 0; i < sizeof(blttbl); i++) {
printf("extern blitter_func blitdofast_%x;\n",blttbl[i]);
printf("extern blitter_func blitdofast_desc_%x;\n",blttbl[i]);
printf("extern blitter_func blitdofast_%x;\n",blttbl[i]);
printf("extern blitter_func blitdofast_desc_%x;\n",blttbl[i]);
}
}
......
......@@ -42,6 +42,7 @@ extern int action_replay_load (void);
extern void action_replay_memory_reset (void);
extern void action_replay_init (int);
extern void action_replay_cleanup (void);
//extern void action_replay_map_banks (void);
extern void REGPARAM3 chipmem_lput_actionreplay23 (uaecptr addr, uae_u32 l) REGPARAM;
extern void REGPARAM3 chipmem_wput_actionreplay23 (uaecptr addr, uae_u32 w) REGPARAM;
extern void REGPARAM3 chipmem_bput_actionreplay1 (uaecptr addr, uae_u32 b) REGPARAM;
......
......@@ -80,7 +80,6 @@ struct device_info {
TCHAR productid[18];
TCHAR revision[6];
TCHAR *backend;
int slow_unit;
struct cd_toc_head toc;
};
......@@ -110,10 +109,11 @@ typedef uae_u8* (*execscsicmd_in_func) (int, uae_u8*, int, int*);
typedef int (*execscsicmd_direct_func) (int, struct amigascsi*);
typedef void (*play_subchannel_callback) (uae_u8*, int);
typedef int (*play_status_callback) (int);
typedef int (*pause_func) (int, int);
typedef int (*stop_func) (int);
typedef int (*play_func) (int, int, int, int, play_subchannel_callback);
typedef int (*play_func) (int, int, int, int, play_status_callback, play_subchannel_callback);
typedef uae_u32 (*volume_func) (int, uae_u16, uae_u16);
typedef int (*qcode_func) (int, uae_u8*, int);
typedef int (*toc_func) (int, struct cd_toc_head*);
......@@ -160,7 +160,7 @@ extern struct device_info *sys_command_info (int unitnum, struct device_info *di
extern int sys_command_cd_pause (int unitnum, int paused);
extern void sys_command_cd_stop (int unitnum);
extern int sys_command_cd_play (int unitnum, int startlsn, int endlsn, int);
extern int sys_command_cd_play2 (int unitnum, int startlsn, int endlsn, int scan, play_subchannel_callback subfunc);
extern int sys_command_cd_play2 (int unitnum, int startlsn, int endlsn, int scan, play_status_callback statusfunc, play_subchannel_callback subfunc);
extern uae_u32 sys_command_cd_volume (int unitnum, uae_u16 volume_left, uae_u16 volume_right);
extern int sys_command_cd_qcode (int unitnum, uae_u8*);
extern int sys_command_cd_toc (int unitnum, struct cd_toc_head*);
......
......@@ -52,28 +52,28 @@ struct romlist {
struct romdata *rd;
};
extern struct romdata *getromdatabypath (TCHAR *path);
extern struct romdata *getromdatabypath (const TCHAR *path);
extern struct romdata *getromdatabycrc (uae_u32 crc32);
extern struct romdata *getromdatabydata (uae_u8 *rom, int size);
extern struct romdata *getromdatabyid (int id);
extern struct romdata *getromdatabyidgroup (int id, int group, int subitem);
//extern struct romdata *getromdatabyzfile (struct zfile *f);
extern struct romlist **getarcadiaroms (void);
extern struct romdata *getarcadiarombyname (TCHAR *name);
extern struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, TCHAR *model, int all);
extern void getromname (struct romdata*, TCHAR*);
extern struct romdata *getarcadiarombyname (const TCHAR *name);
extern struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, const TCHAR *model, int all);
extern void getromname (const struct romdata*, TCHAR*);
//extern struct romdata *getromdatabyname (const TCHAR*);
extern struct romlist *getromlistbyids (int *ids);
extern void romwarning(int *ids);
extern struct romlist *getromlistbyromdata (struct romdata *rd);
extern void romlist_add (TCHAR *path, struct romdata *rd);
extern TCHAR *romlist_get (struct romdata *rd);
extern struct romlist *getromlistbyids (const int *ids);
extern void romwarning(const int *ids);
extern struct romlist *getromlistbyromdata (const struct romdata *rd);
extern void romlist_add (const TCHAR *path, struct romdata *rd);
extern TCHAR *romlist_get (const struct romdata *rd);
extern void romlist_clear (void);
extern struct zfile *read_rom (struct romdata **rd);
extern struct zfile *read_rom_name (const TCHAR *filename);
extern int load_keyring (struct uae_prefs *p, TCHAR *path);
extern uae_u8 *target_load_keyfile (struct uae_prefs *p, TCHAR *path, int *size, TCHAR *name);
extern int load_keyring (struct uae_prefs *p, const TCHAR *path);
extern uae_u8 *target_load_keyfile (struct uae_prefs *p, const TCHAR *path, int *size, TCHAR *name);
extern void free_keyring (void);
extern int get_keyring (void);
extern void kickstart_fix_checksum (uae_u8 *mem, int size);
......@@ -83,7 +83,8 @@ extern int decode_rom (uae_u8 *mem, int size, int mode, int real_size);
extern struct zfile *rom_fopen (const TCHAR *name, const TCHAR *mode, int mask);
extern struct zfile *read_rom_name_guess (const TCHAR *filename);
extern void addkeydir (const TCHAR *path);
extern void addkeyfile (const TCHAR *path);
extern int romlist_count (void);
extern struct romlist *romlist_getit (void);
extern int configure_rom (struct uae_prefs *p, int *rom, int msg);
extern int configure_rom (struct uae_prefs *p, const int *rom, int msg);
......@@ -20,8 +20,8 @@ extern uae_u32 restore_u32_func (uae_u8 **);
extern uae_u16 restore_u16_func (uae_u8 **);
extern uae_u8 restore_u8_func (uae_u8 **);
extern void save_string_func (uae_u8 **, const char *);
extern char *restore_string_func (const uae_u8 **);
extern void save_string_func (uae_u8 **, const TCHAR*);
extern TCHAR *restore_string_func (uae_u8 **);
#define save_u64(x) save_u64_func (&dst, (x))
#define save_u32(x) save_u32_func (&dst, (x))
......@@ -151,9 +151,9 @@ extern uae_u8 *save_action_replay (int *, uae_u8 *);
extern uae_u8 *restore_hrtmon (uae_u8 *);
extern uae_u8 *save_hrtmon (int *, uae_u8 *);
extern void savestate_initsave (const char *filename, int docompress, int nodialogs);
extern int save_state (const char *filename, const char *description);
extern void restore_state (const char *filename);
extern void savestate_initsave (const TCHAR *filename, int docompress, int nodialogs);
extern int save_state (const TCHAR *filename, const TCHAR *description);
extern void restore_state (const TCHAR *filename);
extern void savestate_restore_finish (void);
extern void custom_save_state (void);
......@@ -167,7 +167,7 @@ extern void custom_prepare_savestate (void);
#define STATE_DOREWIND 32
extern int savestate_state;
extern char savestate_fname[MAX_DPATH];
extern TCHAR savestate_fname[MAX_DPATH];
extern struct zfile *savestate_file;
extern void savestate_quick (int slot, int save);
......
......@@ -425,4 +425,5 @@ extern void xfree (const void*);
#define true 1
#define false 0
#define _vsntprintf vsnprintf
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
......@@ -424,7 +424,7 @@ uae_u32 emulib_target_getcpurate (uae_u32 v, uae_u32 *low)
*/
return 0;
}
/*
int isfat (uae_u8 *p)
{
int i, b;
......@@ -454,7 +454,7 @@ int isfat (uae_u8 *p)
return 0;
return 1;
}
*/
void setmouseactivexy (int x, int y, int dir)
{
/* int diff = 8;
......
/*
* UAE - The Un*x Amiga Emulator
*
* Call Amiga Exec functions outside the main UAE thread.
*
* Copyright 1999 Patrick Ohly
*
* Uses the EXTER interrupt that is setup in filesys.c
* and needs thread support.
*/
/*
* UAE - The Un*x Amiga Emulator
*
* Call Amiga Exec functions outside the main UAE thread.
*
* Copyright 1999 Patrick Ohly
*
* Uses the EXTER interrupt that is setup in filesys.c
* and needs thread support.
*/
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -31,7 +31,7 @@ static uae_sem_t n2asem;
void native2amiga_install (void)
{
init_comm_pipe (&native2amiga_pending, 100, 2);
uae_sem_init (&n2asem, 0, 1);
uae_sem_init (&n2asem, 0, 1);
}
void native2amiga_reset (void)
......@@ -58,50 +58,50 @@ int native2amiga_isfree (void)
void uae_Cause (uaecptr interrupt)
{
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 3, 0);
write_comm_pipe_u32 (&native2amiga_pending, interrupt, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 3, 0);
write_comm_pipe_u32 (&native2amiga_pending, interrupt, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
}
void uae_ReplyMsg (uaecptr msg)
{
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 2, 0);
write_comm_pipe_u32 (&native2amiga_pending, msg, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 2, 0);
write_comm_pipe_u32 (&native2amiga_pending, msg, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
}
void uae_PutMsg (uaecptr port, uaecptr msg)
{
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 1, 0);
write_comm_pipe_u32 (&native2amiga_pending, port, 0);
write_comm_pipe_u32 (&native2amiga_pending, msg, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 1, 0);
write_comm_pipe_u32 (&native2amiga_pending, port, 0);
write_comm_pipe_u32 (&native2amiga_pending, msg, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
}
void uae_Signal (uaecptr task, uae_u32 mask)
{
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 0, 0);
write_comm_pipe_u32 (&native2amiga_pending, task, 0);
write_comm_pipe_int (&native2amiga_pending, mask, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 0, 0);
write_comm_pipe_u32 (&native2amiga_pending, task, 0);
write_comm_pipe_int (&native2amiga_pending, mask, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
}
void uae_NotificationHack (uaecptr port, uaecptr nr)
{
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 4, 0);
write_comm_pipe_int (&native2amiga_pending, port, 0);
write_comm_pipe_int (&native2amiga_pending, nr, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
uae_sem_wait (&n2asem);
write_comm_pipe_int (&native2amiga_pending, 4, 0);
write_comm_pipe_int (&native2amiga_pending, port, 0);
write_comm_pipe_int (&native2amiga_pending, nr, 1);
do_uae_int_requested ();
uae_sem_post (&n2asem);
}
#endif
......
......@@ -8,6 +8,7 @@
#define MOVEC_DEBUG 0
#define MMUOP_DEBUG 2
#define DEBUG_CD32CDTVIO 0
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -2675,8 +2676,7 @@ STATIC_INLINE int do_specialties (int cycles)
//static uae_u32 pcs[1000];
//#define DEBUG_CD32CDTVIO
#ifdef DEBUG_CD32CDTVIO
#if DEBUG_CD32CDTVIO
static uae_u32 cd32nextpc, cd32request;
......@@ -2768,7 +2768,7 @@ static void m68k_run_1 (void)
count_instr (opcode);
#ifdef DEBUG_CD32CDTVIO
#if DEBUG_CD32CDTVIO
out_cd32io (m68k_getpc ());
#endif
......@@ -2815,7 +2815,7 @@ static void m68k_run_1_ce (void)
ipl_fetch ();
for (;;) {
uae_u32 opcode = r->ir;
#ifdef DEBUG_CD32CDTVIO
#if DEBUG_CD32CDTVIO
out_cd32io (m68k_getpc ());
#endif
(*cpufunctbl[opcode])(opcode);
......@@ -2947,7 +2947,7 @@ static void opcodedebug (uae_u32 pc, uae_u16 opcode)
if (!fault) {
TCHAR buf[100];
write_log ("mmufixup=%d %04x %04x\n", mmufixup[0].reg, regs.wb3_status, regs.mmu_ssw);
m68k_disasm_2 (buf, 100, addr, NULL, 1, NULL, NULL, 0);
m68k_disasm_2 (buf, sizeof buf / sizeof (TCHAR), addr, NULL, 1, NULL, NULL, 0);
write_log ("%s\n", buf);
m68k_dumpstate (stdout, NULL);
}
......@@ -3050,7 +3050,7 @@ static void m68k_run_2p (void)
uae_u32 opcode;
uae_u32 pc = m68k_getpc ();
#ifdef DEBUG_CD32CDTVIO
#if DEBUG_CD32CDTVIO
out_cd32io (m68k_getpc ());
#endif
......@@ -3218,7 +3218,7 @@ void m68k_go (int may_quit)
#endif
set_x_funcs ();
#if defined(MMU) && defined(JIT)
if (mmu_enabled && !currprefs.cachesize) {
if (mmu_enabled && !currprefs.cachesize) {
run_func = m68k_run_mmu;
} else {
#endif
......
This diff is collapsed.
/*
* UAE - The Un*x Amiga Emulator
*
* ROM file management
*
*/
/*
* UAE - The Un*x Amiga Emulator
*
* ROM file management
*
*/
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -30,7 +30,7 @@ int romlist_count (void)
return romlist_cnt;
}
TCHAR *romlist_get (struct romdata *rd)
TCHAR *romlist_get (const struct romdata *rd)
{
int i;
......@@ -43,7 +43,7 @@ TCHAR *romlist_get (struct romdata *rd)
return 0;
}
static struct romlist *romlist_getrl (struct romdata *rd)
static struct romlist *romlist_getrl (const struct romdata *rd)
{
int i;
......@@ -57,7 +57,7 @@ static struct romlist *romlist_getrl (struct romdata *rd)
}
static void romlist_cleanup (void);
void romlist_add (TCHAR *path, struct romdata *rd)
void romlist_add (const TCHAR *path, struct romdata *rd)
{
struct romlist *rl2;
......@@ -73,7 +73,7 @@ void romlist_add (TCHAR *path, struct romdata *rd)
}
struct romdata *getromdatabypath (TCHAR *path)
struct romdata *getromdatabypath (const TCHAR *path)
{
int i;
for (i = 0; i < romlist_cnt; i++) {
......@@ -88,7 +88,7 @@ struct romdata *getromdatabypath (TCHAR *path)
return NULL;
}
#define NEXT_ROM_ID 73
#define NEXT_ROM_ID 74
static struct romheader romheaders[] = {
{ "Freezer Cartridges", 1 },
......@@ -106,6 +106,8 @@ static struct romdata roms[] = {
0x869ae1b1, 0x801bbab3,0x2e3d3738,0x6dd1636d,0x4f1d6fa7,0xe21d5874 },
{ "Cloanto Amiga Forever 2006 ROM key", 0, 0, 0, 0, 0, 750, 48, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
0xb01c4b56, 0xbba8e5cd,0x118b8d92,0xafed5693,0x5eeb9770,0x2a662d8f },
{ "Cloanto Amiga Forever 2010 ROM key", 0, 0, 0, 0, 0, 1544, 73, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
0x8c4dd05c, 0x05034f62,0x0b5bb7b2,0x86954ea9,0x164fdb90,0xfb2897a4 },
{ "KS ROM v1.0 (A1000)(NTSC)", 1, 0, 1, 0, "A1000\0", 262144, 1, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0x299790ff, 0x00C15406,0xBEB4B8AB,0x1A16AA66,0xC05860E1,0xA7C1AD79 },
......@@ -135,8 +137,8 @@ static struct romdata roms[] = {
0x43b0df7b, 0x02843C42,0x53BBD29A,0xBA535B0A,0xA3BD9A85,0x034ECDE4 },
{ "KS ROM v2.04 (A3000)", 2, 4, 37, 175, "A3000\0", 524288, 71, 3, 0, ROMTYPE_KICK, 0, 0, NULL,
0x234a7233, 0xd82ebb59,0xafc53540,0xddf2d718,0x7ecf239b,0x7ea91590 },
ALTROMPN(71, 1, 1, 262144, ROMTYPE_EVEN, "390629-03", 0x7db1332b,0x48f14b31,0x279da675,0x7848df6f,0xeb531881,0x8f8f576c)
ALTROMPN(71, 1, 2, 262144, ROMTYPE_ODD , "390630-03", 0xa245dbdf,0x83bab8e9,0x5d378b55,0xb0c6ae65,0x61385a96,0xf638598f)
ALTROMPN(71, 1, 1, 262144, ROMTYPE_EVEN, "390629-03", 0xa245dbdf,0x83bab8e9,0x5d378b55,0xb0c6ae65,0x61385a96,0xf638598f)
ALTROMPN(71, 1, 2, 262144, ROMTYPE_ODD , "390630-03", 0x7db1332b,0x48f14b31,0x279da675,0x7848df6f,0xeb531881,0x8f8f576c)
{ "KS ROM v3.0 (A1200)", 3, 0, 39, 106, "A1200\0", 524288, 11, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0x6c9b07d2, 0x70033828,0x182FFFC7,0xED106E53,0x73A8B89D,0xDA76FAA5 },
......@@ -377,7 +379,7 @@ static void romlist_cleanup (void)
}
}
struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, TCHAR *model, int all)
struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, const TCHAR *model, int all)
{
int i, j, ok, out, max;
struct romdata *rd;
......@@ -457,7 +459,7 @@ struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, TC
return rdout;
}
struct romdata *getarcadiarombyname (TCHAR *name)
struct romdata *getarcadiarombyname (const TCHAR *name)
{
int i;
for (i = 0; roms[i].name; i++) {
......@@ -465,7 +467,7 @@ struct romdata *getarcadiarombyname (TCHAR *name)
TCHAR *p = roms[i].name;
p = p + _tcslen (p) + 1;
if (_tcslen (name) >= _tcslen (p) + 4) {
TCHAR *p2 = name + _tcslen (name) - _tcslen (p) - 4;
const TCHAR *p2 = name + _tcslen (name) - _tcslen (p) - 4;
if (!memcmp (p, p2, _tcslen (p)) && !memcmp (p2 + _tcslen (p2) - 4, ".zip", 4))
return &roms[i];
}
......@@ -516,7 +518,7 @@ static int kickstart_checksum_do (uae_u8 *mem, int size)
return cksum == 0xffffffff;
}
#define ROM_KEY_NUM 3
#define ROM_KEY_NUM 4
struct rom_key {
uae_u8 *key;
int size;
......@@ -554,7 +556,7 @@ static void addkey (uae_u8 *key, int size, const TCHAR *name)
write_log ("ROM KEY '%s' %d bytes loaded\n", name, size);
}
static void addkeyfile (const TCHAR *path)
void addkeyfile (const TCHAR *path)
{
struct zfile *f;
int keysize;
......@@ -602,12 +604,12 @@ int get_keyring (void)
return num;
}
int load_keyring (struct uae_prefs *p, TCHAR *path)
int load_keyring (struct uae_prefs *p, const TCHAR *path)
{
uae_u8 *keybuf;
int keysize;
TCHAR tmp[MAX_PATH], *d;
int keyids[] = { 0, 48, -1 };
int keyids[] = { 0, 48, 73, -1 };
int cnt, i;
free_keyring ();
......@@ -683,10 +685,10 @@ void free_keyring (void)
int i;
for (i = 0; i < ROM_KEY_NUM; i++)
xfree (keyring[i].key);
memset(keyring, 0, sizeof (struct rom_key) * ROM_KEY_NUM);
memset (keyring, 0, sizeof (struct rom_key) * ROM_KEY_NUM);
}
struct romdata *getromdatabyname (TCHAR *name)
struct romdata *getromdatabyname (const TCHAR *name)
{
TCHAR tmp[MAX_PATH];
int i = 0;
......@@ -742,7 +744,7 @@ struct romdata *getromdatabycrc (uae_u32 crc32)
return 0;
}
static int cmpsha1 (uae_u8 *s1, struct romdata *rd)
static int cmpsha1 (const uae_u8 *s1, const struct romdata *rd)
{
int i;
......@@ -756,7 +758,7 @@ static int cmpsha1 (uae_u8 *s1, struct romdata *rd)
return 0;
}
static struct romdata *checkromdata (uae_u8 *sha1, int size, uae_u32 mask)
static struct romdata *checkromdata (const uae_u8 *sha1, int size, uae_u32 mask)
{
int i = 0;
while (roms[i].name) {
......@@ -914,7 +916,7 @@ struct romdata *getromdatabyzfile (struct zfile *f)
return rd;
}
void getromname (struct romdata *rd, TCHAR *name)
void getromname (const struct romdata *rd, TCHAR *name)
{
name[0] = 0;
if (!rd)
......@@ -930,7 +932,7 @@ void getromname (struct romdata *rd, TCHAR *name)
_stprintf (name + _tcslen (name), " [%s]", rd->partnumber);
}
struct romlist *getromlistbyromdata (struct romdata *rd)
struct romlist *getromlistbyromdata (const struct romdata *rd)
{
int ids[2];
......@@ -939,7 +941,7 @@ struct romlist *getromlistbyromdata (struct romdata *rd)
return getromlistbyids(ids);
}
struct romlist *getromlistbyids (int *ids)
struct romlist *getromlistbyids (const int *ids)
{
struct romdata *rd;
int i, j;
......@@ -958,7 +960,7 @@ struct romlist *getromlistbyids (int *ids)
return NULL;
}
void romwarning (int *ids)
void romwarning (const int *ids)
{
int i, exp;
TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
......@@ -1029,7 +1031,7 @@ static void mergecd32 (uae_u8 *dst, uae_u8 *src, int size)
#endif
}
static void descramble (struct romdata *rd, uae_u8 *data, int size, int odd)
static void descramble (const struct romdata *rd, uae_u8 *data, int size, int odd)
{
int flags = rd->type;
......@@ -1037,7 +1039,7 @@ static void descramble (struct romdata *rd, uae_u8 *data, int size, int odd)
descramble_nordicpro (data, size, odd);
}
static int read_rom_file (uae_u8 *buf, struct romdata *rd)
static int read_rom_file (uae_u8 *buf, const struct romdata *rd)
{
struct zfile *zf;
struct romlist *rl = romlist_getrl (rd);
......@@ -1300,7 +1302,7 @@ int kickstart_checksum (uae_u8 *mem, int size)
return 1;
}
int configure_rom (struct uae_prefs *p, int *rom, int msg)
int configure_rom (struct uae_prefs *p, const int *rom, int msg)
{
struct romdata *rd;
TCHAR *path = 0;
......
......@@ -199,7 +199,7 @@ uae_u8 restore_u8_func (uae_u8 **dstp)
*dstp = dst + 1;
return v;
}
TCHAR *restore_string_func (const uae_u8 **dstp)
TCHAR *restore_string_func (uae_u8 **dstp)
{
int len;
uae_u8 v;
......@@ -219,7 +219,7 @@ TCHAR *restore_string_func (const uae_u8 **dstp)
#ifdef SAVESTATE
/* read and write IFF-style hunks */
static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, const TCHAR *name, int compress)
static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, TCHAR *name, int compress)
{
uae_u8 tmp[8], *dst;
uae_u8 zero[4]= { 0, 0, 0, 0 };
......@@ -287,7 +287,7 @@ static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, size_t *len, size_t
uae_u8 tmp[6], dummy[4], *mem;
const uae_u8 *src;
uae_u32 flags;
size_t len2;
int len2;
*totallen = 0;
/* chunk name */
......@@ -846,12 +846,12 @@ int save_state (const TCHAR *filename, const TCHAR *description)
xfree (dst);
#endif
#ifdef CDTV
dst = save_dmac (&len);
save_chunk (f, dst, len, "DMAC", 0);
xfree (dst);
dst = save_cdtv (&len);
save_chunk (f, dst, len, "CDTV", 0);
xfree (dst);
dst = save_dmac (&len);
save_chunk (f, dst, len, "DMAC", 0);
xfree (dst);
#endif
#ifdef ACTION_REPLAY
......@@ -888,7 +888,7 @@ int save_state (const TCHAR *filename, const TCHAR *description)
}
#endif
#ifdef CD32
for (i = 0; i < 10; i++) {
for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) {
dst = save_cd (i, &len);
if (dst) {
_stprintf (name, "CDU%d", i);
......@@ -1560,7 +1560,7 @@ ACTION REPLAY
Model (1,2,3) 4
path to rom image
RAM space (depends on model)
ROM CRC 4
ROM CRC 4
"CDx "
......
......@@ -800,7 +800,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
{
int start = io_offset;
int end = io_length + start;
if (!sys_command_cd_play2 (dev->di.unitnum, start, end, 0, NULL))
if (!sys_command_cd_play (dev->di.unitnum, start, end, 0))
io_error = IOERR_BADADDRESS;
}
break;
......@@ -808,7 +808,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
{
int start = msf2lsn (io_offset);
int end = msf2lsn (io_length) + start;
if (!sys_command_cd_play2 (dev->di.unitnum, start, end, 0, NULL))
if (!sys_command_cd_play (dev->di.unitnum, start, end, 0))
io_error = IOERR_BADADDRESS;
}
break;
......@@ -819,7 +819,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
if (sys_command_cd_toc (dev->di.unitnum, &toc)) {
for (i = toc.first_track_offset; i < toc.last_track_offset; i++) {
if (i == io_offset && i + io_length <= toc.last_track_offset) {
ok = sys_command_cd_play2 (dev->di.unitnum, toc.toc[i].address, toc.toc[i + io_length].address, 0, NULL);
ok = sys_command_cd_play (dev->di.unitnum, toc.toc[i].address, toc.toc[i + io_length].address, 0);
break;
}
}
......
......@@ -445,7 +445,7 @@ configure:4344: $? = 0
configure:4344: result: yes
configure:4350: checking for _doprnt
configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccg6gkCX.o: In function `main':
/tmp/cca25XDN.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt'
collect2: ld returned 1 exit status
configure:4350: $? = 1
......@@ -533,7 +533,7 @@ configure:4364: $? = 0
configure:4364: result: yes
configure:4364: checking for strcmpi
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccyGlF54.o: In function `main':
/tmp/ccfgVok2.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi'
collect2: ld returned 1 exit status
configure:4364: $? = 1
......@@ -613,7 +613,7 @@ configure: failed program was:
configure:4364: result: no
configure:4364: checking for stricmp
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/cct8UV89.o: In function `main':
/tmp/ccY0iee7.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp'
collect2: ld returned 1 exit status
configure:4364: $? = 1
......
......@@ -1551,7 +1551,7 @@ int zfile_zopen (const TCHAR *name, zfile_callback zc, void *user)
TCHAR path[MAX_DPATH];
manglefilename (path, name);
l = zfile_fopen_2 (path, L"rb", ZFD_NORMAL);
l = zfile_fopen_2 (path, "rb", ZFD_NORMAL);
if (!l)
return 0;
ztype = iszip (l);
......@@ -1632,7 +1632,7 @@ static struct zfile *zfile_fopen_internet (const TCHAR *name, const TCHAR *mode,
if (!hi) {
hi = InternetOpen (WINUAEAPPNAME, INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY, NULL, NULL, 0);
if (hi == NULL) {
write_log (L"InternetOpen() failed, %d\n", GetLastError ());
write_log ("InternetOpen() failed, %d\n", GetLastError ());
return NULL;
}
}
......@@ -1641,7 +1641,7 @@ static struct zfile *zfile_fopen_internet (const TCHAR *name, const TCHAR *mode,
DWORD err = GetLastError ();
if (err == ERROR_INTERNET_EXTENDED_ERROR)
InternetGetLastResponseInfo (&ierr, tmp, &outbuf);
write_log (L"InternetOpenUrl(%s) failed %d (%d,%s)\n", name, err, ierr, tmp);
write_log ("InternetOpenUrl(%s) failed %d (%d,%s)\n", name, err, ierr, tmp);
goto end;
}
......@@ -1651,11 +1651,11 @@ static struct zfile *zfile_fopen_internet (const TCHAR *name, const TCHAR *mode,
DWORD size = sizeof statuscode;
if (!HttpQueryInfo (i, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &statuscode, &size, &hindex)) {
DWORD err = GetLastError ();
write_log (L"HttpQueryInfo(%s) failed %d\n", name, err);
write_log ("HttpQueryInfo(%s) failed %d\n", name, err);
goto end;
}
if (statuscode != 200) {
write_log (L"HttpQueryInfo(%s)=%d\n", name, statuscode);
write_log ("HttpQueryInfo(%s)=%d\n", name, statuscode);
goto end;
}
}
......@@ -1672,7 +1672,7 @@ static struct zfile *zfile_fopen_internet (const TCHAR *name, const TCHAR *mode,
DWORD err = GetLastError ();
if (err == ERROR_INTERNET_EXTENDED_ERROR)
InternetGetLastResponseInfo (&ierr, tmp, &outbuf);
write_log (L"InternetReadFile(%s) failed %d (%d,%s)\n", name, err, ierr, tmp);
write_log ("InternetReadFile(%s) failed %d (%d,%s)\n", name, err, ierr, tmp);
break;
}
if (didread == 0)
......@@ -1751,9 +1751,9 @@ static struct zfile *zfile_fopenx2 (const TCHAR *name, const TCHAR *mode, int ma
static struct zfile *zfile_fopenx (const TCHAR *name, const TCHAR *mode, int mask, int index)
{
struct zfile *zf;
//write_log (L"zfile_fopen('%s','%s',%08x,%d)\n", name, mode, mask, index);
//write_log ("zfile_fopen('%s','%s',%08x,%d)\n", name, mode, mask, index);
zf = zfile_fopenx2 (name, mode, mask, index);
//write_log (L"=%p\n", zf);
//write_log ("=%p\n", zf);
return zf;
}
......@@ -2700,6 +2700,37 @@ struct znode *zvolume_adddir_abs (struct zvolume *zv, struct zarchive_info *zai)
return znode_adddir (zn2, p, zai);
}
struct znode *zvolume_addfile_abs (struct zvolume *zv, struct zarchive_info *zai)
{
struct znode *zn, *zn2;
int i;
TCHAR *path = my_strdup (zai->name);
TCHAR *p, *p2;
zn2 = &zv->root;
p = p2 = path;
for (i = 0; path[i]; i++) {
if (path[i] == '/' || path[i] == '\\') {
path[i] = 0;
zn2 = znode_adddir (zn2, p, zai);
path[i] = FSDB_DIR_SEPARATOR;
p = p2 = &path[i + 1];
}
}
if (p2) {
zn = znode_alloc_child (zn2, p2);
zn->size = zai->size;
zn->type = ZNODE_FILE;
zn->mtime = zai->t;
if (zai->comment)
zn->comment = my_strdup (zai->comment);
zn->flags = zai->flags;
addvolumesize (zn->volume, zai->size);
}
xfree (path);
return zn;
}
void zfile_fclose_archive (struct zvolume *zv)
{
struct znode *zn;
......@@ -2737,6 +2768,17 @@ void zfile_fclose_archive (struct zvolume *zv)
xfree (zv);
}
struct zdirectory {
TCHAR *parentpath;
struct znode *first;
struct znode *n;
bool doclose;
struct zvolume *zv;
int cnt;
int offset;
TCHAR **filenames;
};
#ifdef _CONSOLE
static TCHAR *zerror;
#define WRITE_LOG_BUF_SIZE 4096
......
This diff is collapsed.
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