diff -r 6752d2b033cf -r 1ad5803ced8b src/os/macosx/macos.mm --- a/src/os/macosx/macos.mm Sat Aug 29 09:30:40 2009 +0000 +++ b/src/os/macosx/macos.mm Sat Aug 29 18:58:54 2009 +0200 @@ -38,12 +38,6 @@ static char *GetOSString() { - static char buffer[175]; - const char *CPU; - char OS[20]; - char newgrf[125]; - SInt32 sysVersion; - // get the hardware info host_basic_info_data_t hostInfo; mach_msg_type_number_t infoCount; @@ -54,6 +48,7 @@ ); // replace the hardware info with strings, that tells a bit more than just an int + const char *CPU; switch (hostInfo.cpu_subtype) { #ifdef __POWERPC__ case CPU_SUBTYPE_POWERPC_750: CPU = "G3"; break; @@ -70,19 +65,30 @@ #endif } - // get the version of OSX - if (Gestalt(gestaltSystemVersion, &sysVersion) != noErr) { + /* get the version of OSX + * Code adopted from http://www.cocoadev.com/index.pl?DeterminingOSVersion + */ + // Maximum length of the OS-Version string should not exceed 40 chars. + char OS[40]; + SInt32 systemVersion, versionMajor, versionMinor, versionBugFix; + if (Gestalt(gestaltSystemVersion, &systemVersion) != noErr) { sprintf(OS, "Undetected"); } else { - int majorHiNib = GB(sysVersion, 12, 4); - int majorLoNib = GB(sysVersion, 8, 4); - int minorNib = GB(sysVersion, 4, 4); - int bugNib = GB(sysVersion, 0, 4); + if (systemVersion < 0x1040) { + versionMajor = GB(systemVersion, 12, 4) * 10 + GB(systemVersion,8,4); + versionMinor = GB(systemVersion,4,4); + versionBugFix = GB(systemVersion,0,4); + } else { + if (Gestalt(gestaltSystemVersionMajor, &versionMajor) != noErr) versionMajor = 0; + if (Gestalt(gestaltSystemVersionMinor, &versionMinor) != noErr) versionMinor = 0; + if (Gestalt(gestaltSystemVersionBugFix, &versionBugFix) != noErr) versionBugFix = 0; + } - sprintf(OS, "%d%d.%d.%d", majorHiNib, majorLoNib, minorNib, bugNib); + sprintf(OS, "%d.%d.%d (internal Version=%d)", (int) versionMajor, (int) versionMinor, (int) versionBugFix, (int) systemVersion); } // make a list of used newgrf files + char newgrf[125]; /* if (_first_grffile != NULL) { char *n = newgrf; const GRFFile *file; @@ -92,9 +98,10 @@ n = strecpy(n, file->filename, lastof(newgrf)); } } else {*/ - sprintf(newgrf, "none"); + sprintf(newgrf, "unkown"); // } + static char buffer[195]; snprintf( buffer, lengthof(buffer), "Please add this info: (tip: copy-paste works)\n"