Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Last active April 2, 2017 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjolnir/18c474a78b4ce07f94cb4119cb2769cd to your computer and use it in GitHub Desktop.
Save fjolnir/18c474a78b4ce07f94cb4119cb2769cd to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#pragma mark Blocks
typedef void (^CDUnknownBlockType)(void); // return type and parameters are unknown
#pragma mark Named Structures
struct BLRAggdInfo {
float manualModeTime;
float sunModeTime;
float scheduleModeTime;
int turnOnForNowCount;
int turnOffForNowCount;
int turnOnUntilTomorrowCount;
int turnOffUntilTomorrowCount;
double _aggdModeChangeTimestamp;
};
struct NMFactorState {
double rampStartTime;
float factor;
float target;
float start;
float rampLength;
};
#pragma mark Typedef'd Structures
typedef struct {
float minCCT;
float maxCCT;
float midCCT;
} CDStruct_6ede4ed5;
typedef struct {
int hour;
int minute;
} CDStruct_bdf7039f;
typedef struct {
CDStruct_bdf7039f fromTime;
CDStruct_bdf7039f toTime;
} CDStruct_6cee55f3;
typedef struct {
char active;
char enabled;
char sunSchedulePermitted;
int mode;
CDStruct_6cee55f3 schedule;
unsigned long long disableFlags;
} CDStruct_768fa5c4;
@class SunriseSunsetProvider;
@interface NightModeControl : NSObject
{
NSMutableDictionary *_properties;
SunriseSunsetProvider *_sunriseSunsetProvider;
int _sunriseSunsetInfoQueryTimeout;
NSDictionary *_sunriseSunsetInfo;
struct __Display *_display;
NSObject<OS_dispatch_queue> *_queue;
NSObject<OS_dispatch_source> *_nextTransitionTimer;
NSObject<OS_dispatch_source> *_transitionTimer;
NSObject<OS_dispatch_source> *_aggdUpdateTimer;
struct BLRAggdInfo _aggdKeysInfo;
int _algoState;
float _transitionLength;
float _transitionLengthActual;
float _transitionsTimesCoeff;
float _transitionRate;
float _minFactor;
float _maxFactor;
struct NMFactorState _factorState;
struct __CFTimeZone *_currentTimeZone;
double _sunsetAbsolute;
double _sunsetPreviousAbsolute;
double _sunriseAbsolute;
double _sunrisePreviousAbsolute;
double _offTransitionTimeAbsoluteUnrestricted;
double _offTransitionTimeAbsoluteUnrestrictedPrev;
BOOL _transitionTimesValid;
BOOL _isDaylight;
int _currentScheduledTransitionType;
double _displayOffTimestamp;
double _untilNexTransitionTimestamp;
float _inactivityTimeout;
BOOL _checkInactivity;
BOOL _displayOff;
int _logLevel;
void (^_callbackBlock)();
CDStruct_768fa5c4 _status;
CDStruct_6cee55f3 _backupSchedule;
BOOL _statusUpdated;
NSString *_currentSunriseKey;
NSString *_currentSunsetKey;
NSString *_previousSunriseKey;
NSString *_previousSunsetKey;
NSString *_nextSunriseKey;
NSString *_nextSunsetKey;
NSString *_isDaylightKey;
int _notifyUserAboutScheduleCounter;
struct __CFUserNotification *_enableNotification;
BOOL _notificationInProgress;
BOOL _revertToSunriseSunset;
struct __CFString *_userName;
}
- (void)displayAlertInteractive:(BOOL)arg1;
- (id)copyTimeStringWithHour:(int)arg1 minute:(int)arg2 second:(int)arg3;
- (void)cancelTransition;
- (void)cancelSchedule;
- (void)cancelAggdPeriodicUpdate;
- (void)tearDownAllTimers;
- (void)clockChanged;
- (void)timeZoneChanged;
- (void)setAlgoState:(int)arg1;
- (void)updateOptionTimestamp:(double)arg1;
- (BOOL)updateTransitionTimesFromSunriseSunset:(double)arg1;
- (void)retrieveSunriseSunsetTimesFromBackup:(double)arg1;
- (void)updateSunriseSunsetInfo:(id)arg1;
- (void)updateSunriseSunsetBackup;
- (void)setSunPermitted:(BOOL)arg1;
- (void)reevaluateCurrentStateWithFactorFadeOption:(float)arg1;
- (void)reevaluateCurrentState;
- (void)initiateFullMinTransition;
- (void)initiateFullMaxTransition;
- (void)initiateRestrictedMaxTransition;
- (void)updateTransitionTimes:(double)arg1;
- (BOOL)updateTransitionTimesFromSchedule:(double)arg1;
- (void)transitionTimerHandler;
- (void)setNightModeFactor:(float)arg1 withFadePeriod:(float)arg2;
- (void)setNightModeFactor:(float)arg1;
- (void)scheduleAggdKeysUpdate;
- (void)aggdKeysUpdate;
- (void)scheduleNextTransition:(double)arg1 withType:(int)arg2;
- (void)initiateTransitionTo:(float)arg1 andRampLength:(float)arg2;
- (void)enableBlueLightReduction:(BOOL)arg1 withOption:(int)arg2;
- (void)setSchedule:(id)arg1;
- (void)setMode:(int)arg1;
- (BOOL)setProperty:(id)arg1 forKey:(id)arg2;
- (id)getPropertyForKey:(id)arg1;
- (void)dealloc;
- (void)switchToUser:(struct __CFString *)arg1;
- (id)initWithDisplay:(struct __Display *)arg1 queue:(id)arg2 callback:(CDUnknownBlockType)arg3;
- (id)copyLowPowerModeState;
- (void)updateLowPowerModeState:(id)arg1;
- (void)updateStatusDictionaryWithValue:(id)arg1 forKey:(id)arg2;
- (id)copyStatusDictionaryFromPrefs;
- (void)saveStatusToPrefs:(id)arg1;
- (id)copyDictionaryFromStatus:(CDStruct_768fa5c4 *)arg1;
- (BOOL)parseStatusDictionary:(id)arg1 intoStruct:(CDStruct_768fa5c4 *)arg2 shouldUpdatePrefs:(char *)arg3;
@end
@interface BLControl : NSObject
{
_Bool AABEnabled;
struct __IOHIDEventSystemClient *hidSystemClient;
unsigned int alsNode[3];
unsigned int driverNode[3];
unsigned int alsOrientation[3];
struct __IOHIDServiceClient *alsClient[3];
struct __IOHIDServiceClient *otherClients[3];
unsigned int alsCount;
unsigned int otherClientsCount;
unsigned int backlight[2];
struct __Display *display[2];
NightModeControl *_nightModeControl[2];
unsigned int displayCount;
NSObject<OS_dispatch_queue> *rootQueue;
NSObject<OS_dispatch_queue> *queue;
_Bool aabExist;
_Bool ignoreBrightnessKey;
_Bool overrideIgnoreBrightness;
_Bool ignoreALSEvents;
CDUnknownBlockType _callback;
void *_callbackContext;
_Bool monitorALSOnly;
_Bool useRootQueue;
_Bool _useMultiCurves;
int _ecoModeNotificationToken;
CDUnknownBlockType _ecoModeNotificationHandler;
int _ecoModePreferencesUpdateNotificationToken;
CDUnknownBlockType _ecoModePreferencesUpdateNotificationHandler;
}
- (void)callBlockWithProperty:(struct __CFString *)arg1 value:(void *)arg2;
- (void)registerNotificationBlock:(CDUnknownBlockType)arg1;
- (void)stop;
- (_Bool)start;
- (int)rootQueuePthreadAttrInit:(struct _opaque_pthread_attr_t *)arg1;
- (id)init;
- (_Bool)setPropertyWithKey:(struct __CFString *)arg1 property:(void *)arg2 client:(struct __CFNumber *)arg3;
- (_Bool)userChange:(struct __CFString *)arg1;
- (_Bool)setBLControlPropertyWithKey:(struct __CFString *)arg1 property:(void *)arg2;
- (void *)copyPropertyWithKey:(struct __CFString *)arg1 client:(struct __CFNumber *)arg2;
- (void *)copyBLControlPropertyWithkey:(struct __CFString *)arg1;
- (_Bool)findHIDClients;
- (struct __CFDictionary *)createDictWithUsagePairPage:(unsigned int)arg1 usage:(unsigned int)arg2;
- (_Bool)findBacklight;
- (_Bool)findAlsNodes;
@end
int main(int argc, char *argv[])
{
BLControl *bl = [BLControl new];
[bl start];
Ivar nightVar = class_getInstanceVariable(BLControl.class, "_nightModeControl");
NightModeControl *nightControl = *((NightModeControl **)((uintptr_t)bl+ivar_getOffset(nightVar)));
NSLog(@"%@ %@", bl, nightControl);
Ivar logVar = class_getInstanceVariable(NightModeControl.class, "_logLevel");
*(int*)((uintptr_t)nightControl + ivar_getOffset(logVar)) = 100;
[nightControl setNightModeFactor:FLT_MIN];
[[NSRunLoop mainRunLoop] run];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment