Skip to content

Commit

Permalink
Updated some shit
Browse files Browse the repository at this point in the history
  • Loading branch information
donato-fiore authored Aug 1, 2021
1 parent c30b6b1 commit e129c7d
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 165 deletions.
9 changes: 8 additions & 1 deletion GameSeagull.plist
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
{ Filter = { Bundles = ( "com.gamerdelights.gamepigeon.ext" ); }; }
{
Filter = {
Bundles = (
"com.gamerdelights.gamepigeon.ext",
"com.apple.MobileSMS"
);
};
}
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
TARGET := iphone:clang:latest:7.0
INSTALL_TARGET_PROCESSES = SpringBoard

ARCHS = arm64 arm64e
ARCHS = arm64

include $(THEOS)/makefiles/common.mk

TWEAK_NAME = GameSeagull

GameSeagull_FILES = Tweak.xm
GameSeagull_CFLAGS = -fobjc-arc
GameSeagull_EXTRA_FRAMEWORKS += Cephei


include $(THEOS_MAKE_PATH)/tweak.mk
SUBPROJECTS += gameseagullprefs
Expand Down
91 changes: 61 additions & 30 deletions Tweak.xm
Original file line number Diff line number Diff line change
@@ -1,58 +1,70 @@
#import <Foundation/Foundation.h>
#import <SpriteKit/SpriteKit.h>
#import <SpriteKit/SKView.h>
#import <UIKit/UIKit.h>

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;
Expand All @@ -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;
}
10 changes: 5 additions & 5 deletions control
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 3 additions & 1 deletion gameseagullprefs/GSPRootListController.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#import <Preferences/PSListController.h>
#import <CepheiPrefs/HBListController.h>
#import <CepheiPrefs/HBAppearanceSettings.h>
#import <Cephei/HBPreferences.h>

@interface GSPRootListController : PSListController

@end
21 changes: 20 additions & 1 deletion gameseagullprefs/GSPRootListController.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "GSPRootListController.h"
#import <CepheiPrefs/HBAppearanceSettings.h>
#import <Cephei/HBPreferences.h>
#import <CepheiPrefs/HBRootListController.h>
#include <spawn.h>

@implementation GSPRootListController

Expand All @@ -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
1 change: 1 addition & 0 deletions gameseagullprefs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit e129c7d

Please sign in to comment.