Merge pull request #216 from srg320/master

pcecd: implement undefined commands (Steam-Heart's) and cdda pause state, cleanup
This commit is contained in:
Alexey Melnikov
2020-05-07 20:54:55 +08:00
committed by GitHub

View File

@@ -16,7 +16,7 @@ float get_cd_seek_ms(int start_sector, int target_sector);
pcecdd_t pcecdd;
pcecdd_t::pcecdd_t() {
latency = 10;
latency = 0;
loaded = 0;
index = 0;
lba = 0;
@@ -284,7 +284,7 @@ void pcecdd_t::Unload()
}
void pcecdd_t::Reset() {
latency = 10;
latency = 0;
index = 0;
lba = 0;
scanOffset = 0;
@@ -410,8 +410,19 @@ void pcecdd_t::Update() {
else {
this->state = PCECD_STATE_IDLE;
}
}
if (this->CDDAMode == PCECD_CDDAMODE_INTERRUPT) {
PendStatus(PCECD_STATUS_GOOD, 0);
}
}
}
else if (this->state == PCECD_STATE_PAUSE)
{
if (this->latency > 0)
{
this->latency--;
return;
}
}
}
@@ -515,10 +526,10 @@ void pcecdd_t::CommandExec() {
int index = GetTrackByLBA(new_lba, &this->toc);
this->index = index;
if (new_lba < this->toc.tracks[index].start)
/*if (new_lba < this->toc.tracks[index].start)
{
new_lba = this->toc.tracks[index].start;
}
}*/
this->latency = (int)(get_cd_seek_ms(this->lba, new_lba)/13.33);
printf("seek time ticks: %d\n", this->latency);
@@ -534,8 +545,6 @@ void pcecdd_t::CommandExec() {
this->audioOffset = 0;
//if (this->toc.sub) fseek(this->toc.sub, lba_ * 96, SEEK_SET);
this->can_read_next = true;
this->state = PCECD_STATE_READ;
@@ -636,7 +645,7 @@ void pcecdd_t::CommandExec() {
int track = U8(comm[2]);
if (!track) track = 1;
new_lba = (track >= toc.last) ? this->toc.end : (this->toc.tracks[track - 1].start + 150);
new_lba = (track >= toc.last) ? this->toc.end : (this->toc.tracks[track - 1].start);
}
break;
}
@@ -648,7 +657,9 @@ void pcecdd_t::CommandExec() {
this->state = PCECD_STATE_PLAY;
}
PendStatus(PCECD_STATUS_GOOD, 0);
if (this->CDDAMode != PCECD_CDDAMODE_INTERRUPT) {
PendStatus(PCECD_STATUS_GOOD, 0);
}
}
printf("\x1b[32mPCECD: Command SAPEP, end = %i, [1] = %02X, [2] = %02X, [9] = %02X\n\x1b[0m", this->CDDAEnd, comm[1], comm[2], comm[9]);
break;
@@ -691,7 +702,8 @@ void pcecdd_t::CommandExec() {
break;
default:
//stat[0] = this->status;
CommandError(SENSEKEY_ILLEGAL_REQUEST, NSE_INVALID_COMMAND, 0, 0);
PendStatus(PCECD_STATUS_CHECK_COND, 0);
printf("\x1b[32mPCECD: Command undefined, [0] = %02X, [1] = %02X, [2] = %02X, [3] = %02X, [4] = %02X, [5] = %02X\n\x1b[0m", comm[0], comm[1], comm[2], comm[3], comm[4], comm[5]);
break;