added files via upload

This commit is contained in:
Balackburn
2023-06-27 09:54:41 +02:00
commit 2ff6aac218
1420 changed files with 88898 additions and 0 deletions

3
Tweaks/YTUHD/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.theos
.DS_Store
packages

74
Tweaks/YTUHD/Common.x Normal file
View File

@@ -0,0 +1,74 @@
#import "Header.h"
#import <VideoToolbox/VideoToolbox.h>
#import <sys/sysctl.h>
#import <version.h>
extern BOOL UseVP9();
%hook YTSettings
- (BOOL)isWebMEnabled {
return YES;
}
%end
%group Spoofing
%hook UIDevice
- (NSString *)systemVersion {
return @"15.7.6";
}
%end
%hook NSProcessInfo
- (NSOperatingSystemVersion)operatingSystemVersion {
NSOperatingSystemVersion version;
version.majorVersion = 15;
version.minorVersion = 7;
version.patchVersion = 6;
return version;
}
%end
%hookf(int, sysctlbyname, const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) {
if (strcmp(name, "kern.osversion") == 0) {
if (oldp)
strcpy((char *)oldp, IOS_BUILD);
*oldlenp = strlen(IOS_BUILD);
}
return %orig(name, oldp, oldlenp, newp, newlen);
}
%end
// #ifdef SIDELOADED
// #import "../PSHeader/Misc.h"
// typedef struct OpaqueVTVideoDecoder VTVideoDecoderRef;
// extern OSStatus VTSelectAndCreateVideoDecoderInstance(CMVideoCodecType codecType, CFAllocatorRef allocator, CFDictionaryRef videoDecoderSpecification, VTVideoDecoderRef *decoderInstanceOut);
// #endif
%ctor {
if (UseVP9()) {
%init;
// #ifdef SIDELOADED
// CFMutableDictionaryRef payload = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
// if (payload) {
// CFDictionarySetValue(payload, CFSTR("RequireHardwareAcceleratedVideoDecoder"), kCFBooleanTrue);
// CFDictionarySetValue(payload, CFSTR("AllowAlternateDecoderSelection"), kCFBooleanTrue);
// VTSelectAndCreateVideoDecoderInstance(kCMVideoCodecType_VP9, kCFAllocatorDefault, payload, NULL);
// CFRelease(payload);
// }
// #endif
if (!IS_IOS_OR_NEWER(iOS_15_0)) {
%init(Spoofing);
}
}
}

18
Tweaks/YTUHD/Header.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef YTUHD_H_
#define YTUHD_H_
#import "../YouTubeHeader/YTIHamplayerSoftwareStreamFilter.h"
#import "../YouTubeHeader/YTIHamplayerConfig.h"
#import "../YouTubeHeader/MLABRPolicyNew.h"
#import "../YouTubeHeader/MLABRPolicyOld.h"
#import "../YouTubeHeader/MLVideo.h"
#import "../YouTubeHeader/MLHAMPlayerItem.h"
#define IOS_BUILD "19H349"
#define MAX_FPS 60
#define MAX_HEIGHT 2160 // 4k
#define MAX_PIXELS 8294400 // 3840 x 2160 (4k)
#define UseVP9Key @"EnableVP9"
#endif

21
Tweaks/YTUHD/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 - 2023 PoomSmart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

20
Tweaks/YTUHD/Makefile Normal file
View File

@@ -0,0 +1,20 @@
TARGET := iphone:clang:latest:11.0
ARCHS = arm64
INSTALL_TARGET_PROCESSES = YouTube
EXTRA_CFLAGS =
ifeq ($(SIDELOADED),1)
EXTRA_CFLAGS += -DSIDELOADED
endif
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = YTUHD
$(TWEAK_NAME)_FILES = Common.x Tweak.x Settings.x
$(TWEAK_NAME)_CFLAGS = -fobjc-arc $(EXTRA_CFLAGS)
$(TWEAK_NAME)_FRAMEWORKS = VideoToolbox
# SUBPROJECTS = YTUHD-AVD
include $(THEOS_MAKE_PATH)/tweak.mk
# include $(THEOS_MAKE_PATH)/aggregate.mk

32
Tweaks/YTUHD/README.md Normal file
View File

@@ -0,0 +1,32 @@
# YTUHD
Unlock 1440p (2K) and 2160p (4K) resolutions in iOS YouTube app.
## Backstory
For a few years, YouTube has been testing 2K/4K resolutions on iOS as A/B (Alpha/Beta testing). The first group of users will see 2K/4K options while the other won't.
There are certain prerequisites for those options to show; (1) Whether a device support VP9 video decoding (which implies on Apple's end to be at least on iOS 14) and
(2) Whether YouTube decides on their end to include those options for that particular device.
YTUHD attemps to bypass those restrictions for all 64-bit devices running iOS 11 or higher, as the performance points of those devices are at most reasonable to be able to keep up with 2K/4K, at least, optimistically.
## VP9
Hardware accelerated VP9 decoder is technically added as of iOS 14 and YouTube has been utilizing it through a private entitlement `com.apple.coremedia.allow-alternate-video-decoder-selection` (All apps are equal is a lie).
This decoder handles the resolutions up to 4K, although not all devices that can run iOS 14 get this decoder. iPhone SE (1st gen) is one example that hardware VP9 decoder is entirely absent from the firmware.
Also, for those old devices they don't get `AppleAVD` driver which is essential for VP9 decoding to work. Such attempt to load VP9 decoder (inside `AppleAVD` driver) from `/System/Library/VideoDecoders/AVD.videodecoder` (provided that you can extract that from dyld_shared_cache of a new device) will result in `AVDRegister - AppleAVDCheckPlatform() returned FALSE`.
## Server ABR
If you look at the source code, there is an enforcement to not use server ABR. The author has yet to figure out what ABR stands for but its purpose is to fetch the available formats (resolutions) of a video.
When the flag is set to true, it's entirely up to YouTube server to respond to YouTube app of the video formats the user can be served.
YTUHD has no control over that and has to disable it and relies on the client code that allows for 2K/4K formats.
## iOS version
The history has shaped YTUHD to spoof the device as iOS 14 (or higher) for those running lower. The user agent gets changed for this for YouTube server to respond with VP9 formats and all.
## Sideloading
It's been reported that the sideloaded version of YouTube will not get 2K/4K even with YTUHD included. This is because of a big reason: VP9.
Normally when an app is sideloaded, the private entitlements get removed (`com.apple.coremedia.allow-alternate-video-decoder-selection`, too) and the app won't be allowed to access hardware VP9 decoder. No known solution for bypassing this, unless you use [TrollStore](https://github.com/opa334/TrollStore) which allows for practically any entitlements, including the aforementioned, to be in your sideloaded app.

64
Tweaks/YTUHD/Settings.x Normal file
View File

@@ -0,0 +1,64 @@
#import "Header.h"
#import <rootless.h>
#import <VideoToolbox/VideoToolbox.h>
#import "../YouTubeHeader/YTHotConfig.h"
#import "../YouTubeHeader/YTSettingsViewController.h"
#import "../YouTubeHeader/YTSettingsSectionItem.h"
#import "../YouTubeHeader/YTSettingsSectionItemManager.h"
#define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil]
extern BOOL UseVP9();
NSBundle *YTUHDBundle() {
static NSBundle *bundle = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"YTUHD" ofType:@"bundle"];
if (tweakBundlePath)
bundle = [NSBundle bundleWithPath:tweakBundlePath];
else
bundle = [NSBundle bundleWithPath:ROOT_PATH_NS(@"/Library/Application Support/YTUHD.bundle")];
});
return bundle;
}
%hook YTSettingsSectionItemManager
- (void)updateVideoQualitySectionWithEntry:(id)entry {
YTHotConfig *hotConfig;
@try {
hotConfig = [self valueForKey:@"_hotConfig"];
} @catch (id ex) {
hotConfig = [self.gimme instanceForType:%c(YTHotConfig)];
}
YTIMediaQualitySettingsHotConfig *mediaQualitySettingsHotConfig = [hotConfig hotConfigGroup].mediaHotConfig.mediaQualitySettingsHotConfig;
BOOL defaultValue = mediaQualitySettingsHotConfig.enablePersistentVideoQualitySettings;
mediaQualitySettingsHotConfig.enablePersistentVideoQualitySettings = YES;
%orig;
mediaQualitySettingsHotConfig.enablePersistentVideoQualitySettings = defaultValue;
}
%end
%hook YTSettingsViewController
- (void)setSectionItems:(NSMutableArray <YTSettingsSectionItem *> *)sectionItems forCategory:(NSInteger)category title:(NSString *)title titleDescription:(NSString *)titleDescription headerHidden:(BOOL)headerHidden {
if (category == 14) {
NSBundle *tweakBundle = YTUHDBundle();
BOOL hasVP9 = VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9);
YTSettingsSectionItem *vp9 = [%c(YTSettingsSectionItem) switchItemWithTitle:LOC(@"USE_VP9")
titleDescription:[NSString stringWithFormat:@"%@\n\n%@: %d", LOC(@"USE_VP9_DESC"), LOC(@"HW_VP9_SUPPORT"), hasVP9]
accessibilityIdentifier:nil
switchOn:UseVP9()
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:UseVP9Key];
return YES;
}
settingItemId:0];
[sectionItems addObject:vp9];
}
%orig;
}
%end

