├── .gitignore ├── Resources ├── Icon.png ├── Icon@2x.png └── Icon@3x.png ├── Sources ├── BCORenderDebugListController.h ├── BCORenderDebugOption.h ├── BCORenderDebugOption.m └── BCORenderDebugListController.m ├── control ├── entry.plist ├── Makefile ├── README.md └── Info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | # Theos 2 | .theos 3 | packages/ 4 | -------------------------------------------------------------------------------- /Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brycebostwick/RenderDebugPreferences/HEAD/Resources/Icon.png -------------------------------------------------------------------------------- /Resources/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brycebostwick/RenderDebugPreferences/HEAD/Resources/Icon@2x.png -------------------------------------------------------------------------------- /Resources/Icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brycebostwick/RenderDebugPreferences/HEAD/Resources/Icon@3x.png -------------------------------------------------------------------------------- /Sources/BCORenderDebugListController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface BCORenderDebugListController : PSListController 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /control: -------------------------------------------------------------------------------- 1 | Package: co.bryce.render-debug-preferences 2 | Name: Render Debug Preferences 3 | Version: 0.0.1 4 | Architecture: iphoneos-arm 5 | Description: Modify Render Debug flags from iOS Sttings 6 | Maintainer: Bryce Pauken 7 | Author: Bryce Pauken 8 | Section: System 9 | Tag: role::hacker 10 | -------------------------------------------------------------------------------- /entry.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | entry 6 | 7 | bundle 8 | RenderDebugPreferences 9 | cell 10 | PSLinkCell 11 | detail 12 | BCORenderDebugListController 13 | icon 14 | Icon.png 15 | isController 16 | 17 | label 18 | Render Debugging 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TARGET = iphone:11.2:10.0 2 | 3 | include $(THEOS)/makefiles/common.mk 4 | 5 | BUNDLE_NAME = RenderDebugPreferences 6 | 7 | RenderDebugPreferences_FILES = $(wildcard Sources/*.m) 8 | RenderDebugPreferences_INSTALL_PATH = /Library/PreferenceBundles 9 | RenderDebugPreferences_FRAMEWORKS = UIKit 10 | RenderDebugPreferences_PRIVATE_FRAMEWORKS = Preferences 11 | RenderDebugPreferences_CFLAGS = -fobjc-arc 12 | RenderDebugPreferences_RESOURCE_DIRS = Resources 13 | 14 | include $(THEOS_MAKE_PATH)/bundle.mk 15 | 16 | internal-stage:: 17 | $(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END) 18 | $(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/RenderDebugPreferences.plist$(ECHO_END) 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RenderDebugPreferences 2 | 3 | A preference pane for jailbroken devices that lets you toggle Render Debug Options 4 | (like Color Blended Layers, or Color Offscreen-Rendered) from your device. 5 | Based on [this](https://bryce.co/on-device-render-debugging/) post on [bryce.co](https://bryce.co/). 6 | 7 | ## Building 8 | 9 | ### Prerequisites 10 | 11 | - A jailbroken device 12 | - [Theos](https://github.com/theos/theos/). 13 | 14 | ### Build 15 | 16 | `make package` 17 | 18 | ## Installation 19 | 20 | If you have `THEOS_DEVICE_IP` and `THEOS_DEVICE_PORT` set (see [Theos setup](https://iphonedevwiki.net/index.php/Theos/Setup)) : 21 | 22 | `make package install` 23 | 24 | Otherwise, you can copy the `.deb` file created by `make package` onto your device and install manually with `dpkg`. 25 | -------------------------------------------------------------------------------- /Sources/BCORenderDebugOption.h: -------------------------------------------------------------------------------- 1 | @interface BCORenderDebugOption: NSObject 2 | 3 | /** 4 | Contains all known render debug options. 5 | */ 6 | @property (nonatomic, strong, nonnull, readonly, class) NSArray *allOptions; 7 | 8 | /** 9 | A user-facing string that represents this render debug option. 10 | */ 11 | @property (nonatomic, strong, nonnull, readonly) NSString *label; 12 | 13 | /** 14 | A unique identifier that represents this render debug option. 15 | */ 16 | @property (nonatomic, strong, nonnull, readonly) NSString *identifier; 17 | 18 | /** 19 | The value associated with this option that can be used with 20 | `CARenderServerGetDebugOption` / `CARenderServerSetDebugOption`. 21 | */ 22 | @property (nonatomic, readonly) NSInteger value; 23 | 24 | - (nonnull instancetype)init NS_UNAVAILABLE; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | RenderDebugPreferences 9 | CFBundleIdentifier 10 | co.bryce.render-debug-preferences 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | NSPrincipalClass 22 | BCORenderDebugListController 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/BCORenderDebugOption.m: -------------------------------------------------------------------------------- 1 | #import "BCORenderDebugOption.h" 2 | 3 | @implementation BCORenderDebugOption 4 | 5 | - (nonnull instancetype)initWithLabel:(nonnull NSString *)label 6 | identifier:(nonnull NSString *)identifier 7 | value:(NSInteger)value { 8 | if (self = [super init]) { 9 | _label = label; 10 | _identifier = identifier; 11 | _value = value; 12 | } 13 | 14 | return self; 15 | } 16 | 17 | + (nonnull NSArray *)allOptions { 18 | return @[ 19 | [[BCORenderDebugOption alloc] initWithLabel:@"Color Blended Layers" 20 | identifier:@"colorBlendedLayers" 21 | value:0x2], 22 | [[BCORenderDebugOption alloc] initWithLabel:@"Color Hits Green and Misses Red" 23 | identifier:@"colorCached" 24 | value:0x13], 25 | [[BCORenderDebugOption alloc] initWithLabel:@"Color Copied Images" 26 | identifier:@"colorCopiedImages" 27 | value:0x1], 28 | [[BCORenderDebugOption alloc] initWithLabel:@"Color Layer Formats" 29 | identifier:@"colorFormat" 30 | value:0x14], 31 | [[BCORenderDebugOption alloc] initWithLabel:@"Color Immediately" 32 | identifier:@"colorImmediately" 33 | value:0x3], 34 | [[BCORenderDebugOption alloc] initWithLabel:@"Color Misaligned Images" 35 | identifier:@"colorMisalignedImages" 36 | value:0xe], 37 | [[BCORenderDebugOption alloc] initWithLabel:@"Color Offscreen-Rendered Yellow" 38 | identifier:@"colorOffscreenRenderedYellow" 39 | value:0x11], 40 | [[BCORenderDebugOption alloc] initWithLabel:@"Color Compositing Fast-Path Blue" 41 | identifier:@"colorOpenGLFastPathBlue" 42 | value:0x12], 43 | [[BCORenderDebugOption alloc] initWithLabel:@"Flash Updated Regions" 44 | identifier:@"flashUpdatedRegions" 45 | value:0x0] 46 | ]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Sources/BCORenderDebugListController.m: -------------------------------------------------------------------------------- 1 | #include "BCORenderDebugListController.h" 2 | #include "BCORenderDebugOption.h" 3 | 4 | #import 5 | #import 6 | 7 | @interface BCORenderDebugListController() 8 | 9 | @property (nonatomic, strong, nullable) NSDictionary *debugOptionMap; 10 | 11 | @end 12 | 13 | @implementation BCORenderDebugListController 14 | 15 | - (void)viewDidLoad { 16 | [super viewDidLoad]; 17 | 18 | NSMutableArray *specifiers = [[NSMutableArray alloc] init]; 19 | NSMutableDictionary *debugOptionMap = [[NSMutableDictionary alloc] init]; 20 | 21 | for (BCORenderDebugOption *debugOption in BCORenderDebugOption.allOptions) { 22 | PSSpecifier* specifier = [PSSpecifier preferenceSpecifierNamed:debugOption.label 23 | target:self 24 | set:@selector(setPreferenceValue:forSpecifier:) 25 | get:@selector(preferenceValueForSpecifier:) 26 | detail:Nil 27 | cell:PSSwitchCell 28 | edit:Nil]; 29 | [specifier setIdentifier:debugOption.identifier]; 30 | [specifiers addObject:specifier]; 31 | [debugOptionMap setObject:debugOption forKey:debugOption.identifier]; 32 | } 33 | 34 | self.specifiers = specifiers; 35 | self.debugOptionMap = debugOptionMap; 36 | } 37 | 38 | - (id)preferenceValueForSpecifier:(PSSpecifier *)specifier { 39 | BCORenderDebugOption *debugOption = self.debugOptionMap[specifier.identifier]; 40 | 41 | typedef void* (*option_func_type)(); 42 | option_func_type CARenderServerGetDebugOption; 43 | void *quartzCore = dlopen("/System/Library/Frameworks/QuartzCore.framework/QuartzCore", RTLD_NOW); 44 | *(void**)(&CARenderServerGetDebugOption) = dlsym(quartzCore,"CARenderServerGetDebugOption"); 45 | BOOL isEnabled = (BOOL)CARenderServerGetDebugOption(0, debugOption.value); 46 | return @(isEnabled); 47 | } 48 | 49 | - (void)setPreferenceValue:(id)value forSpecifier:(PSSpecifier *)specifier { 50 | BCORenderDebugOption *debugOption = self.debugOptionMap[specifier.identifier]; 51 | 52 | typedef void* (*option_func_type)(); 53 | option_func_type CARenderServerSetDebugOption; 54 | void *quartzCore = dlopen("/System/Library/Frameworks/QuartzCore.framework/QuartzCore", RTLD_NOW); 55 | *(void**)(&CARenderServerSetDebugOption) = dlsym(quartzCore,"CARenderServerSetDebugOption"); 56 | CARenderServerSetDebugOption(0, debugOption.value, [value boolValue]); 57 | } 58 | 59 | /** 60 | Override `reloadSpecifiers` to no-op. 61 | 62 | Otherwise, when navigating back to Settings from elsewhere, 63 | the controller will try to load our specifiers 64 | from a source we don't own 65 | */ 66 | - (void)reloadSpecifiers {} 67 | 68 | @end 69 | --------------------------------------------------------------------------------