485 |
|
BusClockSpeed = 100000000; // Default: 100MHz |
486 |
|
#if EMULATED_PPC |
487 |
|
PVR = 0x000c0000; // Default: 7400 (with AltiVec) |
488 |
+ |
#elif defined(__APPLE__) && defined(__MACH__) |
489 |
+ |
proc_file = popen("ioreg -c IOPlatformDevice", "r"); |
490 |
+ |
if (proc_file) { |
491 |
+ |
char line[256]; |
492 |
+ |
bool powerpc_node = false; |
493 |
+ |
while (fgets(line, sizeof(line) - 1, proc_file)) { |
494 |
+ |
// Read line |
495 |
+ |
int len = strlen(line); |
496 |
+ |
if (len == 0) |
497 |
+ |
continue; |
498 |
+ |
line[len - 1] = 0; |
499 |
+ |
|
500 |
+ |
// Parse line |
501 |
+ |
if (strstr(line, "o PowerPC,")) |
502 |
+ |
powerpc_node = true; |
503 |
+ |
else if (powerpc_node) { |
504 |
+ |
uint32 value; |
505 |
+ |
char head[256]; |
506 |
+ |
if (sscanf(line, "%[ |]\"cpu-version\" = <%x>", head, &value) == 2) |
507 |
+ |
PVR = value; |
508 |
+ |
else if (sscanf(line, "%[ |]\"clock-frequency\" = <%x>", head, &value) == 2) |
509 |
+ |
CPUClockSpeed = value; |
510 |
+ |
else if (sscanf(line, "%[ |]\"bus-frequency\" = <%x>", head, &value) == 2) |
511 |
+ |
BusClockSpeed = value; |
512 |
+ |
else if (strchr(line, '}')) |
513 |
+ |
powerpc_node = false; |
514 |
+ |
} |
515 |
+ |
} |
516 |
+ |
fclose(proc_file); |
517 |
+ |
} else { |
518 |
+ |
sprintf(str, GetString(STR_PROC_CPUINFO_WARN), strerror(errno)); |
519 |
+ |
WarningAlert(str); |
520 |
+ |
} |
521 |
|
#else |
522 |
|
proc_file = fopen("/proc/cpuinfo", "r"); |
523 |
|
if (proc_file) { |