-
Notifications
You must be signed in to change notification settings - Fork 13
/
CheatDocument.h
242 lines (174 loc) · 6.66 KB
/
CheatDocument.h
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
/*
* The Cheat - The legendary universal game trainer for Mac OS X.
* http://www.brokenzipper.com/trac/wiki/TheCheat
*
* Copyright (c) 2003-2011, Charles McGarvey et al.
*
* Distributable under the terms and conditions of the 2-clause BSD
* license; see the file COPYING for the legal text of the license.
*/
#import <Cocoa/Cocoa.h>
#import "ChazLog.h"
#include "cheat_global.h"
#import "VariableTable.h"
#import "FadeView.h"
#import "MenuExtras.h"
#import "StatusTextField.h"
#import "CheatData.h"
#import "SearchData.h"
#import "LocalCheater.h"
#import "RemoteCheater.h"
#import "Variable.h"
#import "AppController.h"
typedef unsigned TCDocumentMode;
enum {
TCSearchMode = 0,
TCCheatMode = 1
};
typedef unsigned TCDocumentStatus;
enum {
TCIdleStatus = 0,
TCSearchingStatus = 1,
TCCheatingStatus = 2,
TCDumpingStatus = 3
};
@interface CheatDocument : NSDocument
{
// WINDOW INTERFACE
IBOutlet NSWindow *ibWindow;
IBOutlet NSPopUpButton *ibServerPopup;
IBOutlet NSPopUpButton *ibProcessPopup;
IBOutlet NSView *ibPlaceView;
IBOutlet StatusTextField *ibStatusText;
IBOutlet NSProgressIndicator *ibStatusBar;
// SEARCH MODE INTERFACE
IBOutlet NSView *ibSearchContentView;
IBOutlet NSPopUpButton *ibSearchTypePopup;
IBOutlet NSMatrix *ibSearchIntegerSignMatrix;
IBOutlet NSPopUpButton *ibSearchOperatorPopup;
IBOutlet NSMatrix *ibSearchValueUsedMatrix;
IBOutlet NSTextField *ibSearchValueField;
IBOutlet VariableTable *ibSearchVariableTable;
IBOutlet NSButton *ibSearchClearButton;
IBOutlet NSButton *ibSearchButton;
IBOutlet NSButton *ibSearchVariableButton;
// CHEAT MODE INTERFACE
IBOutlet NSView *ibCheatContentView;
IBOutlet NSTextField *ibCheatInfoText;
IBOutlet BetterTableView *ibCheatVariableTable;
IBOutlet NSButton *ibCheatRepeatButton;
IBOutlet NSTextField *ibCheatRepeatAuxText;
IBOutlet NSTextField *ibCheatRepeatField;
IBOutlet NSButton *ibCheatButton;
// PROPERTIES INTERFACE
IBOutlet NSWindow *ibPropertiesSheet;
IBOutlet NSTextField *ibWindowTitleField;
IBOutlet NSTextField *ibCheatInfoField;
// PASSWORD INTERFACE
IBOutlet NSWindow *ibPasswordSheet;
IBOutlet NSTextField *ibPasswordField;
// CUSTOM SERVER INTERFACE
IBOutlet NSWindow *ibCustomServerSheet;
IBOutlet NSTextField *ibServerField;
IBOutlet NSTextField *ibPortField;
// EDIT VARIABLES INTERFACE
IBOutlet NSWindow *ibEditVariablesSheet;
IBOutlet NSTextField *ibNewValueField;
NSResponder *_lastResponder;
// ### IMPORTANT STUFF ###
BOOL _connectsOnOpen; // set whether connects automatically on open
TCDocumentMode _mode; // 'search' or 'cheat' mode
FadeView *_fadeView; // facilitates the fade animation
TCDocumentStatus _status; // what the user is doing
BOOL _isCancelingTask; // is what the user doing being cancelled
BOOL _isTargetPaused; // is the currently selected process paused
id _serverObject; // the object represented by the current server
Process *_process; // the currently selected process
CheatData *_cheatData; // container for the document data
SearchData *_searchData; // container for the search data
Cheater *_cheater; // the local or remote object to handle the cheating
// rendezvous support
NSNetService *_resolvingService;
}
// #############################################################################
#pragma mark Service Finding
// #############################################################################
+ (NSArray *)cheatServices;
// #############################################################################
#pragma mark Changing Mode
// #############################################################################
// used to set the mode before the nib is loaded.
// do not use after that.
- (void)setMode:(TCDocumentMode)mode;
// use this after the nib is loaded.
- (void)switchToCheatMode;
- (void)switchToSearchMode;
// #############################################################################
#pragma mark Accessors
// #############################################################################
- (NSString *)defaultStatusString;
- (BOOL)isLoadedFromFile;
- (void)addServer:(NSMenuItem *)item;
- (void)removeServerWithObject:(id)serverObject;
// #############################################################################
#pragma mark Interface
// #############################################################################
- (void)updateInterface;
- (void)setDocumentChanged;
- (void)setActualResults:(unsigned)count;
// #############################################################################
#pragma mark Utility
// #############################################################################
+ (void)setGlobalTarget:(Process *)target;
+ (Process *)globalTarget;
- (void)showError:(NSString *)error;
// this doesn't update the interface
// so explicitly call updateInterface after use.
- (BOOL)shouldConnectWithServer:(NSMenuItem *)item;
- (void)selectConnectedCheater;
- (void)connectWithServer:(NSMenuItem *)item;
- (void)disconnectFromCheater;
- (void)setConnectOnOpen:(BOOL)flag;
- (void)connectWithURL:(NSString *)url;
- (void)watchVariables;
@end
// #############################################################################
@interface CheatDocument ( DocInterfaceActions )
- (IBAction)ibSetLocalCheater:(id)sender;
- (IBAction)ibSetRemoteCheater:(id)sender;
- (IBAction)ibSetCustomCheater:(id)sender;
- (IBAction)ibSetNoCheater:(id)sender;
- (IBAction)ibSetProcess:(id)sender;
- (IBAction)ibSetVariableType:(id)sender;
- (IBAction)ibSetIntegerSign:(id)sender;
- (IBAction)ibSetOperator:(id)sender;
- (IBAction)ibSetValueUsed:(id)sender;
- (IBAction)ibClearSearch:(id)sender;
- (IBAction)ibSearch:(id)sender;
- (IBAction)ibAddSearchVariable:(id)sender;
- (IBAction)ibSetCheatRepeats:(id)sender;
- (IBAction)ibSetRepeatInterval:(id)sender;
- (IBAction)ibCheat:(id)sender;
- (IBAction)ibRunPropertiesSheet:(id)sender;
- (IBAction)ibEndPropertiesSheet:(id)sender;
- (IBAction)ibRunPasswordSheet:(id)sender;
- (IBAction)ibEndPasswordSheet:(id)sender;
- (IBAction)ibRunCustomServerSheet:(id)sender;
- (IBAction)ibEndCustomServerSheet:(id)sender;
- (IBAction)ibRunEditVariablesSheet:(id)sender;
- (IBAction)ibEndEditVariablesSheet:(id)sender;
- (IBAction)ibPauseTarget:(id)sender;
- (IBAction)ibResumeTarget:(id)sender;
- (IBAction)ibCancelSearch:(id)sender;
- (IBAction)ibStopCheat:(id)sender;
- (IBAction)ibDumpMemory:(id)sender;
- (IBAction)ibCancelDump:(id)sender;
- (IBAction)ibAddCheatVariable:(id)sender;
- (IBAction)ibSetVariableEnabled:(id)sender;
- (IBAction)ibToggleSearchCheat:(id)sender;
- (IBAction)ibUndo:(id)sender;
- (IBAction)ibRedo:(id)sender;
@end
// #############################################################################
@interface CheatDocument ( DocCheaterDelegate ) < CheaterDelegate >
@end