mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-26 19:47:42 +00:00
Merge upstream/main into main
This commit is contained in:
commit
d8b1eaf23c
4 files changed
+126
-4
No files matched your search
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build the CGDisplayCopyAllDisplayModes NULL-result probe against Darling's SDK."""
|
||||
from pathlib import Path
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
folder = root / 'build/darling-src/build/src/external/cocotron/CoreGraphics'
|
||||
flags = {}
|
||||
for line in (folder / 'CMakeFiles/CoreGraphics.dir/flags.make').read_text().splitlines():
|
||||
if line.startswith('C_') and ' = ' in line:
|
||||
key, value = line.split(' = ', 1)
|
||||
flags[key] = shlex.split(value)
|
||||
obj = root / 'build/riot-display-modes-check.o'
|
||||
subprocess.run(['clang', *flags['C_DEFINES'], *flags['C_INCLUDES'], *flags['C_FLAGS'],
|
||||
'-Wno-macro-redefined', '-c', str(root / 'tools/riot-display-modes-check.c'),
|
||||
'-o', str(obj)], check=True)
|
||||
subprocess.run(['clang', '-target', 'x86_64-apple-macosx11.0', '-fuse-ld=lld', '-nostdlib',
|
||||
'-isysroot', '@DARLING_SDK@', str(obj), '-lSystem',
|
||||
'-framework', 'CoreGraphics', '-framework', 'CoreFoundation',
|
||||
'-o', str(root / 'build/riot-display-modes-check')], check=True)
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Exported by Darling's CoreGraphics but missing from its CGDirectDisplay.h. */
|
||||
CFArrayRef CGDisplayCopyAllDisplayModes(CGDirectDisplayID display, CFDictionaryRef options);
|
||||
|
||||
/* League passes CGDisplayCopyAllDisplayModes' result straight to
|
||||
* CFArrayGetCount; display id 0 comes from an off-screen window. */
|
||||
static int check(CGDirectDisplayID display) {
|
||||
CFArrayRef modes = CGDisplayCopyAllDisplayModes(display, NULL);
|
||||
if (!modes) {
|
||||
printf("DISPLAY_MODES display=%u result=NULL pass=0\n", display);
|
||||
return 0;
|
||||
}
|
||||
printf("DISPLAY_MODES display=%u count=%ld\n", display, (long)CFArrayGetCount(modes));
|
||||
CFRelease(modes);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* League divides by the physical size for its camera aspect ratio; {0,0}
|
||||
* made every 3D vertex NaN. */
|
||||
static int checkSize(CGDirectDisplayID display) {
|
||||
CGSize size = CGDisplayScreenSize(display);
|
||||
int ok = size.width > 0 && size.height > 0;
|
||||
printf("SCREEN_SIZE display=%u size=%.0fx%.0fmm pass=%d\n", display, size.width, size.height, ok);
|
||||
return ok;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int pass = check(CGMainDisplayID()) & check(0) & check(0xffff);
|
||||
pass &= checkSize(CGMainDisplayID()) & checkSize(0) & checkSize(0xffff);
|
||||
printf("DISPLAY_MODES_CHECK pass=%d\n", pass);
|
||||
return !pass;
|
||||
}
|
||||
Reference in new issue
Block a user