71
Tweaks/YTUHD/Tweak.x Normal file
View File

@@ -0,0 +1,71 @@
#import "Header.h"
BOOL UseVP9() {
return [[NSUserDefaults standardUserDefaults] boolForKey:UseVP9Key];
}
// Remove any <= 1080p VP9 formats
NSArray *filteredFormats(NSArray <MLFormat *> *formats) {
NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(MLFormat *format, NSDictionary *bindings) {
return [format height] > 1080 || [[format MIMEType] videoCodec] != 'vp09';
}];
return [formats filteredArrayUsingPredicate:predicate];
}
%hook MLHAMPlayerItem
- (void)load {
MLInnerTubePlayerConfig *config = [self config];
YTIMediaCommonConfig *mediaCommonConfig = [config mediaCommonConfig];
mediaCommonConfig.useServerDrivenAbr = NO;
%orig;
}
%end
static void hookFormats(MLABRPolicy *self) {
YTIHamplayerConfig *config = [self valueForKey:@"_hamplayerConfig"];
config.videoAbrConfig.preferSoftwareHdrOverHardwareSdr = YES;
if ([config respondsToSelector:@selector(setDisableResolveOverlappingQualitiesByCodec:)])
config.disableResolveOverlappingQualitiesByCodec = NO;
YTIHamplayerStreamFilter *filter = config.streamFilter;
filter.enableVideoCodecSplicing = YES;
filter.vp9.maxArea = MAX_PIXELS;
filter.vp9.maxFps = MAX_FPS;
}
%hook MLABRPolicy
- (void)setFormats:(NSArray *)formats {
hookFormats(self);
%orig(filteredFormats(formats));
}
%end
%hook MLABRPolicyOld
- (void)setFormats:(NSArray *)formats {
hookFormats(self);
%orig(filteredFormats(formats));
}
%end
%hook YTHotConfig
- (BOOL)iosClientGlobalConfigEnableNewMlabrpolicy {
return NO;
}
- (BOOL)iosPlayerClientSharedConfigEnableNewMlabrpolicy {
return NO;
}
%end
%ctor {
if (UseVP9()) {
%init;
}
}

View File

@@ -0,0 +1,21 @@
#import <IOKit/IOKitLib.h>
#import <dlfcn.h>
%hookf(kern_return_t, IOServiceGetMatchingServices, mach_port_t mainPort, CFDictionaryRef matching, io_iterator_t *existing) {
if (CFDictionaryGetValue(matching, CFSTR("AppleAVD")))
return 0;
return %orig(mainPort, matching, existing);
}
%hookf(BOOL, AppleAVDCheckPlatform) {
return YES;
}
%ctor {
const char *avdPath = "/System/Library/VideoDecoders/AVD.videodecoder";
void *avd = dlopen(avdPath, RTLD_LAZY);
MSImageRef ref = MSGetImageByName(avdPath);
void *AppleAVDCheckPlatform_p = MSFindSymbol(ref, "_AppleAVDCheckPlatform");
HBLogDebug(@"AVD open: %d, pointer: %d", avd != NULL, AppleAVDCheckPlatform_p != NULL);
%init(AppleAVDCheckPlatform = (void *)AppleAVDCheckPlatform_p);
}

View File

@@ -0,0 +1,11 @@
TARGET := iphone:clang:latest:14.0
ARCHS = arm64
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = YTUHD-AVD
$(TWEAK_NAME)_FILES = AVD.x
$(TWEAK_NAME)_CFLAGS = -fobjc-arc
$(TWEAK_NAME)_FRAMEWORKS = IOKit
include $(THEOS_MAKE_PATH)/tweak.mk

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Filter</key>
<dict>
<key>Bundles</key>
<array>
<string>com.google.ios.youtube</string>
</array>
<key>Executables</key>
<array>
<string>mediaserverd</string>
</array>
<key>CoreFoundationVersion</key>
<array>
<real>1751.108</real>
</array>
</dict>
</dict>
</plist>

1
Tweaks/YTUHD/YTUHD.plist Normal file
View File

@@ -0,0 +1 @@
{ Filter = { Bundles = ( "com.google.ios.youtube" ); }; }

11
Tweaks/YTUHD/control Normal file
View File

