Skip to content

Commit

Permalink
Add compatibility for all macOS versions and ppc
Browse files Browse the repository at this point in the history
Make it compilable in all versions of Xcode, all SDKs, all architectures (PowerPC, Intel, ARM).

Changes:

- Added separate Xcode project files for older versions of macOS. Separate project files makes them easier to compare. Each project has one target and builds to a separate folder in a build folder (when built with xcodebuild).
-- AllRez10.6 builds in Mac OS X 10.6. It builds 32-bit binaries for PowerPC and Intel which is required for Mac OS X 10.4 which has only 32-bit ApplicationServices.framework. It can build 64-bit Intel for Mac OS X 10.5 and later. For ppc64, the 10.5 SDK is required and it won't run for Mac OS X 10.4 or for Rosetta (but don't run AllRez for Rosetta since it doesn't do endian swap in some cases).
-- AllRez10.12 builds in OS X 10.12. This works for Mac OS X starting from 10.5. It can work for 10.4 if you remove the 64-bit binary.
-- AllRez builds in macOS 13. It builds 64-bit binaries for ARM and Intel which work with macOS versions starting from OS X 10.8 (though deployment target is 10.9).
-- All project files are Xcode version 3.1 so the file can be opened in older version of Xcode.

- Added MacOSMacros.h which determines the SDK version in case MAC_OS_X_VERSION_MAX_ALLOWED is insufficient (it's not always the same as the SDK version). SDK version is not needed for header files that have a version define but most do not.

- Added AppleMisc.cpp which does the following (among other things related to AppleMisc.h):
-- get the current Darwin and macOS Version. The macOS version may not be accurate if kern.osproductversion doesn't exist because in that case it guesses the macOS version from the Darwin version which might have a different minor version number. The best way to get macOS Version is probably from reading the SystemVersion.plist file.
-- UniversalI2CSendRequest is a version of I2CSendRequest that works in all MacOS versions for 32-bit and 64-bit.

- Added olderversions of iogdiagnose.
-- IOGraphics530.14 is for macOS 10.13.4 to 10.14.3.
-- IOGraphics530.66 is for macOS 10.14.4 to 10.14.6.
-- IOGraphics576.1 is for macOS 10.15 to 10.15.7.
-- IOGraphics is for macOS 11 to 13.2. Only this version has the extra AGDCDiagnose displaypolicyd parsing.

- APIs that exist and later macOS versions may not exist in earlier macOS versions. AllRez will check if the API exists before using it.
- Fields of structs in later macOS versions may not exist in earlier macOS versions. AllRez will not output fields that don't exist for the current macOS version. It will output flags that are set even if the current macOS version shouldn't know about that flag.

- iofbdebuguser.cpp has example of overriding EDID (uses joevt Lilu/WhateverGreen forks - not finished yet). The override occurs at a lower level than the Display overrides.

- oui.cpp compiles faster when the oui list is used in an array instead of a switch statement.

- CFOutput in printf.cpp uses regex to transform CFCopyDescription output of older macOS versions.

- Added parsing of scaled-resolutions, dspc, drng, trng, tinf, tovr
  • Loading branch information
joevt committed Apr 7, 2023
1 parent dd0f7b7 commit b31eaf8
Show file tree
Hide file tree
Showing 40 changed files with 7,389 additions and 2,015 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
DerivedData
project.xcworkspace
xcuserdata
xcshareddata
*.bc
*.ii
*.i
*.s
build
*.mode1
*.mode1v3
*.pbxuser
AllRez10.4.xcodeproj
AllRez10.5.xcodeproj
AllRez10.7.xcodeproj
AllRez10.8.xcodeproj
AllRez10.9.xcodeproj
AllRez10.10.xcodeproj
AllRez10.11.xcodeproj
AllRez10.13.xcodeproj
AllRez10.14.xcodeproj
AllRez10.15.xcodeproj
AllRez11.xcodeproj
AllRez12.xcodeproj
282 changes: 102 additions & 180 deletions AllRez.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

114 changes: 69 additions & 45 deletions AllRez/AGDCDiagnose.cpp

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions AllRez/AGDCDiagnose.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

#include <IOKit/IOKitLib.h>

#define PACKED __attribute__((packed)) __attribute__((aligned(1)))
#define UNALIGNED __attribute__((aligned(1)))
#define PACKED __attribute__((packed)) UNALIGNED

typedef uint64_t reginfo;

Expand Down Expand Up @@ -106,12 +107,16 @@ typedef struct {
/* 0x38 */ uint64_t platformFlags;
/* 0x40 */ uint64_t extraSupportFlags;
/* 0x48 */ uint64_t wranglerFlags;
/* 0x50 */ PACKED launcherinfo launcher[8];
/* 0x238 */ PACKED gpuinfo gpu[8];
/* 0x50 */ UNALIGNED launcherinfo launcher[8];
/* 0x238 */ UNALIGNED gpuinfo gpu[8];
/* 0x14c0 */ gtraceinfo gtrace;
/* 0x74f8 */ // end
} DisplayPolicyState;

extern int assertx[(__builtin_offsetof(DisplayPolicyState, gpu) == 0x238) - 1];
extern int assertx[(__builtin_offsetof(DisplayPolicyState, gtrace) == 0x14c0) - 1];
extern int assertx[(sizeof(DisplayPolicyState) == 0x74f8) - 1];

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
Loading

0 comments on commit b31eaf8

Please sign in to comment.