Updated YTSpeed

This commit is contained in:
Balackburn
2024-02-05 11:00:05 +01:00
parent 006416f9cd
commit 376ec3ed12

View File

@@ -386,15 +386,15 @@ static BOOL IsEnabled(NSString *key) {
%end %end
%end %end
// YTSpeed - https://github.com/Lyvendia/YTSpeed (Only works on YouTube v16.05.7-v18.18.2) // YTSpeed - https://github.com/Lyvendia/YTSpeed
%group gYTSpeed %group gYTSpeed
%hook YTVarispeedSwitchController %hook YTVarispeedSwitchController
- (id)init { - (id)init {
id result = %orig; id result = %orig;
const int size = 17; const int size = 17;
float speeds[] = {0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 5.0}; float speeds[] = {0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 5.0};
id varispeedSwitchControllerOptions[size]; id varispeedSwitchControllerOptions[size];
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
id title = [NSString stringWithFormat:@"%.2fx", speeds[i]]; id title = [NSString stringWithFormat:@"%.2fx", speeds[i]];
@@ -411,7 +411,7 @@ static BOOL IsEnabled(NSString *key) {
%hook MLHAMQueuePlayer %hook MLHAMQueuePlayer
- (void)setRate:(float)rate { - (void)setRate:(float)rate {
MSHookIvar<float>(self, "_rate") = rate; MSHookIvar<float>(self, "_rate") = rate;
MSHookIvar<float>(self, "_preferredRate") = rate; MSHookIvar<float>(self, "_preferredRate") = rate;
id player = MSHookIvar<HAMPlayerInternal *>(self, "_player"); id player = MSHookIvar<HAMPlayerInternal *>(self, "_player");