From 539aa862316c41cc44a71f4f8545df72c8db4947 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Mon, 21 Dec 2009 23:42:14 +0000 Subject: [PATCH] core: - fix bug in RTC; --- desmume/src/rtc.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/desmume/src/rtc.cpp b/desmume/src/rtc.cpp index 3dfd91907..45ba2d59c 100644 --- a/desmume/src/rtc.cpp +++ b/desmume/src/rtc.cpp @@ -172,7 +172,8 @@ static void rtcRecv() rtc.data[0]=toBCD(movie.year); rtc.data[1]=toBCD(movie.month); rtc.data[2]=toBCD(movie.monthday); - rtc.data[3]=(movie.weekday + 6) & 7; + rtc.data[3]=(movie.weekday + 7) & 7; + if (rtc.data[3] == 7) rtc.data[3] = 0; if (!(rtc.regStatus1 & 0x02)) movie.hour %= 12; rtc.data[4] = ((movie.hour < 12) ? 0x00 : 0x40) | toBCD(movie.hour); rtc.data[5]=toBCD(movie.minute); @@ -184,13 +185,15 @@ static void rtcRecv() rtc.data[0] = toBCD(tm_local->tm_year); rtc.data[1] = toBCD(tm_local->tm_mon); rtc.data[2] = toBCD(tm_local->tm_mday); - rtc.data[3] = (tm_local->tm_wday + 6) & 7; + rtc.data[3] = (tm_local->tm_wday + 7) & 7; + if (rtc.data[3] == 7) rtc.data[3] = 0; if (!(rtc.regStatus1 & 0x02)) tm_local->tm_hour %= 12; rtc.data[4] = ((tm_local->tm_hour < 12) ? 0x00 : 0x40) | toBCD(tm_local->tm_hour); rtc.data[5] = toBCD(tm_local->tm_min); rtc.data[6] = toBCD(tm_local->tm_sec); break; } + break; } case 3: // time { @@ -207,6 +210,7 @@ static void rtcRecv() rtc.data[0] = ((movie.hour < 12) ? 0x00 : 0x40) | toBCD(movie.hour); rtc.data[1] = toBCD(movie.minute); rtc.data[2] = toBCD(movie.sec); + break; } else { @@ -216,6 +220,7 @@ static void rtcRecv() rtc.data[2] = toBCD(tm_local->tm_sec); break; } + break; } case 4: // freq/alarm 1 /*if (cmdBitsSize[0x04] == 8)