Emulog: Print user-selected BIOS time zone

This commit is contained in:
TheTechnician27 2025-10-19 01:21:24 -05:00 committed by Ty
parent 746174d73d
commit 94bd268a51
3 changed files with 155 additions and 2 deletions

View File

@ -927,6 +927,20 @@ void cdvdReset()
// Print time zone offset, DST, time format, date format, and system time basis. // 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", 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)); 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, "DST: %s Time", configParams2.daylightSavings ? "Summer" : "Winter");
DevCon.WriteLn(Color_StrongGreen, "Time Format: %s-Hour", configParams2.timeFormat ? "12" : "24"); 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"); DevCon.WriteLn(Color_StrongGreen, "Date Format: %s", configParams2.dateFormat ? (configParams2.dateFormat == 2 ? "DD/MM/YYYY" : "MM/DD/YYYY") : "YYYY/MM/DD");

View File

@ -65,6 +65,7 @@ void ReadOSDConfigParames()
configParams1.version = (params[2] & 0xE0) >> 5; // OSD Ver (Not sure but best guess). configParams1.version = (params[2] & 0xE0) >> 5; // OSD Ver (Not sure but best guess).
configParams1.language = params[2] & 0x1F; // Language. configParams1.language = params[2] & 0x1F; // Language.
configParams1.timezoneOffset = params[4] | ((u32)(params[3] & 0x7) << 8); // Timezone offset in minutes. 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 // Region settings for time/date and extended language
configParams2.UC[1] = ((u32)params[3] & 0x78) << 1; // Daylight Savings, 24hr clock, Date format configParams2.UC[1] = ((u32)params[3] & 0x78) << 1; // Daylight Savings, 24hr clock, Date format

View File

@ -44,6 +44,8 @@ typedef struct
/*16*/ u32 language : 5; /*16*/ u32 language : 5;
/** timezone minutes offset from gmt */ /** timezone minutes offset from gmt */
/*21*/ s32 timezoneOffset : 11; /*21*/ s32 timezoneOffset : 11;
/** timezone location ID */
/*32*/ u8 timeZoneID : 7;
}; };
u8 UC[4]; u8 UC[4];
@ -85,7 +87,7 @@ typedef struct
// TODO: namespace this // TODO: namespace this
extern BiosDebugInformation CurrentBiosInformation; 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 u32 BiosRegion; // Used by CDVD
extern bool NoOSD; // Used for HLE OSD Config Params extern bool NoOSD; // Used for HLE OSD Config Params
extern ConfigParam configParams1; extern ConfigParam configParams1;
@ -117,3 +119,139 @@ extern bool IsBIOSAvailable(const std::string& full_path);
extern bool LoadBIOS(); extern bool LoadBIOS();
extern void CopyBIOSToMemory(); 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