]> Dogcows Code - chaz/thecheat/blob - CheatDocument.h
The Cheat 1.2
[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 IBOutlet NSButton *ibVariableEnableButton;
105
106 NSResponder *_lastResponder;
107
108 // ### IMPORTANT STUFF ###
109 BOOL _connectsOnOpen; // set whether connects automatically on open
110 TCDocumentMode _mode; // 'search' or 'cheat' mode
111 FadeView *_fadeView; // facilitates the fade animation
112
113 TCDocumentStatus _status; // what the user is doing
114 BOOL _isCancelingTask; // is what the user doing being cancelled
115 BOOL _isTargetPaused; // is the currently selected process paused
116
117 id _serverObject; // the object represented by the current server
118 Process *_process; // the currently selected process
119
120 CheatData *_cheatData; // container for the document data
121 SearchData *_searchData; // container for the search data
122
123 Cheater *_cheater; // the local or remote object to handle the cheating
124
125 // rendezvous support
126 NSNetService *_resolvingService;
127 }
128
129 // #############################################################################
130 #pragma mark Service Finding
131 // #############################################################################
132
133 + (NSArray *)cheatServices;
134
135 // #############################################################################
136 #pragma mark Changing Mode
137 // #############################################################################
138
139 // used to set the mode before the nib is loaded.
140 // do not use after that.
141 - (void)setMode:(TCDocumentMode)mode;
142
143 // use this after the nib is loaded.
144 - (void)switchToCheatMode;
145 - (void)switchToSearchMode;
146
147 // #############################################################################
148 #pragma mark Accessors
149 // #############################################################################
150
151 - (NSString *)defaultStatusString;
152 - (BOOL)isLoadedFromFile;
153
154 - (void)addServer:(NSMenuItem *)item;
155 - (void)removeServerWithObject:(id)serverObject;
156
157 // #############################################################################
158 #pragma mark Interface
159 // #############################################################################
160
161 - (void)updateInterface;
162 - (void)setDocumentChanged;
163
164 - (void)setActualResults:(unsigned)count;
165
166 // #############################################################################
167 #pragma mark Utility
168 // #############################################################################
169
170 + (void)setGlobalTarget:(Process *)target;
171 + (Process *)globalTarget;
172
173 - (void)showError:(NSString *)error;
174
175 // this doesn't update the interface
176 // so explicitly call updateInterface after use.
177 - (BOOL)shouldConnectWithServer:(NSMenuItem *)item;
178 - (void)selectConnectedCheater;
179 - (void)connectWithServer:(NSMenuItem *)item;
180 - (void)disconnectFromCheater;
181
182 - (void)setConnectOnOpen:(BOOL)flag;
183 - (void)connectWithURL:(NSString *)url;
184
185 - (void)watchVariables;
186
187
188 @end
189
190
191 // #############################################################################
192
193 @interface CheatDocument ( DocInterfaceActions )
194
195 - (IBAction)ibSetLocalCheater:(id)sender;
196 - (IBAction)ibSetRemoteCheater:(id)sender;
197 - (IBAction)ibSetCustomCheater:(id)sender;
198 - (IBAction)ibSetNoCheater:(id)sender;
199
200 - (IBAction)ibSetProcess:(id)sender;
201
202 - (IBAction)ibSetVariableType:(id)sender;
203 - (IBAction)ibSetIntegerSign:(id)sender;
204 - (IBAction)ibSetOperator:(id)sender;
205 - (IBAction)ibSetValueUsed:(id)sender;
206
207 - (IBAction)ibClearSearch:(id)sender;
208 - (IBAction)ibSearch:(id)sender;
209 - (IBAction)ibAddSearchVariable:(id)sender;
210
211 - (IBAction)ibSetCheatRepeats:(id)sender;
212 - (IBAction)ibSetRepeatInterval:(id)sender;
213 - (IBAction)ibCheat:(id)sender;
214
215 - (IBAction)ibRunPropertiesSheet:(id)sender;
216 - (IBAction)ibEndPropertiesSheet:(id)sender;
217
218 - (IBAction)ibRunPasswordSheet:(id)sender;
219 - (IBAction)ibEndPasswordSheet:(id)sender;
220
221 - (IBAction)ibRunCustomServerSheet:(id)sender;
222 - (IBAction)ibEndCustomServerSheet:(id)sender;
223
224 - (IBAction)ibRunEditVariablesSheet:(id)sender;
225 - (IBAction)ibEndEditVariablesSheet:(id)sender;
226
227 - (IBAction)ibPauseTarget:(id)sender;
228 - (IBAction)ibResumeTarget:(id)sender;
229
230 - (IBAction)ibCancelSearch:(id)sender;
231 - (IBAction)ibStopCheat:(id)sender;
232
233 - (IBAction)ibDumpMemory:(id)sender;
234 - (IBAction)ibCancelDump:(id)sender;
235
236 - (IBAction)ibAddCheatVariable:(id)sender;
237 - (IBAction)ibSetVariableEnabled:(id)sender;
238
239 - (IBAction)ibToggleSearchCheat:(id)sender;
240
241 - (IBAction)ibUndo:(id)sender;
242 - (IBAction)ibRedo:(id)sender;
243
244 @end
245
246
247 // #############################################################################
248
249 @interface CheatDocument ( DocCheaterDelegate ) < CheaterDelegate >
250
251 @end
252
This page took 0.041512 seconds and 5 git commands to generate.