setIrq();
}
- memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
+ if (cdr.SetlocPending) {
+ memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
+ cdr.SetlocPending = 0;
+ }
Find_CurTrack(cdr.SetSectorPlay);
ReadTrack(cdr.SetSectorPlay);
cdr.TrackChanged = FALSE;
case CdlSetloc:
break;
+ do_CdlPlay:
case CdlPlay:
StopCdda();
if (cdr.Seeked == SEEK_PENDING) {
// XXX: wrong, should seek instead..
- memcpy( cdr.SetSectorPlay, cdr.SetSector, 4 );
cdr.Seeked = SEEK_DONE;
}
+ if (cdr.SetlocPending) {
+ memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
+ cdr.SetlocPending = 0;
+ }
// BIOS CD Player
// - Pause player, hit Track 01/02/../xx (Setloc issued!!)
case CdlReadN:
case CdlReadS:
+ if (cdr.SetlocPending) {
+ memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
+ cdr.SetlocPending = 0;
+ }
+ Find_CurTrack(cdr.SetSectorPlay);
+
+ if ((cdr.Mode & MODE_CDDA) && cdr.CurTrack > 1)
+ // Read* acts as play for cdda tracks in cdda mode
+ goto do_CdlPlay;
+
cdr.Reading = 1;
cdr.FirstSector = 1;
// Fighting Force 2 - update subq time immediately
// - fixes new game
- Find_CurTrack(cdr.SetSector);
- ReadTrack(cdr.SetSector);
+ ReadTrack(cdr.SetSectorPlay);
// Crusaders of Might and Magic - update getlocl now
cdr.Result[0] = cdr.StatP;
cdr.Seeked = SEEK_DONE;
- ReadTrack(cdr.SetSector);
+ ReadTrack(cdr.SetSectorPlay);
buf = CDR_getBuffer();
if (buf == NULL)
}
}
- cdr.SetSector[2]++;
- if (cdr.SetSector[2] == 75) {
- cdr.SetSector[2] = 0;
- cdr.SetSector[1]++;
- if (cdr.SetSector[1] == 60) {
- cdr.SetSector[1] = 0;
- cdr.SetSector[0]++;
+ cdr.SetSectorPlay[2]++;
+ if (cdr.SetSectorPlay[2] == 75) {
+ cdr.SetSectorPlay[2] = 0;
+ cdr.SetSectorPlay[1]++;
+ if (cdr.SetSectorPlay[1] == 60) {
+ cdr.SetSectorPlay[1] = 0;
+ cdr.SetSectorPlay[0]++;
}
}
}
// update for CdlGetlocP
- ReadTrack(cdr.SetSector);
+ ReadTrack(cdr.SetSectorPlay);
}
/*
for (i = 0; i < 3; i++)
set_loc[i] = btoi(cdr.Param[i]);
- // FIXME: clean up this SetSector/SetSectorPlay mess,
- // there should be single var tracking current sector pos
- if (cdr.Play)
- i = msf2sec(cdr.SetSectorPlay);
- else
- i = msf2sec(cdr.SetSector);
+ i = msf2sec(cdr.SetSectorPlay);
i = abs(i - msf2sec(set_loc));
if (i > 16)
cdr.Seeked = SEEK_PENDING;
memcpy(cdr.SetSector, set_loc, 3);
cdr.SetSector[3] = 0;
+ cdr.SetlocPending = 1;
break;
case CdlReadN:
if (Mode == 0 && !Config.Cdda)
CDR_stop();
- cdr.freeze_ver = 0x63647201;
+ cdr.freeze_ver = 0x63647202;
gzfreeze(&cdr, sizeof(cdr));
if (Mode == 1) {
ReadTrack(tmpp);
if (cdr.Play) {
+ if (cdr.freeze_ver < 0x63647202)
+ memcpy(cdr.SetSectorPlay, cdr.SetSector, 3);
+
Find_CurTrack(cdr.SetSectorPlay);
if (!Config.Cdda)
CDR_play(cdr.SetSectorPlay);