1290
static int32 CalcSeekTime(int32 initial, int32 target, bool motor_on, bool paused)
1295
int32 PS_CDC::CalcSeekTime(int32 initial, int32 target, bool motor_on, bool paused)
1302
1307
if(abs(initial - target) >= 2250)
1303
1308
ret += (int64)33868800 * 300 / 1000;
1304
1309
else if(paused)
1305
ret += (int64)33868800 * 150 / 1000;
1311
// The delay to restart from a Pause state is...very....WEIRD. The time it takes is related to the amount of time that has passed since the pause, and
1312
// where on the disc the laser head is, with generally more time passed = longer to resume, except that there's a window of time where it takes a
1313
// ridiculous amount of time when not much time has passed.
1315
// What we have here will be EXTREMELY simplified.
1320
//if(time_passed >= 67737)
1325
// Take twice as long for 1x mode.
1326
ret += 1247952 * ((Mode & MODE_SPEED) ? 1 : 2);
1307
1330
printf("%d\n", ret);
1371
1394
printf("[CDC] Play track: %d\n", track);
1372
1395
SeekTarget = toc.tracks[track].lba;
1373
1396
PSRCounter = CalcSeekTime(CurSector, SeekTarget, DriveStatus != DS_STOPPED, DriveStatus == DS_PAUSED);
1397
HeaderBufValid = false;
1374
1398
PreSeekHack(SeekTarget);
1376
1400
DriveStatus = DS_SEEKING;
1381
if(CommandLoc_Dirty || (DriveStatus != DS_PLAYING && DriveStatus != DS_PAUSED))
1405
if(CommandLoc_Dirty || (DriveStatus != DS_PLAYING && DriveStatus != DS_PAUSED && DriveStatus != DS_STANDBY))
1383
1407
ClearAudioBuffers();
1384
1408
SeekTarget = CommandLoc;
1385
1409
PlayTrackMatch = -1;
1387
1411
PSRCounter = CalcSeekTime(CurSector, SeekTarget, DriveStatus != DS_STOPPED, DriveStatus == DS_PAUSED);
1412
HeaderBufValid = false;
1388
1413
PreSeekHack(SeekTarget);
1390
1415
DriveStatus = DS_SEEKING;
1529
// TODO: Pause speed depends on speed(1x/2x) and current position. Also check restart(for ReadN/ReadS and Play) 'delay'.
1548
int32 PS_CDC::Command_Standby(const int arg_count, const uint8 *args)
1550
if(!CommandCheckDiscPresent())
1553
if(DriveStatus != DS_STOPPED)
1555
WriteResult(MakeStatus(true));
1557
WriteIRQ(CDCIRQ_DISC_ERROR);
1561
WriteResult(MakeStatus());
1562
WriteIRQ(CDCIRQ_ACKNOWLEDGE);
1564
ClearAudioBuffers();
1566
DriveStatus = DS_STANDBY;
1568
return((int64)33868800 * 100 / 1000); // No idea, FIXME.
1571
int32 PS_CDC::Command_Standby_Part2(void)
1575
WriteResult(MakeStatus());
1576
WriteIRQ(CDCIRQ_COMPLETE);
1530
1581
int32 PS_CDC::Command_Pause(const int arg_count, const uint8 *args)
1532
1583
if(!CommandCheckDiscPresent())
1750
1803
SeekTarget = CommandLoc;
1752
PSRCounter = CalcSeekTime(CurSector, SeekTarget, DriveStatus != DS_STOPPED, false); //DriveStatus == DS_PAUSED);
1805
PSRCounter = CalcSeekTime(CurSector, SeekTarget, DriveStatus != DS_STOPPED, DriveStatus == DS_PAUSED);
1806
HeaderBufValid = false;
1753
1807
PreSeekHack(SeekTarget);
1754
1808
DriveStatus = DS_SEEKING_LOGICAL;
1755
StatusAfterSeek = DS_PAUSED;
1809
StatusAfterSeek = DS_STANDBY;
1758
1812
return(PSRCounter);
1769
1823
SeekTarget = CommandLoc;
1771
PSRCounter = CalcSeekTime(CurSector, SeekTarget, DriveStatus != DS_STOPPED, false); //DriveStatus == DS_PAUSED);
1825
PSRCounter = CalcSeekTime(CurSector, SeekTarget, DriveStatus != DS_STOPPED, DriveStatus == DS_PAUSED);
1826
HeaderBufValid = false;
1772
1827
PreSeekHack(SeekTarget);
1773
1828
DriveStatus = DS_SEEKING;
1774
StatusAfterSeek = DS_PAUSED;
1829
StatusAfterSeek = DS_STANDBY;
1777
1832
return(PSRCounter);
2017
2074
{ /* 0x04, */ 0, 0, "Forward", &PS_CDC::Command_Forward, NULL },
2018
2075
{ /* 0x05, */ 0, 0, "Backward", &PS_CDC::Command_Backward, NULL },
2019
2076
{ /* 0x06, */ 0, 0, "ReadN", &PS_CDC::Command_ReadN, NULL },
2020
{ /* 0x07, */ 0, 0, "Standby", &PS_CDC::Command_Pause, &PS_CDC::Command_Pause_Part2 },
2077
{ /* 0x07, */ 0, 0, "Standby", &PS_CDC::Command_Standby, &PS_CDC::Command_Standby_Part2 },
2021
2078
{ /* 0x08, */ 0, 0, "Stop", &PS_CDC::Command_Stop, &PS_CDC::Command_Stop_Part2 },
2022
2079
{ /* 0x09, */ 0, 0, "Pause", &PS_CDC::Command_Pause, &PS_CDC::Command_Pause_Part2 },
2023
2080
{ /* 0x0A, */ 0, 0, "Reset", &PS_CDC::Command_Reset, NULL },