@@ -0,0 +1,11 @@
Package: com.ps.ytuhd
Name: YTUHD
Version: 1.4.0
Architecture: iphoneos-arm
Description: Unlock 1440p and 2160p resolutions in iOS YouTube app.
Maintainer: PoomSmart
Author: PoomSmart
Section: Tweaks
Depends: mobilesubstrate (>= 0.9.5000), firmware (>= 11.0)
Depiction: https://poomsmart.github.io/repo/depictions/ytuhd.html
SileoDepiction: https://poomsmart.github.io/repo/sileodepictions/ytuhd.json

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "استخدام VP9";
"USE_VP9_DESC" = "تفعيل كوديك VP9 والذي يدعم الأبعاد حتى 4K. يعمل بكفاءة أكثر في الأجهزة ذات معالح A11 فأعلى. يتطلب إعادة تشغيل التطبيق.";
"HW_VP9_SUPPORT" = "دعم العتاد لكوديك VP9 المطلوب";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "VP9 verwenden";
"USE_VP9_DESC" = "Aktiviert den VP9-Codec, welcher bis zu 4k-Auflösungen unterstützt. Funktioniert am besten bei Geräten mit Apple CPU A11 und höher. App-Neustart erforderlich!";
"HW_VP9_SUPPORT" = "Hardware VP9 Support";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Use VP9";
"USE_VP9_DESC" = "Enable VP9 codec that supports up to 4K resolutions. Works best with devices with Apple CPU A11 and higher. App restart is required.";
"HW_VP9_SUPPORT" = "Hardware VP9 Support";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Utilizar VP9";
"USE_VP9_DESC" = "Activa el códec VP9 que admite resoluciones de hasta 4K. Funciona mejor con dispositivos con CPU Apple A11 y superior. Es necesario reiniciar la aplicación";
"HW_VP9_SUPPORT" = "Soporte de hardware VP9";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Utiliser VP9";
"USE_VP9_DESC" = "Active le codec VP9 qui prend en charge les résolutions jusqu'à 4K. Fonctionne mieux avec les appareils dotés d'un processeur Apple A11 ou supérieur. Le redémarrage de l'application est nécessaire.";
"HW_VP9_SUPPORT" = "Support matériel de VP9";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Használja a VP9-et";
"USE_VP9_DESC" = "Engedélyezze az akár 4K felbontást támogató VP9 kodeket. A legjobban az Apple CPU A11 vagy újabb CPU-val rendelkező eszközökkel működik. Az alkalmazás újraindítása szükséges.";
"HW_VP9_SUPPORT" = "Hardveres VP9 támogatás";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Usa VP9";
"USE_VP9_DESC" = "Attiva il codec VP9 che supporta risoluzione fino a 4K. Funziona meglio con dispositivi con CPU Apple A11 o superiore. È richiesto un riavvio dell'app.";
"HW_VP9_SUPPORT" = "Supporto Hardware VP9";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "VP9を使用";
"USE_VP9_DESC" = "最大で4K解像度に対応するVP9コーデックを有効にします。Apple CPU A11以降のチップを搭載した端末で最適に動作します。アプリの再起動が必要です。";
"HW_VP9_SUPPORT" = "ハードウェアVP9への対応";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "VP9 사용";
"USE_VP9_DESC" = "VP9 코덱을 활성화하면 최대 4K 해상도를 지원합니다. Apple CPU A11 이상이 탑재된 기기에서 가장 잘 작동합니다. 앱 재시작이 필요합니다.";
"HW_VP9_SUPPORT" = "VP9 하드웨어 지원";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Gebruik VP9";
"USE_VP9_DESC" = "Schakel het VP9-codec in die tot 4K resoluties ondersteunt. Werkt het beste met apparaten met Apple CPU A11 of hoger. App herstart is vereist.";
"HW_VP9_SUPPORT" = "Hardware VP9-ondersteuning";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Usar VP9";
"USE_VP9_DESC" = "Ative o codec VP9 que suporta resoluções de até 4K. Funciona melhor com dispositivos com Apple CPU A11 e superior. A reinicialização do app é necessária.";
"HW_VP9_SUPPORT" = "Suporte de Hardware VP9";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Utilizare VP9";
"USE_VP9_DESC" = "Activare codec VP9, care suportă rezoluții până la 4K. Funcționează ideal cu dispozitive cu procesor Apple A11 sau ulterior. Este necesară repornirea aplicației.";
"HW_VP9_SUPPORT" = "Suport VP9 Hardware";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Включить кодек VP9";
"USE_VP9_DESC" = "Активирует кодек VP9, поддерживающий разрешения до 4K. Не рекомендуется включение на устройствах с процессором ниже A11. Потребуется перезапуск приложения.";
"HW_VP9_SUPPORT" = "Поддержка VP9 железом";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "VP9'u etkinleştir";
"USE_VP9_DESC" = "4K çözünürlüğe kadar destekleyen VP9 kodek bileşenini etkinleştirin. Apple CPU A11 ve üzeri cihazlarla en iyi şekilde çalışır. Uygulamanın yeniden başlatılması gerekir.";
"HW_VP9_SUPPORT" = "Donanımsal VP9 Desteği";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "Sử dụng bộ giải mã VP9";
"USE_VP9_DESC" = "Sử dụng bộ giải mã VP9 để có thể tải video với chất lượng 2K/4K. Hoạt động tốt nhất với chip A11 trở lên và ứng dụng được cài đặt bằng TrollStore. Cần khởi động lại ứng dụng.";
"HW_VP9_SUPPORT" = "Hỗ trợ bộ giải mã VP9";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "使用 VP9 编码";
"USE_VP9_DESC" = "启用最高支持 4K 分辨率的 VP9 编解码器。推荐使用搭载 A11 芯片或以上的机型iPhone 8/X 或以上)。更改本设置后需要重启 App。";
"HW_VP9_SUPPORT" = "硬件 VP9 编码支持状态";

View File

@@ -0,0 +1,5 @@
// Settings
"USE_VP9" = "使用 VP9 編碼";
"USE_VP9_DESC" = "支援 4K 解析度的 VP9 編解碼器並且建議使用 A11 晶片(含)以上的機型。需重新啟動應用程式。";
"HW_VP9_SUPPORT" = "硬體 VP9 編碼支援狀態";