diff --git a/GameSeagull.plist b/GameSeagull.plist index 243453a..227959b 100644 --- a/GameSeagull.plist +++ b/GameSeagull.plist @@ -1 +1,8 @@ -{ Filter = { Bundles = ( "com.gamerdelights.gamepigeon.ext" ); }; } +{ + Filter = { + Bundles = ( + "com.gamerdelights.gamepigeon.ext", + "com.apple.MobileSMS" + ); + }; +} \ No newline at end of file diff --git a/Makefile b/Makefile index 2b9dd3a..ec7d0ff 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ -TARGET := iphone:clang:latest:7.0 INSTALL_TARGET_PROCESSES = SpringBoard -ARCHS = arm64 arm64e +ARCHS = arm64 include $(THEOS)/makefiles/common.mk @@ -9,6 +8,8 @@ TWEAK_NAME = GameSeagull GameSeagull_FILES = Tweak.xm GameSeagull_CFLAGS = -fobjc-arc +GameSeagull_EXTRA_FRAMEWORKS += Cephei + include $(THEOS_MAKE_PATH)/tweak.mk SUBPROJECTS += gameseagullprefs diff --git a/Tweak.xm b/Tweak.xm index 84e8400..5909674 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -1,58 +1,70 @@ +#import #import #import #import -static BOOL windHack; -static BOOL trajectoryHack; -static BOOL tankWind; -static BOOL dartHack; -static int dartMode; +#define PLIST_PATH @"/var/mobile/Library/Preferences/com.donato.gameseagullprefs.plist" -#define PLIST_PATH "/var/mobile/Library/Preferences/com.kermit.gameseagullprefs.plist" -#define boolValueForKey(key) [[[NSDictionary dictionaryWithContentsOfFile:@(PLIST_PATH)] valueForKey:key] boolValue] -#define valueForKey(key) [[[NSDictionary dictionaryWithContentsOfFile:@(PLIST_PATH)] valueForKey:key] intValue] +BOOL boolForKey(NSString *key) { + static NSUserDefaults *prefs; + if (prefs == nil) { + prefs = [[NSUserDefaults alloc] initWithSuiteName:PLIST_PATH]; + } + NSNumber *value = [prefs objectForKey:key] ?: @YES; + return [value boolValue]; +} -static void loadPrefs() { - windHack = boolValueForKey(@"archeryNoWind"); - trajectoryHack = boolValueForKey(@"showTrajectory"); - tankWind = boolValueForKey(@"tankNoWind"); - dartHack = boolValueForKey(@"oneDart"); - dartMode = valueForKey(@"dartMode"); +int valueForKey(NSString *key) { + static NSUserDefaults *prefs; + if (prefs == nil) { + prefs = [[NSUserDefaults alloc] initWithSuiteName:PLIST_PATH]; + } + NSNumber *value = [prefs objectForKey:key] ?: @1; + return [value intValue]; } +// Archery %hook ArcheryScene -(void)setWind:(float)arg1 angle:(float)arg2 { - loadPrefs(); - if(!windHack) return %orig; - if(windHack) return %orig(.0, .0); + if(boolForKey(@"archeryNoWind")) { + %orig(0.0, 0.0); + } else { + %orig; + } } %end +// 8 ball %hook PoolBall -(BOOL)isStripes { - loadPrefs(); - if(trajectoryHack) return true; + if(boolForKey(@"showTrajectory")) { + return true; + } return %orig; - } -(BOOL)isSolid { - loadPrefs(); - if(trajectoryHack) return true; + if(boolForKey(@"showTrajectory")) { + return true; + } return %orig; } + %end +// Tanks %hook TanksWind -(void)setWind:(float)arg1 { - loadPrefs(); - if(!tankWind) return %orig; - if(tankWind) return %orig(.0); + if(boolForKey(@"tankNoWind")) { + return %orig(0.0); + } + return %orig; } %end +// Darts %hook DartsScene -(void)showScore2:(int)arg1 full_score:(int)arg2 multi:(int)arg3 pos:(CGPoint)arg4 send_pos:(CGPoint)arg5 { - loadPrefs(); + int dartMode = valueForKey(@"dartMode"); int num; if(dartMode == 1) { num = 101; @@ -61,11 +73,30 @@ static void loadPrefs() { } else if(dartMode == 3) { num = 301; } - if(!dartHack) return %orig; - if(dartHack) return %orig(arg1, num, arg3, arg4, arg5); + if(boolForKey(@"oneDart")) { + return %orig(arg1, num, arg3, arg4, arg5); + } else { + %orig; + } } %end -%ctor { - %init(ArcheryScene = objc_getClass("ArcheryScene"), PoolBall = objc_getClass("PoolBall"), TanksWind = objc_getClass("TanksWind"), DartsScene = objc_getClass("DartsScene")); +// Mini golf +%hook GolfBall +-(BOOL)inside { + if(boolForKey(@"holeInOne")) { + return true; + } + return %orig; } +-(BOOL)hole { + if(boolForKey(@"holeInOne")) { + return true; + } + return %orig; +} +%end + +%ctor { + %init; +} \ No newline at end of file diff --git a/control b/control index 12246b7..b57da9d 100644 --- a/control +++ b/control @@ -1,9 +1,9 @@ -Package: com.kermit.gameseagull +Package: com.donato.gameseagull Name: GameSeagull Version: 0.0.1 Architecture: iphoneos-arm -Description: Minor GamePigeon "assistance" -Maintainer: kermit the flop -Author: kermit the flop +Description: Minor game pigeon "assistance" +Maintainer: Donato Fiore +Author: Donato Fiore Section: Tweaks -Depends: mobilesubstrate (>= 0.9.5000) +Depends: mobilesubstrate, ws.hbang.common (>= 1.11) \ No newline at end of file diff --git a/gameseagullprefs/GSPRootListController.h b/gameseagullprefs/GSPRootListController.h index 051898b..939f296 100644 --- a/gameseagullprefs/GSPRootListController.h +++ b/gameseagullprefs/GSPRootListController.h @@ -1,5 +1,7 @@ #import +#import +#import +#import @interface GSPRootListController : PSListController - @end diff --git a/gameseagullprefs/GSPRootListController.m b/gameseagullprefs/GSPRootListController.m index d0c3dbc..8bcc43c 100644 --- a/gameseagullprefs/GSPRootListController.m +++ b/gameseagullprefs/GSPRootListController.m @@ -1,4 +1,8 @@ #include "GSPRootListController.h" +#import +#import +#import +#include @implementation GSPRootListController @@ -9,12 +13,27 @@ - (NSArray *)specifiers { return _specifiers; } --(void)sourceCode { + +- (instancetype)init { + self = [super init]; + + if (self) { + HBAppearanceSettings *appearanceSettings = [[HBAppearanceSettings alloc] init]; + appearanceSettings.tintColor = [UIColor colorWithRed:1.0f green:0.81f blue:0.86f alpha:1]; + appearanceSettings.tableViewCellSeparatorColor = [UIColor colorWithWhite:0 alpha:0]; + self.hb_appearanceSettings = appearanceSettings; + } + return self; +} + +-(void)github { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://github.com/donato-fiore/GameSeagull"]]; } + - (void)apply:(id)sender { pid_t pid; const char *args[] = {"sh", "-c", "killall MobileSMS", NULL}; posix_spawn(&pid, "/bin/sh", NULL, NULL, (char *const *)args, NULL); } + @end diff --git a/gameseagullprefs/Makefile b/gameseagullprefs/Makefile index dd8cfee..cdc0abb 100644 --- a/gameseagullprefs/Makefile +++ b/gameseagullprefs/Makefile @@ -6,6 +6,7 @@ include $(THEOS)/makefiles/common.mk BUNDLE_NAME = gameseagullprefs +gameseagullprefs_EXTRA_FRAMEWORKS = Cephei CepheiPrefs gameseagullprefs_FILES = GSPRootListController.m gameseagullprefs_FRAMEWORKS = UIKit gameseagullprefs_PRIVATE_FRAMEWORKS = Preferences diff --git a/gameseagullprefs/Resources/Root.plist b/gameseagullprefs/Resources/Root.plist index f8a535f..5ef56be 100644 --- a/gameseagullprefs/Resources/Root.plist +++ b/gameseagullprefs/Resources/Root.plist @@ -1,132 +1,177 @@ - - items - - - cell - PSGroupCell - label - Archery - footerText - Pebis cock man - - - cell - PSSwitchCell - default - - defaults - com.kermit.gameseagullprefs - key - archeryNoWind - label - Disable Wind - - - cell - PSGroupCell - label - 8 ball - - - cell - PSSwitchCell - default - - defaults - com.kermit.gameseagullprefs - key - showTrajectory - label - Always show trajectory - - - cell - PSGroupCell - label - Darts - - - cell - PSSwitchCell - default - - defaults - com.kermit.gameseagullprefs - key - oneDart - label - One shot win - - - cell - PSSegmentCell - default - 0 - defaults - com.kermit.gameseagullprefs - key - dartMode - validTitles - - 101 - 201 - 301 - - validValues - - 1 - 2 - 3 - - - - cell - PSGroupCell - label - tanks - - - cell - PSSwitchCell - default - - defaults - com.kermit.gameseagullprefs - key - tankNoWind - label - Disable Wind - + + items + + + cell + PSGroupCell + headerCellClass + HBPackageNameHeaderCell + icon + icon.png + packageIdentifier + com.donato.gameseagull + packageNameOverride + GameSeagull + titleColor + #ffcdd9 + subtitleColor + #aaaaaa + - - cell - PSGroupCell - label - - + + cell + PSGroupCell + label + Archery + + + cell + PSSwitchCell + default + + defaults + com.donato.gameseagullprefs + key + archeryNoWind + label + Disable Wind + + + cell + PSGroupCell + label + 8 ball + + + cell + PSSwitchCell + default + + defaults + com.donato.gameseagullprefs + key + showTrajectory + label + Always show trajectory + + + cell + PSGroupCell + label + Darts + + + cell + PSSwitchCell + default + + defaults + com.donato.gameseagullprefs + key + oneDart + label + One shot win + + + cell + PSSegmentCell + default + 0 + defaults + com.donato.gameseagullprefs + key + dartMode + validTitles + + 101 + 201 + 301 + + validValues + + 1 + 2 + 3 + + + + cell + PSGroupCell + label + tanks + + + cell + PSSwitchCell + default + + defaults + com.donato.gameseagullprefs + key + tankNoWind + label + Disable Wind + - - action - apply: - cell - PSButtonCell - label - Apply - - - action - sourceCode - cell - PSButtonCell - label - View Source Code - - - title - GameSeagull - + + + cell + PSGroupCell + label + Mini Golf + + + cell + PSSwitchCell + default + + defaults + com.donato.gameseagullprefs + key + holeInOne + label + Always Hole in One + + + + + + cell + PSGroupCell + footerText + GameSeagull by Donato + isStaticText + + + + action + apply: + cell + PSButtonCell + cellClass + HBTintedTableCell + label + Apply + + + + cellClass + HBLinkTableCell + cell + PSButtonCell + action + github + label + GitHub + subtitle + Source Code + + + title + GameSeagull +