-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMasterViewController.m
73 lines (58 loc) · 1.89 KB
/
MasterViewController.m
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
//
// MasterViewController.m
// FTL Trainer
//
// Created by Brett Basler on 6/6/13.
// Copyright (c) 2013 br3tt. All rights reserved.
//
#import "MasterViewController.h"
@interface MasterViewController ()
@end
@implementation MasterViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
NSArray *runningApplicationsList = [[NSWorkspace sharedWorkspace] runningApplications];
for (id object in runningApplicationsList) {
if ([[object bundleIdentifier] isEqual:@"subset.FTL"]) {
pid_t pid = (pid_t) [object processIdentifier];
NSLog(@"FTL Found: %i", pid);
proc = [ProcessManipulator alloc];
proc = [proc init:pid];
baseptr = [proc readInt: FTL_BASE_PTR];
NSLog(@"baseptr: %x", baseptr);
}
}
}
return self;
}
- (IBAction)fuel:(id)sender {
int addr = baseptr + 0x330;
int fuel = [proc readInt:addr];
[proc writeInt:addr :fuel + 999];
}
- (IBAction)missles:(id)sender {
int addr = baseptr + 0x34;
int missleptr = [proc readInt:addr] + 0x168;
int missles = [proc readInt:missleptr];
[proc writeInt:missleptr :missles + 999];
}
- (IBAction)droneparts:(id)sender {
int addr = baseptr + 0x4AC;
int credz = [proc readInt:addr];
[proc writeInt:addr :credz + 999];
}
- (IBAction)credits:(NSButton *)sender {
int addr = baseptr + 0x370;
int credz = [proc readInt:addr];
[proc writeInt:addr :credz + 999];
}
- (IBAction)repair:(id)sender {
int addr = baseptr + 0xDC;
[proc writeInt:addr :30];
}
- (IBAction)github:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://github.com/br3tt"]];
}
@end