-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTweak.xm
More file actions
608 lines (493 loc) · 21.4 KB
/
Tweak.xm
File metadata and controls
608 lines (493 loc) · 21.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
#import <UIKit/UIKit.h>
#import "vm_writeData.h"
#import "Macros.h"
void makeZeroXLabel(CGFloat, CGFloat, CGFloat, CGFloat);
int menuCreationCount = 0;
//Floats go to 0.0 when used as parameters for Objective-C methods on my phone, but not in the simulator. WTF
float labelSpacing = 5.0;
float switchSpacing = 0.5;
float miscellaneousTypeSpacing = 8.0;
float labelXValue = 8.0;
float labelWidth = 270.0;
float labelHeight = 21.0;
float switchXValue = 319.0;
float switchWidth = 51.0;
float switchHeight = 31.0;
float bulletTypeAndGrenadeTypeXValue = 102.0;
float bulletTypeAndGrenadeTypeWidth = 173.0;
float bulletTypeAndGrenadeTypeHeight = 30.0;
NSArray *labelArray;
NSArray *bulletArray;
NSArray *grenadeArray;
NSArray *killstreakArray;
NSArray *weaponPickupArray;
NSUserDefaults *defaults;
UIBlurEffect *blurEffect;
UIButton *closeMenu;
UIButton *set;
UIButton *bulletType;
UIButton *grenadeType;
UIButton *killstreakType;
UIButton *weaponPickupType;
UIButton *bulletChooserButton;
UIView *main;
UIView *closeButtonBackgroundView;
UIView *separator;
UIView *mainMenuView;
UILabel *writeToOffset;
UILabel *zeroX;
UILabel *typeStatus;
UIScrollView *normalModsScrollView;
UIScrollView *otherModsScrollView;
UIScrollView *bulletTypeScrollView;
UIScrollView *grenadeTypeScrollView;
UIScrollView *killstreakTypeScrollView;
UIScrollView *weaponPickupTypeScrollView;
UISegmentedControl *pageSelector;
UITextField *offsetTextField;
UITextField *hexTextField;
uint64_t offsetArray[24] = {/*removed*/};
uint64_t moddedHexArray[21] = {/*removed*/};
uint64_t originalHexArray[24] = {/*removed*/};
uint64_t chooserHexes[32] = {/*removed*/};
uint64_t weaponPickupHexArray[21] = {/*removed*/};
%hook UnityAppController
- (void)applicationDidBecomeActive:(id)arg0 {
main = [UIApplication sharedApplication].keyWindow.rootViewController.view;
bulletChooserButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
bulletChooserButton.frame = CGRectMake((main.frame.size.width/2)-15,(main.frame.size.height/2)+75,30,30);
bulletChooserButton.backgroundColor = [UIColor clearColor];
bulletChooserButton.layer.cornerRadius = 16;
bulletChooserButton.layer.borderWidth = 2.0f;
bulletChooserButton.layer.borderColor = rgb(0xaa0114).CGColor;
[bulletChooserButton addTarget:self action:@selector(showMenu)
forControlEvents:UIControlEventTouchDragInside];
[main addSubview:bulletChooserButton];
%orig;
}
%new
- (void)showMenu {
defaults = [NSUserDefaults standardUserDefaults];
if(menuCreationCount == 0){
[self setupMenuGUI];
[self setupSwitchesAndLabels];
[self setupOtherModsSection];
[self setupBulletTypeSection];
[self setupGrenadeTypeSection];
[self setupKillstreakTypeSection];
[self setupWeaponPickupTypeSection];
[self setupCloseButtonStuff];
}
menuCreationCount++;
}
%new
- (void)setupOtherModsSection {
otherModsScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 83, 376, 184)];
otherModsScrollView.backgroundColor = [UIColor clearColor];
otherModsScrollView.contentSize = CGSizeMake(376, 0);
otherModsScrollView.hidden = true;
[mainMenuView addSubview:otherModsScrollView];
bulletType = [UIButton buttonWithType:UIButtonTypeCustom];
bulletType.frame = CGRectMake(127, 8, 123, 30);
bulletType.backgroundColor = [UIColor clearColor];
bulletType.tag = 500;
bulletType.titleLabel.textAlignment = NSTextAlignmentCenter;
[bulletType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[bulletType setTitle:@"Bullet Type" forState:UIControlStateNormal];
[bulletType addTarget:self action:@selector(showSpecificViewForChooserSection:) forControlEvents:UIControlEventTouchDown];
[otherModsScrollView addSubview:bulletType];
grenadeType = [UIButton buttonWithType:UIButtonTypeCustom];
grenadeType.frame = CGRectMake(101, 46, 175, 30);
grenadeType.backgroundColor = [UIColor clearColor];
grenadeType.tag = 501;
grenadeType.titleLabel.textAlignment = NSTextAlignmentCenter;
[grenadeType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[grenadeType setTitle:@"Grenade Type" forState:UIControlStateNormal];
[grenadeType addTarget:self action:@selector(showSpecificViewForChooserSection:) forControlEvents:UIControlEventTouchDown];
[otherModsScrollView addSubview:grenadeType];
killstreakType = [UIButton buttonWithType:UIButtonTypeCustom];
killstreakType.frame = CGRectMake(95, 84, 187, 30);
killstreakType.backgroundColor = [UIColor clearColor];
killstreakType.tag = 502;
killstreakType.titleLabel.textAlignment = NSTextAlignmentCenter;
[killstreakType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[killstreakType setTitle:@"Killstreak Type" forState:UIControlStateNormal];
[killstreakType addTarget:self action:@selector(showSpecificViewForChooserSection:) forControlEvents:UIControlEventTouchDown];
[otherModsScrollView addSubview:killstreakType];
weaponPickupType = [UIButton buttonWithType:UIButtonTypeCustom];
weaponPickupType.frame = CGRectMake(69, 122, 239, 30);
weaponPickupType.backgroundColor = [UIColor clearColor];
weaponPickupType.tag = 503;
weaponPickupType.titleLabel.textAlignment = NSTextAlignmentCenter;
[weaponPickupType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[weaponPickupType setTitle:@"Weapon Pickup Type" forState:UIControlStateNormal];
[weaponPickupType addTarget:self action:@selector(showSpecificViewForChooserSection:) forControlEvents:UIControlEventTouchDown];
[otherModsScrollView addSubview:weaponPickupType];
}
%new
- (void)setupBulletTypeSection {
bulletTypeScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 73, 376, 184)];
bulletTypeScrollView.backgroundColor = [UIColor clearColor];
bulletTypeScrollView.contentSize = CGSizeMake(376, 640);
bulletTypeScrollView.hidden = true;
[mainMenuView addSubview:bulletTypeScrollView];
[self setupBulletTypeButtons];
}
%new
- (void)setupGrenadeTypeSection {
grenadeTypeScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 73, 376, 184)];
grenadeTypeScrollView.backgroundColor = [UIColor clearColor];
grenadeTypeScrollView.contentSize = CGSizeMake(376, 0);
grenadeTypeScrollView.hidden = true;
[mainMenuView addSubview:grenadeTypeScrollView];
[self setupGrenadeTypeButtons];
}
%new
- (void)setupKillstreakTypeSection {
killstreakTypeScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 73, 376, 184)];
killstreakTypeScrollView.backgroundColor = [UIColor clearColor];
killstreakTypeScrollView.contentSize = CGSizeMake(376, 220);
killstreakTypeScrollView.hidden = true;
[mainMenuView addSubview:killstreakTypeScrollView];
[self setupKillstreakTypeButtons];
}
%new
- (void)setupWeaponPickupTypeSection {
weaponPickupTypeScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 73, 376, 184)];
weaponPickupTypeScrollView.backgroundColor = [UIColor clearColor];
weaponPickupTypeScrollView.contentSize = CGSizeMake(376, 640);
weaponPickupTypeScrollView.hidden = true;
[mainMenuView addSubview:weaponPickupTypeScrollView];
[self setupWeaponPickupTypeButtons];
}
%new
- (void)setupSwitchesAndLabels {
labelArray = @[@"No Recoil", @"Better Aim", @"Infinite Ammo", @"Modded Gravity", @"Anti Flashbang", @"Everyone Orange", @"Crosshairs Always Enabled", @"25555.0 Pickup Range", @"Sniper Light Shows Through Walls", @"Knife Button Always Shows", @"Knife Faster", @"Debug Rechamber Animation", @"Instant Reload", @"God Mode Lobby", @"Always Headshot", @"All Camos", @"Killstreaks Ready", @"Deaths Don't Count", @"Instant Grenade Explosion", @"Modded Fire Rate", @"Auto Fire", @"Shoot Through Walls", @"One Hit Kill", @"No Killstreak Wait"];
UISwitch *s;
for(int i=0; i<[labelArray count]; i++){
[normalModsScrollView addSubview:[self makeHackLabel:labelArray[i]]];
s = [self makeHackSwitch:i];
[normalModsScrollView addSubview:s];
[self setSwitchStateBasedOnPrefs:i withSwitch:s];
if([defaults boolForKey:[NSString stringWithFormat:@"%d", (int)s.tag]]){
[self switchToggled:s];
}
}
}
%new
- (void)setupBulletTypeButtons {
bulletArray = @[@"Original", @"M4A1", @"Famas", @"AK 12", @"SCAR-H", @"MP5", @"870 MCS", @"M40A5", @"MPX", @"SAIGA 12K", @"MG4", @"AS VAL", @"RPG", @"M200", @"Compact .45", @"MP412 REX", @"M320 HE", @"M320 DART", @"Hand", @"Butterfly Knife", @"G18"];
for(int i=0; i<[bulletArray count]; i++){
[bulletTypeScrollView addSubview:[self makeTypeChooserButton:bulletArray[i] withTag:i]];
}
}
%new
- (void)setupGrenadeTypeButtons {
miscellaneousTypeSpacing = 8.0;
grenadeArray = @[@"Original", @"Frag Grenade", @"Smoke Grenade", @"Flashbang"];
int bulletArrayLength = (int)[bulletArray count];
for(int i=0; i<[grenadeArray count]; i++){
[grenadeTypeScrollView addSubview:[self makeTypeChooserButton:grenadeArray[i] withTag:i+bulletArrayLength]];
}
}
%new
- (void)setupKillstreakTypeButtons {
miscellaneousTypeSpacing = 8.0;
killstreakArray = @[@"Original", @"UAV", @"Super Solider", @"Counter UAV", @"Advanced UAV", @"Haste", @"Nuke"];
int tagBase = (int)[bulletArray count]+(int)[grenadeArray count];
for(int i=0; i<[killstreakArray count]; i++){
[killstreakTypeScrollView addSubview:[self makeTypeChooserButton:killstreakArray[i] withTag:i+tagBase]];
}
}
%new
- (void)setupWeaponPickupTypeButtons {
miscellaneousTypeSpacing = 8.0;
int tagBase = (int)[bulletArray count]+(int)[grenadeArray count]+(int)[killstreakArray count];
for(int i=0; i<[bulletArray count]; i++){
[weaponPickupTypeScrollView addSubview:[self makeTypeChooserButton:bulletArray[i] withTag:i+tagBase]];
}
}
%new
- (void)setupMenuGUI {
//I get away with hardcoding frame values because I'm the only one using this menu
mainMenuView = [[UIView alloc] initWithFrame:CGRectMake(145, 44, 376, 286)];
mainMenuView.backgroundColor = [UIColor whiteColor];
mainMenuView.alpha = 0.7;
mainMenuView.layer.cornerRadius = 5;
mainMenuView.layer.borderColor = rgb(0xaa0114).CGColor;
mainMenuView.layer.borderWidth = 1;
[main addSubview:mainMenuView];
writeToOffset = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 376, 19)];
writeToOffset.text = @"Write To A Custom Offset";
writeToOffset.textAlignment = NSTextAlignmentCenter;
[writeToOffset setFont:[UIFont systemFontOfSize:12]];
[mainMenuView addSubview:writeToOffset];
makeZeroXLabel(8, 28, 22, 21);
[mainMenuView addSubview:zeroX];
makeZeroXLabel(205, 28, 22, 21);
[mainMenuView addSubview:zeroX];
offsetTextField = [[UITextField alloc] initWithFrame:CGRectMake(29, 24, 140, 30)];
offsetTextField.placeholder = @"OFFSET";
offsetTextField.returnKeyType = UIReturnKeyDone;
offsetTextField.tag = 0;
[mainMenuView addSubview:offsetTextField];
hexTextField = [[UITextField alloc] initWithFrame:CGRectMake(228, 24, 140, 30)];
hexTextField.placeholder = @"HEX";
hexTextField.returnKeyType = UIReturnKeyDone;
hexTextField.tag = 1;
[mainMenuView addSubview:hexTextField];
set = [UIButton buttonWithType:UIButtonTypeCustom];
set.frame = CGRectMake(157, 51, 63, 26);
set.backgroundColor = [UIColor clearColor];
[set setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[set setTitle:@"Set" forState:UIControlStateNormal];
[set addTarget:self action:@selector(writeToCustomOffset) forControlEvents:UIControlEventTouchDown];
[mainMenuView addSubview:set];
pageSelector = [[UISegmentedControl alloc] initWithItems:@[@"Normal Mods", @"Other Mods"]];
pageSelector.frame = CGRectMake(87, 257, 289, 29);
pageSelector.tintColor = rgb(0xaa0114);
[pageSelector setSelectedSegmentIndex:0];
[pageSelector addTarget:self
action:@selector(changeView:)
forControlEvents:UIControlEventValueChanged];
[mainMenuView addSubview:pageSelector];
normalModsScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 73, 376, 184)];
normalModsScrollView.backgroundColor = [UIColor clearColor];
normalModsScrollView.contentSize = CGSizeMake(376, 730);
[mainMenuView addSubview:normalModsScrollView];
}
%new
- (void)setupCloseButtonStuff {
separator = [[UIView alloc] initWithFrame:CGRectMake(0, 73, 376, 1)];
separator.backgroundColor = [UIColor blackColor];
[mainMenuView addSubview:separator];
closeButtonBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 257, 87, 28)];
closeButtonBackgroundView.backgroundColor = rgb(0xaa0114);
closeButtonBackgroundView.layer.cornerRadius = 2;
[mainMenuView addSubview:closeButtonBackgroundView];
closeMenu = [UIButton buttonWithType:UIButtonTypeCustom];
closeMenu.frame = CGRectMake(0, 257, 87, 30);
closeMenu.backgroundColor = [UIColor clearColor];
closeMenu.titleLabel.textAlignment = NSTextAlignmentCenter;
[closeMenu setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[closeMenu setTitle:@"Close" forState:UIControlStateNormal];
[closeMenu addTarget:self action:@selector(closeModMenu) forControlEvents:UIControlEventTouchDown];
[mainMenuView addSubview:closeMenu];
}
%new
- (void)setSwitchStateBasedOnPrefs:(int)tag withSwitch:(UISwitch *)s {
//Instead of creating tons of unique keys for switches, why not just use the switch tag?
s.on = [defaults boolForKey:[NSString stringWithFormat:@"%d", tag]];
}
%new
- (void)switchToggled:(UISwitch *)sender {
int switchTag = (int)sender.tag;
bool isOn = sender.on;
//If you haven't already guessed, the button tag corresponds to the feature in the labelArray, and the index of that is the same as the index in the offsetArray and the moddedHexArray.
//Custom calls to writeData because always headshot, instant reload, and one hit kill needed more than one offset.
//I tried to keep it all in the arrays but it became a big mess of if statements.
if(switchTag == 12){
if(isOn){
/*removed*/
}
else{
/*removed*/
}
}
else if(switchTag == 13){
if(isOn){
write(offsetArray[switchTag-1], moddedHexArray[switchTag-1]);
}
else{
write(offsetArray[switchTag-1], originalHexArray[switchTag-1]);
}
}
else if(switchTag == 14){
if(isOn){
/*removed*/
}
else{
/*removed*/
}
}
else if(switchTag == 22){
if(isOn){
/*removed*/
}
else{
/*removed*/
}
}
else{
if(switchTag > 14){
if(isOn){
write(offsetArray[switchTag-2], moddedHexArray[switchTag-2]);
}
else{
write(offsetArray[switchTag-2], originalHexArray[switchTag-2]);
}
}
else{
if(isOn){
write(offsetArray[switchTag], moddedHexArray[switchTag]);
}
else{
write(offsetArray[switchTag], originalHexArray[switchTag]);
}
}
}
//Again, much better to use the switch tag as a key for small projects like this, in my opinion.
[defaults setBool:isOn forKey:[NSString stringWithFormat:@"%d", (int)sender.tag]];
}
%new
- (void)changeView:(UISegmentedControl *)sender {
[self showViewBasedOnSelectedIndex:(int)pageSelector.selectedSegmentIndex];
}
%new
- (void)writeToCustomOffset {
[offsetTextField resignFirstResponder];
[hexTextField resignFirstResponder];
write([offsetTextField.text longLongValue], [hexTextField.text longLongValue]);
offsetTextField.text = @"";
hexTextField.text = @"";
}
%new
- (void)showSpecificViewForChooserSection:(UIButton *)button {
otherModsScrollView.hidden = true;
int buttonTag = (int)button.tag;
if(buttonTag == 500){
bulletTypeScrollView.hidden = false;
[self modifyCloseButtonSelector:false];
}
else if(buttonTag == 501){
grenadeTypeScrollView.hidden = false;
[self modifyCloseButtonSelector:false];
}
else if(buttonTag == 502){
killstreakTypeScrollView.hidden = false;
[self modifyCloseButtonSelector:false];
}
else{
weaponPickupTypeScrollView.hidden = false;
[self modifyCloseButtonSelector:false];
}
}
%new
- (void)applyTypeChooserHack:(UIButton *)button {
[typeStatus removeFromSuperview];
int buttonTag = (int)button.tag;
NSAttributedString *typeStatusBold;
NSString *text;
if(buttonTag>20 && buttonTag<25){
write(/*removed*/, chooserHexes[buttonTag]);
text = [NSString stringWithFormat:@"Grenade type changed to %@", button.titleLabel.text];
}
else if(buttonTag>24 && buttonTag<32){
write(/*removed*/, chooserHexes[buttonTag]);
text = [NSString stringWithFormat:@"Killstreak type changed to %@", button.titleLabel.text];
}
else if(buttonTag>31){
write(/*removed*/, weaponPickupHexArray[buttonTag-32]);
text = [NSString stringWithFormat:@"Pickup gun changed to %@", button.titleLabel.text];
}
else{
write(/*removed*/, chooserHexes[buttonTag]);
text = [NSString stringWithFormat:@"Bullet type changed to %@", button.titleLabel.text];
}
typeStatus = [[UILabel alloc] initWithFrame:CGRectMake(134, 6, 399, 21)];
typeStatus.textColor = rgb(0x228b22);
typeStatus.backgroundColor = [UIColor blackColor];
typeStatus.layer.cornerRadius = 5;
typeStatus.alpha = 0.9;
typeStatus.textAlignment = NSTextAlignmentCenter;
typeStatusBold = [[NSAttributedString alloc] initWithString:text
attributes:@{ NSFontAttributeName: [UIFont boldSystemFontOfSize:18.0] }];
typeStatus.attributedText = typeStatusBold;
[main addSubview:typeStatus];
[self performSelector:@selector(removeLabel) withObject:@NO afterDelay:3];
}
%new
- (void)showViewBasedOnSelectedIndex:(int)index {
if(index == 0){
normalModsScrollView.hidden = false;
bulletTypeScrollView.hidden = true;
grenadeTypeScrollView.hidden = true;
otherModsScrollView.hidden = true;
killstreakTypeScrollView.hidden = true;
weaponPickupTypeScrollView.hidden = true;
[self modifyCloseButtonSelector:true];
}
else{
normalModsScrollView.hidden = true;
otherModsScrollView.hidden = false;
}
}
%new
- (void)goBackToOtherModsView {
otherModsScrollView.hidden = false;
bulletTypeScrollView.hidden = true;
grenadeTypeScrollView.hidden = true;
killstreakTypeScrollView.hidden = true;
weaponPickupTypeScrollView.hidden = true;
[self modifyCloseButtonSelector:true];
}
%new
- (UIButton *)makeTypeChooserButton:(NSString *)title withTag:(int)tag {
UIButton *toReturn = [UIButton buttonWithType:UIButtonTypeCustom];
toReturn.frame = CGRectMake(bulletTypeAndGrenadeTypeXValue, miscellaneousTypeSpacing, bulletTypeAndGrenadeTypeWidth, bulletTypeAndGrenadeTypeHeight);
toReturn.backgroundColor = [UIColor clearColor];
toReturn.tag = tag;
[toReturn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[toReturn setTitle:title forState:UIControlStateNormal];
[toReturn addTarget:self action:@selector(applyTypeChooserHack:) forControlEvents:UIControlEventTouchDown];
miscellaneousTypeSpacing+=30.0f;
return toReturn;
}
%new
- (UISwitch *)makeHackSwitch:(int)tag {
UISwitch *toReturn = [[UISwitch alloc] initWithFrame:CGRectMake(switchXValue, switchSpacing, switchWidth, switchHeight)];
toReturn.transform = CGAffineTransformMakeScale(0.5, 0.5);
toReturn.onTintColor = rgb(0x228b28);
toReturn.tag = tag;
[toReturn addTarget:self action:@selector(switchToggled:) forControlEvents:UIControlEventValueChanged];
switchSpacing+=30.0f;
return toReturn;
}
%new
- (UILabel *)makeHackLabel:(NSString *)text {
UILabel *toReturn = [[UILabel alloc] initWithFrame:CGRectMake(labelXValue, labelSpacing, labelWidth, labelHeight)];
toReturn.text = text;
labelSpacing+=30.0f;
return toReturn;
}
//Helper method to avoid rewriting the same code four times
%new
- (void)modifyCloseButtonSelector:(bool)isGoingBack {
if(isGoingBack){
closeMenu.titleLabel.text = @"Close";
[closeMenu removeTarget:self action:@selector(goBackToOtherModsView) forControlEvents:UIControlEventTouchDown];
[closeMenu addTarget:self action:@selector(closeModMenu) forControlEvents:UIControlEventTouchDown];
}
else{
closeMenu.titleLabel.text = @"Back";
[closeMenu removeTarget:self action:@selector(closeModMenu) forControlEvents:UIControlEventTouchDown];
[closeMenu addTarget:self action:@selector(goBackToOtherModsView) forControlEvents:UIControlEventTouchDown];
}
}
%new
- (void)removeLabel {
[typeStatus removeFromSuperview];
}
%new
- (void)closeModMenu {
menuCreationCount = 0;
labelSpacing = 5.0;
switchSpacing = 0.5;
miscellaneousTypeSpacing = 8.0;
[mainMenuView removeFromSuperview];
}
%end
void makeZeroXLabel(CGFloat x, CGFloat y, CGFloat w, CGFloat h){
zeroX = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
zeroX.text = @"0x";
}