From 94bd268a51c14f030d1324af5e55ba85d2784ed8 Mon Sep 17 00:00:00 2001 From: TheTechnician27 Date: Sun, 19 Oct 2025 01:21:24 -0500 Subject: [PATCH] Emulog: Print user-selected BIOS time zone --- pcsx2/CDVD/CDVD.cpp | 14 ++++ pcsx2/ps2/BiosTools.cpp | 3 +- pcsx2/ps2/BiosTools.h | 140 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 155 insertions(+), 2 deletions(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 90490e575e..0c5ff56f02 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -927,6 +927,20 @@ void cdvdReset() // Print time zone offset, DST, time format, date format, and system time basis. DevCon.WriteLn(Color_StrongGreen, configParams1.timezoneOffset < 0 ? "Time Zone Offset: GMT%03d:%02d" : "Time Zone Offset: GMT+%02d:%02d", configParams1.timezoneOffset / 60, std::abs(configParams1.timezoneOffset % 60)); + + // Time zone ID has exactly 128 possible values. + if (configParams1.timeZoneID < 0x80) + { + // Cutoff for the old naming scheme (TimeZoneLocations[][0]) is v01.70 inclusive. + const bool new_time_zone_ID_names = ((BiosVersion >> 8) == 2) || ((BiosVersion & 0xFF) >= 90); + DevCon.WriteLn(Color_StrongGreen, "Time Zone Location: %s", + TimeZoneLocations[configParams1.timeZoneID][new_time_zone_ID_names]); + } + else + { + DevCon.WriteLn(Color_StrongRed, "Invalid time zone configuration in BIOS (ID: %d)", configParams1.timeZoneID); + } + DevCon.WriteLn(Color_StrongGreen, "DST: %s Time", configParams2.daylightSavings ? "Summer" : "Winter"); DevCon.WriteLn(Color_StrongGreen, "Time Format: %s-Hour", configParams2.timeFormat ? "12" : "24"); DevCon.WriteLn(Color_StrongGreen, "Date Format: %s", configParams2.dateFormat ? (configParams2.dateFormat == 2 ? "DD/MM/YYYY" : "MM/DD/YYYY") : "YYYY/MM/DD"); diff --git a/pcsx2/ps2/BiosTools.cpp b/pcsx2/ps2/BiosTools.cpp index a77bf94242..61a018f79c 100644 --- a/pcsx2/ps2/BiosTools.cpp +++ b/pcsx2/ps2/BiosTools.cpp @@ -65,7 +65,8 @@ void ReadOSDConfigParames() configParams1.version = (params[2] & 0xE0) >> 5; // OSD Ver (Not sure but best guess). configParams1.language = params[2] & 0x1F; // Language. configParams1.timezoneOffset = params[4] | ((u32)(params[3] & 0x7) << 8); // Timezone offset in minutes. - + configParams1.timeZoneID = params[6]; // ID for time zone selection + // Region settings for time/date and extended language configParams2.UC[1] = ((u32)params[3] & 0x78) << 1; // Daylight Savings, 24hr clock, Date format configParams2.daylightSavings = configParams2.UC[1] & 0x10 ? 1 : 0; diff --git a/pcsx2/ps2/BiosTools.h b/pcsx2/ps2/BiosTools.h index a738b64c10..456d5c8267 100644 --- a/pcsx2/ps2/BiosTools.h +++ b/pcsx2/ps2/BiosTools.h @@ -44,6 +44,8 @@ typedef struct /*16*/ u32 language : 5; /** timezone minutes offset from gmt */ /*21*/ s32 timezoneOffset : 11; + /** timezone location ID */ + /*32*/ u8 timeZoneID : 7; }; u8 UC[4]; @@ -85,7 +87,7 @@ typedef struct // TODO: namespace this extern BiosDebugInformation CurrentBiosInformation; -extern u32 BiosVersion; // Used by CDVD +extern u32 BiosVersion; // Used by CDVD; third octet is major version, fourth is minor version. extern u32 BiosRegion; // Used by CDVD extern bool NoOSD; // Used for HLE OSD Config Params extern ConfigParam configParams1; @@ -117,3 +119,139 @@ extern bool IsBIOSAvailable(const std::string& full_path); extern bool LoadBIOS(); extern void CopyBIOSToMemory(); + +// Values in [][0] are the names on BIOSes v1.70 and below. +// Values in [][1] are the names on BIOSes v1.90 and above. +// ID 127 ("Seoul" in v01.90 and above) appears to have no corresponding value ("South Korea") on v01.70 and below. +// clang-format off +constexpr const char* TimeZoneLocations[128][2] = { + {"Afghanistan", "Kabul"}, // [0] + {"Albania", "Tirana"}, // [1] + {"Algeria", "Algiers"}, // [2] + {"Andorra", "Andorra la Vella"}, // [3] + {"Armenia", "Yerevan"}, // [4] + {"Australia – Perth", "Perth"}, // [5] + {"Australia – Adelaide", "Adelaide"}, // [6] + {"Australia – Sydney", "Sydney"}, // [7] + {"Australia – Lord Howe Island", "Lord Howe Island"}, // [8] + {"Austria", "Vienna"}, // [9] + {"Azerbaijan", "Baku"}, // [10] + {"Bahrain", "Manama"}, // [11] + {"Bangladesh", "Dhaka"}, // [12] + {"Belarus", "Minsk"}, // [13] + {"Belgium", "Brussels"}, // [14] + {"Bosnia and Herzegovina", "Sarajevo"}, // [15] + {"Bulgaria", "Sofia"}, // [16] + {"Canada – Pacific, Yukon", "Pacific (Canada)"}, // [17] + {"Canada – Mountain", "Mountain (Canada)"}, // [18] + {"Canada – Central", "Central (Canada)"}, // [19] + {"Canada – Eastern", "Eastern (Canada)"}, // [20] + {"Canada – Atlantic", "Atlantic (Canada)"}, // [21] + {"Canada – Newfoundland", "Newfoundland"}, // [22] + {"Cape Verde", "Praia"}, // [23] + {"Chile – Santiago", "Santiago"}, // [24] + {"Chile – Easter Island", "Easter Island"}, // [25] + {"China", "Beijing"}, // [26] + {"Croatia", "Zagreb"}, // [27] + {"Cyprus", "Nicosia"}, // [28] + {"Czech Republic", "Prague"}, // [29] + {"Denmark", "Copenhagen"}, // [30] + {"Egypt", "Cairo"}, // [31] + {"Estonia", "Tallinn"}, // [32] + {"Fiji", "Suva"}, // [33] + {"Finland", "Helsinki"}, // [34] + {"France", "Paris"}, // [35] + {"Georgia", "Tbilisi"}, // [36] + {"Germany", "Berlin"}, // [37] + {"Gibraltar", "Gibraltar"}, // [38] + {"Greece", "Athens"}, // [39] + {"Greenland – Pituffik", "Northwestern Greenland"}, // [40] + {"Greenland – Greenland", "Southwestern Greenland"}, // [41] + {"Greenland – Ittoqqortoormiit", "Eastern Greenland"}, // [42] + {"Hungary", "Budapest"}, // [43] + {"Iceland", "Reykjavik"}, // [44] + {"India", "Calcutta"}, // [45] + {"Iran", "Tehran"}, // [46] + {"Iraq", "Baghdad"}, // [47] + {"Ireland", "Dublin"}, // [48] + {"Israel", "Jerusalem"}, // [49] + {"Italy", "Rome"}, // [50] + {"Japan", "Tokyo"}, // [51] + {"Jordan", "Amman"}, // [52] + {"Kazakhstan – Western", "Western Kazakhstan"}, // [53] + {"Kazakhstan – Central", "Central Kazakhstan"}, // [54] + {"Kazakhstan – Eastern", "Eastern Kazakhstan"}, // [55] + {"Kuwait", "Kuwait City"}, // [56] + {"Kyrgyzstan", "Bishkek"}, // [57] + {"Latvia", "Riga"}, // [58] + {"Lebanon", "Beirut"}, // [59] + {"Liechtenstein", "Vaduz"}, // [60] + {"Lithuania", "Vilnius"}, // [61] + {"Luxembourg", "Luxembourg"}, // [62] + {"Macedonia", "Skopje"}, // [63] + {"Malta", "Valletta"}, // [64] + {"Mexico – Tijuana", "Tijuana"}, // [65] + {"Mexico – Chihuahua", "Chihuahua"}, // [66] + {"Mexico – Mexico City", "Mexico City"}, // [67] + {"Midway Islands", "Midway Islands"}, // [68] + {"Monaco", "Monaco"}, // [69] + {"Morocco", "Casablanca"}, // [70] + {"Namibia", "Windhoek"}, // [71] + {"Nepal", "Kathmandu"}, // [72] + {"Netherlands", "Amsterdam"}, // [73] + {"New Caledonia", "New Caledonia"}, // [74] + {"New Zealand", "Wellington"}, // [75] + {"Norway", "Oslo"}, // [76] + {"Oman", "Muscat"}, // [77] + {"Pakistan", "Karachi"}, // [78] + {"Panama", "Panama City"}, // [79] + {"Poland", "Warsaw"}, // [80] + {"Portugal – Azores", "Azores"}, // [81] + {"Portugal – Lisbon", "Lisbon"}, // [82] + {"Puerto Rico", "Puerto Rico"}, // [83] + {"Reunion", "Reunion"}, // [84] + {"Romania", "Bucharest"}, // [85] + {"Russian Federation – Kaliningrad", "Kaliningrad"}, // [86] + {"Russian Federation – Moscow", "Moscow"}, // [87] + {"Russian Federation – Izhevsk", "Izhevsk"}, // [88] + {"Russian Federation – Perm", "Perm"}, // [89] + {"Russian Federation – Omsk", "Omsk"}, // [90] + {"Russian Federation – Norilsk", "Norilsk"}, // [91] + {"Russian Federation – Bratsk", "Bratsk"}, // [92] + {"Russian Federation – Yakutsk", "Yakutsk"}, // [93] + {"Russian Federation – Vladivostok", "Vladivostok"}, // [94] + {"Russian Federation – Magadan", "Magadan"}, // [95] + {"Russian Federation – Petropavlovsk-Kamchatsky", "Petropavlovsk-Kamchatsky"}, // [96] + {"Samoa", "Samoa Islands"}, // [97] + {"San Marino", "San Marino"}, // [98] + {"Saudi Arabia", "Riyadh"}, // [99] + {"Slovakia", "Bratislava"}, // [100] + {"Slovenia", "Ljubljana"}, // [101] + {"South Africa", "Johannesburg"}, // [102] + {"Spain – Canary Islands", "Canary Islands"}, // [103] + {"Spain – Madrid", "Madrid"}, // [104] + {"Sweden", "Stockholm"}, // [105] + {"Switzerland", "Bern"}, // [106] + {"Syria", "Damascus"}, // [107] + {"Tunisia", "Tunis"}, // [108] + {"Turkey", "Istanbul"}, // [109] + {"Ukraine", "Kiev"}, // [110] + {"United Arab Emirates", "Abu Dhabi"}, // [111] + {"United Kingdom", "London"}, // [112] + {"United States – Hawaii", "Hawaii"}, // [113] + {"United States – Alaska", "Alaska"}, // [114] + {"United States – Pacific", "Pacific (USA)"}, // [115] + {"United States – Mountain", "Mountain (USA)"}, // [116] + {"United States – Central", "Central (USA)"}, // [117] + {"United States – Eastern", "Eastern (USA)"}, // [118] + {"Uzbekistan", "Tashkent"}, // [119] + {"Venezuela", "Caracas"}, // [120] + {"Yugoslavia", "Belgrade"}, // [121] + {"Thailand", "Bangkok"}, // [122] + {"Hong Kong", "Hong Kong"}, // [123] + {"Malaysia", "Kuala Lumpur"}, // [124] + {"Singapore", "Singapore"}, // [125] + {"Taiwan", "Taipei"}, // [126] + {"South Korea", "Seoul"}, // [127] +}; +// clang-format on