diff options
author | h.udo <hudokkow@gmail.com> | 2018-06-08 12:23:10 +0100 |
---|---|---|
committer | h.udo <hudokkow@gmail.com> | 2018-06-12 13:06:19 +0100 |
commit | 5c6e3a8b9bec8a594695fe5808bb384f6645bcec (patch) | |
tree | 6b54545a47606b5c6543df01504ef2ed9e09eede | |
parent | e8d74c663841eddaa70946bee298a15c2454de20 (diff) |
[tools] nuke whitespace
78 files changed, 656 insertions, 656 deletions
diff --git a/tools/EventClients/Clients/KodiSend/kodi-send.py b/tools/EventClients/Clients/KodiSend/kodi-send.py index 2eebc556b7..d5c00a112f 100755 --- a/tools/EventClients/Clients/KodiSend/kodi-send.py +++ b/tools/EventClients/Clients/KodiSend/kodi-send.py @@ -80,14 +80,14 @@ def main(): actions.append({'type': TYPE_DELAY, 'content': int(a)}) else: assert False, "unhandled option" - + addr = (ip, port) sock = socket(AF_INET,SOCK_DGRAM) - + if len(actions) is 0: usage() sys.exit(0) - + for action in actions: print('Sending: %s' % action) if action['type'] == TYPE_ACTION: diff --git a/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h b/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h index 8a847aeae3..5c3aed373e 100644 --- a/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h +++ b/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h @@ -12,21 +12,21 @@ // // Copyright (c) 2007-2014 IOSPIRIT GmbH (http://www.iospirit.com/) // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: -// +// // * Redistributions of source code must retain the above copyright notice, this list // of conditions and the following disclaimer. -// +// // * Redistributions in binary form must reproduce the above copyright notice, this // list of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. -// +// // * Neither the name of IOSPIRIT GmbH nor the names of its contributors may be used to // endorse or promote products derived from this software without specific prior // written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT @@ -178,7 +178,7 @@ typedef enum newID:(SInt32)newID forHardwareWithAttributes:(NSMutableDictionary *)attributes; -// Notification about hardware additions/removals +// Notification about hardware additions/removals - (void)hidRemote:(HIDRemote *)hidRemote // Invoked when new hardware was found / added to HIDRemote's pool foundNewHardwareWithAttributes:(NSMutableDictionary *)attributes; @@ -192,7 +192,7 @@ typedef enum // Matching of newly found receiver hardware - (BOOL)hidRemote:(HIDRemote *)hidRemote // Invoked when new hardware is inspected - inspectNewHardwareWithService:(io_service_t)service // + inspectNewHardwareWithService:(io_service_t)service // prematchResult:(BOOL)prematchResult; // Return YES if HIDRemote should go on with this hardware and try // to use it, or NO if it should not be pursued further. @@ -206,7 +206,7 @@ typedef enum - (BOOL)hidRemote:(HIDRemote *)hidRemote shouldRetryExclusiveLockWithInfo:(NSDictionary *)applicationInfo; -@end +@end #pragma mark -- Actual header file for class -- @@ -219,56 +219,56 @@ typedef enum // Notification ports IONotificationPortRef _notifyPort; CFRunLoopSourceRef _notifyRLSource; - + // Matching iterator io_iterator_t _matchingServicesIterator; - + // SecureInput notification io_object_t _secureInputNotification; - + // Service attributes NSMutableDictionary *_serviceAttribMap; - + // Mode HIDRemoteMode _mode; BOOL _autoRecover; NSTimer *_autoRecoveryTimer; - + // Delegate NSObject <HIDRemoteDelegate> *_delegate; - + // Last seen ID and remote model SInt32 _lastSeenRemoteID; HIDRemoteModel _lastSeenModel; SInt32 _lastSeenModelRemoteID; - + // Unused button codes NSArray *_unusedButtonCodes; - + // Simulate Plus/Minus Hold BOOL _simulateHoldEvents; - + // SecureEventInput workaround BOOL _secureEventInputWorkAround; UInt64 _lastSecureEventInputPIDSum; uid_t _lastFrontUserSession; BOOL _lastScreenIsLocked; - + // Exclusive lock lending BOOL _exclusiveLockLending; BOOL _sendExclusiveResourceReuseNotification; NSNumber *_waitForReturnByPID; NSNumber *_returnToPID; BOOL _isRestarting; - + // Status notifications BOOL _sendStatusNotifications; NSString *_pidString; - + // Status BOOL _applicationIsTerminating; BOOL _isStopping; - + // Thread safety #ifdef HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING /* #define HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING if you're running your HIDRemote instance on a background thread (requires OS X 10.5 or later) */ NSThread *_runOnThread; @@ -285,7 +285,7 @@ typedef enum - (HIDRemoteAluminumRemoteSupportLevel)aluminiumRemoteSystemSupportLevel; #pragma mark -- PUBLIC: Interface / API -- -- (BOOL)startRemoteControl:(HIDRemoteMode)hidRemoteMode; +- (BOOL)startRemoteControl:(HIDRemoteMode)hidRemoteMode; - (void)stopRemoteControl; - (BOOL)isStarted; diff --git a/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m b/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m index b916210fe4..216c3adf6c 100644 --- a/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m +++ b/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m @@ -12,21 +12,21 @@ // // Copyright (c) 2007-2014 IOSPIRIT GmbH (http://www.iospirit.com/) // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: -// +// // * Redistributions of source code must retain the above copyright notice, this list // of conditions and the following disclaimer. -// +// // * Redistributions in binary form must reproduce the above copyright notice, this // list of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. -// +// // * Neither the name of IOSPIRIT GmbH nor the names of its contributors may be used to // endorse or promote products derived from this software without specific prior // written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT @@ -52,7 +52,7 @@ #import "HIDRemote.h" // Callback Prototypes -static void HIDEventCallback( void * target, +static void HIDEventCallback( void * target, IOReturn result, void * refcon, void * sender); @@ -83,7 +83,7 @@ static HIDRemote *sHIDRemote = nil; { sHIDRemote = [[HIDRemote alloc] init]; } - + return (sHIDRemote); } @@ -94,7 +94,7 @@ static HIDRemote *sHIDRemote = nil; #ifdef HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING _runOnThread = [[NSThread currentThread] retain]; #endif - + // Detect application becoming active/inactive [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_appStatusChanged:) name:NSApplicationDidBecomeActiveNotification object:[NSApplication sharedApplication]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_appStatusChanged:) name:NSApplicationWillResignActiveNotification object:[NSApplication sharedApplication]]; @@ -102,18 +102,18 @@ static HIDRemote *sHIDRemote = nil; // Handle distributed notifications _pidString = [[NSString alloc] initWithFormat:@"%d", getpid()]; - + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemotePing object:nil]; [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteRetry object:kHIDRemoteDNHIDRemoteRetryGlobalObject]; [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteRetry object:_pidString]; // Enabled by default: simulate hold events for plus/minus _simulateHoldEvents = YES; - + // Enabled by default: work around for a locking issue introduced with Security Update 2008-004 / 10.4.9 and beyond (credit for finding this workaround goes to Martin Kahr) _secureEventInputWorkAround = YES; _secureInputNotification = 0; - + // Initialize instance variables _lastSeenRemoteID = -1; _lastSeenModel = kHIDRemoteModelUndetermined; @@ -121,7 +121,7 @@ static HIDRemote *sHIDRemote = nil; _exclusiveLockLending = NO; _sendExclusiveResourceReuseNotification = YES; _applicationIsTerminating = NO; - + // Send status notifications _sendStatusNotifications = YES; } @@ -139,7 +139,7 @@ static HIDRemote *sHIDRemote = nil; [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteRetry object:kHIDRemoteDNHIDRemoteRetryGlobalObject]; [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteRetry object:_pidString]; [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:nil object:nil]; /* As demanded by the documentation for -[NSDistributedNotificationCenter removeObserver:name:object:] */ - + [self stopRemoteControl]; [self setExclusiveLockLendingEnabled:NO]; @@ -205,14 +205,14 @@ static HIDRemote *sHIDRemote = nil; return (YES); } break; - + default: return (NO); break; } break; } - + return (NO); } @@ -228,7 +228,7 @@ static HIDRemote *sHIDRemote = nil; NSOperatingSystemVersion osVersion; osVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; - + sHRGestaltOSXVersion = (SInt32)(0x01000 | ((osVersion.majorVersion-10)<<8) | (osVersion.minorVersion<<4) | osVersion.patchVersion); #else #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9 @@ -238,7 +238,7 @@ static HIDRemote *sHIDRemote = nil; if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) { osVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; - + sHRGestaltOSXVersion = (SInt32)(0x01000 | ((osVersion.majorVersion-10)<<8) | (osVersion.minorVersion<<4) | osVersion.patchVersion); } else @@ -257,7 +257,7 @@ static HIDRemote *sHIDRemote = nil; #endif /* MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9 */ #endif /* MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9 */ } - + return (sHRGestaltOSXVersion); } @@ -266,13 +266,13 @@ static HIDRemote *sHIDRemote = nil; HIDRemoteAluminumRemoteSupportLevel supportLevel = kHIDRemoteAluminumRemoteSupportLevelNone; NSEnumerator *attribDictsEnum; NSDictionary *hidAttribsDict; - + attribDictsEnum = [_serviceAttribMap objectEnumerator]; - + while ((hidAttribsDict = [attribDictsEnum nextObject]) != nil) { NSNumber *deviceSupportLevel; - + if ((deviceSupportLevel = [hidAttribsDict objectForKey:kHIDRemoteAluminumRemoteSupportLevel]) != nil) { if ([deviceSupportLevel intValue] > (int)supportLevel) @@ -281,7 +281,7 @@ static HIDRemote *sHIDRemote = nil; } } } - + return (supportLevel); } @@ -293,16 +293,16 @@ static HIDRemote *sHIDRemote = nil; kern_return_t kernReturn; CFMutableDictionaryRef matchDict=NULL; io_service_t rootService; - + do { // Get IOKit master port kernReturn = IOMasterPort(bootstrap_port, &_masterPort); if ((kernReturn!=kIOReturnSuccess) || (_masterPort==0)) { break; } - + // Setup notification port _notifyPort = IONotificationPortCreate(_masterPort); - + if ((_notifyRLSource = IONotificationPortGetRunLoopSource(_notifyPort)) != NULL) { CFRunLoopAddSource( CFRunLoopGetCurrent(), @@ -313,7 +313,7 @@ static HIDRemote *sHIDRemote = nil; { break; } - + // Setup SecureInput notification if ((hidRemoteMode == kHIDRemoteModeExclusive) || (hidRemoteMode == kHIDRemoteModeExclusiveAuto)) { @@ -326,7 +326,7 @@ static HIDRemote *sHIDRemote = nil; (void *)self, &_secureInputNotification); if (kernReturn != kIOReturnSuccess) { break; } - + [self _updateSessionInformation]; } else @@ -348,35 +348,35 @@ static HIDRemote *sHIDRemote = nil; &_matchingServicesIterator); if (kernReturn != kIOReturnSuccess) { break; } - // Setup serviceAttribMap + // Setup serviceAttribMap _serviceAttribMap = [[NSMutableDictionary alloc] init]; if (_serviceAttribMap==nil) { break; } - + // Phew .. everything went well! _mode = hidRemoteMode; CFRelease(matchDict); - + [self _serviceMatching:_matchingServicesIterator]; - + [self _postStatusWithAction:kHIDRemoteDNStatusActionStart]; - + // Register for system wake notifications [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(_computerDidWake:) name:NSWorkspaceDidWakeNotification object:nil]; - + return (YES); }while(0); - + // An error occured. Do necessary clean up. if (matchDict!=NULL) { CFRelease(matchDict); matchDict = NULL; } - + [self stopRemoteControl]; } - + return (NO); } @@ -397,22 +397,22 @@ static HIDRemote *sHIDRemote = nil; if (_serviceAttribMap!=nil) { NSDictionary *cloneDict = [[NSDictionary alloc] initWithDictionary:_serviceAttribMap]; - + if (cloneDict!=nil) { NSEnumerator *mapKeyEnum = [cloneDict keyEnumerator]; NSNumber *serviceValue; - + while ((serviceValue = [mapKeyEnum nextObject]) != nil) { [self _destructService:(io_object_t)[serviceValue unsignedIntValue]]; serviceCount++; }; - + [cloneDict release]; cloneDict = nil; } - + [_serviceAttribMap release]; _serviceAttribMap = nil; } @@ -422,7 +422,7 @@ static HIDRemote *sHIDRemote = nil; IOObjectRelease((io_object_t) _matchingServicesIterator); _matchingServicesIterator = 0; } - + if (_secureInputNotification!=0) { IOObjectRelease((io_object_t) _secureInputNotification); @@ -464,7 +464,7 @@ static HIDRemote *sHIDRemote = nil; if (((_mode==kHIDRemoteModeExclusive) || (_mode==kHIDRemoteModeExclusiveAuto)) && (_sendExclusiveResourceReuseNotification==YES) && (_exclusiveLockLending==NO) && (serviceCount>0)) { _mode = kHIDRemoteModeNone; - + if (!_isRestarting) { [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kHIDRemoteDNHIDRemoteRetry @@ -481,7 +481,7 @@ static HIDRemote *sHIDRemote = nil; // Unregister from system wake notifications [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self name:NSWorkspaceDidWakeNotification object:nil]; } - + _mode = kHIDRemoteModeNone; _isStopping = NO; } @@ -535,7 +535,7 @@ static HIDRemote *sHIDRemote = nil; { [newArrayWithUnusedButtonCodesAsNSNumbers retain]; [_unusedButtonCodes release]; - + _unusedButtonCodes = newArrayWithUnusedButtonCodesAsNSNumbers; [self _postStatusWithAction:kHIDRemoteDNStatusActionUpdate]; @@ -567,7 +567,7 @@ static HIDRemote *sHIDRemote = nil; if (newExclusiveLockLendingEnabled != _exclusiveLockLending) { _exclusiveLockLending = newExclusiveLockLendingEnabled; - + if (_exclusiveLockLending) { [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteStatus object:nil]; @@ -575,7 +575,7 @@ static HIDRemote *sHIDRemote = nil; else { [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteStatus object:nil]; - + [_waitForReturnByPID release]; _waitForReturnByPID = nil; } @@ -622,7 +622,7 @@ static HIDRemote *sHIDRemote = nil; return; } } - + if ([[notification name] isEqual:NSApplicationWillResignActiveNotification]) { if (_mode != kHIDRemoteModeExclusiveAuto) @@ -630,7 +630,7 @@ static HIDRemote *sHIDRemote = nil; return; } } - + [self performSelector:@selector(_appStatusChanged:) onThread:_runOnThread withObject:notification waitUntilDone:[[notification name] isEqual:NSApplicationWillTerminateNotification]]; return; } @@ -669,11 +669,11 @@ static HIDRemote *sHIDRemote = nil; _autoRecover = YES; } } - + if ([[notification name] isEqual:NSApplicationWillTerminateNotification]) { _applicationIsTerminating = YES; - + if ([self isStarted]) { [self stopRemoteControl]; @@ -745,7 +745,7 @@ static HIDRemote *sHIDRemote = nil; if ([self isStarted]) { BOOL retry = YES; - + // Ignore our own global retry broadcasts if ([[notification object] isEqual:kHIDRemoteDNHIDRemoteRetryGlobalObject]) { @@ -759,7 +759,7 @@ static HIDRemote *sHIDRemote = nil; } } } - + if (retry) { if (([self delegate] != nil) && @@ -768,22 +768,22 @@ static HIDRemote *sHIDRemote = nil; retry = [[self delegate] hidRemote:self shouldRetryExclusiveLockWithInfo:[notification userInfo]]; } } - + if (retry) { HIDRemoteMode restartInMode = _mode; - + if (restartInMode != kHIDRemoteModeNone) { _isRestarting = YES; [self stopRemoteControl]; - + [_returnToPID release]; _returnToPID = nil; - + [self startRemoteControl:restartInMode]; _isRestarting = NO; - + if (restartInMode != kHIDRemoteModeShared) { _returnToPID = [[[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey] retain]; @@ -797,18 +797,18 @@ static HIDRemote *sHIDRemote = nil; _returnToPID = [[[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey] retain]; [self _postStatusWithAction:kHIDRemoteDNStatusActionNoNeed]; [_returnToPID release]; - + _returnToPID = cacheReturnPID; } } } - + if (_exclusiveLockLending) { if ([notificationName isEqual:kHIDRemoteDNHIDRemoteStatus]) { NSString *action; - + if ((action = [[notification userInfo] objectForKey:kHIDRemoteDNStatusActionKey]) != nil) { if ((_mode == kHIDRemoteModeNone) && (_waitForReturnByPID!=nil)) @@ -818,13 +818,13 @@ static HIDRemote *sHIDRemote = nil; if ((pidNumber = [[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey]) != nil) { returnToPIDNumber = [[notification userInfo] objectForKey:kHIDRemoteDNStatusReturnToPIDKey]; - + if ([action isEqual:kHIDRemoteDNStatusActionStart]) { if ([pidNumber isEqual:_waitForReturnByPID]) { NSNumber *startMode; - + if ((startMode = [[notification userInfo] objectForKey:kHIDRemoteDNStatusModeKey]) != nil) { if ([startMode intValue] == kHIDRemoteModeShared) @@ -844,7 +844,7 @@ static HIDRemote *sHIDRemote = nil; { [_waitForReturnByPID release]; _waitForReturnByPID = nil; - + if (([self delegate] != nil) && ([[self delegate] respondsToSelector:@selector(hidRemote:exclusiveLockReleasedByApplicationWithInfo:)])) { @@ -866,7 +866,7 @@ static HIDRemote *sHIDRemote = nil; { NSNumber *originPID = [[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey]; BOOL lendLock = YES; - + if ([originPID intValue] != getpid()) { if (([self delegate] != nil) && @@ -874,16 +874,16 @@ static HIDRemote *sHIDRemote = nil; { lendLock = [[self delegate] hidRemote:self lendExclusiveLockToApplicationWithInfo:[notification userInfo]]; } - + if (lendLock) { [_waitForReturnByPID release]; _waitForReturnByPID = [originPID retain]; - + if (_waitForReturnByPID != nil) { [self stopRemoteControl]; - + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kHIDRemoteDNHIDRemoteRetry object:[NSString stringWithFormat:@"%d", [_waitForReturnByPID intValue]] userInfo:[NSDictionary dictionaryWithObjectsAndKeys: @@ -918,7 +918,7 @@ static HIDRemote *sHIDRemote = nil; BOOL serviceMatches = NO; NSString *ioClass; NSNumber *candelairHIDRemoteCompatibilityMask; - + if (service != 0) { // IOClass matching @@ -933,14 +933,14 @@ static HIDRemote *sHIDRemote = nil; CFTypeRef candelairHIDRemoteCompatibilityDevice; serviceMatches = YES; - + if ((candelairHIDRemoteCompatibilityDevice = IORegistryEntryCreateCFProperty((io_registry_entry_t)service, CFSTR("CandelairHIDRemoteCompatibilityDevice"), kCFAllocatorDefault, 0)) != NULL) { if (CFEqual(kCFBooleanTrue, candelairHIDRemoteCompatibilityDevice)) { serviceMatches = NO; } - + CFRelease (candelairHIDRemoteCompatibilityDevice); } } @@ -950,7 +950,7 @@ static HIDRemote *sHIDRemote = nil; { serviceMatches = YES; } - + CFRelease((CFTypeRef)ioClass); } @@ -968,7 +968,7 @@ static HIDRemote *sHIDRemote = nil; serviceMatches = NO; } } - + CFRelease((CFTypeRef)candelairHIDRemoteCompatibilityMask); } } @@ -978,7 +978,7 @@ static HIDRemote *sHIDRemote = nil; { serviceMatches = [((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self inspectNewHardwareWithService:service prematchResult:serviceMatches]; } - + return (serviceMatches); } @@ -995,7 +995,7 @@ static HIDRemote *sHIDRemote = nil; // Aluminum Remote: Center buttonCode = (kHIDRemoteButtonCodeCenter|kHIDRemoteButtonCodeAluminumMask); break; - + case kHIDUsage_Csmr_ModeStep: // Aluminium Remote: Center Hold buttonCode = (kHIDRemoteButtonCodeCenterHold|kHIDRemoteButtonCodeAluminumMask); @@ -1005,11 +1005,11 @@ static HIDRemote *sHIDRemote = nil; // Aluminum Remote: Play/Pause buttonCode = (kHIDRemoteButtonCodePlay|kHIDRemoteButtonCodeAluminumMask); break; - + case kHIDUsage_Csmr_Rewind: buttonCode = kHIDRemoteButtonCodeLeftHold; break; - + case kHIDUsage_Csmr_FastForward: buttonCode = kHIDRemoteButtonCodeRightHold; break; @@ -1027,7 +1027,7 @@ static HIDRemote *sHIDRemote = nil; break; } break; - + case kHIDPage_GenericDesktop: switch (usage) { @@ -1056,7 +1056,7 @@ static HIDRemote *sHIDRemote = nil; break; } break; - + case 0x06: /* Reserved */ switch (usage) { @@ -1065,7 +1065,7 @@ static HIDRemote *sHIDRemote = nil; break; } break; - + case 0xFF01: /* Vendor specific */ switch (usage) { @@ -1081,7 +1081,7 @@ static HIDRemote *sHIDRemote = nil; } break; } - + return (buttonCode); } @@ -1115,52 +1115,52 @@ static HIDRemote *sHIDRemote = nil; kIOCFPlugInInterfaceID, &cfPluginInterface, &score); - + if (kernResult != kIOReturnSuccess) { error = [NSError errorWithDomain:NSMachErrorDomain code:kernResult userInfo:nil]; errorCode = 1; - break; + break; } - + // .. use it to get the HID interface .. - hResult = (*cfPluginInterface)->QueryInterface( cfPluginInterface, + hResult = (*cfPluginInterface)->QueryInterface( cfPluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122), (LPVOID)&hidDeviceInterface); - + if ((hResult!=S_OK) || (hidDeviceInterface==NULL)) { error = [NSError errorWithDomain:NSMachErrorDomain code:hResult userInfo:nil]; errorCode = 2; - break; + break; } - + // .. then open it .. switch (_mode) { case kHIDRemoteModeShared: hResult = (*hidDeviceInterface)->open(hidDeviceInterface, kIOHIDOptionsTypeNone); break; - + case kHIDRemoteModeExclusive: case kHIDRemoteModeExclusiveAuto: hResult = (*hidDeviceInterface)->open(hidDeviceInterface, kIOHIDOptionsTypeSeizeDevice); break; - + default: goto cleanUp; // Ugh! But there are no "double breaks" available in C AFAIK .. break; } - + if (hResult!=S_OK) { error = [NSError errorWithDomain:NSMachErrorDomain code:hResult userInfo:nil]; errorCode = 3; break; } - + opened = YES; // .. query the HID elements .. @@ -1171,7 +1171,7 @@ static HIDRemote *sHIDRemote = nil; { error = [NSError errorWithDomain:NSMachErrorDomain code:returnCode userInfo:nil]; errorCode = 4; - + break; } @@ -1206,7 +1206,7 @@ static HIDRemote *sHIDRemote = nil; UInt32 i, hidElementCnt = CFArrayGetCount(hidElements); NSMutableDictionary *cookieButtonCodeLUT = [[NSMutableDictionary alloc] init]; NSMutableDictionary *cookieCount = [[NSMutableDictionary alloc] init]; - + if ((cookieButtonCodeLUT==nil) || (cookieCount==nil)) { [cookieButtonCodeLUT release]; @@ -1220,20 +1220,20 @@ static HIDRemote *sHIDRemote = nil; break; } - + // Analyze the HID elements and find matching elements for (i=0;i<hidElementCnt;i++) { CFDictionaryRef hidDict; NSNumber *usage, *usagePage, *cookie; HIDRemoteButtonCode buttonCode = kHIDRemoteButtonCodeNone; - + hidDict = CFArrayGetValueAtIndex(hidElements, i); - + usage = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementUsageKey)); usagePage = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementUsagePageKey)); cookie = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementCookieKey)); - + if ((usage!=nil) && (usagePage!=nil) && (cookie!=nil)) { // Find the button codes for the ID combos @@ -1245,23 +1245,23 @@ static HIDRemote *sHIDRemote = nil; #include "HIDRemoteAdditions.h" #undef _HIDREMOTE_EXTENSIONS_SECTION #endif /* _HIDREMOTE_EXTENSIONS */ - + // Did record match? if (buttonCode != kHIDRemoteButtonCodeNone) { NSString *pairString = [[NSString alloc] initWithFormat:@"%u_%u", [usagePage unsignedIntValue], [usage unsignedIntValue]]; NSNumber *buttonCodeNumber = [[NSNumber alloc] initWithUnsignedInt:(unsigned int)buttonCode]; - + #ifdef _HIDREMOTE_EXTENSIONS // Debug logging code #define _HIDREMOTE_EXTENSIONS_SECTION 4 #include "HIDRemoteAdditions.h" #undef _HIDREMOTE_EXTENSIONS_SECTION #endif /* _HIDREMOTE_EXTENSIONS */ - + [cookieCount setObject:buttonCodeNumber forKey:pairString]; [cookieButtonCodeLUT setObject:buttonCodeNumber forKey:cookie]; - + (*hidQueueInterface)->addElement(hidQueueInterface, (IOHIDElementCookie) [cookie unsignedIntValue], 0); @@ -1272,13 +1272,13 @@ static HIDRemote *sHIDRemote = nil; #include "HIDRemoteAdditions.h" #undef _HIDREMOTE_EXTENSIONS_SECTION #endif /* _HIDREMOTE_EXTENSIONS */ - + [buttonCodeNumber release]; [pairString release]; } } } - + // Compare number of *unique* matches (thus the cookieCount dictionary) with required minimum if ([cookieCount count] < 10) { @@ -1302,16 +1302,16 @@ static HIDRemote *sHIDRemote = nil; [cookieCount release]; cookieCount = nil; } - + // Finish setup of IOHIDQueueInterface with CFRunLoop returnCode = (*hidQueueInterface)->createAsyncEventSource(hidQueueInterface, &queueEventSource); if ((returnCode != kIOReturnSuccess) || (queueEventSource == NULL)) { error = [NSError errorWithDomain:NSMachErrorDomain code:returnCode userInfo:nil]; errorCode = 9; - break; + break; } - + returnCode = (*hidQueueInterface)->setEventCallout(hidQueueInterface, HIDEventCallback, (void *)((intptr_t)service), (void *)self); if (returnCode != kIOReturnSuccess) { @@ -1319,12 +1319,12 @@ static HIDRemote *sHIDRemote = nil; errorCode = 10; break; } - + CFRunLoopAddSource( CFRunLoopGetCurrent(), queueEventSource, kCFRunLoopCommonModes); [hidAttribsDict setObject:[NSValue valueWithPointer:(const void *)queueEventSource] forKey:kHIDRemoteCFRunLoopSource]; - + returnCode = (*hidQueueInterface)->start(hidQueueInterface); if (returnCode != kIOReturnSuccess) { @@ -1332,7 +1332,7 @@ static HIDRemote *sHIDRemote = nil; errorCode = 11; break; } - + queueStarted = YES; // Setup device notifications @@ -1350,7 +1350,7 @@ static HIDRemote *sHIDRemote = nil; } [hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:(unsigned int)serviceNotification] forKey:kHIDRemoteServiceNotification]; - + // Retain service if (IOObjectRetain(service) != kIOReturnSuccess) { @@ -1358,13 +1358,13 @@ static HIDRemote *sHIDRemote = nil; errorCode = 13; break; } - + [hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:(unsigned int)service] forKey:kHIDRemoteService]; - + // Get some (somewhat optional) infos on the device { CFStringRef product, manufacturer, transport; - + if ((product = IORegistryEntryCreateCFProperty( (io_registry_entry_t)service, (CFStringRef) @"Product", kCFAllocatorDefault, @@ -1374,7 +1374,7 @@ static HIDRemote *sHIDRemote = nil; { [hidAttribsDict setObject:(NSString *)product forKey:kHIDRemoteProduct]; } - + CFRelease(product); } @@ -1387,7 +1387,7 @@ static HIDRemote *sHIDRemote = nil; { [hidAttribsDict setObject:(NSString *)manufacturer forKey:kHIDRemoteManufacturer]; } - + CFRelease(manufacturer); } @@ -1400,16 +1400,16 @@ static HIDRemote *sHIDRemote = nil; { [hidAttribsDict setObject:(NSString *)transport forKey:kHIDRemoteTransport]; } - + CFRelease(transport); } } - + // Determine Aluminum Remote support { CFNumberRef aluSupport; HIDRemoteAluminumRemoteSupportLevel supportLevel = kHIDRemoteAluminumRemoteSupportLevelNone; - + if ((_mode == kHIDRemoteModeExclusive) || (_mode == kHIDRemoteModeExclusiveAuto)) { // Determine if this driver offers on-demand support for the Aluminum Remote (only relevant under OS versions < 10.6.2) @@ -1433,11 +1433,11 @@ static HIDRemote *sHIDRemote = nil; [hidAttribsDict setObject:[NSNumber numberWithBool:YES] forKey:kHIDRemoteAluminumRemoteSupportOnDemand]; } - + CFRelease(aluSupport); } } - + if (supportLevel == kHIDRemoteAluminumRemoteSupportLevelNone) { if ((aluSupport = IORegistryEntryCreateCFProperty((io_registry_entry_t)service, @@ -1449,13 +1449,13 @@ static HIDRemote *sHIDRemote = nil; { supportLevel = (HIDRemoteAluminumRemoteSupportLevel) [(NSNumber *)aluSupport intValue]; } - + CFRelease(aluSupport); } else { CFStringRef ioKitClassName; - + if ((ioKitClassName = IORegistryEntryCreateCFProperty( (io_registry_entry_t)service, CFSTR(kIOClassKey), kCFAllocatorDefault, @@ -1476,7 +1476,7 @@ static HIDRemote *sHIDRemote = nil; supportLevel = kHIDRemoteAluminumRemoteSupportLevelNative; } } - + CFRelease(ioKitClassName); } } @@ -1484,24 +1484,24 @@ static HIDRemote *sHIDRemote = nil; [hidAttribsDict setObject:(NSNumber *)[NSNumber numberWithInt:(int)supportLevel] forKey:kHIDRemoteAluminumRemoteSupportLevel]; } - + // Add it to the serviceAttribMap [_serviceAttribMap setObject:hidAttribsDict forKey:[NSNumber numberWithUnsignedInt:(unsigned int)service]]; - + // And we're done with setup .. if (([self delegate]!=nil) && ([[self delegate] respondsToSelector:@selector(hidRemote:foundNewHardwareWithAttributes:)])) { [((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self foundNewHardwareWithAttributes:hidAttribsDict]; } - + [hidAttribsDict release]; hidAttribsDict = nil; - + return(YES); }while(0); - + cleanUp: if (([self delegate]!=nil) && @@ -1509,7 +1509,7 @@ static HIDRemote *sHIDRemote = nil; { if (error!=nil) { - error = [NSError errorWithDomain:[error domain] + error = [NSError errorWithDomain:[error domain] code:[error code] userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:errorCode] forKey:@"InternalErrorCode"] ]; @@ -1517,7 +1517,7 @@ static HIDRemote *sHIDRemote = nil; [((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self failedNewHardwareWithError:error]; } - + // An error occured or this device is not of interest .. cleanup .. if (serviceNotification!=0) { @@ -1530,7 +1530,7 @@ static HIDRemote *sHIDRemote = nil; CFRunLoopSourceInvalidate(queueEventSource); queueEventSource=NULL; } - + if (hidQueueInterface!=NULL) { if (queueStarted) @@ -1547,13 +1547,13 @@ static HIDRemote *sHIDRemote = nil; [hidAttribsDict release]; hidAttribsDict = nil; } - + if (hidElements!=NULL) { CFRelease(hidElements); hidElements = NULL; } - + if (hidDeviceInterface!=NULL) { if (opened) @@ -1564,13 +1564,13 @@ static HIDRemote *sHIDRemote = nil; // opened = NO; hidDeviceInterface = NULL; } - + if (cfPluginInterface!=NULL) { IODestroyPlugInInterface(cfPluginInterface); cfPluginInterface = NULL; } - + return (NO); } @@ -1578,14 +1578,14 @@ static HIDRemote *sHIDRemote = nil; { NSNumber *serviceValue; NSMutableDictionary *serviceDict = NULL; - + if ((serviceValue = [NSNumber numberWithUnsignedInt:(unsigned int)service]) == nil) { return; } - + serviceDict = [_serviceAttribMap objectForKey:serviceValue]; - + if (serviceDict!=nil) { IOHIDDeviceInterface122 **hidDeviceInterface = NULL; @@ -1605,7 +1605,7 @@ static HIDRemote *sHIDRemote = nil; cfPluginInterface = (IOCFPlugInInterface **) ([serviceDict objectForKey:kHIDRemoteCFPluginInterface] ? [[serviceDict objectForKey:kHIDRemoteCFPluginInterface] pointerValue] : NULL); cookieButtonMap = (NSMutableDictionary *) [serviceDict objectForKey:kHIDRemoteCookieButtonCodeLUT]; simulateHoldTimer = (NSTimer *) [serviceDict objectForKey:kHIDRemoteSimulateHoldEventsTimer]; - + [serviceDict retain]; [_serviceAttribMap removeObjectForKey:serviceValue]; @@ -1625,7 +1625,7 @@ static HIDRemote *sHIDRemote = nil; { [((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self releasedHardwareWithAttributes:serviceDict]; } - + if (simulateHoldTimer!=nil) { [simulateHoldTimer invalidate]; @@ -1642,12 +1642,12 @@ static HIDRemote *sHIDRemote = nil; queueEventSource, kCFRunLoopCommonModes); } - + if ((hidQueueInterface!=NULL) && (cookieButtonMap!=nil)) { NSEnumerator *cookieEnum = [cookieButtonMap keyEnumerator]; NSNumber *cookie; - + while ((cookie = [cookieEnum nextObject]) != nil) { if ((*hidQueueInterface)->hasElement(hidQueueInterface, (IOHIDElementCookie) [cookie unsignedIntValue])) @@ -1657,25 +1657,25 @@ static HIDRemote *sHIDRemote = nil; } }; } - + if (hidQueueInterface!=NULL) { (*hidQueueInterface)->stop(hidQueueInterface); (*hidQueueInterface)->dispose(hidQueueInterface); (*hidQueueInterface)->Release(hidQueueInterface); } - + if (hidDeviceInterface!=NULL) { (*hidDeviceInterface)->close(hidDeviceInterface); (*hidDeviceInterface)->Release(hidDeviceInterface); } - + if (cfPluginInterface!=NULL) { IODestroyPlugInInterface(cfPluginInterface); } - + if (theService!=0) { IOObjectRelease(theService); @@ -1692,11 +1692,11 @@ static HIDRemote *sHIDRemote = nil; NSMutableDictionary *hidAttribsDict; NSTimer *shTimer; NSNumber *shButtonCode; - + if ((hidAttribsDict = (NSMutableDictionary *)[aTimer userInfo]) != nil) { if (((shTimer = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsTimer]) != nil) && - ((shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]) != nil)) + ((shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]) != nil)) { [shTimer invalidate]; [hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsTimer]; @@ -1726,16 +1726,16 @@ static HIDRemote *sHIDRemote = nil; if (isPressed) { [hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:buttonCode] forKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]; - + if ((shTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:0.7] interval:0.1 target:self selector:@selector(_simulateHoldEvent:) userInfo:hidAttribsDict repeats:NO]) != nil) { [hidAttribsDict setObject:shTimer forKey:kHIDRemoteSimulateHoldEventsTimer]; - + // Using CFRunLoopAddTimer instead of [[NSRunLoop currentRunLoop] addTimer:.. for consistency with run loop modes. // The kCFRunLoopCommonModes counterpart NSRunLoopCommonModes is only available in 10.5 and later, whereas this code // is designed to be also compatible with 10.4. CFRunLoopTimerRef is "toll-free-bridged" with NSTimer since 10.0. CFRunLoopAddTimer(CFRunLoopGetCurrent(), (CFRunLoopTimerRef)shTimer, kCFRunLoopCommonModes); - + [shTimer release]; break; @@ -1745,7 +1745,7 @@ static HIDRemote *sHIDRemote = nil; { shTimer = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsTimer]; shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]; - + if ((shTimer!=nil) && (shButtonCode!=nil)) { [self _sendButtonCode:(HIDRemoteButtonCode)[shButtonCode unsignedIntValue] isPressed:YES hidAttribsDict:hidAttribsDict]; @@ -1762,10 +1762,10 @@ static HIDRemote *sHIDRemote = nil; [hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsTimer]; [hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]; - + break; } - + default: [self _sendButtonCode:buttonCode isPressed:isPressed hidAttribsDict:hidAttribsDict]; break; @@ -1807,14 +1807,14 @@ static HIDRemote *sHIDRemote = nil; } break; } - + // As soon as we have received a code that's unique to the Aluminum Remote, we can tell kHIDRemoteButtonCodePlayHold and kHIDRemoteButtonCodeCenterHold apart. // Prior to that, a long press of the new "Play" button will be submitted as a "kHIDRemoteButtonCodeCenterHold", not a "kHIDRemoteButtonCodePlayHold" code. if ((buttonCode == kHIDRemoteButtonCodeCenterHold) && (_lastSeenModel == kHIDRemoteModelAluminum)) { buttonCode = kHIDRemoteButtonCodePlayHold; } - + [((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self eventWithButton:(buttonCode & (~kHIDRemoteButtonCodeAluminumMask)) isPressed:isPressed fromHardwareWithAttributes:hidAttribsDict]; } } @@ -1822,19 +1822,19 @@ static HIDRemote *sHIDRemote = nil; - (void)_hidEventFor:(io_service_t)hidDevice from:(IOHIDQueueInterface **)interface withResult:(IOReturn)result { NSMutableDictionary *hidAttribsDict = [[[_serviceAttribMap objectForKey:[NSNumber numberWithUnsignedInt:(unsigned int)hidDevice]] retain] autorelease]; - + if (hidAttribsDict!=nil) { IOHIDQueueInterface **queueInterface = NULL; - + queueInterface = [[hidAttribsDict objectForKey:kHIDRemoteHIDQueueInterface] pointerValue]; - + if (interface == queueInterface) { NSNumber *lastButtonPressedNumber = nil; HIDRemoteButtonCode lastButtonPressed = kHIDRemoteButtonCodeNone; NSMutableDictionary *cookieButtonMap = nil; - + cookieButtonMap = [hidAttribsDict objectForKey:kHIDRemoteCookieButtonCodeLUT]; if ((lastButtonPressedNumber = [hidAttribsDict objectForKey:kHIDRemoteLastButtonPressed]) != nil) @@ -1846,27 +1846,27 @@ static HIDRemote *sHIDRemote = nil; { IOHIDEventStruct hidEvent; AbsoluteTime supportedTime = { 0,0 }; - + result = (*queueInterface)->getNextEvent( queueInterface, &hidEvent, supportedTime, 0); - + if (result == kIOReturnSuccess) { NSNumber *buttonCodeNumber = [cookieButtonMap objectForKey:[NSNumber numberWithUnsignedInt:(unsigned int) hidEvent.elementCookie]]; - + #ifdef _HIDREMOTE_EXTENSIONS // Debug logging code #define _HIDREMOTE_EXTENSIONS_SECTION 5 #include "HIDRemoteAdditions.h" #undef _HIDREMOTE_EXTENSIONS_SECTION #endif /* _HIDREMOTE_EXTENSIONS */ - + if (buttonCodeNumber!=nil) { HIDRemoteButtonCode buttonCode = [buttonCodeNumber unsignedIntValue]; - + if (hidEvent.value == 0) { if (buttonCode == lastButtonPressed) @@ -1891,21 +1891,21 @@ static HIDRemote *sHIDRemote = nil; { [((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self remoteIDChangedOldID:_lastSeenRemoteID newID:hidEvent.value forHardwareWithAttributes:hidAttribsDict]; } - + _lastSeenRemoteID = hidEvent.value; _lastSeenModel = kHIDRemoteModelUndetermined; } - + [self _handleButtonCode:buttonCode isPressed:YES hidAttribsDict:hidAttribsDict]; lastButtonPressed = buttonCode; } } } }; - + [hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:lastButtonPressed] forKey:kHIDRemoteLastButtonPressed]; } - + #ifdef _HIDREMOTE_EXTENSIONS // Debug logging code #define _HIDREMOTE_EXTENSIONS_SECTION 6 @@ -1940,9 +1940,9 @@ static HIDRemote *sHIDRemote = nil; { NSArray *consoleUsersArray; io_service_t rootService; - + if (_masterPort==0) { return; } - + if ((rootService = IORegistryGetRootEntry(_masterPort)) != 0) { if ((consoleUsersArray = (NSArray *)IORegistryEntryCreateCFProperty((io_registry_entry_t)rootService, CFSTR("IOConsoleUsers"), kCFAllocatorDefault, 0)) != nil) @@ -1950,14 +1950,14 @@ static HIDRemote *sHIDRemote = nil; if ([consoleUsersArray isKindOfClass:[NSArray class]]) // Be careful - ensure this really is an array { NSEnumerator *consoleUsersEnum; // I *love* Obj-C2's fast enumerators, but we need to stay compatible with 10.4 :-/ - + if ((consoleUsersEnum = [consoleUsersArray objectEnumerator]) != nil) { UInt64 secureEventInputPIDSum = 0; uid_t frontUserSession = 0; BOOL screenIsLocked = NO; NSDictionary *consoleUserDict; - + while ((consoleUserDict = [consoleUsersEnum nextObject]) != nil) { if ([consoleUserDict isKindOfClass:[NSDictionary class]]) // Be careful - ensure this really is a dictionary @@ -1966,7 +1966,7 @@ static HIDRemote *sHIDRemote = nil; NSNumber *onConsole; NSNumber *userID; NSNumber *screenIsLockedBool; - + if ((secureInputPID = [consoleUserDict objectForKey:@"kCGSSessionSecureInputPID"]) != nil) { if ([secureInputPID isKindOfClass:[NSNumber class]]) @@ -1974,7 +1974,7 @@ static HIDRemote *sHIDRemote = nil; secureEventInputPIDSum += ((UInt64) [secureInputPID intValue]); } } - + if (((onConsole = [consoleUserDict objectForKey:@"kCGSSessionOnConsoleKey"]) != nil) && ((userID = [consoleUserDict objectForKey:@"kCGSSessionUserIDKey"]) != nil)) { @@ -1986,7 +1986,7 @@ static HIDRemote *sHIDRemote = nil; } } } - + if ((screenIsLockedBool = [consoleUserDict objectForKey:@"CGSSessionScreenIsLocked"]) != nil) { if ([screenIsLockedBool isKindOfClass:[NSNumber class]]) @@ -2002,10 +2002,10 @@ static HIDRemote *sHIDRemote = nil; _lastScreenIsLocked = screenIsLocked; } } - + CFRelease((CFTypeRef)consoleUsersArray); } - + IOObjectRelease((io_object_t) rootService); } } @@ -2016,7 +2016,7 @@ static HIDRemote *sHIDRemote = nil; { HIDRemoteMode restartInMode = _mode; unsigned checkActiveRemoteControlCount = [self activeRemoteControlCount]; - + // Only restart when we already have active remote controls - to avoid race conditions with other applications using kHIDRemoteModeExclusive mode (new in V1.2.1) if (checkActiveRemoteControlCount > 0) { @@ -2024,7 +2024,7 @@ static HIDRemote *sHIDRemote = nil; [self stopRemoteControl]; [self startRemoteControl:restartInMode]; _isRestarting = NO; - + // Check whether we lost a remote control due to restarting/secure input change notification handling (new in V1.2.1) if (checkActiveRemoteControlCount != [self activeRemoteControlCount]) { @@ -2042,9 +2042,9 @@ static HIDRemote *sHIDRemote = nil; UInt64 old_lastSecureEventInputPIDSum = _lastSecureEventInputPIDSum; uid_t old_lastFrontUserSession = _lastFrontUserSession; BOOL old_lastScreenIsLocked = _lastScreenIsLocked; - + [self _updateSessionInformation]; - + if (((old_lastSecureEventInputPIDSum != _lastSecureEventInputPIDSum) || (old_lastFrontUserSession != _lastFrontUserSession) || (old_lastScreenIsLocked != _lastScreenIsLocked)) && _secureEventInputWorkAround) @@ -2082,7 +2082,7 @@ static HIDRemote *sHIDRemote = nil; #pragma mark - PRIVATE: IOKitLib Callbacks -static void HIDEventCallback( void * target, +static void HIDEventCallback( void * target, IOReturn result, void * refCon, void * sender) @@ -2114,7 +2114,7 @@ static void ServiceNotificationCallback(void * refCon, { HIDRemote *hidRemote = (HIDRemote *)refCon; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + [hidRemote _serviceNotificationFor:service messageType:messageType messageArgument:messageArgument]; @@ -2129,7 +2129,7 @@ static void SecureInputNotificationCallback( void * refCon, { HIDRemote *hidRemote = (HIDRemote *)refCon; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + [hidRemote _secureInputNotificationFor:service messageType:messageType messageArgument:messageArgument]; diff --git a/tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h b/tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h index 8650f87412..d57fef2fad 100644 --- a/tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h +++ b/tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h @@ -4,17 +4,17 @@ // // Created by Stephan Diederich on 21.09.08. // Copyright 2008 University Heidelberg. All rights reserved. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. @@ -36,7 +36,7 @@ #define ELOG(s, ...) NSLog(@"[ERROR] " s, ##__VA_ARGS__) #define DLOG(s, ...) LOG(s, ##__VA_ARGS__) #else -#define LOG(s, ...) +#define LOG(s, ...) #define ILOG(s, ...) NSLog(@"[INFO] " s, ##__VA_ARGS__) #define ELOG(s, ...) NSLog(@"[ERROR] " s, ##__VA_ARGS__) #define DLOG(s, ...) LOG(s, ##__VA_ARGS__) diff --git a/tools/EventClients/Clients/OSXRemote/XBMCHelper.h b/tools/EventClients/Clients/OSXRemote/XBMCHelper.h index 5aa984cda3..da33a8b603 100644 --- a/tools/EventClients/Clients/OSXRemote/XBMCHelper.h +++ b/tools/EventClients/Clients/OSXRemote/XBMCHelper.h @@ -21,7 +21,7 @@ - (void) enableVerboseMode:(bool) f_really; - (void) setApplicationPath:(NSString*) fp_app_path; -- (void) setApplicationHome:(NSString*) fp_home_path; +- (void) setApplicationHome:(NSString*) fp_home_path; - (void) connectToServer:(NSString*) fp_server onPort:(int) f_port withMode:(eRemoteMode) f_mode withTimeout:(double) f_timeout; - (void) disconnect; diff --git a/tools/EventClients/Clients/OSXRemote/XBMCHelper.m b/tools/EventClients/Clients/OSXRemote/XBMCHelper.m index d3f0d38bcb..018426a96c 100644 --- a/tools/EventClients/Clients/OSXRemote/XBMCHelper.m +++ b/tools/EventClients/Clients/OSXRemote/XBMCHelper.m @@ -148,7 +148,7 @@ [mp_wrapper handleEvent:ATV_BUTTON_RIGHT]; else [mp_wrapper handleEvent:ATV_BUTTON_RIGHT_RELEASE]; - break; + break; case kHIDRemoteButtonCodeCenter: if(isPressed) [mp_wrapper handleEvent:ATV_BUTTON_CENTER]; break; @@ -183,7 +183,7 @@ break; case kHIDRemoteButtonCodeCenterHold: if(isPressed) [mp_wrapper handleEvent:ATV_BUTTON_CENTER_H]; - break; + break; case kHIDRemoteButtonCodeMenuHold: if(isPressed) { [self checkAndLaunchApp]; //launch mp_app_path if it's not running @@ -202,13 +202,13 @@ // Notification of ID changes -- (void)hidRemote:(HIDRemote *)hidRemote remoteIDChangedOldID:(SInt32)old +- (void)hidRemote:(HIDRemote *)hidRemote remoteIDChangedOldID:(SInt32)old newID:(SInt32)newID forHardwareWithAttributes:(NSMutableDictionary *)attributes { if(m_verbose) NSLog(@"Change of remote ID from %d to %d", old, newID); [mp_wrapper switchRemote: newID]; - + } #pragma mark - diff --git a/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h b/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h index 7c78ef7920..08332f4030 100644 --- a/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h +++ b/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h @@ -10,12 +10,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #import <Cocoa/Cocoa.h> diff --git a/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm b/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm index 3bc580e51f..97b2e789f2 100644 --- a/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm +++ b/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm @@ -10,12 +10,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. @@ -31,12 +31,12 @@ class XBMCClientEventSequence{ public: XBMCClientEventSequence(){} - + //implicit conversion XBMCClientEventSequence(eATVClientEvent f_event){ m_stream.push_back(f_event); } - + std::string str() const{ std::stringstream ss; for(std::vector<eATVClientEvent>::const_iterator it = m_stream.begin(); @@ -49,7 +49,7 @@ public: void clear(){ m_stream.clear(); } - + // // operators // @@ -63,7 +63,7 @@ public: } friend bool operator <(XBMCClientEventSequence const& fcr_lhs,XBMCClientEventSequence const& fcr_rhs){ return fcr_lhs.m_stream < fcr_rhs.m_stream; - } + } friend bool operator ==(XBMCClientEventSequence const& fcr_lhs,XBMCClientEventSequence const& fcr_rhs){ return fcr_lhs.m_stream == fcr_rhs.m_stream; } @@ -83,7 +83,7 @@ class XBMCClientWrapperImpl{ tSequenceMap m_sequence_map; tMultiRemoteMap m_multiremote_map; eRemoteMode m_mode; - int m_socket; + int m_socket; std::string m_address; int m_port; XBMCClientEventSequence m_sequence; @@ -109,7 +109,7 @@ public: void switchRemote(int f_device_id){ m_device_id = f_device_id; } - void handleEvent(eATVClientEvent f_event); + void handleEvent(eATVClientEvent f_event); void enableVerboseMode(bool f_value){ m_verbose_mode = f_value; } @@ -122,7 +122,7 @@ void XBMCClientWrapperImpl::timerCallBack (CFRunLoopTimerRef timer, void *info) fprintf(stderr, "Error. invalid argument to timer callback\n"); return; } - + XBMCClientWrapperImpl *p_impl = (XBMCClientWrapperImpl *)info; p_impl->sendSequence(); p_impl->resetTimer(); @@ -136,12 +136,12 @@ void XBMCClientWrapperImpl::resetTimer(){ CFRelease(m_timer); m_timer = NULL; } -} +} void XBMCClientWrapperImpl::restartTimer(){ if (m_timer) - resetTimer(); - + resetTimer(); + CFRunLoopTimerContext context = { 0, this, 0, 0, 0 }; m_timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + m_sequence_timeout, 0, 0, 0, timerCallBack, &context); CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_timer, kCFRunLoopCommonModes); @@ -173,7 +173,7 @@ XBMCClientWrapperImpl::XBMCClientWrapperImpl(eRemoteMode f_mode, const std::stri NSLog(@"XBMCClientWrapperImpl started in normal mode sending to address %s, port %i", fcr_address.c_str(), f_port); populateEventMap(); } - + //open udp port etc m_socket = socket(AF_INET, SOCK_DGRAM, 0); if (m_socket < 0) @@ -185,7 +185,7 @@ XBMCClientWrapperImpl::XBMCClientWrapperImpl(eRemoteMode f_mode, const std::stri namespace { struct delete_second{ - template <class T> + template <class T> void operator ()(T& fr_pair){ delete fr_pair.second; } @@ -208,14 +208,14 @@ void XBMCClientWrapperImpl::sendButton(eATVClientEvent f_event){ if(m_mode == MULTIREMOTE_MODE){ tMultiRemoteMap::iterator it = m_multiremote_map.find(std::make_pair(m_device_id, f_event)); if(it == m_multiremote_map.end()){ - ELOG(@"XBMCClientWrapperImpl::sendButton: No mapping defined for remoteID: %i button %i", m_device_id, f_event); + ELOG(@"XBMCClientWrapperImpl::sendButton: No mapping defined for remoteID: %i button %i", m_device_id, f_event); return; } lp_packet = it->second; } else { tEventMap::iterator it = m_event_map.find(f_event); if(it == m_event_map.end()){ - ELOG(@"XBMCClientWrapperImpl::sendButton: No mapping defined for button %i", f_event); + ELOG(@"XBMCClientWrapperImpl::sendButton: No mapping defined for button %i", f_event); return; } lp_packet = it->second; @@ -224,7 +224,7 @@ void XBMCClientWrapperImpl::sendButton(eATVClientEvent f_event){ CAddress addr(m_address.c_str(), m_port); if(m_verbose_mode) NSLog(@"XBMCClientWrapperImpl::sendButton sending button %i down:%i up:%i", lp_packet->GetButtonCode(), lp_packet->GetFlags()&BTN_DOWN,lp_packet->GetFlags()&BTN_UP ); - lp_packet->Send(m_socket, addr); + lp_packet->Send(m_socket, addr); } void XBMCClientWrapperImpl::sendSequence(){ @@ -232,7 +232,7 @@ void XBMCClientWrapperImpl::sendSequence(){ if(it != m_sequence_map.end()){ CPacketBUTTON& packet = *(it->second); CAddress addr(m_address.c_str()); - packet.Send(m_socket, addr); + packet.Send(m_socket, addr); if(m_verbose_mode) NSLog(@"XBMCClientWrapperImpl::sendSequence sent sequence %i down:%i up:%i", packet.GetButtonCode(), packet.GetFlags()&BTN_DOWN,packet.GetFlags()&BTN_UP ); } else { @@ -241,12 +241,12 @@ void XBMCClientWrapperImpl::sendSequence(){ m_sequence.clear(); } -void XBMCClientWrapperImpl::handleEvent(eATVClientEvent f_event){ +void XBMCClientWrapperImpl::handleEvent(eATVClientEvent f_event){ if(m_mode != UNIVERSAL_MODE){ sendButton(f_event); } else { //in universal mode no keys are directly send. instead a key-sequence is assembled and a timer started - //when the timer expires, that key sequence is checked against predefined sequences and if it is a valid one, + //when the timer expires, that key sequence is checked against predefined sequences and if it is a valid one, //a button press is generated if(m_sequence.str().empty()){ if(isStartToken(f_event)){ @@ -271,7 +271,7 @@ void XBMCClientWrapperImpl::handleEvent(eATVClientEvent f_event){ void XBMCClientWrapperImpl::populateEventMap(){ tEventMap& lr_map = m_event_map; - + lr_map.insert(std::make_pair(ATV_BUTTON_CENTER, new CPacketBUTTON(5, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT, new CPacketBUTTON(4, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_RELEASE, new CPacketBUTTON(4, "CC:AppleRemote", BTN_UP | BTN_NO_REPEAT | BTN_QUEUE))); @@ -283,12 +283,12 @@ void XBMCClientWrapperImpl::populateEventMap(){ lr_map.insert(std::make_pair(ATV_BUTTON_UP_RELEASE, new CPacketBUTTON(1, "CC:AppleRemote", BTN_UP | BTN_QUEUE))); lr_map.insert(std::make_pair(ATV_BUTTON_DOWN, new CPacketBUTTON(2, "CC:AppleRemote", BTN_DOWN | BTN_QUEUE))); lr_map.insert(std::make_pair(ATV_BUTTON_DOWN_RELEASE, new CPacketBUTTON(2, "CC:AppleRemote", BTN_UP | BTN_QUEUE))); - + // only present on ATV <= 2.1 <--- check that; OSX seems to have the release parts - lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_H, new CPacketBUTTON(10, "CC:AppleRemote", BTN_DOWN | BTN_QUEUE))); - lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_H_RELEASE, new CPacketBUTTON(10, "CC:AppleRemote", BTN_UP | BTN_QUEUE))); + lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_H, new CPacketBUTTON(10, "CC:AppleRemote", BTN_DOWN | BTN_QUEUE))); + lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_H_RELEASE, new CPacketBUTTON(10, "CC:AppleRemote", BTN_UP | BTN_QUEUE))); lr_map.insert(std::make_pair(ATV_BUTTON_LEFT_H, new CPacketBUTTON(9, "CC:AppleRemote", BTN_DOWN | BTN_QUEUE))); - lr_map.insert(std::make_pair(ATV_BUTTON_LEFT_H_RELEASE, new CPacketBUTTON(9, "CC:AppleRemote", BTN_UP | BTN_QUEUE))); + lr_map.insert(std::make_pair(ATV_BUTTON_LEFT_H_RELEASE, new CPacketBUTTON(9, "CC:AppleRemote", BTN_UP | BTN_QUEUE))); //new aluminium remote buttons lr_map.insert(std::make_pair(ATV_BUTTON_PLAY, new CPacketBUTTON(12, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); @@ -296,7 +296,7 @@ void XBMCClientWrapperImpl::populateEventMap(){ // only present on atv >= 2.2 lr_map.insert(std::make_pair(ATV_BUTTON_CENTER_H, new CPacketBUTTON(7, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); - + //learned remote buttons (ATV >=2.3) lr_map.insert(std::make_pair(ATV_LEARNED_PLAY, new CPacketBUTTON(70, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); lr_map.insert(std::make_pair(ATV_LEARNED_PAUSE, new CPacketBUTTON(71, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); @@ -321,7 +321,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){ m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(23, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(24, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(25, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); - + sequence_prefix.clear(); sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_CENTER; m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(26, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); @@ -330,7 +330,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){ m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(29, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(30, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(31, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); - + sequence_prefix.clear(); sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_UP; m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(32, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); @@ -339,7 +339,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){ m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(35, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(36, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(37, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); - + sequence_prefix.clear(); sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_DOWN; m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(38, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); @@ -348,7 +348,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){ m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(41, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(42, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(43, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); - + sequence_prefix.clear(); sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_RIGHT; m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(44, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); @@ -357,7 +357,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){ m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(47, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(48, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(49, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); - + sequence_prefix.clear(); sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_LEFT; m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(50, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); @@ -376,11 +376,11 @@ void XBMCClientWrapperImpl::populateMultiRemoteModeMap(){ { // keymaps for mult-apple-remote, including the device-key sent after remote-switch // we just add them here with unique button numbers and do the real mapping in keymap.xml - // as an offset for the buttons we use the device - + // as an offset for the buttons we use the device + // this loop should probably be replaced by a proper setting of the individual keys // cons: currently only button-codes (aka ints) are sent - // way too lazy ;) + // way too lazy ;) // pro: custom tweaks. e.g. button 1 on the harmony may be (153, ATV_BUTTON_LEFT) and this should not get a repeat // maybe use the loop and tweak individual buttons later; plex maps here to strings, and later in keymap.xml to other strings, // but this may need another kind of remote in XBMC source @@ -388,22 +388,22 @@ void XBMCClientWrapperImpl::populateMultiRemoteModeMap(){ m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_UP_RELEASE), new CPacketBUTTON(1 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_DOWN), new CPacketBUTTON(2 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_DOWN_RELEASE), new CPacketBUTTON(2 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE))); - + m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT), new CPacketBUTTON(3 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_RELEASE), new CPacketBUTTON(3 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_RIGHT), new CPacketBUTTON(4 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_RIGHT_RELEASE), new CPacketBUTTON(4 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE))); - + m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_CENTER), new CPacketBUTTON(5 + offset, "CC:Harmony", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_MENU), new CPacketBUTTON(6 + offset, "CC:Harmony", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_CENTER_H), new CPacketBUTTON(7 + offset, "CC:Harmony", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_MENU_H), new CPacketBUTTON(8 + offset, "CC:Harmony", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE))); - + m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_RIGHT_H), new CPacketBUTTON(9 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE))); m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_RIGHT_H_RELEASE),new CPacketBUTTON(9 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE))); - - m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_H), new CPacketBUTTON(10 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE))); - m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_H_RELEASE),new CPacketBUTTON(10 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE))); + + m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_H), new CPacketBUTTON(10 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE))); + m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_H_RELEASE),new CPacketBUTTON(10 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE))); } } @@ -413,7 +413,7 @@ void XBMCClientWrapperImpl::populateMultiRemoteModeMap(){ } - (id) initWithMode:(eRemoteMode) f_mode serverAddress:(NSString*) fp_server port:(int) f_port verbose:(bool) f_verbose{ if( ![super init] ) - return nil; + return nil; mp_impl = new XBMCClientWrapperImpl(f_mode, [fp_server UTF8String], f_port, f_verbose); return self; } diff --git a/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm b/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm index 9895629215..8670d06c81 100644 --- a/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm +++ b/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm @@ -37,7 +37,7 @@ static struct option long_options[] = { { "verbose", no_argument, 0, 'v' }, { "externalConfig", no_argument, 0, 'x' }, { "appPath", required_argument, 0, 'a' }, -{ "appHome", required_argument, 0, 'z' }, +{ "appHome", required_argument, 0, 'z' }, { 0, 0, 0, 0 }, }; @@ -67,30 +67,30 @@ void ReadConfig() // Compute filename. std::string strFile = getenv("HOME"); strFile += "/Library/Application Support/Kodi/XBMCHelper.conf"; - + // Open file. std::ifstream ifs(strFile.c_str()); if (!ifs) return; - + // Read file. stringstream oss; oss << ifs.rdbuf(); - + if (!ifs && !ifs.eof()) return; - + // Tokenize. string strData(oss.str()); istringstream is(strData); vector<string> args = vector<string>(istream_iterator<string>(is), istream_iterator<string>()); - + // Convert to char**. int argc = args.size() + 1; char** argv = new char*[argc + 1]; int i = 0; argv[i++] = (char*)"XBMCHelper"; - + for (vector<string>::iterator it = args.begin(); it != args.end(); ){ //fixup the arguments, here: remove '"' like bash would normally do std::string::size_type j = 0; @@ -98,12 +98,12 @@ void ReadConfig() it->replace(j, 1, ""); argv[i++] = (char* )(*it++).c_str(); } - + argv[i] = 0; - + // Parse the arguments. ParseOptions(argc, argv); - + delete[] argv; } @@ -122,8 +122,8 @@ void ParseOptions(int argc, char** argv) g_universal_timeout = 0.5; g_verbose_mode = false; NSLog(@"ParseOptions - force VerboseMode on"); - - while ((c = getopt_long(argc, argv, options, long_options, &option_index)) != -1) + + while ((c = getopt_long(argc, argv, options, long_options, &option_index)) != -1) { switch (c) { case 'h': @@ -150,7 +150,7 @@ void ParseOptions(int argc, char** argv) case 'm': g_mode = MULTIREMOTE_MODE; NSLog(@"ParseOptions - MultiRemoteMode on"); - break; + break; case 't': g_universal_timeout = atof(optarg) * 0.001; NSLog(@"ParseOptions - Universal Timeout %lf", g_universal_timeout); @@ -178,22 +178,22 @@ void ParseOptions(int argc, char** argv) //reset getopts state optreset = 1; optind = 0; - + if (readExternal == true) - ReadConfig(); - + ReadConfig(); + } //---------------------------------------------------------------------------- void ConfigureHelper(){ [gp_xbmchelper enableVerboseMode:g_verbose_mode]; - + //set apppath to startup when pressing Menu - [gp_xbmchelper setApplicationPath:[NSString stringWithUTF8String:g_app_path.c_str()]]; + [gp_xbmchelper setApplicationPath:[NSString stringWithUTF8String:g_app_path.c_str()]]; //set apppath to startup when pressing Menu [gp_xbmchelper setApplicationHome:[NSString stringWithUTF8String:g_app_home.c_str()]]; //connect to specified server - [gp_xbmchelper connectToServer:[NSString stringWithUTF8String:g_server_address.c_str()] onPort:g_server_port withMode:g_mode withTimeout: g_universal_timeout]; + [gp_xbmchelper connectToServer:[NSString stringWithUTF8String:g_server_address.c_str()] onPort:g_server_port withMode:g_mode withTimeout: g_universal_timeout]; } //---------------------------------------------------------------------------- @@ -215,32 +215,32 @@ void Reconfigure(int nSignal) //---------------------------------------------------------------------------- int main (int argc, char * argv[]) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - + int instanceLockFile = open("/tmp/xbmchelper.lock", O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); if (flock(instanceLockFile, LOCK_EX | LOCK_NB) != 0) { NSLog(@"Already running - exiting ..."); return 0; } - + ParseOptions(argc,argv); NSLog(@"%s %s starting up...", PROGNAME, PROGVERS); - gp_xbmchelper = [[XBMCHelper alloc] init]; + gp_xbmchelper = [[XBMCHelper alloc] init]; if(gp_xbmchelper){ signal(SIGHUP, Reconfigure); signal(SIGINT, Reconfigure); signal(SIGTERM, Reconfigure); - + ConfigureHelper(); - + //run event loop in this thread RunCurrentEventLoop(kEventDurationForever); NSLog(@"%s %s exiting...", PROGNAME, PROGVERS); //cleanup - [gp_xbmchelper release]; + [gp_xbmchelper release]; } else { - NSLog(@"%s %s failed to initialize remote.", PROGNAME, PROGVERS); + NSLog(@"%s %s failed to initialize remote.", PROGNAME, PROGVERS); return -1; } [pool drain]; diff --git a/tools/EventClients/Clients/PS3SixaxisController/ps3d.py b/tools/EventClients/Clients/PS3SixaxisController/ps3d.py index 254a17961c..f961cf8d33 100755 --- a/tools/EventClients/Clients/PS3SixaxisController/ps3d.py +++ b/tools/EventClients/Clients/PS3SixaxisController/ps3d.py @@ -261,7 +261,7 @@ class SixWatch(threading.Thread): class ZeroconfThread ( threading.Thread ): """ - + """ def __init__(self): threading.Thread.__init__(self) diff --git a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp index 825bce4f6c..d18ae8a015 100644 --- a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp +++ b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp @@ -59,20 +59,20 @@ void CWiiRemote::MessageCallback(cwiid_wiimote_t *wiiremote, int mesg_count, uni #endif /* The MessageCallback for the Wiiremote. - This callback is used for error reports, mainly to see if the connection has been broken + This callback is used for error reports, mainly to see if the connection has been broken This callback is also used for getting the IR sources, if this is done in update as with buttons we usually only get 1 IR source at a time wich is much harder to calculate */ void CWiiRemote::MessageCallback(cwiid_wiimote_t *wiiremote, int mesg_count, union cwiid_mesg mesg[], struct timespec *timestamp) { for (int i=0; i < mesg_count; i++) { int valid_source; - switch (mesg[i].type) + switch (mesg[i].type) { case CWIID_MESG_IR: valid_source = 0; - for (int j = 0; j < CWIID_IR_SRC_COUNT; j++) + for (int j = 0; j < CWIID_IR_SRC_COUNT; j++) { - if (mesg[i].ir_mesg.src[j].valid) + if (mesg[i].ir_mesg.src[j].valid) valid_source++; } if (valid_source == 2) @@ -87,7 +87,7 @@ void CWiiRemote::MessageCallback(cwiid_wiimote_t *wiiremote, int mesg_count, uni g_WiiRemote.CalculateMousePointer(mesg[i].ir_mesg.src[0].pos[CWIID_X], mesg[i].ir_mesg.src[0].pos[CWIID_Y], mesg[i].ir_mesg.src[1].pos[CWIID_X], - mesg[i].ir_mesg.src[1].pos[CWIID_Y]); + mesg[i].ir_mesg.src[1].pos[CWIID_Y]); } break; case CWIID_MESG_ERROR: @@ -95,7 +95,7 @@ void CWiiRemote::MessageCallback(cwiid_wiimote_t *wiiremote, int mesg_count, uni break; case CWIID_MESG_BTN: g_WiiRemote.ProcessKey(mesg[i].btn_mesg.buttons); - break; + break; case CWIID_MESG_STATUS: //Here we can figure out Extension types and such break; @@ -227,13 +227,13 @@ void CWiiRemote::Initialize(CAddress Addr, int Socket) ToggleBit(m_rptMode, CWIID_RPT_NUNCHUK); //If wiiremote is used as a mouse, then report the IR sources -#ifndef CWIID_OLD - if (m_useIRMouse) +#ifndef CWIID_OLD + if (m_useIRMouse) #endif - ToggleBit(m_rptMode, CWIID_RPT_IR); + ToggleBit(m_rptMode, CWIID_RPT_IR); //Have the first and fourth LED on the Wiiremote shine when connected - ToggleBit(m_ledState, CWIID_LED1_ON); + ToggleBit(m_ledState, CWIID_LED1_ON); ToggleBit(m_ledState, CWIID_LED4_ON); } @@ -267,9 +267,9 @@ void CWiiRemote::EnableMouseEmulation() m_useIRMouse = true; #ifndef CWIID_OLD - //We toggle IR Reporting (Save resources?) + //We toggle IR Reporting (Save resources?) if (!(m_rptMode & CWIID_RPT_IR)) - ToggleBit(m_rptMode, CWIID_RPT_IR); + ToggleBit(m_rptMode, CWIID_RPT_IR); if (m_connected) SetRptMode(); #endif @@ -285,7 +285,7 @@ void CWiiRemote::DisableMouseEmulation() m_useIRMouse = false; #ifndef CWIID_OLD - //We toggle IR Reporting (Save resources?) + //We toggle IR Reporting (Save resources?) if (m_rptMode & CWIID_RPT_IR) ToggleBit(m_rptMode, CWIID_RPT_IR); if (m_connected) @@ -308,18 +308,18 @@ void CWiiRemote::Disconnect() if (m_connected) m_DisconnectWhenPossible = true; } - -#ifdef CWIID_OLD + +#ifdef CWIID_OLD /* This function is mostly a hack as CWIID < 6.0 doesn't report on disconnects, this function is called everytime a message is sent to the callback (Will be once every 10 ms or so) this is to see if the connection is interrupted. */ void CWiiRemote::CheckIn() { //This is always called from a criticalsection m_LastMsgTime = getTicks(); -} -#endif +} +#endif //---------------------Private------------------------------------------------------------------- -/* Connect is designed to be run in a different thread as it only +/* Connect is designed to be run in a different thread as it only exits if wiiremote is either disabled or a connection is made*/ bool CWiiRemote::Connect() { @@ -356,10 +356,10 @@ bool CWiiRemote::Connect() notification.Send(m_Socket, m_MyAddr); } #ifdef CWIID_OLD - /* CheckIn to say that this is the last msg, If this isn't called it could give issues if we Connects -> Disconnect and then try to connect again + /* CheckIn to say that this is the last msg, If this isn't called it could give issues if we Connects -> Disconnect and then try to connect again the CWIID_OLD hack would automatically disconnect the wiiremote as the lastmsg is too old. */ CheckIn(); -#endif +#endif m_connected = true; CPacketLOG log(LOGNOTICE, "Successfully connected a WiiRemote"); @@ -397,7 +397,7 @@ void CWiiRemote::DisconnectNow(bool startConnectThread) } #ifdef CWIID_OLD -/* This is a harsh check if there really is a connection, It will mainly be used in CWIID < 6.0 +/* This is a harsh check if there really is a connection, It will mainly be used in CWIID < 6.0 as it doesn't report connect error, wich is needed to see if the Wiiremote suddenly disconnected. This could possible be done with bluetooth specific queries but I cannot find how to do it. */ bool CWiiRemote::CheckConnection() @@ -451,7 +451,7 @@ void CWiiRemote::ProcessKey(int Key) } else { - if (getTicks() - m_lastKeyPressed > WIIREMOTE_BUTTON_DELAY_TIME) + if (getTicks() - m_lastKeyPressed > WIIREMOTE_BUTTON_DELAY_TIME) { m_buttonRepeat = true; m_lastKeyPressed = getTicks(); @@ -471,12 +471,12 @@ void CWiiRemote::ProcessKey(int Key) RtnKey = 3; else if (Key == CWIID_BTN_DOWN) RtnKey = 2; - + else if (Key == CWIID_BTN_A) RtnKey = 5; else if (Key == CWIID_BTN_B) RtnKey = 6; - + else if (Key == CWIID_BTN_MINUS) RtnKey = 7; else if (Key == CWIID_BTN_PLUS) @@ -484,7 +484,7 @@ void CWiiRemote::ProcessKey(int Key) else if (Key == CWIID_BTN_HOME) RtnKey = 8; - + else if (Key == CWIID_BTN_1) RtnKey = 10; else if (Key == CWIID_BTN_2) @@ -546,7 +546,7 @@ void CWiiRemote::ProcessNunchuck(struct cwiid_nunchuk_mesg &Nunchuck) } else { - if (getTicks() - m_lastKeyPressedNunchuck > WIIREMOTE_BUTTON_DELAY_TIME) + if (getTicks() - m_lastKeyPressedNunchuck > WIIREMOTE_BUTTON_DELAY_TIME) { m_buttonRepeatNunchuck = true; m_lastKeyPressedNunchuck = getTicks(); @@ -575,7 +575,7 @@ void CWiiRemote::SetRptMode() { //Sets our wiiremote to report something, for example IR, Buttons #ifdef CWIID_OLD if (cwiid_command(m_wiiremoteHandle, CWIID_CMD_RPT_MODE, m_rptMode)) -#else +#else if (cwiid_set_rpt_mode(m_wiiremoteHandle, m_rptMode)) #endif { @@ -588,7 +588,7 @@ void CWiiRemote::SetLedState() { //Sets our leds on the wiiremote #ifdef CWIID_OLD if (cwiid_command(m_wiiremoteHandle, CWIID_CMD_LED, m_ledState)) -#else +#else if (cwiid_set_led(m_wiiremoteHandle, m_ledState)) #endif { @@ -749,7 +749,7 @@ int main(int argc, char **argv) g_WiiRemote.EnableMouseEmulation(); else g_WiiRemote.DisableMouseEmulation(); - + g_Ping->Send(sockfd, my_addr); bool HaveConnected = false; while (true) diff --git a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h index 003f40f18d..58d051e1d2 100644 --- a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h +++ b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h @@ -70,13 +70,13 @@ class CWiiRemote public: CWiiRemote(char *btaddr = NULL); ~CWiiRemote(); - + void Initialize(CAddress Addr, int Socket); - void Disconnect(); + void Disconnect(); bool GetConnected(); bool EnableWiiRemote(); - bool DisableWiiRemote(); + bool DisableWiiRemote(); void Update(); @@ -86,7 +86,7 @@ public: void EnableMouseEmulation(); void DisableMouseEmulation(); - bool Connect(); + bool Connect(); void SetBluetoothAddress(const char * btaddr); void SetSensitivity(float DeadX, float DeadY, int Samples); @@ -103,7 +103,7 @@ private: #ifdef CWIID_OLD bool CheckConnection(); int m_LastMsgTime; -#endif +#endif char *m_JoyMap; int m_lastKeyPressed; int m_LastKey; @@ -117,12 +117,12 @@ private: void SetLedState(); void SetupWiiRemote(); - + bool m_connected; bool m_DisconnectWhenPossible; bool m_connectThreadRunning; - + //CWIID Specific cwiid_wiimote_t *m_wiiremoteHandle; unsigned char m_ledState; @@ -141,25 +141,25 @@ private: int m_Socket; CAddress m_MyAddr; - - // Mouse + + // Mouse bool m_haveIRSources; bool m_isActive; bool m_useIRMouse; int m_lastActiveTime; - -/* The protected functions is for the static callbacks */ + +/* The protected functions is for the static callbacks */ protected: //Connection void DisconnectNow(bool startConnectThread); - + //Mouse void CalculateMousePointer(int x1, int y1, int x2, int y2); // void SetIR(bool set); - + //Button void ProcessKey(int Key); - + //Nunchuck void ProcessNunchuck(struct cwiid_nunchuk_mesg &Nunchuck); #ifdef CWIID_OLD diff --git a/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp b/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp index e24c8ed2c9..48f5a1a947 100644 --- a/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp +++ b/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp @@ -39,11 +39,11 @@ void CWiiController::get_keys(wiimote* wm) } } -void CWiiController::handleKeyPress() +void CWiiController::handleKeyPress() { if ((m_holdableReleased && m_buttonDownTime < g_hold_button_timeout)) EventClient.SendButton(m_buttonReleased, m_joyString, BTN_QUEUE | BTN_NO_REPEAT); - if (m_buttonPressed && !m_holdableHeld && !m_buttonHeld) + if (m_buttonPressed && !m_holdableHeld && !m_buttonHeld) EventClient.SendButton(m_buttonPressed, m_joyString, BTN_QUEUE | BTN_NO_REPEAT); } @@ -66,7 +66,7 @@ void CWiiController::handleACC(float currentRoll, float currentPitch) if (rollWeight > 65000) rollWeight = 65000; - if (m_start_pitch == 0) + if (m_start_pitch == 0) m_start_pitch = currentPitch; m_abs_pitch = smoothDeg(m_abs_pitch, currentPitch); m_rel_pitch = m_start_pitch - m_abs_pitch; @@ -81,7 +81,7 @@ void CWiiController::handleACC(float currentRoll, float currentPitch) { m_currentAction = ACTION_ROLL; } - else if ((g_deadzone - (abs((int)m_rel_pitch)) < 5) && (abs((int)m_abs_roll) < (g_deadzone / 1.5))) + else if ((g_deadzone - (abs((int)m_rel_pitch)) < 5) && (abs((int)m_abs_roll) < (g_deadzone / 1.5))) // crossed the pitch deadzone threshold while inside the roll deadzone { m_currentAction = ACTION_PITCH; @@ -126,7 +126,7 @@ int connectWiimote(wiimote** wiimotes) wm = wiimotes[0]; if (connected) { - EventClient.SendHELO("Wii Remote", ICON_PNG, NULL); + EventClient.SendHELO("Wii Remote", ICON_PNG, NULL); wiiuse_set_leds(wm, WIIMOTE_LED_1); wiiuse_rumble(wm, 1); wiiuse_set_orient_threshold(wm,1); @@ -193,7 +193,7 @@ int32_t getTicks(void) return ticks; } -int main(int argc, char** argv) +int main(int argc, char** argv) { int32_t timeout = 0; bool connected = 0; @@ -217,13 +217,13 @@ int main(int argc, char** argv) if ((controller.m_buttonDownTime > g_repeat_rate) && controller.m_repeatableHeld) controller.handleRepeat(); } - if (wiiuse_poll(wiimotes, MAX_WIIMOTES)) + if (wiiuse_poll(wiimotes, MAX_WIIMOTES)) { for (int i = 0; i < MAX_WIIMOTES; ++i) //MAX_WIIMOTES hardcoded at 1. { DisableMotionSensing(wm); - switch (wiimotes[i]->event) + switch (wiimotes[i]->event) { case WIIUSE_EVENT: diff --git a/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h b/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h index d231436546..7226137364 100644 --- a/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h +++ b/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h @@ -48,11 +48,11 @@ #define WIIMOTE_BUTTON_DOWN 0x0400 #define WIIMOTE_BUTTON_UP 0x0800 #define WIIMOTE_BUTTON_PLUS 0x1000 - + #define WIIMOTE_NUM_BUTTONS 11 #define KEYCODE_BUTTON_UP 1 #define KEYCODE_BUTTON_DOWN 2 -#define KEYCODE_BUTTON_LEFT 3 +#define KEYCODE_BUTTON_LEFT 3 #define KEYCODE_BUTTON_RIGHT 4 #define KEYCODE_BUTTON_A 5 #define KEYCODE_BUTTON_B 6 @@ -95,7 +95,7 @@ class CWiiController{ float m_start_roll; float m_start_pitch; char* m_joyString; - + void get_keys(wiimote* wm); void handleKeyPress(); diff --git a/tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial b/tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial index b556a2278c..ea8fae6d14 100644 --- a/tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial +++ b/tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial @@ -15,7 +15,7 @@ in works that are PROPRIETARY. the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. - 0. Additional Definitions. + 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU @@ -116,7 +116,7 @@ the following: a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked - Version. + Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the diff --git a/tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp b/tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp index 077914f446..106befba98 100644 --- a/tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp +++ b/tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp @@ -102,7 +102,7 @@ void checkAll(Xbox360Controller &cont) checkThumb(cont, client, 1, "leftthumbstickdown", "leftthumbstickup"); checkThumb(cont, client, 2, "rightthumbstickleft", "rightthumbstickright"); checkThumb(cont, client, 3, "rightthumbstickdown", "rightthumbstickup"); - } + } } int main(int argc, char* argv[]) diff --git a/tools/EventClients/Clients/Xbox360Controller/targetver.h b/tools/EventClients/Clients/Xbox360Controller/targetver.h index 6fe8eb79e1..5697f1a757 100644 --- a/tools/EventClients/Clients/Xbox360Controller/targetver.h +++ b/tools/EventClients/Clients/Xbox360Controller/targetver.h @@ -1,8 +1,8 @@ #pragma once // The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and // including the version specified. // Modify the following defines if you have to target a platform prior to the ones specified below. diff --git a/tools/EventClients/examples/java/XBMCDemoClient1.java b/tools/EventClients/examples/java/XBMCDemoClient1.java index 0be3865cbd..922d4d64ed 100644 --- a/tools/EventClients/examples/java/XBMCDemoClient1.java +++ b/tools/EventClients/examples/java/XBMCDemoClient1.java @@ -22,23 +22,23 @@ public class XBMCDemoClient1 { Thread.sleep(20000); XBMCClient oXBMCClient = new XBMCClient(host, 9777, "My Client", "/usr/share/xbmc/media/icon.png"); - + Thread.sleep(7000); - + oXBMCClient.sendNotification("My Title", "My Message"); - - + + Thread.sleep(7000); oXBMCClient.sendButton("KB", "escape", false, true, false, (short)0 , (byte)0); - + Thread.sleep(7000); oXBMCClient.sendButton("KB", "escape", true, true, false, (short)0 , (byte)0); oXBMCClient.sendNotification("My Title", "Escape sent"); - + Thread.sleep(1000); - + oXBMCClient.sendButton("KB", "escape", true, false, false, (short)0 , (byte)0); oXBMCClient.sendNotification("My Title", "Escape released"); @@ -46,7 +46,7 @@ public class XBMCDemoClient1 { oXBMCClient.sendLog((byte)0, "My Client disconnects...."); oXBMCClient.sendNotification("My Title", "Client will disconnect"); oXBMCClient.stopClient(); - + } } diff --git a/tools/EventClients/examples/python/example_action.py b/tools/EventClients/examples/python/example_action.py index 6de0bb3825..16b270c235 100755 --- a/tools/EventClients/examples/python/example_action.py +++ b/tools/EventClients/examples/python/example_action.py @@ -13,7 +13,7 @@ def main(): host = "localhost" port = 9777 - + # Create an XBMCClient object and connect xbmc = XBMCClient("Example Remote", "../../icons/bluetooth.png") xbmc.connect() @@ -28,7 +28,7 @@ def main(): except Exception as e: print(str(e)) xbmc.send_action("ActivateWindow(ShutdownMenu)") - + # ok we're done, close the connection # Note that closing the connection clears any repeat key that is diff --git a/tools/EventClients/examples/python/example_button2.py b/tools/EventClients/examples/python/example_button2.py index b420bd84b8..e2ec759bb4 100755 --- a/tools/EventClients/examples/python/example_button2.py +++ b/tools/EventClients/examples/python/example_button2.py @@ -61,7 +61,7 @@ def main(): # doesn't matter. packet = PacketBUTTON(code=0x28, down=0) packet.send(sock, addr) - + # ok we're done, close the connection # Note that closing the connection clears any repeat key that is # active. So in this example, the actual release button event above diff --git a/tools/EventClients/examples/python/example_notification.py b/tools/EventClients/examples/python/example_notification.py index 81bbadccd2..72c0bbcb8d 100755 --- a/tools/EventClients/examples/python/example_notification.py +++ b/tools/EventClients/examples/python/example_notification.py @@ -13,26 +13,26 @@ from socket import * def main(): import time import sys - + host = "localhost" port = 9777 addr = (host, port) sock = socket(AF_INET,SOCK_DGRAM) - + packet = PacketHELO("Email Notifier", ICON_NONE) packet.send(sock, addr) # wait for 5 seconds time.sleep (5) - + packet = PacketNOTIFICATION("New Mail!", # caption "RE: Check this out", # message ICON_PNG, # optional icon type "../../icons/mail.png") # icon file (local) packet.send(sock, addr) - + packet = PacketBYE() packet.send(sock, addr) - + if __name__=="__main__": main() diff --git a/tools/EventClients/examples/python/example_simple.py b/tools/EventClients/examples/python/example_simple.py index 6218131e13..f28b002841 100755 --- a/tools/EventClients/examples/python/example_simple.py +++ b/tools/EventClients/examples/python/example_simple.py @@ -13,7 +13,7 @@ def main(): host = "localhost" port = 9777 - + # Create an XBMCClient object and connect xbmc = XBMCClient("Example Remote", "../../icons/bluetooth.png") xbmc.connect() diff --git a/tools/EventClients/lib/c++/xbmcclient.h b/tools/EventClients/lib/c++/xbmcclient.h index b6465af6ce..59e3f15297 100644 --- a/tools/EventClients/lib/c++/xbmcclient.h +++ b/tools/EventClients/lib/c++/xbmcclient.h @@ -103,7 +103,7 @@ public: CAddress(const char *Address, int Port = STD_PORT) { m_Addr.sin_port = htons(Port); - + struct hostent *h; if (Address == NULL || (h=gethostbyname(Address)) == NULL) { @@ -329,7 +329,7 @@ public: unsigned int len = strlen(DevName); for (unsigned int i = 0; i < len; i++) - m_DeviceName.push_back(DevName[i]); + m_DeviceName.push_back(DevName[i]); m_IconType = IconType; @@ -647,7 +647,7 @@ public: m_Payload.push_back(((m_Y & 0xff00) >> 8)); m_Payload.push_back( (m_Y & 0x00ff)); } - + virtual ~CPacketMOUSE() { } }; @@ -692,7 +692,7 @@ public: m_Payload.push_back('\0'); } - + virtual ~CPacketLOG() { } }; @@ -728,7 +728,7 @@ public: m_Payload.push_back('\0'); } - + virtual ~CPacketACTION() { } }; diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java index f9c9041ba3..09507cbe1b 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java @@ -73,15 +73,15 @@ import java.net.InetAddress; * */ public abstract class Packet { - + private byte[] sig; private byte[] payload = new byte[0]; private byte minver; private byte majver; - - private short packettype; - - + + private short packettype; + + private final static short MAX_PACKET_SIZE = 1024; private final static short HEADER_SIZE = 32; private final static short MAX_PAYLOAD_SIZE = MAX_PACKET_SIZE - HEADER_SIZE; @@ -102,16 +102,16 @@ public abstract class Packet { public final static byte ICON_JPEG = 0x01; public final static byte ICON_PNG = 0x02; public final static byte ICON_GIF = 0x03; - + private static int uid = (int)(Math.random()*Integer.MAX_VALUE); - + /** * This is an Abstract class and cannot be instanced. Please use one of the Packet implementation Classes - * (PacketXXX). - * + * (PacketXXX). + * * Implements an XBMC Event Client Packet. Type is to be specified at creation time, Payload can be added * with the various appendPayload methods. Packet can be sent through UDP-Socket with method "send". - * @param packettype Type of Packet (PT_XXX) + * @param packettype Type of Packet (PT_XXX) */ protected Packet(short packettype) { @@ -122,7 +122,7 @@ public abstract class Packet { } /** - * Appends a String to the payload (terminated with 0x00) + * Appends a String to the payload (terminated with 0x00) * @param payload Payload as String */ protected void appendPayload(String payload) @@ -172,7 +172,7 @@ public abstract class Packet { protected void appendPayload(short s) { appendPayload(shortToByteArray(s)); } - + /** * Get Number of Packets which will be sent with current Payload... * @return Number of Packets @@ -181,7 +181,7 @@ public abstract class Packet { { return (int)((payload.length + (MAX_PAYLOAD_SIZE - 1)) / MAX_PAYLOAD_SIZE); } - + /** * Get Header for a specific Packet in this sequence... * @param seq Current sequence number @@ -207,10 +207,10 @@ public abstract class Packet { System.arraycopy(uid, 0, header, 18, 4); byte[] reserved = new byte[10]; System.arraycopy(reserved, 0, header, 22, 10); - + return header; } - + /** * Generates the whole UDP-Message with Header and Payload of a specific Packet in sequence * @param seq Current sequence number @@ -221,23 +221,23 @@ public abstract class Packet { int maxseq = (int)((payload.length + (MAX_PAYLOAD_SIZE - 1)) / MAX_PAYLOAD_SIZE); if(seq > maxseq) return null; - + short actpayloadsize; - + if(seq == maxseq) actpayloadsize = (short)(payload.length%MAX_PAYLOAD_SIZE); - + else actpayloadsize = (short)MAX_PAYLOAD_SIZE; byte[] pack = new byte[HEADER_SIZE+actpayloadsize]; - + System.arraycopy(getHeader(seq, maxseq, actpayloadsize), 0, pack, 0, HEADER_SIZE); System.arraycopy(payload, (seq-1)*MAX_PAYLOAD_SIZE, pack, HEADER_SIZE, actpayloadsize); - + return pack; } - + /** * Sends this packet to the EventServer * @param adr Address of the EventServer @@ -248,7 +248,7 @@ public abstract class Packet { { int maxseq = getNumPackets(); DatagramSocket s = new DatagramSocket(); - + // For each Packet in Sequence... for(int seq=1;seq<=maxseq;seq++) { @@ -260,7 +260,7 @@ public abstract class Packet { s.send(p); } } - + /** * Helper Method to convert an integer to a Byte array * @param value @@ -285,5 +285,5 @@ public abstract class Packet { (byte)value}; } - + } diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java index 878710c3a9..eb597a21bf 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java @@ -19,18 +19,18 @@ package org.xbmc.eventclient; /** * XBMC Event Client Class - * + * * An ACTION packet tells XBMC to do the action specified, based on the type it knows were it needs to be sent. * The idea is that this will be as in scripting/skining and keymapping, just triggered from afar. * @author Stefan Agner * */ public class PacketACTION extends Packet { - + public final static byte ACTION_EXECBUILTIN = 0x01; public final static byte ACTION_BUTTON = 0x02; - + /** * An ACTION packet tells XBMC to do the action specified, based on the type it knows were it needs to be sent. * @param actionmessage Actionmessage (as in scripting/skinning) @@ -52,7 +52,7 @@ public class PacketACTION extends Packet { super(PT_ACTION); appendPayload(actionmessage, actiontype); } - + private void appendPayload(String actionmessage, byte actiontype) { appendPayload(actiontype); diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java index b4ba1bbff2..de25a2c96d 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java @@ -19,13 +19,13 @@ package org.xbmc.eventclient; /** * XBMC Event Client Class - * + * * A button packet send a key press or release event to XBMC * @author Stefan Agner * */ public class PacketBUTTON extends Packet { - + protected final static byte BT_USE_NAME = 0x01; protected final static byte BT_DOWN = 0x02; protected final static byte BT_UP = 0x04; @@ -44,12 +44,12 @@ public class PacketBUTTON extends Packet { * @param down if this is 1, it implies a press event, 0 implies a release * event. (default: 1) * @param queue a queued key press means that the button event is - * executed just once after which the next key press is processed. + * executed just once after which the next key press is processed. * It can be used for macros. Currently there is no support for * time delays between queued presses. (default: 0) * @param amount unimplemented for now; in the future it will be used for * specifying magnitude of analog key press events - * @param axis + * @param axis */ public PacketBUTTON(short code, boolean repeat, boolean down, boolean queue, short amount, byte axis) { @@ -59,7 +59,7 @@ public class PacketBUTTON extends Packet { short flags = 0; appendPayload(code, map_name, button_name, repeat, down, queue, amount, axis, flags); } - + /** * A button packet send a key press or release event to XBMC * @param map_name a combination of map_name and button_name refers to a @@ -73,19 +73,19 @@ public class PacketBUTTON extends Packet { * <li>"LI:devicename" => LIRC remote map where 'devicename' is the * actual device's name</li></ul> * @param button_name a button name defined in the map specified in map_name. - * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml + * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml * then, valid button_names include "printscreen", "minus", "x", etc. * @param repeat this key press should repeat until released (default: 1) * Note that queued pressed cannot repeat. * @param down if this is 1, it implies a press event, 0 implies a release * event. (default: 1) * @param queue a queued key press means that the button event is - * executed just once after which the next key press is processed. + * executed just once after which the next key press is processed. * It can be used for macros. Currently there is no support for * time delays between queued presses. (default: 0) * @param amount unimplemented for now; in the future it will be used for * specifying magnitude of analog key press events - * @param axis + * @param axis */ public PacketBUTTON(String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis) { @@ -94,7 +94,7 @@ public class PacketBUTTON extends Packet { short flags = BT_USE_NAME; appendPayload(code, map_name, button_name, repeat, down, queue, amount, axis, flags); } - + /** * Appends Payload for a Button Packet (this method is used by the different Constructors of this Packet) * @param code raw button code (default: 0) @@ -109,19 +109,19 @@ public class PacketBUTTON extends Packet { * <li>"LI:devicename" => LIRC remote map where 'devicename' is the * actual device's name</li></ul> * @param button_name a button name defined in the map specified in map_name. - * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml + * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml * then, valid button_names include "printscreen", "minus", "x", etc. * @param repeat this key press should repeat until released (default: 1) * Note that queued pressed cannot repeat. * @param down if this is 1, it implies a press event, 0 implies a release * event. (default: 1) * @param queue a queued key press means that the button event is - * executed just once after which the next key press is processed. + * executed just once after which the next key press is processed. * It can be used for macros. Currently there is no support for * time delays between queued presses. (default: 0) * @param amount unimplemented for now; in the future it will be used for * specifying magnitude of analog key press events - * @param axis + * @param axis * @param flags Packet specific flags */ private void appendPayload(short code, String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis, short flags) @@ -130,24 +130,24 @@ public class PacketBUTTON extends Packet { flags |= BT_USE_AMOUNT; else amount = 0; - + if(down) flags |= BT_DOWN; else flags |= BT_UP; - + if(!repeat) flags |= BT_NO_REPEAT; - + if(queue) flags |= BT_QUEUE; - + if(axis == 1) flags |= BT_AXISSINGLE; else if (axis == 2) flags |= BT_AXIS; - + appendPayload(code); appendPayload(flags); appendPayload(amount); diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java index b8b8944053..e63a2c6c3b 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java @@ -19,12 +19,12 @@ package org.xbmc.eventclient; /** * XBMC Event Client Class - * + * * A BYE packet terminates the connection to XBMC. * @author Stefan Agner * */ -public class PacketBYE extends Packet +public class PacketBYE extends Packet { /** diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java index cbcd56e745..95e8fa9891 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java @@ -21,15 +21,15 @@ import java.nio.charset.Charset; /** * XBMC Event Client Class - * + * * A HELO packet establishes a valid connection to XBMC. It is the * first packet that should be sent. * @author Stefan Agner * */ public class PacketHELO extends Packet { - - + + /** * A HELO packet establishes a valid connection to XBMC. * @param devicename Name of the device which connects to XBMC @@ -60,5 +60,5 @@ public class PacketHELO extends Packet { this.appendPayload(0); // reserved2 this.appendPayload(iconData); // reserved2 } - + } diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java index afebce0048..b0d59bb591 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java @@ -19,13 +19,13 @@ package org.xbmc.eventclient; /** * XBMC Event Client Class - * + * * A LOG packet tells XBMC to log the message to xbmc.log with the loglevel as specified. * @author Stefan Agner * */ public class PacketLOG extends Packet { - + /** * A LOG packet tells XBMC to log the message to xbmc.log with the loglevel as specified. * @param loglevel the loglevel, follows XBMC standard. diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java index 6c865ec7c4..816e1a72f8 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java @@ -19,13 +19,13 @@ package org.xbmc.eventclient; /** * XBMC Event Client Class - * + * * A MOUSE packets sets the mouse position in XBMC * @author Stefan Agner * */ public class PacketMOUSE extends Packet { - + protected final static byte MS_ABSOLUTE = 0x01; /** diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java index 3b8c96e8ff..7089ad6946 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java @@ -19,7 +19,7 @@ package org.xbmc.eventclient; /** * XBMC Event Client Class - * + * * This packet displays a notification window in XBMC. It can contain * a caption, a message and an icon. * @author Stefan Agner @@ -39,7 +39,7 @@ public class PacketNOTIFICATION extends Packet { super(PT_NOTIFICATION); appendPayload(title, message, iconType, iconData); } - + /** * This packet displays a notification window in XBMC. * @param title Message title @@ -66,6 +66,6 @@ public class PacketNOTIFICATION extends Packet { appendPayload(0); // reserved if(iconData!=null) appendPayload(iconData); - + } } diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java index 18e74e2da6..2afbd8d66b 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java @@ -19,7 +19,7 @@ package org.xbmc.eventclient; /** * XBMC Event Client Class - * + * * A PING packet tells XBMC that the client is still alive. All valid * packets act as ping (not just this one). A client needs to ping * XBMC at least once in 60 seconds or it will time diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java index 9642a6d76b..322ebf1796 100644 --- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java +++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java @@ -24,14 +24,14 @@ import java.net.InetAddress; /** * XBMC Event Client Class - * + * * Implements an XBMC-Client. This class can be used to implement your own application which * should act as a Input device for XBMC. Also starts a Ping-Thread, which tells the XBMC EventServer - * that the client is alive. Therefore if you close your application you SHOULD call stopClient()! + * that the client is alive. Therefore if you close your application you SHOULD call stopClient()! * @author Stefan Agner * */ -public class XBMCClient +public class XBMCClient { private boolean hasIcon = false; private String deviceName; @@ -40,9 +40,9 @@ public class XBMCClient private byte[] iconData; private InetAddress hostAddress; private int hostPort; - + /** - * Starts a XBMC EventClient. + * Starts a XBMC EventClient. * @param hostAddress Address of the Host running XBMC * @param hostPort Port of the Host running XBMC (default 9777) * @param deviceName Name of the Device @@ -64,21 +64,21 @@ public class XBMCClient FileInputStream iconFileStream = new FileInputStream(iconFile); byte[] iconData = new byte[iconFileStream.available()]; iconFileStream.read(iconData); - + hasIcon = true; - + // Call start-Method... startClient(hostAddress, hostPort, deviceName, iconType, iconData); } - + /** - * Starts a XBMC EventClient. + * Starts a XBMC EventClient. * @param hostAddress Address of the Host running XBMC * @param hostPort Port of the Host running XBMC (default 9777) * @param deviceName Name of the Device * @param iconType Type of the icon file (see Packet.ICON_PNG, Packet.ICON_JPEG or Packet.ICON_GIF) - * @param iconData The icon itself as a Byte-Array + * @param iconData The icon itself as a Byte-Array * @throws IOException */ public XBMCClient(InetAddress hostAddress, int hostPort, String deviceName, byte iconType, byte[] iconData) throws IOException @@ -86,9 +86,9 @@ public class XBMCClient hasIcon = true; startClient(hostAddress, hostPort, deviceName, iconType, iconData); } - + /** - * Starts a XBMC EventClient without an icon. + * Starts a XBMC EventClient without an icon. * @param hostAddress Address of the Host running XBMC * @param hostPort Port of the Host running XBMC (default 9777) * @param deviceName Name of the Device @@ -104,12 +104,12 @@ public class XBMCClient /** - * Starts a XBMC EventClient. + * Starts a XBMC EventClient. * @param hostAddress Address of the Host running XBMC * @param hostPort Port of the Host running XBMC (default 9777) * @param deviceName Name of the Device * @param iconType Type of the icon file (see Packet.ICON_PNG, Packet.ICON_JPEG or Packet.ICON_GIF) - * @param iconData The icon itself as a Byte-Array + * @param iconData The icon itself as a Byte-Array * @throws IOException */ private void startClient(InetAddress hostAddress, int hostPort, String deviceName, byte iconType, byte[] iconData) throws IOException @@ -118,7 +118,7 @@ public class XBMCClient this.hostAddress = hostAddress; this.hostPort = hostPort; this.deviceName = deviceName; - + this.iconType = iconType; this.iconData = iconData; @@ -128,14 +128,14 @@ public class XBMCClient p = new PacketHELO(deviceName, iconType, iconData); else p = new PacketHELO(deviceName); - + p.send(hostAddress, hostPort); - + // Start Thread (for Ping packets...) oPingThread = new PingThread(hostAddress, hostPort, 20000); oPingThread.start(); } - + /** * Stops the XBMC EventClient (especially the Ping-Thread) * @throws IOException @@ -145,11 +145,11 @@ public class XBMCClient // Stop Ping-Thread... oPingThread.giveup(); oPingThread.interrupt(); - + PacketBYE p = new PacketBYE(); p.send(hostAddress, hostPort); } - + /** * Displays a notification window in XBMC. @@ -174,12 +174,12 @@ public class XBMCClient * @param down if this is 1, it implies a press event, 0 implies a release * event. (default: 1) * @param queue a queued key press means that the button event is - * executed just once after which the next key press is processed. + * executed just once after which the next key press is processed. * It can be used for macros. Currently there is no support for * time delays between queued presses. (default: 0) * @param amount unimplemented for now; in the future it will be used for * specifying magnitude of analog key press events - * @param axis + * @param axis */ public void sendButton(short code, boolean repeat, boolean down, boolean queue, short amount, byte axis) throws IOException { @@ -200,19 +200,19 @@ public class XBMCClient * <li>"LI:devicename" => LIRC remote map where 'devicename' is the * actual device's name</li></ul> * @param button_name a button name defined in the map specified in map_name. - * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml + * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml * then, valid button_names include "printscreen", "minus", "x", etc. * @param repeat this key press should repeat until released (default: 1) * Note that queued pressed cannot repeat. * @param down if this is 1, it implies a press event, 0 implies a release * event. (default: 1) * @param queue a queued key press means that the button event is - * executed just once after which the next key press is processed. + * executed just once after which the next key press is processed. * It can be used for macros. Currently there is no support for * time delays between queued presses. (default: 0) * @param amount unimplemented for now; in the future it will be used for * specifying magnitude of analog key press events - * @param axis + * @param axis */ public void sendButton(String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis) throws IOException { @@ -230,7 +230,7 @@ public class XBMCClient PacketMOUSE p = new PacketMOUSE(x, y); p.send(hostAddress, hostPort); } - + /** * Sends a ping to the XBMC EventServer * @throws IOException @@ -259,7 +259,7 @@ public class XBMCClient PacketLOG p = new PacketLOG(loglevel, logmessage); p.send(hostAddress, hostPort); } - + /** * Tells XBMC to do the action specified, based on the type it knows were it needs to be sent. * @param actionmessage Actionmessage (as in scripting/skinning) @@ -269,7 +269,7 @@ public class XBMCClient PacketACTION p = new PacketACTION(actionmessage); p.send(hostAddress, hostPort); } - + /** * Implements a PingThread which tells XBMC EventServer that the Client is alive (this should * be done at least every 60 seconds! @@ -282,7 +282,7 @@ public class XBMCClient private int hostPort; private int sleepTime; private boolean giveup = false; - + public PingThread(InetAddress hostAddress, int hostPort, int sleepTime) { super("XBMC EventClient Ping-Thread"); @@ -290,12 +290,12 @@ public class XBMCClient this.hostPort = hostPort; this.sleepTime = sleepTime; } - + public void giveup() { giveup = true; } - + public void run() { while(!giveup) @@ -304,10 +304,10 @@ public class XBMCClient PacketPING p = new PacketPING(); p.send(hostAddress, hostPort); } catch (IOException e) { - + e.printStackTrace(); } - + try { Thread.sleep(sleepTime); } catch (InterruptedException e) { diff --git a/tools/EventClients/lib/python/ps3/sixaxis.py b/tools/EventClients/lib/python/ps3/sixaxis.py index 44489e87e8..c690283078 100644 --- a/tools/EventClients/lib/python/ps3/sixaxis.py +++ b/tools/EventClients/lib/python/ps3/sixaxis.py @@ -111,8 +111,8 @@ def normalize(val): if val > upperlimit: val = upperlimit - val = ((float(val) - offset) / (float(upperlimit) - - lowerlimit)) * 65535.0 + val = ((float(val) - offset) / (float(upperlimit) - + lowerlimit)) * 65535.0 if val <= 0: val = 1 return val @@ -147,17 +147,17 @@ def average(array): for i in array: val += i return val / len(array) - + def smooth(arr, val): cnt = len(arr) arr.insert(0, val) arr.pop(cnt) - return average(arr) + return average(arr) def set_l2cap_mtu2(sock, mtu): SOL_L2CAP = 6 L2CAP_OPTIONS = 1 - + s = sock.getsockopt (SOL_L2CAP, L2CAP_OPTIONS, 12) o = list( struct.unpack ("HHHBBBH", s) ) o[0] = o[1] = mtu @@ -168,7 +168,7 @@ def set_l2cap_mtu2(sock, mtu): print("Warning: Unable to set mtu") class sixaxis(): - + def __init__(self, xbmc, control_sock, interrupt_sock): self.xbmc = xbmc @@ -177,7 +177,7 @@ class sixaxis(): self.sumy = [0] * self.num_samples self.sumr = [0] * self.num_samples self.axis_amount = [0, 0, 0, 0] - + self.released = set() self.pressed = set() self.pending = set() @@ -185,7 +185,7 @@ class sixaxis(): self.psflags = 0 self.psdown = 0 self.mouse_enabled = 0 - + set_l2cap_mtu2(control_sock, 64) set_l2cap_mtu2(interrupt_sock, 64) time.sleep(0.25) # If we ask to quickly here, it sometimes doesn't start @@ -200,7 +200,7 @@ class sixaxis(): # HID Command: HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_OUTPUT # HID Report:1 - bytes = [0x52, 0x1] + bytes = [0x52, 0x1] bytes.extend([0x00, 0x00, 0x00]) bytes.extend([0xFF, 0x72]) bytes.extend([0x00, 0x00, 0x00, 0x00]) @@ -214,7 +214,7 @@ class sixaxis(): #0x40 = 2Hz bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED4 [0xff, 0xff, 0x10, 0x10, 0x10] bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED3 [0xff, 0x40, 0x08, 0x10, 0x10] - bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED2 [0xff, 0x00, 0x10, 0x30, 0x30] + bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED2 [0xff, 0x00, 0x10, 0x30, 0x30] bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED1 [0xff, 0x00, 0x10, 0x40, 0x10] bytes.extend([0x00, 0x00, 0x00, 0x00, 0x00]) bytes.extend([0x00, 0x00, 0x00, 0x00, 0x00]) @@ -282,7 +282,7 @@ class sixaxis(): xpos = normalize_angle(roll, math.radians(30)) ypos = normalize_angle(pitch, math.radians(30)) - + axis = struct.unpack("BBBB", data[7:11]) return self.process_input(bflags, pressure, axis, xpos, ypos) diff --git a/tools/EventClients/lib/python/ps3/sixpair.py b/tools/EventClients/lib/python/ps3/sixpair.py index 264c2f778c..2fa8cae0e0 100755 --- a/tools/EventClients/lib/python/ps3/sixpair.py +++ b/tools/EventClients/lib/python/ps3/sixpair.py @@ -57,7 +57,7 @@ def set_pair(dev, mac): handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS | usb.RECIP_INTERFACE , usb.REQ_SET_CONFIGURATION, msg, passed_value, itf.interfaceNumber, timeout) finally: - handle.releaseInterface() + handle.releaseInterface() def get_pair(dev): @@ -102,7 +102,7 @@ if __name__=="__main__": except: print("Failed to parse HCI address") mac = None - + for dev in devs: if mac: update_pair(dev, mac) diff --git a/tools/Linux/packaging/README.debian b/tools/Linux/packaging/README.debian index fae32f0682..06ce8c99c7 100644 --- a/tools/Linux/packaging/README.debian +++ b/tools/Linux/packaging/README.debian @@ -2,7 +2,7 @@ There are two available build methods: 1.) debuild / debhelper - Requirements: debhelper, devscripts, all Kodi build deps + Requirements: debhelper, devscripts, all Kodi build deps sudo apt-get install debhelper devscripts sudo apt-get build-dep kodi (if you have one of our repos/ppas added, else read docs/README.linux or docs/README.ubuntu) @@ -11,9 +11,9 @@ There are two available build methods: Example Usage: ./mk-debian-package.sh -2.) pdebuild / pbuilder +2.) pdebuild / pbuilder Requirements: pbuilder, devscripts, proper pbuilder environment - For a comprehensive example how to setup pbuilder read: + For a comprehensive example how to setup pbuilder read: https://wiki.ubuntu.com/PbuilderHowto Result: Debian package for arbitrary Debian based distributions and architectures. diff --git a/tools/Linux/packaging/mk-debian-package.sh b/tools/Linux/packaging/mk-debian-package.sh index 409a620ebf..ad81be0623 100755 --- a/tools/Linux/packaging/mk-debian-package.sh +++ b/tools/Linux/packaging/mk-debian-package.sh @@ -75,7 +75,7 @@ function checkEnv { function getVersion { getGitRev if [[ $RELEASEV == "auto" ]] - then + then local MAJORVER=$(grep VERSION_MAJOR $REPO_DIR/version.txt | awk '{ print $2 }') local MINORVER=$(grep VERSION_MINOR $REPO_DIR/version.txt | awk '{ print $2 }') RELEASEV=${MAJORVER}.${MINORVER} diff --git a/tools/android/packaging/Makefile.in b/tools/android/packaging/Makefile.in index 7a18544ac3..388c677690 100644 --- a/tools/android/packaging/Makefile.in +++ b/tools/android/packaging/Makefile.in @@ -8,7 +8,7 @@ OBJS = libplist.so libshairplay.so \ libbluray.so libsmbclient.so PLATFORM_OBJS = -EXCLUDED_ADDONS = +EXCLUDED_ADDONS = CMAKE_SOURCE_DIR = $(shell cd $(CURDIR)/../../..; pwd) APP_PACKAGE_DIR = $(subst .,/,@APP_PACKAGE@) @@ -28,7 +28,7 @@ endif X86OVERRIDES=XBMC_OVERRIDE_HOST=i686-android-linux XBMC_OVERRIDE_TOOLCHAIN=$(XBMC_X86_TOOLCHAIN) ARMOVERRIDES=XBMC_OVERRIDE_HOST=arm-linux-androideabi XBMC_OVERRIDE_TOOLCHAIN=$(XBMC_ARM_TOOLCHAIN) -#this fixes a android ndk fuckup where the paths to +#this fixes a android ndk fuckup where the paths to #prebuilt stuff follow different name schemes for #arm and x86 ifeq ($(findstring i686,$(CPU)),i686) diff --git a/tools/android/packaging/apksign b/tools/android/packaging/apksign index 0a2289b6c7..7ac9f57bb9 100755 --- a/tools/android/packaging/apksign +++ b/tools/android/packaging/apksign @@ -6,5 +6,5 @@ usage(){ [[ $# -lt 3 ]] && usage -make apk-sign SIGN_STORE=$1 SIGN_STOREPASS=$2 SIGN_KEY=$3 SIGN_KEYPASS=$4 +make apk-sign SIGN_STORE=$1 SIGN_STOREPASS=$2 SIGN_KEY=$3 SIGN_KEYPASS=$4 diff --git a/tools/android/packaging/xbmc/build.gradle.in b/tools/android/packaging/xbmc/build.gradle.in index 4850c47f5f..7ef91d66ef 100644 --- a/tools/android/packaging/xbmc/build.gradle.in +++ b/tools/android/packaging/xbmc/build.gradle.in @@ -20,7 +20,7 @@ android { debugUnsigned { signingConfig null } - + } aaptOptions { ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' diff --git a/tools/android/packaging/xbmc/res/layout/activity_splash.xml b/tools/android/packaging/xbmc/res/layout/activity_splash.xml index 5fdab946fa..eedd3a4668 100644 --- a/tools/android/packaging/xbmc/res/layout/activity_splash.xml +++ b/tools/android/packaging/xbmc/res/layout/activity_splash.xml @@ -9,7 +9,7 @@ android:layout_height="match_parent" android:layout_centerHorizontal="true" android:adjustViewBounds="true" - android:layout_alignParentTop="true" + android:layout_alignParentTop="true" android:scaleType="centerCrop" android:src="@drawable/splash" /> @@ -25,7 +25,7 @@ android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" - android:layout_alignParentBottom="true" + android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" diff --git a/tools/android/packaging/xbmc/res/xml/searchable.xml b/tools/android/packaging/xbmc/res/xml/searchable.xml index a914552794..af66a877fe 100644 --- a/tools/android/packaging/xbmc/res/xml/searchable.xml +++ b/tools/android/packaging/xbmc/res/xml/searchable.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/app_name" - android:hint="@string/search_hint" + android:hint="@string/search_hint" android:searchSuggestAuthority="org.xbmc.kodi.media" android:searchSuggestPath="suggestions" - + android:searchSuggestIntentAction="android.intent.action.GET_CONTENT" android:searchSuggestIntentData="content://org.xbmc.kodi.media/intent" - + android:includeInGlobalSearch="true" android:searchSettingsDescription="Media" android:searchSuggestThreshold="3" diff --git a/tools/android/packaging/xbmc/searchable.xml.in b/tools/android/packaging/xbmc/searchable.xml.in index 6b0e38d405..682dacd345 100644 --- a/tools/android/packaging/xbmc/searchable.xml.in +++ b/tools/android/packaging/xbmc/searchable.xml.in @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/app_name" - android:hint="@string/search_hint" + android:hint="@string/search_hint" android:searchSuggestAuthority="@APP_PACKAGE@.media" android:searchSuggestPath="suggestions" - + android:searchSuggestIntentAction="android.intent.action.VIEW" android:searchSuggestIntentData="content://@APP_PACKAGE@.media/intent" - + android:includeInGlobalSearch="true" android:searchSettingsDescription="Media" android:searchSuggestThreshold="3" diff --git a/tools/android/packaging/xbmc/src/content/XBMCMediaContentProvider.java.in b/tools/android/packaging/xbmc/src/content/XBMCMediaContentProvider.java.in index 98179571e2..47e5327702 100644 --- a/tools/android/packaging/xbmc/src/content/XBMCMediaContentProvider.java.in +++ b/tools/android/packaging/xbmc/src/content/XBMCMediaContentProvider.java.in @@ -12,7 +12,7 @@ import @APP_PACKAGE@.XBMCJsonRPC; public class XBMCMediaContentProvider extends XBMCContentProvider { private static String TAG = "@APP_NAME@_Media_Provider"; - + public static final String AUTHORITY = AUTHORITY_ROOT + ".media"; public static final String SUGGEST_PATH = "suggestions"; @@ -65,7 +65,7 @@ public class XBMCMediaContentProvider extends XBMCContentProvider String[] selectionArgs, String sortOrder) { Log.d(TAG, "query: " + uri.toString()); - + switch (URI_MATCHER.match(uri)) { case SEARCH_SUGGEST: @@ -75,7 +75,7 @@ public class XBMCMediaContentProvider extends XBMCContentProvider limit = Integer.parseInt(uri.getQueryParameter("limit")); } catch (Exception e) {} return mJsonRPC.getSuggestions(query, limit); - + default: throw new IllegalArgumentException("Unknown Uri: " + uri); } diff --git a/tools/buildsteps/android/make-binary-addons b/tools/buildsteps/android/make-binary-addons index aa283c9cfc..3bb9e746de 100644 --- a/tools/buildsteps/android/make-binary-addons +++ b/tools/buildsteps/android/make-binary-addons @@ -2,7 +2,7 @@ WORKSPACE=${WORKSPACE:-$( cd $(dirname $0)/../../.. ; pwd -P )} XBMC_PLATFORM_DIR=android . $WORKSPACE/tools/buildsteps/defaultenv -. $WORKSPACE/tools/buildsteps/$XBMC_PLATFORM_DIR/make-native-depends +. $WORKSPACE/tools/buildsteps/$XBMC_PLATFORM_DIR/make-native-depends #clear the build failed file rm -f $WORKSPACE/cmake/$FAILED_BUILD_FILENAME diff --git a/tools/buildsteps/defaultenv b/tools/buildsteps/defaultenv index 08eea0bc33..14267825c6 100644 --- a/tools/buildsteps/defaultenv +++ b/tools/buildsteps/defaultenv @@ -64,12 +64,12 @@ fi if [ "$NDK_VERSION" == "Default" ] then NDK_VERSION=$DEFAULT_NDK_VERSION -fi +fi if [ "$NDK_API" == "Default" ] then NDK_API=$DEFAULT_NDK_API -fi +fi if [ "$XBMC_DEPENDS_ROOT" == "Default" ] then @@ -78,7 +78,7 @@ fi if [ "$DARWIN_ARM_CPU" == "Default" ] then - DARWIN_ARM_CPU=$DEFAULT_DARWIN_ARM_CPU + DARWIN_ARM_CPU=$DEFAULT_DARWIN_ARM_CPU fi if [ "$XCODE_APP" == "Default" ] @@ -136,7 +136,7 @@ function pathChanged () else ret="1" fi - + echo $ret } diff --git a/tools/buildsteps/jenkins_docs/README.mac b/tools/buildsteps/jenkins_docs/README.mac index 1ef1ed1d7e..dca05fabd3 100644 --- a/tools/buildsteps/jenkins_docs/README.mac +++ b/tools/buildsteps/jenkins_docs/README.mac @@ -77,7 +77,7 @@ java -Djava.awt.headless=true -jar slave.jar -jar-cache /Users/Shared/jenkins/ca </plist> 13. sudo cp /Users/Shared/jenkins/slave/org.jenkins-ci.slave.jnlp.plist /Library/LaunchDaemons/org.jenkins-ci.slave.jnlp.plist - + 14. sudo nano /etc/profile and add PATH=$PATH:/usr/local/bin 15. curl http://jenkins.kodi.tv/jnlpJars/slave.jar -o /Users/Shared/jenkins/slave.jar diff --git a/tools/buildsteps/windows/BuildSetup.bat b/tools/buildsteps/windows/BuildSetup.bat index 8aebf73121..19996fb729 100644 --- a/tools/buildsteps/windows/BuildSetup.bat +++ b/tools/buildsteps/windows/BuildSetup.bat @@ -112,7 +112,7 @@ set WORKSPACE=%base_dir%\kodi-build PUSHD %base_dir%\project\Win32BuildSetup IF EXIST BUILD_WIN32\application rmdir BUILD_WIN32\application /S /Q rem Add files to exclude.txt that should not be included in the installer - + Echo Thumbs.db>>exclude.txt Echo Desktop.ini>>exclude.txt Echo dsstdfx.bin>>exclude.txt @@ -139,7 +139,7 @@ set WORKSPACE=%base_dir%\kodi-build rem Exclude dlls from system to avoid duplicates Echo .dll>>exclude_dll.txt - + md BUILD_WIN32\application xcopy %EXE% BUILD_WIN32\application > NUL @@ -198,7 +198,7 @@ set WORKSPACE=%base_dir%\kodi-build del /s /q /f BUILD_WIN32\application\*.exp > NUL del /s /q /f BUILD_WIN32\application\*.lib > NUL POPD - + ECHO ------------------------------------------------------------ ECHO Build Succeeded! GOTO NSIS_EXE @@ -222,7 +222,7 @@ set WORKSPACE=%base_dir%\kodi-build rem try with space delim instead of tab FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B ) - + IF NOT EXIST "%NSISExePath%" ( rem fails on localized windows (Default) becomes (Par D�faut) FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B @@ -231,7 +231,7 @@ set WORKSPACE=%base_dir%\kodi-build IF NOT EXIST "%NSISExePath%" ( FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "HKLM\Software\NSIS" /ve') DO SET NSISExePath=%%B ) - + rem proper x64 registry checks IF NOT EXIST "%NSISExePath%" ( ECHO using x64 registry entries diff --git a/tools/buildsteps/windows/buildhelpers.sh b/tools/buildsteps/windows/buildhelpers.sh index 0a7856f9d4..e91d7b5a06 100644 --- a/tools/buildsteps/windows/buildhelpers.sh +++ b/tools/buildsteps/windows/buildhelpers.sh @@ -95,7 +95,7 @@ do_pkgConfig() { } do_autoreconf() { - if [[ ! -f $LOCALSRCDIR/configure ]]; then + if [[ ! -f $LOCALSRCDIR/configure ]]; then local CURDIR=$(pwd) cd $LOCALSRCDIR autoreconf -fiv @@ -203,7 +203,7 @@ function pathChanged () else ret="1" fi - + echo $ret } diff --git a/tools/buildsteps/windows/download-msys2.bat b/tools/buildsteps/windows/download-msys2.bat index 64f9caa595..40b985f1be 100644 --- a/tools/buildsteps/windows/download-msys2.bat +++ b/tools/buildsteps/windows/download-msys2.bat @@ -102,7 +102,7 @@ if exist "%downloaddir%\%msysfile%" ( echo ------------------------------------------------------------------------------- %unpack_exe% x %downloaddir%\%msysfile% -so 2>NUL | %unpack_exe% x -aoa -si -ttar -o%instdir% >NUL 2>NUL ) - + if not exist %instdir%\%msys2%\usr\bin\msys-2.0.dll ( echo ------------------------------------------------------------------------------- echo.- Installing msys2 basic system failed, diff --git a/tools/buildsteps/windows/make-mingwlibs.bat b/tools/buildsteps/windows/make-mingwlibs.bat index a06992da2d..fd7a2aacad 100644 --- a/tools/buildsteps/windows/make-mingwlibs.bat +++ b/tools/buildsteps/windows/make-mingwlibs.bat @@ -21,15 +21,15 @@ FOR %%b in (%*) DO ( IF %%b==clean SET BUILDMODE=clean IF %%b==noclean SET BUILDMODE=noclean IF %%b==sh SET opt=sh - IF %%b==build64 ( - SET build64=yes + IF %%b==build64 ( + SET build64=yes SET build32=no SET buildArm=no SET vcarch=amd64 SET TARGETPLATFORM=x64 ) - IF %%b==buildArm ( - SET build64=no + IF %%b==buildArm ( + SET build64=no SET build32=no SET buildArm=yes SET vcarch=arm @@ -71,7 +71,7 @@ GOTO ENDWITHERROR ECHO msys environment not found ECHO bla>%ERRORFILE% EXIT /B 1 - + :END ECHO exiting msys environment IF EXIST %ERRORFILE% ( diff --git a/tools/codegenerator/Helper.groovy b/tools/codegenerator/Helper.groovy index 2b474aeb16..764e6c83a9 100644 --- a/tools/codegenerator/Helper.groovy +++ b/tools/codegenerator/Helper.groovy @@ -28,7 +28,7 @@ import java.util.regex.Pattern /** * This class contains a series of helper methods for parsing a xbmc addon spec xml file. It is intended to be * used from a bindings template. - * + * * @author jim * */ @@ -77,7 +77,7 @@ public class Helper public static void setDoxygenXmlDir(File dir) { doxygenXmlDir = dir } private static String retrieveDocStringFromDoxygen(Node methodOrClass) - { + { if (doxygenXmlDir == null) return null @@ -104,7 +104,7 @@ public class Helper doc = docspec.compounddef[0].detaileddescription[0] else // it's a method of some sort ... or it better be { - Node memberdef = docspec.depthFirst().find { + Node memberdef = docspec.depthFirst().find { return (it instanceof String) ? false : ((it.name() == 'memberdef' && (it.@kind == 'function' || it.@kind == 'variable') && it.@id.startsWith(doxygenId)) && (it.name != null && it.name.text().trim() == methodOrClass.@sym_name)) @@ -114,13 +114,13 @@ public class Helper } if (doc != null) - { + { def indent = ' ' def curIndent = '' def prevIndent = '' def handleDoc - handleDoc = { + handleDoc = { if (it instanceof String) ret += it else // it's a Node @@ -171,7 +171,7 @@ public class Helper /** * <p>This method uses the previously set outTypemap and defaultOutTypemap to produce the chunk of code - * that will be used to return the method invocation result to the scripting language. For example, in + * that will be used to return the method invocation result to the scripting language. For example, in * python, if the return type from the method is a long, then the OutConversion could look something like:</p> * <code> * result = PyInt_FromLong(thingReturnedFromMethod); @@ -242,7 +242,7 @@ public class Helper } Map bindings = ['result' : apiName, 'api' : 'apiResult', 'type' : "${apiType}", - 'method' : method, 'helper' : Helper.class, + 'method' : method, 'helper' : Helper.class, 'swigTypeParser' : SwigTypeParser.class, 'sequence' : seq ] if (className) bindings['classname'] = className @@ -260,7 +260,7 @@ public class Helper { File cur = (File)convertTemplate if (!cur.exists()) // see if the file is relative to the template file - { + { File parent = curTemplateFile.getParentFile() // find the relative path to the convertTemplate File cwd = new File('.').getCanonicalFile() @@ -372,7 +372,7 @@ public class Helper 'type': "${apiType}", 'ltype': "${apiLType}", 'slarg' : "${slName}", 'api' : "${apiName}", 'param' : "${paramName}", - 'method' : method, 'helper' : Helper.class, + 'method' : method, 'helper' : Helper.class, 'swigTypeParser' : SwigTypeParser.class, 'sequence' : seq ] @@ -390,7 +390,7 @@ public class Helper { File cur = (File)convertTemplate if (!cur.exists()) // see if the file is relative to the template file - { + { File parent = curTemplateFile.getParentFile() // find the relative path to the convertTemplate File cwd = new File('.').getCanonicalFile() @@ -417,13 +417,13 @@ public class Helper /** * <p>Transform a Swig generated xml file into something more manageable. For the most part this method will:</p> - * + * * <li>1) Make all pertinent 'attributelist' elements actually be attributes of the parent element while * an attribute with the name 'name' will become that parent element name.</li> * <li>2) Filter out unused attributes</li> * <li>3) Filter out the automatically included 'swig'swg'</li> * <li>4) Flatten out the remaining 'include' elements</li> - * <li>5) Removes extraneous default argument function/method Node</li> + * <li>5) Removes extraneous default argument function/method Node</li> * <li>6) Converts all type tables to a single entry under the main module node removing all 1-1 mappings.</li> * <li>7) Removes all non-public non-constructor methods.</li> * @param swigxml is the raw swig output xml document @@ -489,7 +489,7 @@ public class Helper } it.parent().remove(it) } - + // now remove all non-public methods, but leave constructors List allMethods = ret.depthFirst().findAll({ it.name() == 'function' || it.name() == 'destructor' || it.name() == 'constructor'}) allMethods.each { @@ -502,7 +502,7 @@ public class Helper new Node(it,'doc',['value' : doc]) } } - + // now remove all non-public variables List allVariables = ret.depthFirst().findAll({ it.name() == 'variable' }) allVariables.each { @@ -550,35 +550,35 @@ public class Helper { return (hasDefinedConstructor(clazz) && clazz.constructor[0].@access != null && clazz.constructor[0].@access != 'public') } - + /** * <p>This will look through the entire module and look up a class node by name. It will return null if * that class node isn't found. It's meant to be used to look up base classes from a base class list * so it's fairly robust. It goes through the following rules:</p> - * + * * <li>Does the FULL classname (considering the namespace) match the name provided.</li> * <li>Does the FULL classname match the reference nodes namespace + '::' + the provided classname.</li> * <li>Does the class node's name (which may contain the full classname) match the classname provided.</li> - * + * * <p>Note, this method is not likely to find the classnode if you just pass a simple name and - * no referenceNode in the case where namespaces are used extensively.</p> + * no referenceNode in the case where namespaces are used extensively.</p> */ public static Node findClassNodeByName(Node module, String classname, Node referenceNode = null) { return module.depthFirst().findAll({ it.name() == 'class' }).find { // first check to see if this FULL class name matches if (findFullClassName(it).trim() == classname.trim()) return true - + // now check to see if it matches the straight name considering the reference node if (referenceNode != null && (findNamespace(referenceNode) + classname) == findFullClassName(it)) return true - + // now just see if it matches the straight name if (it.@name == classname) return true - + return false } } - + /** * Find me the class node that this node either is, or is within. * If this node is not within a class node then it will return null. @@ -588,7 +588,7 @@ public class Helper if (node.name() == 'class') return node return node.parent() == null ? null : findClassNode(node.parent()) } - + /** * If this node is a class node, or a child of a class name (for example, a method) then * the full classname, with the namespace will be returned. Otherwise, null. @@ -649,8 +649,8 @@ public class Helper /** * Group together overloaded methods into a map keyed by the first method's id. Each - * entry in this map contains a list of nodes that represent overloaded versions of - * the same method. + * entry in this map contains a list of nodes that represent overloaded versions of + * the same method. */ public static Map functionNodesByOverloads(Node module) { @@ -682,7 +682,7 @@ public class Helper /** * Because the return type is a combination of the function 'decl' and the - * function 'type,' this method will construct a valid Swig typestring from + * function 'type,' this method will construct a valid Swig typestring from * the two. */ public static String getReturnSwigType(Node method) @@ -718,7 +718,7 @@ public class Helper } /** - * Swig has 'insert' nodes in it's parse tree that contain code chunks that are + * Swig has 'insert' nodes in it's parse tree that contain code chunks that are * meant to be inserted into various positions in the generated code. This method * will extract the nodes that refer to the specific section asked for. See the * Swig documentation for more information. @@ -733,7 +733,7 @@ public class Helper public static String unescape(String insertSection) { return StringEscapeUtils.unescapeHtml(insertSection) } public static boolean isDirector(Node method) - { + { Node clazz = findClassNode(method) if (!clazz || !clazz.@feature_director) return false @@ -746,17 +746,17 @@ public class Helper /** * This method will search from the 'searchFrom' Node up to the root - * looking for a %feature("knownbasetypes") declaration that the given 'type' is + * looking for a %feature("knownbasetypes") declaration that the given 'type' is * known for 'searchFrom' Node. */ - public static boolean isKnownBaseType(String type, Node searchFrom) + public static boolean isKnownBaseType(String type, Node searchFrom) { return hasFeatureSetting(type,searchFrom,'feature_knownbasetypes',{ it.split(',').find({ it.trim() == type }) != null }) } /** * This method will search from the 'searchFrom' Node up to the root - * looking for a %feature("knownapitypes") declaration that the given 'type' is + * looking for a %feature("knownapitypes") declaration that the given 'type' is * known for 'searchFrom' Node. */ public static String isKnownApiType(String type, Node searchFrom) @@ -765,14 +765,14 @@ public class Helper String namespace = findNamespace(searchFrom,'::',false) String lastMatch = null hasFeatureSetting(type,searchFrom,'feature_knownapitypes',{ it.split(',').find( - { + { if (it.trim() == rootType) { lastMatch = rootType return true } - // we assume the 'type' is defined within namespace and - // so we can walk up the namespace appending the type until + // we assume the 'type' is defined within namespace and + // so we can walk up the namespace appending the type until // we find a match. while (namespace != '') { diff --git a/tools/codegenerator/SwigTypeParser.groovy b/tools/codegenerator/SwigTypeParser.groovy index d079c485ed..24437f228d 100644 --- a/tools/codegenerator/SwigTypeParser.groovy +++ b/tools/codegenerator/SwigTypeParser.groovy @@ -20,10 +20,10 @@ /** * These methods are somewhat ugly because they have been copied out of - * the Swig source code and simply made compilable with groovy. They could + * the Swig source code and simply made compilable with groovy. They could * all be much cleaner and smaller if they were completely groovyfied but * I have no intention of doing that since they are complicated and they work - * and I don't want to try to trace down problems that would be inevitable + * and I don't want to try to trace down problems that would be inevitable * with such a refactor. */ public class SwigTypeParser @@ -34,7 +34,7 @@ public class SwigTypeParser private static Map typeTable = [:] /** - * Add a typedef node to the global list of typedefs to be used later in + * Add a typedef node to the global list of typedefs to be used later in * parsing types. */ public static void appendTypeTable(Node typetab) { typetab.each { typeTable[it.@namespace + it.@type] = it.@basetype } } @@ -52,11 +52,11 @@ public class SwigTypeParser /** * This method will return the base type for the provided type string. For example, - * if the type string is p.MyType you will get MyType. If the string is + * if the type string is p.MyType you will get MyType. If the string is * p.q(const).int you will get 'int' */ public static String getRootType(String ty) - { + { int li = ty.lastIndexOf('.') return li >= 0 ? ty.substring(li + 1) : ty } @@ -151,7 +151,7 @@ public class SwigTypeParser * most basic types. */ public static String SwigType_resolve_all_typedefs(String s) - { + { String result = '' String tc = s @@ -268,7 +268,7 @@ public class SwigTypeParser // convert template parameters //return result.replaceAll('<\\(', '<').replaceAll('\\)>', '>') } - + /** * This creates the C++ declaration for a valid ltype for the type string * given. For example, if the type is a "const char*" which is equivalent @@ -290,7 +290,7 @@ public class SwigTypeParser { String prefix = (t.startsWith('q(')) ? t.substring(0,t.indexOf('.') + 1) : "" String remainder = (t.startsWith('q(')) ? t.substring(t.indexOf('.') + 1) : t - + return prefix + "p." + remainder } @@ -498,7 +498,7 @@ public class SwigTypeParser * Type elements are always delimited by periods, but may be nested with * parentheses. A nested element is always handled as a single item. * - * Returns the integer size of the element (which can be used to extract a + * Returns the integer size of the element (which can be used to extract a * substring, to chop the element off, or for other purposes). * ----------------------------------------------------------------------------- */ @@ -576,9 +576,9 @@ public class SwigTypeParser </typetab> ''' Node xml = new XmlParser().parseText(xmlText) - + SwigTypeParser.appendTypeTable(xml) - + // testPrint('f(int,int,int)','foo') // testPrint('p.a(10).p.f(int,p.f(int).int)','foo') // testPrint('p.q(const).char','foo') diff --git a/tools/codegenerator/example/Example.call.template b/tools/codegenerator/example/Example.call.template index 8674dd44fa..bc17282c64 100644 --- a/tools/codegenerator/example/Example.call.template +++ b/tools/codegenerator/example/Example.call.template @@ -32,8 +32,8 @@ module.function.each { functionNode -> } %> code to invoke the api method { - ${Helper.callingName(functionNode)}( <% - functionNode.parm.eachWithIndex { param, i -> + ${Helper.callingName(functionNode)}( <% + functionNode.parm.eachWithIndex { param, i -> %> p_${param.@name}${i < functionNode.parm.size() - 1 ? "," : ""} <% } %> ); } diff --git a/tools/darwin/Support/Codesign.command b/tools/darwin/Support/Codesign.command index 07fde9b126..ae7558aeeb 100755 --- a/tools/darwin/Support/Codesign.command +++ b/tools/darwin/Support/Codesign.command @@ -45,7 +45,7 @@ if [ "${PLATFORM_NAME}" == "iphoneos" ] || [ "${PLATFORM_NAME}" == "appletvos" ] ${GEN_ENTITLEMENTS} "${BUNDLEID}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent"; codesign -v -f -s "${CODE_SIGN_IDENTITY_FOR_ITEMS}" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/" - + #if user has set a code_sign_identity different from iPhone Developer we do a real codesign (for deployment on non-jailbroken devices) if ! [ -z "${CODE_SIGN_IDENTITY}" ] && [ "${CODE_SIGN_IDENTITY}" == "iPhone Developer" ] && [ "${CODE_SIGN_IDENTITY}" != "Don't Code Sign" ]; then echo "Doing a full bundle sign using genuine identity ${CODE_SIGN_IDENTITY}" diff --git a/tools/darwin/Support/CopyRootFiles-osx.command b/tools/darwin/Support/CopyRootFiles-osx.command index 0d1d480800..1aa2e844b8 100755 --- a/tools/darwin/Support/CopyRootFiles-osx.command +++ b/tools/darwin/Support/CopyRootFiles-osx.command @@ -13,7 +13,7 @@ if [ "$ACTION" = build ] ; then SYNC="rsync -aq --exclude .git* --exclude .DS_Store* --exclude *.dll --exclude *.DLL --exclude *linux.* --exclude *arm-osx.* --exclude *.zlib --exclude *.a" # rsync command for excluding pngs and jpgs as well. Note that if the skin itself is not compiled -# using XBMCTex then excluding the pngs and jpgs will most likely make the skin unusable +# using XBMCTex then excluding the pngs and jpgs will most likely make the skin unusable SYNCSKIN="rsync -aq --exclude .git* --exclude CVS* --exclude .svn* --exclude .cvsignore* --exclude .cvspass* --exclude .DS_Store* --exclude *.dll --exclude *.DLL --exclude *linux.* --exclude *.png --exclude *.jpg --exclude *.bat" # rsync command for including everything but the skins diff --git a/tools/darwin/Support/copyframeworks-osx.command b/tools/darwin/Support/copyframeworks-osx.command index 2ac16b45d3..7f1e6a510c 100755 --- a/tools/darwin/Support/copyframeworks-osx.command +++ b/tools/darwin/Support/copyframeworks-osx.command @@ -21,7 +21,7 @@ function check_dyloaded_depends install_name_tool -change "$a" "$DYLIB_NAMEPATH/$(basename $a)" "$TARGET_FRAMEWORKS/$(basename $b)" fi fi - done + done fi } @@ -123,7 +123,7 @@ do let REWIND="1" fi install_name_tool -change "$a" "$DYLIB_NAMEPATH/$(basename $a)" "$TARGET_FRAMEWORKS/$(basename $b)" - done + done done done diff --git a/tools/darwin/packaging/ios/mkdeb-ios.sh.in b/tools/darwin/packaging/ios/mkdeb-ios.sh.in index 6aee2b042e..8632edbe1e 100644 --- a/tools/darwin/packaging/ios/mkdeb-ios.sh.in +++ b/tools/darwin/packaging/ios/mkdeb-ios.sh.in @@ -14,15 +14,15 @@ ARM64=false if [ "${SWITCH#*debug}" != "${SWITCH}" ]; then echo "Packaging Debug target for iOS" APP="$DIRNAME/../../../../build/Debug-iphoneos/@APP_NAME@.app" - DSYM="$DIRNAME/../../../../build/Debug-iphoneos/$DSYM_FILENAME" + DSYM="$DIRNAME/../../../../build/Debug-iphoneos/$DSYM_FILENAME" elif [ "${SWITCH#*release}" != "${SWITCH}" ]; then echo "Packaging Release target for iOS" APP="$DIRNAME/../../../../build/Release-iphoneos/@APP_NAME@.app" - DSYM="$DIRNAME/../../../../build/Release-iphoneos/$DSYM_FILENAME" + DSYM="$DIRNAME/../../../../build/Release-iphoneos/$DSYM_FILENAME" else echo "You need to specify the build target" - exit 1 -fi + exit 1 +fi # check if build is 64-bit if [[ "$(lipo -info "$APP/@APP_NAME@" | awk '{print $NF}')" == "arm64" ]]; then diff --git a/tools/darwin/packaging/osx/dmgmaker.pl b/tools/darwin/packaging/osx/dmgmaker.pl index 54164ebd52..e728e866d5 100755 --- a/tools/darwin/packaging/osx/dmgmaker.pl +++ b/tools/darwin/packaging/osx/dmgmaker.pl @@ -39,7 +39,7 @@ sub make_dmg { die("Could not obtain device handle\n") if !$dev_handle; print "Got device handle \"$dev_handle\"\n"; #clear the volume - we will copy stuff on it with ditto later - #this removes crap which might have come in via the srcfolder + #this removes crap which might have come in via the srcfolder #parameter of hdiutil above `rm -r /Volumes/$pkgname/*`; print "Ignore \"No space left on device\" warnings from ditto, they are an autosize artifact\n"; diff --git a/tools/darwin/packaging/osx/mkdmg-osx.sh.in b/tools/darwin/packaging/osx/mkdmg-osx.sh.in index 69b2de772d..ad9d44e51e 100755 --- a/tools/darwin/packaging/osx/mkdmg-osx.sh.in +++ b/tools/darwin/packaging/osx/mkdmg-osx.sh.in @@ -13,7 +13,7 @@ elif [ ${SWITCH:-""} = "release" ]; then APP="$DIRNAME/../../../../build/Release/@APP_NAME@.app" else echo "You need to specify the build target" - exit 1 + exit 1 fi if [ ! -d $APP ]; then diff --git a/tools/depends/README b/tools/depends/README index 422ee83308..4c48585b30 100644 --- a/tools/depends/README +++ b/tools/depends/README @@ -20,7 +20,7 @@ TVOS: You can target the same --prefix path, each setup will be done in an isolated directory. The last configure/make you do is the one used for Kodi/Xcode. - + #- Android (the paths are examples and have to match those of docs/READM.android) #---------------------------------------------------------------------------- diff --git a/tools/depends/native/JsonSchemaBuilder/src/JsonSchemaBuilder.cpp b/tools/depends/native/JsonSchemaBuilder/src/JsonSchemaBuilder.cpp index 9a8acdbd9b..0e148a1744 100644 --- a/tools/depends/native/JsonSchemaBuilder/src/JsonSchemaBuilder.cpp +++ b/tools/depends/native/JsonSchemaBuilder/src/JsonSchemaBuilder.cpp @@ -55,11 +55,11 @@ void print_json(ifstream &in, ofstream &out) out << endl; continue; } - + // If we just closed a whole object we need to print the separator if (closing) out << "," << endl; - + out << " "; bool started = false; closing = false; @@ -111,7 +111,7 @@ void print_json(ifstream &in, ofstream &out) // Only print a closing " if there was real content on the line if (started) out << '"'; - + // Only print a newline if we haven't just closed a whole object if (!closing) out << endl; diff --git a/tools/depends/native/TexturePacker/src/SimpleFS.h b/tools/depends/native/TexturePacker/src/SimpleFS.h index bbda2b50a8..5448373b02 100644 --- a/tools/depends/native/TexturePacker/src/SimpleFS.h +++ b/tools/depends/native/TexturePacker/src/SimpleFS.h @@ -31,7 +31,7 @@ public: { m_file = NULL; } - + ~CFile() { Close(); @@ -70,7 +70,7 @@ public: return size; return 0; } - + FILE *getFP() { return m_file; diff --git a/tools/depends/native/TexturePacker/src/TexturePacker.cpp b/tools/depends/native/TexturePacker/src/TexturePacker.cpp index 4c45b704d6..1efadd6eb2 100644 --- a/tools/depends/native/TexturePacker/src/TexturePacker.cpp +++ b/tools/depends/native/TexturePacker/src/TexturePacker.cpp @@ -84,7 +84,7 @@ void CreateSkeletonHeaderImpl(CXBTFWriter& xbtfWriter, std::string fullPath, std { while ((dp = readdir(dirp)) != NULL) { - if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) + if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) { continue; } @@ -201,12 +201,12 @@ CXBTFFrame createXBTFFrame(RGBAImage &image, CXBTFWriter& writer, double maxMSE, int width, height; unsigned int format = 0; unsigned char* argb = (unsigned char*)image.pixels; - + width = image.width; height = image.height; bool hasAlpha = HasAlpha(argb, width, height); - CXBTFFrame frame; + CXBTFFrame frame; format = XB_FMT_A8R8G8B8; frame = appendContent(writer, width, height, argb, (width * height * 4), format, hasAlpha, flags); @@ -239,7 +239,7 @@ static bool checkDupe(struct MD5Context* ctx, map<string,unsigned int>::iterator it = hashes.find(hex); if (it != hashes.end()) { - dupes[pos] = it->second; + dupes[pos] = it->second; return true; } diff --git a/tools/depends/native/TexturePacker/src/cmdlineargs.h b/tools/depends/native/TexturePacker/src/cmdlineargs.h index d836f535e5..d0b9d03d34 100644 --- a/tools/depends/native/TexturePacker/src/cmdlineargs.h +++ b/tools/depends/native/TexturePacker/src/cmdlineargs.h @@ -41,7 +41,7 @@ public: if (m_cmdline) { strcpy (m_cmdline, cmdline); - ParseCmdLine(); + ParseCmdLine(); } else { #ifdef TARGET_POSIX delete[] cmdline; @@ -110,7 +110,7 @@ private: bInQuotes = (*pargs == QUOTE); // see if this token is quoted if (bInQuotes) // skip leading quote - pargs++; + pargs++; push_back (pargs); // store position of current token @@ -121,7 +121,7 @@ private: if (bInQuotes) { // find next quote followed by a space or terminator - while (*pargs && + while (*pargs && !(*pargs == QUOTE && (isspace (pargs[1]) || pargs[1] == TERM))) pargs++; if (*pargs) @@ -134,7 +134,7 @@ private: else { // skip to next non-whitespace character - while (*pargs && !isspace (*pargs)) + while (*pargs && !isspace (*pargs)) pargs++; if (*pargs && isspace (*pargs)) // end of token { diff --git a/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp b/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp index f970793d02..7e5179b0cc 100644 --- a/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp +++ b/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp @@ -45,7 +45,7 @@ bool GIFDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) for (unsigned int i = 0; i < extractedFrames.size(); i++) { DecodedFrame frame; - + frame.rgbaImage.pixels = (char *)new char[frameSize]; memcpy(frame.rgbaImage.pixels, extractedFrames[i]->m_pImage, frameSize); frame.rgbaImage.height = height; @@ -53,7 +53,7 @@ bool GIFDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) frame.rgbaImage.bbp = 32; frame.rgbaImage.pitch = pitch; frame.delay = extractedFrames[i]->m_delay; - + frames.frameList.push_back(frame); } } diff --git a/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp b/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp index 9ced4ec5bc..0f6c2865d9 100644 --- a/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp +++ b/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp @@ -221,7 +221,7 @@ bool GifHelper::LoadGif(const char* file) { fprintf(stderr, "Gif::LoadGif(): Could not extract any frame. File %s\n", m_filename.c_str()); return false; - } + } else if (extractedFrames < (int)m_numFrames) { fprintf(stderr, "Gif::LoadGif(): Could only extract %d/%d frames. File %s\n", extractedFrames, m_numFrames, m_filename.c_str()); @@ -420,7 +420,7 @@ bool GifHelper::PrepareTemplate(GifFrame &frame) case DISPOSE_PREVIOUS: { - /* + /* * This disposal method makes no sense for the first frame * Since browsers etc. handle that too, we'll fall back to DISPOSE_DO_NOT */ diff --git a/tools/depends/native/TexturePacker/src/decoder/GifHelper.h b/tools/depends/native/TexturePacker/src/decoder/GifHelper.h index b5dfbc5f76..5281df5b71 100644 --- a/tools/depends/native/TexturePacker/src/decoder/GifHelper.h +++ b/tools/depends/native/TexturePacker/src/decoder/GifHelper.h @@ -17,7 +17,7 @@ * <http://www.gnu.org/licenses/>. * */ - + #pragma once #include "gif_lib.h" diff --git a/tools/depends/native/TexturePacker/src/decoder/IDecoder.h b/tools/depends/native/TexturePacker/src/decoder/IDecoder.h index 6ae8982e86..b197296d9b 100644 --- a/tools/depends/native/TexturePacker/src/decoder/IDecoder.h +++ b/tools/depends/native/TexturePacker/src/decoder/IDecoder.h @@ -27,7 +27,7 @@ class RGBAImage { public: RGBAImage() : pixels(NULL), width(0), height(0), bbp(0), pitch(0) {} - + char *pixels;//image data int width;// width int height;// height diff --git a/tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp b/tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp index b0f18bed68..4022dc719f 100644 --- a/tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp +++ b/tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp @@ -68,33 +68,33 @@ bool JPGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) delete arq; return false; } - + struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; - + int ImageSize; - + cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); - + jpeg_stdio_src(&cinfo, arq->getFP()); jpeg_read_header(&cinfo, TRUE); jpeg_start_decompress(&cinfo); - + // Image Size is calculated as (width * height * bytes per pixel = 4 ImageSize = cinfo.image_width * cinfo.image_height * 4; - + frames.user = NULL; DecodedFrame frame; - + frame.rgbaImage.pixels = (char *)new char[ImageSize]; - + unsigned char *scanlinebuff = new unsigned char[3 * cinfo.image_width]; unsigned char *dst = (unsigned char *)frame.rgbaImage.pixels; while (cinfo.output_scanline < cinfo.output_height) { jpeg_read_scanlines(&cinfo,&scanlinebuff,1); - + unsigned char *src2 = scanlinebuff; unsigned char *dst2 = dst; for (unsigned int x = 0; x < cinfo.image_width; x++, src2 += 3) @@ -107,16 +107,16 @@ bool JPGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) dst += cinfo.image_width * 4; } delete [] scanlinebuff; - + jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); - + frame.rgbaImage.height = cinfo.image_height; frame.rgbaImage.width = cinfo.image_width; frame.rgbaImage.bbp = 32; frame.rgbaImage.pitch = 4 * cinfo.image_width; frames.frameList.push_back(frame); - + delete arq; return true; } @@ -127,7 +127,7 @@ void JPGDecoder::FreeDecodedFrames(DecodedFrames &frames) { delete [] frames.frameList[i].rgbaImage.pixels; } - + frames.clear(); } diff --git a/tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp b/tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp index f2d10eb5d2..96ca0b461f 100644 --- a/tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp +++ b/tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp @@ -51,11 +51,11 @@ bool PNGDecoder::CanDecode(const std::string &filename) #define PNG_BYTES_TO_CHECK 4 CFile fp; char buf[PNG_BYTES_TO_CHECK]; - + /* Open the prospective PNG file. */ if (!fp.Open(filename)) return false; - + /* Read in some of the signature bytes */ if (fp.Read(buf, PNG_BYTES_TO_CHECK) != PNG_BYTES_TO_CHECK) { @@ -72,30 +72,30 @@ bool PNGDecoder::CanDecode(const std::string &filename) bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) { png_byte header[8]; - + CFile fp; if (!fp.Open(filename)) { perror(filename.c_str()); return false; } - + // read the header fp.Read(header, 8); - + if (png_sig_cmp(header, 0, 8)) { fprintf(stderr, "error: %s is not a PNG.\n", filename.c_str()); return false; } - + png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { fprintf(stderr, "error: png_create_read_struct returned 0.\n"); return false; } - + // create png info struct png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) @@ -104,7 +104,7 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); return false; } - + // create png info struct png_infop end_info = png_create_info_struct(png_ptr); if (!end_info) @@ -113,36 +113,36 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); return false; } - + // the code in this if statement gets called if libpng encounters an error if (setjmp(png_jmpbuf(png_ptr))) { fprintf(stderr, "error from libpng\n"); png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); return false; } - + // init png reading png_init_io(png_ptr, fp.getFP()); - + // let libpng know you already read the first 8 bytes png_set_sig_bytes(png_ptr, 8); - + // read all the info up to the image data png_read_info(png_ptr, info_ptr); - + // variables to pass to get info int bit_depth, color_type; png_uint_32 temp_width, temp_height; - + // get info about png png_get_IHDR(png_ptr, info_ptr, &temp_width, &temp_height, &bit_depth, &color_type, NULL, NULL, NULL); - + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { png_set_tRNS_to_alpha(png_ptr); } - + //set it to 32bit pixeldepth png_color_8 sig_bit; sig_bit.red = 32; @@ -151,12 +151,12 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) // if the image has an alpha channel then sig_bit.alpha = 32; png_set_sBIT(png_ptr, info_ptr, &sig_bit); - - + + /* Add filler (or alpha) byte (before/after each RGB triplet) */ png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER); - - + + if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_RGB_ALPHA) png_set_bgr(png_ptr); @@ -164,10 +164,10 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) // convert indexed color to rgb if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr); - + /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ //png_set_swap_alpha(png_ptr); - + //libsquish only eats 32bit RGBA, must convert grayscale into this format if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) @@ -178,13 +178,13 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) // Update the png info struct. png_read_update_info(png_ptr, info_ptr); - + // Row size in bytes. int rowbytes = png_get_rowbytes(png_ptr, info_ptr); - + // glTexImage2d requires rows to be 4-byte aligned // rowbytes += 3 - ((rowbytes-1) % 4); - + // Allocate the image_data as a big block, to be given to opengl png_byte * image_data; image_data = (png_byte*)new png_byte[rowbytes * temp_height * sizeof(png_byte)+15]; @@ -194,7 +194,7 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); return false; } - + // row_pointers is for pointing to image_data for reading the png with libpng png_bytep * row_pointers = (png_bytep*) new png_bytep[temp_height * sizeof(png_bytep)]; if (row_pointers == NULL) @@ -204,19 +204,19 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) delete [] image_data; return false; } - + // set the individual row_pointers to point at the correct offsets of image_data for (unsigned int i = 0; i < temp_height; i++) { row_pointers[i] = image_data + i * rowbytes; } - + // read the png into image_data through row_pointers png_read_image(png_ptr, row_pointers); - + frames.user = NULL; DecodedFrame frame; - + frame.rgbaImage.pixels = (char *)image_data; frame.rgbaImage.height = temp_height; frame.rgbaImage.width = temp_width; @@ -235,7 +235,7 @@ void PNGDecoder::FreeDecodedFrames(DecodedFrames &frames) { delete [] frames.frameList[i].rgbaImage.pixels; } - + frames.clear(); } diff --git a/tools/depends/native/TexturePacker/src/md5.h b/tools/depends/native/TexturePacker/src/md5.h index 6a1554765a..5e753c8767 100644 --- a/tools/depends/native/TexturePacker/src/md5.h +++ b/tools/depends/native/TexturePacker/src/md5.h @@ -25,7 +25,7 @@ #include <cstring> /* for memcpy() */ #include <cstdint> -struct MD5Context +struct MD5Context { uint32_t buf[4]; uint32_t bytes[2]; diff --git a/tools/depends/target/fontconfig/Makefile b/tools/depends/target/fontconfig/Makefile index 6bc721a9f3..8f4f8cba11 100644 --- a/tools/depends/target/fontconfig/Makefile +++ b/tools/depends/target/fontconfig/Makefile @@ -23,7 +23,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM) cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) cd $(PLATFORM); patch -p1 < ../lconv.patch - cd $(PLATFORM); patch -p1 < ../fix-aarch64_atomics.patch + cd $(PLATFORM); patch -p1 < ../fix-aarch64_atomics.patch cd $(PLATFORM); $(AUTORECONF) -vif cd $(PLATFORM); $(CONFIGURE) diff --git a/tools/depends/target/libffi/Makefile b/tools/depends/target/libffi/Makefile index 1b3d01d759..eb62087cb8 100644 --- a/tools/depends/target/libffi/Makefile +++ b/tools/depends/target/libffi/Makefile @@ -8,7 +8,7 @@ SOURCE=$(LIBNAME)-$(VERSION) ARCHIVE=$(SOURCE).tar.gz # configuration settings -CONFIGURE= ./configure --prefix=$(PREFIX) --disable-shared --disable-builddir +CONFIGURE= ./configure --prefix=$(PREFIX) --disable-shared --disable-builddir LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a diff --git a/tools/depends/target/openssl/Makefile b/tools/depends/target/openssl/Makefile index f5b8c1f3ca..6fd67cecf1 100644 --- a/tools/depends/target/openssl/Makefile +++ b/tools/depends/target/openssl/Makefile @@ -38,7 +38,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) sed -ie "s|CFLAG= |CFLAG=$(CFLAGS) |" "$(PLATFORM)/Makefile"; \ fi # for iphoneos-cross config a sysroot argument is added - # however sysroot already set in Makefile.include, so remove this + # however sysroot already set in Makefile.include, so remove this if test "$(OS)" = "ios"; then \ sed -ie "s|CFLAG= |CFLAG=$(CFLAGS) |" "$(PLATFORM)/Makefile"; \ sed -ie "s|-isysroot \$$(CROSS_TOP)/SDKs/\$$(CROSS_SDK) ||" "$(PLATFORM)/Makefile"; \ diff --git a/tools/depends/target/python27/Makefile b/tools/depends/target/python27/Makefile index c7d6004d30..ad4d715b86 100644 --- a/tools/depends/target/python27/Makefile +++ b/tools/depends/target/python27/Makefile @@ -20,7 +20,7 @@ endif CONFIGURE=OPT="$(CFLAGS)" \ LIBS=-lm \ ./configure --prefix=$(PREFIX) --host=$(HOST) \ - --disable-toolbox-glue --disable-framework --with-system-expat --with-system-ffi --without-pymalloc --enable-ipv6 + --disable-toolbox-glue --disable-framework --with-system-expat --with-system-ffi --without-pymalloc --enable-ipv6 LIBDYLIB=$(PLATFORM)/libpython2.7.a diff --git a/tools/depends/target/python27/modules.setup b/tools/depends/target/python27/modules.setup index e192662acb..fbe47b2513 100644 --- a/tools/depends/target/python27/modules.setup +++ b/tools/depends/target/python27/modules.setup @@ -109,7 +109,7 @@ PYTHONPATH=$(COREPYTHONPATH) # various reasons; therefore they are listed here instead of in the # normal order. -# This only contains the minimal set of modules required to run the +# This only contains the minimal set of modules required to run the # setup.py script in the root of the Python source tree. posix posixmodule.c # posix (UNIX) system calls @@ -126,9 +126,9 @@ zipimport zipimport.c # The rest of the modules listed in this file are all commented out by # default. Usually they can be detected and built as dynamically # loaded modules by the new setup.py script added in Python 2.1. If -# you're on a platform that doesn't support dynamic loading, want to -# compile modules statically into the Python binary, or need to -# specify some odd set of compiler switches, you can uncomment the +# you're on a platform that doesn't support dynamic loading, want to +# compile modules statically into the Python binary, or need to +# specify some odd set of compiler switches, you can uncomment the # appropriate lines below. # ====================================================================== @@ -177,7 +177,7 @@ _weakref _weakref.c # basic weak reference support _testcapi _testcapimodule.c # Python C API test module _random _randommodule.c # Random number generator _collections _collectionsmodule.c # Container types -itertools itertoolsmodule.c # Functions creating iterators for efficient looping +itertools itertoolsmodule.c # Functions creating iterators for efficient looping strop stropmodule.c # String manipulations _functools _functoolsmodule.c # Tools for working with functions and callable objects @@ -198,7 +198,7 @@ _locale _localemodule.c -lintl # supported...) # fcntl fcntlmodule.c # fcntl(2) and ioctl(2) -#spwd spwdmodule.c # spwd(3) +#spwd spwdmodule.c # spwd(3) #grp grpmodule.c # grp(3) select selectmodule.c # select(2); not on ancient System V @@ -304,7 +304,7 @@ _sha512 sha512module.c #sunaudiodev sunaudiodev.c -# A Linux specific module -- off by default; this may also work on +# A Linux specific module -- off by default; this may also work on # some *BSDs. #linuxaudiodev linuxaudiodev.c @@ -370,7 +370,7 @@ syslog syslogmodule.c # syslog daemon interface #_curses _cursesmodule.c -lcurses -ltermcap # Wrapper for the panel library that's part of ncurses and SYSV curses. -#_curses_panel _curses_panel.c -lpanel -lncurses +#_curses_panel _curses_panel.c -lpanel -lncurses # Generic (SunOS / SVR4) dynamic loading module. diff --git a/tools/windows/packaging/uwp/package.appxmanifest.in b/tools/windows/packaging/uwp/package.appxmanifest.in index 11a0ee512f..ddb4222da3 100644 --- a/tools/windows/packaging/uwp/package.appxmanifest.in +++ b/tools/windows/packaging/uwp/package.appxmanifest.in @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<Package - xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" - xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" - xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" - xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" +<Package + xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" + xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" + xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" + xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="mp uap uap3"> <Identity Name="@APP_PACKAGE_IDENTITY@" ProcessorArchitecture="@SDK_TARGET_ARCH@" Publisher="CN=@APP_PACKAGE_PUBLISHER@" Version="@APP_VERSION_CODE@.0" /> @@ -26,11 +26,11 @@ <Applications> <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@APP_NAME_LC@.App"> - <uap:VisualElements - DisplayName="@APP_NAME@ @APP_VERSION@" + <uap:VisualElements + DisplayName="@APP_NAME@ @APP_VERSION@" Description="@APP_PACKAGE_DESCRIPTION@" - Square150x150Logo="media\icon150x150.png" - Square44x44Logo="media\icon44x44.png" + Square150x150Logo="media\icon150x150.png" + Square44x44Logo="media\icon44x44.png" BackgroundColor="transparent"> <uap:DefaultTile Wide310x150Logo="media\banner310x150.png" /> <uap:SplashScreen Image="media\SplashScreen.png" BackgroundColor="black" /> |