mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-25 18:29:49 +00:00
viacuda: Fix get/set time and one sec modes.
The first packet the one sec mode should send is a mode 1 real time packet, same as GET_REAL_TIME. A mode 2 packet is the same but doesn't include the time.
This commit is contained in:
parent
2b76d8a53a
commit
a22bc34816
@ -95,7 +95,7 @@ ViaCuda::ViaCuda() {
|
|||||||
.tm_mday = 1,
|
.tm_mday = 1,
|
||||||
.tm_mon = 1 - 1,
|
.tm_mon = 1 - 1,
|
||||||
.tm_year = 1904 - 1900,
|
.tm_year = 1904 - 1900,
|
||||||
.tm_isdst = -1 // Use DST value from local time zone
|
.tm_isdst = 1 // -1 = Use DST value from local time zone; 0 = not summer; 1 = is summer time
|
||||||
};
|
};
|
||||||
mac_epoch = std::chrono::system_clock::from_time_t(std::mktime(&tm));
|
mac_epoch = std::chrono::system_clock::from_time_t(std::mktime(&tm));
|
||||||
}
|
}
|
||||||
@ -540,24 +540,24 @@ void ViaCuda::autopoll_handler() {
|
|||||||
|
|
||||||
// draw guest system's attention
|
// draw guest system's attention
|
||||||
schedule_sr_int(USECS_TO_NSECS(30));
|
schedule_sr_int(USECS_TO_NSECS(30));
|
||||||
} else if (this->one_sec_mode == 3) {
|
} else if (this->one_sec_mode != 0) {
|
||||||
uint32_t this_time = calc_real_time();
|
uint32_t this_time = calc_real_time();
|
||||||
if (this_time != this->last_time) {
|
if (this_time != this->last_time) {
|
||||||
|
/*
|
||||||
if ((this->last_time & 15) == 0) {
|
We'll send a time packet every 4
|
||||||
/*
|
seconds just in case we get out of
|
||||||
FIXME: This doesn't do anything in Mac OS 8.6.
|
sync.
|
||||||
A real Mac probably doesn't do this. So why do I?
|
*/
|
||||||
supermario checks for packets that are not PKT_TICK
|
bool send_time = !(this->last_time & 3);
|
||||||
to set the time but I don't know which Mac OS versions
|
if (send_time || this->one_sec_mode < 3) {
|
||||||
have that code and if that code is triggered by this.
|
response_header(CUDA_PKT_PSEUDO, 0);
|
||||||
*/
|
this->out_buf[2] = CUDA_GET_REAL_TIME;
|
||||||
response_header(9, 0);
|
if (send_time || this->one_sec_mode == 1) {
|
||||||
this->out_buf[3] = CUDA_GET_REAL_TIME;
|
uint32_t real_time = this_time + this->time_offset;
|
||||||
uint32_t real_time = this_time + time_offset;
|
WRITE_DWORD_BE_U(&this->out_buf[3], real_time);
|
||||||
WRITE_DWORD_BE_U(&this->out_buf[3], real_time);
|
this->out_count = 7;
|
||||||
this->out_count = 7;
|
}
|
||||||
} else {
|
} else if (this->one_sec_mode == 3) {
|
||||||
response_header(CUDA_PKT_TICK, 0);
|
response_header(CUDA_PKT_TICK, 0);
|
||||||
this->out_count = 1;
|
this->out_count = 1;
|
||||||
}
|
}
|
||||||
@ -610,7 +610,7 @@ void ViaCuda::pseudo_command() {
|
|||||||
case CUDA_GET_REAL_TIME: {
|
case CUDA_GET_REAL_TIME: {
|
||||||
response_header(CUDA_PKT_PSEUDO, 0);
|
response_header(CUDA_PKT_PSEUDO, 0);
|
||||||
uint32_t this_time = this->calc_real_time();
|
uint32_t this_time = this->calc_real_time();
|
||||||
uint32_t real_time = this_time + time_offset;
|
uint32_t real_time = this_time + this->time_offset;
|
||||||
WRITE_DWORD_BE_U(&this->out_buf[3], real_time);
|
WRITE_DWORD_BE_U(&this->out_buf[3], real_time);
|
||||||
this->out_count = 7;
|
this->out_count = 7;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user