MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / cdvdReset

Function cdvdReset

pcsx2/CDVD/CDVD.cpp:915–1032  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

913}
914
915void cdvdReset()
916{
917 std::memset(&cdvd, 0, sizeof(cdvd));
918
919 cdvd.DiscType = CDVD_TYPE_NODISC;
920 cdvd.Spinning = false;
921
922 cdvd.sDataIn = 0x40;
923 cdvdUpdateReady(CDVD_DRIVE_READY);
924 cdvdUpdateStatus(CDVD_STATUS_TRAY_OPEN);
925 cdvd.Speed = 4;
926 cdvd.BlockSize = 2064;
927 cdvd.Action = cdvdAction_None;
928 cdvd.ReadTime = cdvdBlockReadTime(MODE_DVDROM);
929 cdvd.RotSpeed = cdvdRotationTime(MODE_DVDROM);
930
931 ReadOSDConfigParames();
932
933 // Print time zone offset, DST, time format, date format, and system time basis.
934 DevCon.WriteLn(Color_StrongGreen, configParams1.timezoneOffset < 0 ? "Time Zone Offset: GMT%03d:%02d" : "Time Zone Offset: GMT+%02d:%02d",
935 configParams1.timezoneOffset / 60, std::abs(configParams1.timezoneOffset % 60));
936
937 // Time zone ID has exactly 128 possible values.
938 if (configParams1.timeZoneID < 0x80)
939 {
940 // Cutoff for the old naming scheme (TimeZoneLocations[][0]) is v01.70 inclusive.
941 const bool new_time_zone_ID_names = ((BiosVersion >> 8) == 2) || ((BiosVersion & 0xFF) >= 90);
942 DevCon.WriteLn(Color_StrongGreen, "Time Zone Location: %s",
943 TimeZoneLocations[configParams1.timeZoneID][new_time_zone_ID_names]);
944 }
945 else
946 {
947 DevCon.WriteLn(Color_StrongRed, "Invalid time zone configuration in BIOS (ID: %d)", configParams1.timeZoneID);
948 }
949
950 DevCon.WriteLn(Color_StrongGreen, "DST: %s Time", configParams2.daylightSavings ? "Summer" : "Winter");
951 DevCon.WriteLn(Color_StrongGreen, "Time Format: %s-Hour", configParams2.timeFormat ? "12" : "24");
952 DevCon.WriteLn(Color_StrongGreen, "Date Format: %s", configParams2.dateFormat ? (configParams2.dateFormat == 2 ? "DD/MM/YYYY" : "MM/DD/YYYY") : "YYYY/MM/DD");
953 DevCon.WriteLn(Color_StrongGreen, "System Time Basis: %s",
954 EmuConfig.ManuallySetRealTimeClock ? "Manual RTC" : g_InputRecording.isActive() ? "Default Input Recording Time" : "Operating System Time");
955
956 std::tm input_tm{};
957 std::tm resulting_tm{};
958
959 const int bios_settings_offset_seconds = 60 * (configParams1.timezoneOffset + configParams2.daylightSavings * 60);
960
961 // CDVD internally uses GMT+9, 1-indexed months, and year offset of 2000 instead of 1900.
962 // tm struct uses 0-indexed months and year offset of 1900.
963 if (EmuConfig.ManuallySetRealTimeClock)
964 {
965 resulting_tm.tm_sec = EmuConfig.RtcSecond;
966 resulting_tm.tm_min = EmuConfig.RtcMinute;
967 resulting_tm.tm_hour = EmuConfig.RtcHour;
968 resulting_tm.tm_mday = EmuConfig.RtcDay;
969 resulting_tm.tm_mon = EmuConfig.RtcMonth - 1;
970 resulting_tm.tm_year = EmuConfig.RtcYear + 100;
971 resulting_tm.tm_isdst = 0;
972

Callers 1

psxHwResetFunction · 0.85

Calls 11

cdvdUpdateReadyFunction · 0.85
cdvdUpdateStatusFunction · 0.85
cdvdBlockReadTimeFunction · 0.85
cdvdRotationTimeFunction · 0.85
ReadOSDConfigParamesFunction · 0.85
gmtime_sFunction · 0.85
gmtime_rFunction · 0.85
cdvdCtrlTrayCloseFunction · 0.85
isActiveMethod · 0.80
absFunction · 0.50
WriteLnMethod · 0.45

Tested by

no test coverage detected