pcecd: implement undefined commands (Steam-Heart's) and cdda pause state, cleanup

This commit is contained in:
Sergey Dvodnenko
2020-05-07 13:39:34 +03:00
parent dfc87dedfd
commit 194e355c78

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;
@@ -411,7 +411,14 @@ void pcecdd_t::Update() {
this->state = PCECD_STATE_IDLE;
}
}
}
else if (this->state == PCECD_STATE_PAUSE)
{
if (this->latency > 0)
{
this->latency--;
return;
}
}
}
@@ -515,10 +522,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 +541,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;
@@ -691,7 +696,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;