mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-27 19:54:38 +00:00
123 lines
3.9 KiB
Diff
123 lines
3.9 KiB
Diff
diff --git a/include/Foundation/NSProcessInfo.h b/include/Foundation/NSProcessInfo.h
|
|
index b3742a82e..f4d7b4d6d 100644
|
|
--- a/include/Foundation/NSProcessInfo.h
|
|
+++ b/include/Foundation/NSProcessInfo.h
|
|
@@ -50,6 +50,14 @@ NSOperatingSystemVersion;
|
|
- (NSOperatingSystemVersion)operatingSystemVersion;
|
|
- (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version;
|
|
|
|
+typedef NS_ENUM(NSInteger, NSProcessInfoThermalState) {
|
|
+ NSProcessInfoThermalStateNominal = 0,
|
|
+ NSProcessInfoThermalStateFair = 1,
|
|
+ NSProcessInfoThermalStateSerious = 2,
|
|
+ NSProcessInfoThermalStateCritical = 3,
|
|
+};
|
|
+- (NSProcessInfoThermalState)thermalState;
|
|
+
|
|
@end
|
|
|
|
@interface NSProcessInfo (NSProcessInfoPlatform)
|
|
@@ -62,3 +70,5 @@ NSOperatingSystemVersion;
|
|
#ifdef DARLING
|
|
FOUNDATION_EXPORT void __NSInitializeProcess(int argc,const char *argv[]);
|
|
#endif
|
|
+
|
|
+FOUNDATION_EXPORT NSString *const NSProcessInfoThermalStateDidChangeNotification;
|
|
diff --git a/include/Foundation/NSUserActivity.h b/include/Foundation/NSUserActivity.h
|
|
index 80c92bc07..2a80df649 100644
|
|
--- a/include/Foundation/NSUserActivity.h
|
|
+++ b/include/Foundation/NSUserActivity.h
|
|
@@ -21,3 +21,5 @@
|
|
|
|
@interface NSUserActivity : NSObject
|
|
@end
|
|
+
|
|
+FOUNDATION_EXPORT NSString *const NSUserActivityTypeBrowsingWeb;
|
|
diff --git a/src/NSProcessInfo.m b/src/NSProcessInfo.m
|
|
index 1c21f17..420955a 100644
|
|
--- a/src/NSProcessInfo.m
|
|
+++ b/src/NSProcessInfo.m
|
|
@@ -251,12 +251,13 @@ SINGLETON_RR()
|
|
}
|
|
#else
|
|
NSDictionary* dict = (NSDictionary*) _CFCopySystemVersionDictionary();
|
|
- NSString* string = [dict objectForKey: @"ProductVersion"];
|
|
+ NSString* string = [dict objectForKey: @"FullVersionString"];
|
|
+ if (![string length]) string = [dict objectForKey: @"ProductVersion"];
|
|
|
|
[string retain];
|
|
[dict release];
|
|
|
|
- return [string autorelease];
|
|
+ return [string autorelease] ?: @"Unknown";
|
|
#endif
|
|
}
|
|
|
|
@@ -285,13 +286,17 @@ SINGLETON_RR()
|
|
|
|
- (unsigned long long)physicalMemory
|
|
{
|
|
- unsigned long long amt = 1;
|
|
- size_t len = sizeof(unsigned long long);
|
|
- if (sysctlbyname("hw.physmem", &amt, &len, 0, 0) != 0)
|
|
- {
|
|
- amt = 1;
|
|
- }
|
|
- return amt;
|
|
+ uint64_t memory = 0;
|
|
+ size_t length = sizeof(memory);
|
|
+ if (sysctlbyname("hw.memsize", &memory, &length, NULL, 0) == 0)
|
|
+ return memory;
|
|
+
|
|
+ // hw.physmem is a legacy 32-bit value; reset the buffer width on fallback.
|
|
+ uint32_t legacyMemory = 0;
|
|
+ length = sizeof(legacyMemory);
|
|
+ if (sysctlbyname("hw.physmem", &legacyMemory, &length, NULL, 0) == 0)
|
|
+ return legacyMemory;
|
|
+ return 1;
|
|
}
|
|
|
|
- (NSTimeInterval)systemUptime
|
|
@@ -305,12 +310,23 @@ SINGLETON_RR()
|
|
return t.tv_sec + t.tv_usec / (NSTimeInterval)USEC_PER_SEC;
|
|
}
|
|
|
|
+- (NSProcessInfoThermalState)thermalState
|
|
+{
|
|
+ /* No thermal-pressure source on Linux; report Nominal so clients
|
|
+ * (e.g. Chromium's ThermalStateObserverMac) proceed normally. */
|
|
+ return NSProcessInfoThermalStateNominal;
|
|
+}
|
|
+
|
|
- (NSOperatingSystemVersion)operatingSystemVersion
|
|
{
|
|
NSOperatingSystemVersion version = { 0, 0, 0 };
|
|
|
|
- NSString* string = [self operatingSystemVersionString];
|
|
- NSArray* arr = [string componentsSeparatedByString:@"."];
|
|
+ // Parse the numeric product version independently of its localized display string.
|
|
+ NSDictionary* dict = (NSDictionary*) _CFCopySystemVersionDictionary();
|
|
+ NSArray* arr = [[dict objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."];
|
|
+ [arr retain];
|
|
+ [dict release];
|
|
+ [arr autorelease];
|
|
|
|
if ([arr count] >= 1)
|
|
{
|
|
@@ -396,3 +412,5 @@ void __NSInitializeProcess(int argc,const char *argv[]) {
|
|
}
|
|
}
|
|
#endif
|
|
+
|
|
+NSString *const NSProcessInfoThermalStateDidChangeNotification = @"NSProcessInfoThermalStateDidChangeNotification";
|
|
diff --git a/src/NSUserActivity.m b/src/NSUserActivity.m
|
|
index 09c0a732b..53649d20b 100644
|
|
--- a/src/NSUserActivity.m
|
|
+++ b/src/NSUserActivity.m
|
|
@@ -34,3 +34,5 @@
|
|
}
|
|
|
|
@end
|
|
+
|
|
+NSString *const NSUserActivityTypeBrowsingWeb = @"com.apple.coreservices.useractivity.browser";
|