23 #import <sys/types.h> |
23 #import <sys/types.h> |
24 #import <sys/sysctl.h> |
24 #import <sys/sysctl.h> |
25 #import <mach/mach.h> |
25 #import <mach/mach.h> |
26 #import <mach/mach_host.h> |
26 #import <mach/mach_host.h> |
27 #import <QuartzCore/QuartzCore.h> |
27 #import <QuartzCore/QuartzCore.h> |
28 #import <AudioToolbox/AudioToolbox.h> |
|
29 #import <CommonCrypto/CommonDigest.h> |
28 #import <CommonCrypto/CommonDigest.h> |
30 #import <SystemConfiguration/SCNetworkReachability.h> |
29 #import <SystemConfiguration/SCNetworkReachability.h> |
31 #import <netinet/in.h> |
30 #import <netinet/in.h> |
32 #import "PascalImports.h" |
31 #import "PascalImports.h" |
33 #import "hwconsts.h" |
32 #import "hwconsts.h" |
72 sysctlbyname("hw.machine", name, &size, NULL, 0); |
71 sysctlbyname("hw.machine", name, &size, NULL, 0); |
73 NSString *modelId = [NSString stringWithUTF8String:name]; |
72 NSString *modelId = [NSString stringWithUTF8String:name]; |
74 free(name); |
73 free(name); |
75 |
74 |
76 return modelId; |
75 return modelId; |
77 } |
|
78 |
|
79 void playSound (NSString *snd) { |
|
80 if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"sound"] boolValue] == YES) { |
|
81 // get the filename of the sound file: |
|
82 NSString *path = [NSString stringWithFormat:@"%@/%@.wav",[[NSBundle mainBundle] resourcePath],snd]; |
|
83 |
|
84 // declare a system sound id and get a URL for the sound file |
|
85 SystemSoundID soundID; |
|
86 NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO]; |
|
87 |
|
88 // use audio sevices to create and play the sound |
|
89 AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID); |
|
90 AudioServicesPlaySystemSound(soundID); |
|
91 } |
|
92 } |
76 } |
93 |
77 |
94 NSArray *getAvailableColors (void) { |
78 NSArray *getAvailableColors (void) { |
95 // by default colors are ARGB but we do computation over RGB, hence we have to "& 0x00FFFFFF" before processing |
79 // by default colors are ARGB but we do computation over RGB, hence we have to "& 0x00FFFFFF" before processing |
96 unsigned int colors[] = HW_TEAMCOLOR_ARRAY; |
80 unsigned int colors[] = HW_TEAMCOLOR_ARRAY; |