Browse Source

Initial commit

master
Jamie Berghmans 4 years ago
commit
8d9472a3a6
5 changed files with 101 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +1
    -0
      AutoReplay.plist
  3. +11
    -0
      Makefile
  4. +77
    -0
      Tweak.xm
  5. +9
    -0
      control

+ 3
- 0
.gitignore View File

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

+ 1
- 0
AutoReplay.plist View File

@@ -0,0 +1 @@
{ Filter = { Bundles = ( "com.apple.mobileslideshow" ); }; }

+ 11
- 0
Makefile View File

@@ -0,0 +1,11 @@
export ARCHS = armv7 arm64 arm64e

include ~/theos/makefiles/common.mk

TWEAK_NAME = AutoReplay
AutoReplay_FILES = Tweak.xm

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
install.exec "killall -9 SpringBoard"

+ 77
- 0
Tweak.xm View File

@@ -0,0 +1,77 @@
typedef struct {
long long value;
int timescale;
unsigned int flags;
long long epoch;
} TIME;

@interface PUBrowsingVideoPlayer
-(void)videoSessionDidPlayToEnd:(id)arg1; //IOS12
-(void)avPlayer:(id)arg1 itemDidPlayToEnd:(id)arg2; //IOS13
-(void)seekToTime:(TIME)arg1 toleranceBefore:(TIME)arg2 toleranceAfter:(TIME)arg3 completionHandler:(id)arg4;
-(void)seekToTime:(TIME)arg1 completionHandler:(id)arg2;
-(TIME)currentTime;
-(void)_updateVideoSessionDesiredPlayState;
-(void)rewindExistingPlayer;
@property(nonatomic) long long desiredPlayState;
@end





%group IOS12
%hook PUBrowsingVideoPlayer

- (void)avPlayer:(id)arg1 itemDidPlayToEnd:(id)arg2 {
// %orig (arg1, arg2);
NSLog(@"AutoReplay - Ended 12");

TIME t = [self currentTime];
t.value = (long long) 0;
t.timescale = 100;
t.flags = (unsigned int) 1;

[self seekToTime:t toleranceBefore:t toleranceAfter:t completionHandler:NULL];
}

%end
%end //end group IOS12





%group IOS13
%hook PUBrowsingVideoPlayer

static bool isFirstTryAfterEnding = false;

- (void)videoSessionDidPlayToEnd:(id)arg1 {
isFirstTryAfterEnding = true;
[self rewindExistingPlayer];
}

- (void)_updateVideoSessionDesiredPlayState {
if (self.desiredPlayState == 0 && isFirstTryAfterEnding) {
isFirstTryAfterEnding = false;
MSHookIvar<long long>(self, "_desiredPlayState") = 1;
}

%orig;
}
%end
%end //end group IOS13





%ctor {
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if (version <= 12) {
%init(IOS12);
} else {
%init(IOS13);
}
}

+ 9
- 0
control View File

@@ -0,0 +1,9 @@
Package: com.devvix.autoreplay
Name: AutoReplay
Depends: mobilesubstrate
Version: 1.0.2
Architecture: iphoneos-arm
Description: An awesome MobileSubstrate tweak!
Maintainer: Devvix
Author: Devvix
Section: Tweaks

Loading…
Cancel
Save