]> Dogcows Code - chaz/thecheat/blob - CheatDocument.h
The Cheat 1.2.1
[chaz/thecheat] / CheatDocument.h
1
2 // **********************************************************************
3 // The Cheat - A universal game cheater for Mac OS X
4 // (C) 2003-2005 Chaz McGarvey (BrokenZipper)
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 1, or (at your option)
9 // any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 //
20
21 #import <Cocoa/Cocoa.h>
22 #import "ChazLog.h"
23 #include "cheat_global.h"
24
25 #import "VariableTable.h"
26 #import "FadeView.h"
27 #import "MenuExtras.h"
28 #import "StatusTextField.h"
29
30 #import "CheatData.h"
31 #import "SearchData.h"
32
33 #import "LocalCheater.h"
34 #import "RemoteCheater.h"
35 #import "Variable.h"
36
37 #import "AppController.h"
38
39
40 typedef unsigned TCDocumentMode;
41 enum {
42 TCSearchMode = 0,
43 TCCheatMode = 1
44 };
45
46
47 typedef unsigned TCDocumentStatus;
48 enum {
49 TCIdleStatus = 0,
50 TCSearchingStatus = 1,
51 TCCheatingStatus = 2,
52 TCDumpingStatus = 3
53 };
54
55
56 @interface CheatDocument : NSDocument
57 {
58 // WINDOW INTERFACE
59 IBOutlet NSWindow *ibWindow;
60 IBOutlet NSPopUpButton *ibServerPopup;
61 IBOutlet NSPopUpButton *ibProcessPopup;
62 IBOutlet NSView *ibPlaceView;
63 IBOutlet StatusTextField *ibStatusText;
64 IBOutlet NSProgressIndicator *ibStatusBar;
65
66 // SEARCH MODE INTERFACE
67 IBOutlet NSView *ibSearchContentView;
68 IBOutlet NSPopUpButton *ibSearchTypePopup;
69 IBOutlet NSMatrix *ibSearchIntegerSignMatrix;
70 IBOutlet NSPopUpButton *ibSearchOperatorPopup;
71 IBOutlet NSMatrix *ibSearchValueUsedMatrix;
72 IBOutlet NSTextField *ibSearchValueField;
73 IBOutlet VariableTable *ibSearchVariableTable;
74 IBOutlet NSButton *ibSearchClearButton;
75 IBOutlet NSButton *ibSearchButton;
76 IBOutlet NSButton *ibSearchVariableButton;
77
78 // CHEAT MODE INTERFACE
79 IBOutlet NSView *ibCheatContentView;
80 IBOutlet NSTextField *ibCheatInfoText;
81 IBOutlet BetterTableView *ibCheatVariableTable;
82 IBOutlet NSButton *ibCheatRepeatButton;
83 IBOutlet NSTextField *ibCheatRepeatAuxText;
84 IBOutlet NSTextField *ibCheatRepeatField;
85 IBOutlet NSButton *ibCheatButton;
86
87 // PROPERTIES INTERFACE
88 IBOutlet NSWindow *ibPropertiesSheet;
89 IBOutlet NSTextField *ibWindowTitleField;
90 IBOutlet NSTextField *ibCheatInfoField;
91
92 // PASSWORD INTERFACE
93 IBOutlet NSWindow *ibPasswordSheet;
94 IBOutlet NSTextField *ibPasswordField;
95
96 // CUSTOM SERVER INTERFACE
97 IBOutlet NSWindow *ibCustomServerSheet;
98 IBOutlet NSTextField *ibServerField;
99 IBOutlet NSTextField *ibPortField;
100
101 // EDIT VARIABLES INTERFACE
102 IBOutlet NSWindow *ibEditVariablesSheet;
103 IBOutlet NSTextField *ibNewValueField;
104
105 NSResponder *_lastResponder;
106
107 // ### IMPORTANT STUFF ###
108 BOOL _connectsOnOpen; // set whether connects automatically on open
109 TCDocumentMode _mode; // 'search' or 'cheat' mode
110 FadeView *_fadeView; // facilitates the fade animation
111
112 TCDocumentStatus _status; // what the user is doing
113 BOOL _isCancelingTask; // is what the user doing being cancelled
114 BOOL _isTargetPaused; // is the currently selected process paused
115
116 id _serverObject; // the object represented by the current server
117 Process *_process; // the currently selected process
118
119 CheatData *_cheatData; // container for the document data
120 SearchData *_searchData; // container for the search data
121
122 Cheater *_cheater; // the local or remote object to handle the cheating
123
124 // rendezvous support
125 NSNetService *_resolvingService;
126 }
127
128 // #############################################################################
129 #pragma mark Service Finding
130 // #############################################################################
131
132 + (NSArray *)cheatServices;
133
134 // #############################################################################
135 #pragma mark Changing Mode
136 // #############################################################################
137
138 // used to set the mode before the nib is loaded.
139 // do not use after that.
140 - (void)setMode:(TCDocumentMode)mode;
141
142 // use this after the nib is loaded.
143 - (void)switchToCheatMode;
144 - (void)switchToSearchMode;
145
146 // #############################################################################
147 #pragma mark Accessors
148 // #############################################################################
149
150 - (NSString *)defaultStatusString;
151 - (BOOL)isLoadedFromFile;
152
153 - (void)addServer:(NSMenuItem *)item;
154 - (void)removeServerWithObject:(id)serverObject;
155
156 // #############################################################################
157 #pragma mark Interface
158 // #############################################################################
159
160 - (void)updateInterface;
161 - (void)setDocumentChanged;
162
163 - (void)setActualResults:(unsigned)count;
164
165 // #############################################################################
166 #pragma mark Utility
167 // #############################################################################
168
169 + (void)setGlobalTarget:(Process *)target;
170 + (Process *)globalTarget;
171
172 - (void)showError:(NSString *)error;
173
174 // this doesn't update the interface
175 // so explicitly call updateInterface after use.
176 - (BOOL)shouldConnectWithServer:(NSMenuItem *)item;
177 - (void)selectConnectedCheater;
178 - (void)connectWithServer:(NSMenuItem *)item;
179 - (void)disconnectFromCheater;
180
181 - (void)setConnectOnOpen:(BOOL)flag;
182 - (void)connectWithURL:(NSString *)url;
183
184 - (void)watchVariables;
185
186
187 @end
188
189
190 // #############################################################################
191
192 @interface CheatDocument ( DocInterfaceActions )
193
194 - (IBAction)ibSetLocalCheater:(id)sender;
195 - (IBAction)ibSetRemoteCheater:(id)sender;
196 - (IBAction)ibSetCustomCheater:(id)sender;
197 - (IBAction)ibSetNoCheater:(id)sender;
198
199 - (IBAction)ibSetProcess:(id)sender;
200
201 - (IBAction)ibSetVariableType:(id)sender;
202 - (IBAction)ibSetIntegerSign:(id)sender;
203 - (IBAction)ibSetOperator:(id)sender;
204 - (IBAction)ibSetValueUsed:(id)sender;
205
206 - (IBAction)ibClearSearch:(id)sender;
207 - (IBAction)ibSearch:(id)sender;
208 - (IBAction)ibAddSearchVariable:(id)sender;
209
210 - (IBAction)ibSetCheatRepeats:(id)sender;
211 - (IBAction)ibSetRepeatInterval:(id)sender;
212 - (IBAction)ibCheat:(id)sender;
213
214 - (IBAction)ibRunPropertiesSheet:(id)sender;
215 - (IBAction)ibEndPropertiesSheet:(id)sender;
216
217 - (IBAction)ibRunPasswordSheet:(id)sender;
218 - (IBAction)ibEndPasswordSheet:(id)sender;
219
220 - (IBAction)ibRunCustomServerSheet:(id)sender;
221 - (IBAction)ibEndCustomServerSheet:(id)sender;
222
223 - (IBAction)ibRunEditVariablesSheet:(id)sender;
224 - (IBAction)ibEndEditVariablesSheet:(id)sender;
225
226 - (IBAction)ibPauseTarget:(id)sender;
227 - (IBAction)ibResumeTarget:(id)sender;
228
229 - (IBAction)ibCancelSearch:(id)sender;
230 - (IBAction)ibStopCheat:(id)sender;
231
232 - (IBAction)ibDumpMemory:(id)sender;
233 - (IBAction)ibCancelDump:(id)sender;
234
235 - (IBAction)ibAddCheatVariable:(id)sender;
236 - (IBAction)ibSetVariableEnabled:(id)sender;
237
238 - (IBAction)ibToggleSearchCheat:(id)sender;
239
240 - (IBAction)ibUndo:(id)sender;
241 - (IBAction)ibRedo:(id)sender;
242
243 @end
244
245
246 // #############################################################################
247
248 @interface CheatDocument ( DocCheaterDelegate ) < CheaterDelegate >
249
250 @end
251
This page took 0.042447 seconds and 4 git commands to generate.