├── Lock.tif ├── Server.png ├── Update.png ├── icon.icns ├── General.png ├── icondoc.icns ├── disc_session.tif ├── English.lproj ├── InfoPlist.strings ├── Session~.nib │ ├── objects.nib │ ├── keyedobjects.nib │ ├── info.nib │ └── classes.nib ├── Help.nib │ ├── keyedobjects.nib │ ├── classes.nib │ └── info.nib ├── Help~.nib │ ├── keyedobjects.nib │ ├── classes.nib │ └── info.nib ├── AboutBox.nib │ ├── keyedobjects.nib │ ├── classes.nib │ └── info.nib ├── MainMenu.nib │ ├── keyedobjects.nib │ ├── info.nib │ └── classes.nib ├── Record~.nib │ ├── keyedobjects.nib │ ├── classes.nib │ └── info.nib ├── AboutBox~.nib │ ├── keyedobjects.nib │ ├── classes.nib │ └── info.nib ├── MainMenu~.nib │ ├── keyedobjects.nib │ ├── info.nib │ └── classes.nib ├── CheatDocument.nib │ ├── keyedobjects.nib │ ├── disc_session.tiff │ ├── info.nib │ └── classes.nib ├── Preferences.nib │ ├── keyedobjects.nib │ ├── info.nib │ └── classes.nib ├── Preferences~.nib │ ├── keyedobjects.nib │ ├── info.nib │ └── classes.nib ├── CheatDocument~.nib │ ├── disc_session.tiff │ ├── keyedobjects.nib │ ├── info.nib │ └── classes.nib └── locversion.plist ├── AUTHORS ├── The_Cheat_Prefix.pch ├── CheatURLHandler.scriptSuite ├── CheatURLHandler.scriptTerminology ├── version.plist ├── CheatURLCommand.h ├── HelpController.h ├── UpdatePrefs.h ├── MenuExtras.h ├── DumpContext.h ├── TrackerScroller.h ├── RemoteCheater.h ├── DumpContext.m ├── AboutBoxController.h ├── PreferenceController.h ├── UpdatePrefs.m ├── CheatURLCommand.m ├── ServerPrefs.h ├── TrackerScroller.m ├── VariableTable.h ├── Process.h ├── StatusTextField.h ├── FadeView.h ├── GeneralPrefs.h ├── BetterTableView.h ├── AppController.h ├── LocalCheater.h ├── COPYING ├── ServerChild.h ├── ChazLog.h ├── HelpController.m ├── ChazUpdate.h ├── Conversions.h ├── cheat_global.h ├── CheaterTypes.m ├── SearchData.h ├── Info.plist ├── CheatServer.h ├── MenuExtras.m ├── CheatData.h ├── AboutBoxController.m ├── StatusTextField.m ├── Variable.h ├── FadeView.m ├── SearchContext.h ├── ChazLog.m ├── VariableTable.m ├── PreferenceController.m ├── Searching.h ├── cheat_global.m ├── CheaterTypes.h ├── main.m ├── GeneralPrefs.m ├── MySocket.h ├── Cheater.h ├── SearchData.m ├── CheatData.m ├── ServerPrefs.m ├── README.md ├── VMRegion.h ├── BetterTableView.m ├── Cheater.m ├── Process.m ├── CheatServer.m └── CheatDocument.h /Lock.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/Lock.tif -------------------------------------------------------------------------------- /Server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/Server.png -------------------------------------------------------------------------------- /Update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/Update.png -------------------------------------------------------------------------------- /icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/icon.icns -------------------------------------------------------------------------------- /General.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/General.png -------------------------------------------------------------------------------- /icondoc.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/icondoc.icns -------------------------------------------------------------------------------- /disc_session.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/disc_session.tif -------------------------------------------------------------------------------- /English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /English.lproj/Session~.nib/objects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/Session~.nib/objects.nib -------------------------------------------------------------------------------- /English.lproj/Help.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/Help.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/Help~.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/Help~.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/AboutBox.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/AboutBox.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/Record~.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/Record~.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/Session~.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/Session~.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/AboutBox~.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/AboutBox~.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/MainMenu~.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/MainMenu~.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/CheatDocument.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/CheatDocument.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/Preferences.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/Preferences.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/Preferences~.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/Preferences~.nib/keyedobjects.nib -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Charles McGarvey 2 | Adrien Pujol 3 | nil 4 | Zhe Fang 5 | -------------------------------------------------------------------------------- /English.lproj/CheatDocument.nib/disc_session.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/CheatDocument.nib/disc_session.tiff -------------------------------------------------------------------------------- /English.lproj/CheatDocument~.nib/disc_session.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/CheatDocument~.nib/disc_session.tiff -------------------------------------------------------------------------------- /English.lproj/CheatDocument~.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chazmcgarvey/thecheat/HEAD/English.lproj/CheatDocument~.nib/keyedobjects.nib -------------------------------------------------------------------------------- /The_Cheat_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'The Cheat' target in the 'The Cheat' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /CheatURLHandler.scriptSuite: -------------------------------------------------------------------------------- 1 | 2 | // CheatURLHandler.scriptSuite 3 | 4 | { 5 | Name = CheatURLHandler; 6 | AppleEventCode = "UrHD"; 7 | 8 | Commands = { 9 | "GetURL" = { 10 | CommandClass = CheatURLCommand; 11 | AppleEventCode = GURL; 12 | AppleEventClassCode = GURL; 13 | }; 14 | }; 15 | } -------------------------------------------------------------------------------- /CheatURLHandler.scriptTerminology: -------------------------------------------------------------------------------- 1 | 2 | // CheatURLHandler.scriptTerminology 3 | 4 | { 5 | Name = "CheatURLHandler"; 6 | Description = "Handles cheat:// URLs"; 7 | 8 | Commands = { 9 | "GetURL" = { 10 | Name = "Get URL"; 11 | Description = "Launches a new cheat session with a remote server."; 12 | }; 13 | }; 14 | } -------------------------------------------------------------------------------- /English.lproj/Record~.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = CMStatusView; LANGUAGE = ObjC; SUPERCLASS = NSTextField; }, 4 | {CLASS = CheatDocument; LANGUAGE = ObjC; SUPERCLASS = NSDocument; }, 5 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 6 | ); 7 | IBVersion = 1; 8 | } -------------------------------------------------------------------------------- /English.lproj/Help.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | { 5 | CLASS = HelpController; 6 | LANGUAGE = ObjC; 7 | OUTLETS = {helpWindow = NSWindow; webView = WebView; }; 8 | SUPERCLASS = NSWindowController; 9 | } 10 | ); 11 | IBVersion = 1; 12 | } -------------------------------------------------------------------------------- /English.lproj/Help~.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | { 5 | CLASS = HelpController; 6 | LANGUAGE = ObjC; 7 | OUTLETS = {helpWindow = NSWindow; webView = WebView; }; 8 | SUPERCLASS = NSWindowController; 9 | } 10 | ); 11 | IBVersion = 1; 12 | } -------------------------------------------------------------------------------- /English.lproj/locversion.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LprojCompatibleVersion 6 | 116.2 7 | LprojLocale 8 | en 9 | LprojRevisionLevel 10 | 1 11 | LprojVersion 12 | 116.2 13 | 14 | 15 | -------------------------------------------------------------------------------- /version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 1 7 | CFBundleShortVersionString 8 | 0.1 9 | CFBundleVersion 10 | 0.1 11 | ProjectName 12 | NibPBTemplates 13 | SourceVersion 14 | 1160200 15 | 16 | 17 | -------------------------------------------------------------------------------- /English.lproj/Help.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 69 61 356 241 0 0 1280 1002 7 | IBFramework Version 8 | 364.0 9 | IBOpenObjects 10 | 11 | 18 12 | 13 | IBSystem Version 14 | 7U16 15 | 16 | 17 | -------------------------------------------------------------------------------- /English.lproj/Help~.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 69 61 356 241 0 0 1280 1002 7 | IBFramework Version 8 | 364.0 9 | IBOpenObjects 10 | 11 | 18 12 | 13 | IBSystem Version 14 | 7U16 15 | 16 | 17 | -------------------------------------------------------------------------------- /English.lproj/Record~.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 129 74 356 240 0 0 1280 938 7 | IBFramework Version 8 | 364.0 9 | IBOpenObjects 10 | 11 | 6 12 | 13 | IBSystem Version 14 | 7H63 15 | 16 | 17 | -------------------------------------------------------------------------------- /CheatURLCommand.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | #import "ChazLog.h" 15 | 16 | #import "CheatDocument.h" 17 | 18 | 19 | @interface CheatURLCommand : NSScriptCommand 20 | { 21 | 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /HelpController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import 14 | #import "ChazLog.h" 15 | 16 | 17 | @interface HelpController : NSWindowController 18 | { 19 | IBOutlet NSWindow *helpWindow; 20 | IBOutlet WebView *webView; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /English.lproj/AboutBox.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = {ibEmailButton = id; ibWebsiteButton = id; }; 5 | CLASS = AboutBoxController; 6 | LANGUAGE = ObjC; 7 | OUTLETS = { 8 | ibDateText = NSTextField; 9 | ibEmailButton = NSButton; 10 | ibNameVersionText = NSTextField; 11 | ibWebsiteButton = NSButton; 12 | }; 13 | SUPERCLASS = NSWindowController; 14 | }, 15 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 16 | ); 17 | IBVersion = 1; 18 | } -------------------------------------------------------------------------------- /English.lproj/AboutBox~.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = {ibEmailButton = id; ibWebsiteButton = id; }; 5 | CLASS = AboutBoxController; 6 | LANGUAGE = ObjC; 7 | OUTLETS = { 8 | ibDateText = NSTextField; 9 | ibEmailButton = NSButton; 10 | ibNameVersionText = NSTextField; 11 | ibWebsiteButton = NSButton; 12 | }; 13 | SUPERCLASS = NSWindowController; 14 | }, 15 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 16 | ); 17 | IBVersion = 1; 18 | } -------------------------------------------------------------------------------- /English.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBFramework Version 6 | 677 7 | IBLastKnownRelativeProjectPath 8 | ../The Cheat.xcodeproj 9 | IBOldestOS 10 | 5 11 | IBOpenObjects 12 | 13 | 370 14 | 15 | IBSystem Version 16 | 9J61 17 | targetFramework 18 | IBCocoaFramework 19 | 20 | 21 | -------------------------------------------------------------------------------- /English.lproj/MainMenu~.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 485 122 356 240 0 0 1280 938 7 | IBEditorPositions 8 | 9 | 29 10 | 179 806 349 44 0 0 1280 938 11 | 12 | IBFramework Version 13 | 364.0 14 | IBOpenObjects 15 | 16 | 29 17 | 18 | IBSystem Version 19 | 7U16 20 | 21 | 22 | -------------------------------------------------------------------------------- /UpdatePrefs.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | #import "cheat_global.h" 15 | 16 | #import "ChazUpdate.h" 17 | 18 | 19 | @interface UpdatePrefs : NSObject 20 | { 21 | IBOutlet NSButton *ibAutoCheckButton; 22 | } 23 | 24 | - (IBAction)ibAutoCheckButton:(id)sender; 25 | - (IBAction)ibCheckNowButton:(id)sender; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MenuExtras.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | 14 | 15 | @interface NSMenu ( MenuExtras ) 16 | 17 | - (void)removeItemWithTitle:(NSString *)title; 18 | - (void)removeAllItemsWithTitle:(NSString *)title; 19 | - (void)removeItemWithTag:(int)tag; 20 | - (void)removeItemWithRepresentedObject:(id)object; 21 | 22 | - (void)removeAllItems; 23 | 24 | - (void)enableAllItems; 25 | - (void)disableAllItems; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /DumpContext.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | 15 | #import "VMRegion.h" 16 | 17 | 18 | @interface DumpContext : NSObject 19 | { 20 | // for fast access while iterating through the task loop. 21 | @public; 22 | 23 | pid_t process; 24 | unsigned regionCount; 25 | VMRegion lastRegion; 26 | 27 | NSMutableData *dump; 28 | } 29 | 30 | // Initialization 31 | 32 | - (id)initWithPID:(pid_t)pid; 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /TrackerScroller.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | 15 | 16 | @interface TrackerScroller : NSScroller 17 | { 18 | id _delegate; 19 | } 20 | 21 | - (id)delegate; 22 | - (void)setDelegate:(id)delegate; 23 | 24 | @end 25 | 26 | 27 | @interface NSObject ( TrackerScrollerDelegate ) 28 | 29 | - (void)scrollerDidStartScrolling:(TrackerScroller *)scroller; 30 | - (void)scrollerDidStopScrolling:(TrackerScroller *)scroller; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RemoteCheater.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazUpdate.h" 14 | 15 | #import "Cheater.h" 16 | 17 | #import "MySocket.h" 18 | 19 | 20 | @interface RemoteCheater : Cheater 21 | { 22 | MySocket *_socket; 23 | 24 | /* the current packet being read. */ 25 | TCPacketHeader _header; 26 | NSData *_parameters; 27 | } 28 | 29 | - (BOOL)connectToHostWithData:(NSData *)data; 30 | // disconnects automatically upon dealloc 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /DumpContext.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import "DumpContext.h" 14 | 15 | 16 | @implementation DumpContext 17 | 18 | 19 | - (id)initWithPID:(pid_t)pid 20 | { 21 | if ( self = [super init] ) { 22 | process = pid; 23 | regionCount = VMCountRegionsWithAttributes( pid, VMREGION_READABLE ); 24 | dump = [[NSMutableData alloc] init]; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)dealloc 30 | { 31 | //[lastRegion release]; 32 | [dump release]; 33 | [super dealloc]; 34 | } 35 | 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /AboutBoxController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazLog.h" 14 | 15 | #import "ChazUpdate.h" 16 | 17 | #include "cheat_global.h" 18 | 19 | 20 | @interface AboutBoxController : NSWindowController 21 | { 22 | IBOutlet NSTextField *ibNameVersionText; 23 | IBOutlet NSButton *ibWebsiteButton; 24 | IBOutlet NSButton *ibEmailButton; 25 | IBOutlet NSTextField *ibDateText; 26 | } 27 | 28 | - (IBAction)ibWebsiteButton:(id)sender; 29 | - (IBAction)ibEmailButton:(id)sender; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /English.lproj/Preferences.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 333 104 431 282 0 0 1280 938 7 | IBEditorPositions 8 | 9 | 441 10 | 325 550 476 321 0 0 1280 938 11 | 463 12 | 402 570 476 210 0 0 1280 938 13 | 478 14 | 402 433 476 420 0 0 1280 938 15 | 16 | IBFramework Version 17 | 437.0 18 | IBLockedObjects 19 | 20 | IBOpenObjects 21 | 22 | 441 23 | 24 | IBSystem Version 25 | 8A428 26 | 27 | 28 | -------------------------------------------------------------------------------- /English.lproj/Preferences~.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 333 104 431 282 0 0 1280 938 7 | IBEditorPositions 8 | 9 | 441 10 | 325 550 476 321 0 0 1280 938 11 | 463 12 | 402 570 476 210 0 0 1280 938 13 | 478 14 | 402 433 476 420 0 0 1280 938 15 | 16 | IBFramework Version 17 | 437.0 18 | IBLockedObjects 19 | 20 | IBOpenObjects 21 | 22 | 441 23 | 24 | IBSystem Version 25 | 8A428 26 | 27 | 28 | -------------------------------------------------------------------------------- /English.lproj/CheatDocument.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 540 85 356 394 0 0 1280 938 7 | IBEditorPositions 8 | 9 | 24 10 | 420 519 440 253 0 0 1280 938 11 | 45 12 | 420 519 440 253 0 0 1280 938 13 | 14 | IBFramework Version 15 | 437.0 16 | IBOpenObjects 17 | 18 | 122 19 | 757 20 | 643 21 | 45 22 | 5 23 | 24 24 | 483 25 | 26 | IBSystem Version 27 | 8B15 28 | 29 | 30 | -------------------------------------------------------------------------------- /English.lproj/CheatDocument~.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 540 85 356 394 0 0 1280 938 7 | IBEditorPositions 8 | 9 | 24 10 | 420 519 440 253 0 0 1280 938 11 | 45 12 | 420 519 440 253 0 0 1280 938 13 | 14 | IBFramework Version 15 | 437.0 16 | IBOpenObjects 17 | 18 | 122 19 | 757 20 | 643 21 | 45 22 | 5 23 | 24 24 | 483 25 | 26 | IBSystem Version 27 | 8B15 28 | 29 | 30 | -------------------------------------------------------------------------------- /PreferenceController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazLog.h" 14 | 15 | #include "cheat_global.h" 16 | 17 | 18 | @interface PreferenceController : NSWindowController 19 | { 20 | NSToolbar *_toolbar; 21 | 22 | NSView *_contentView; 23 | IBOutlet NSView *ibGeneralView; 24 | IBOutlet NSView *ibServerView; 25 | IBOutlet NSView *ibUpdateCheckView; 26 | } 27 | 28 | - (void)chooseGeneral:(id)object; 29 | - (void)chooseServer:(id)object; 30 | - (void)chooseUpdate:(id)object; 31 | - (void)switchToView:(NSView *)view; 32 | 33 | - (void)initialInterfaceSetup; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /UpdatePrefs.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import "UpdatePrefs.h" 14 | 15 | 16 | @implementation UpdatePrefs 17 | 18 | 19 | - (void)awakeFromNib 20 | { 21 | // set initial states 22 | [ibAutoCheckButton setState:[[NSUserDefaults standardUserDefaults] boolForKey:TCUpdateCheckPref]]; 23 | } 24 | 25 | - (IBAction)ibAutoCheckButton:(id)sender 26 | { 27 | BOOL pref = [sender state]; 28 | [[NSUserDefaults standardUserDefaults] setBool:pref forKey:TCUpdateCheckPref]; 29 | } 30 | 31 | - (IBAction)ibCheckNowButton:(id)sender 32 | { 33 | ChazCheckForUpdate( TCUpdateCheckURL, YES ); 34 | } 35 | 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /CheatURLCommand.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import "CheatURLCommand.h" 14 | 15 | 16 | @implementation CheatURLCommand 17 | 18 | - (id)performDefaultImplementation 19 | { 20 | NSDocumentController *controller = [NSDocumentController sharedDocumentController]; 21 | CheatDocument *doc = [controller makeUntitledDocumentOfType:@"Cheat Document"]; 22 | if ( !doc ) { 23 | ChazLog( @"nil document" ); 24 | } 25 | [doc setMode:TCSearchMode]; 26 | [doc setConnectOnOpen:NO]; 27 | [controller addDocument:doc]; 28 | [doc makeWindowControllers]; 29 | [doc showWindows]; 30 | [doc connectWithURL:[self directParameter]]; 31 | return nil; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /English.lproj/AboutBox.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 124 93 356 241 0 0 1280 938 7 | IBFramework Version 8 | 364.0 9 | IBGroupedObjects 10 | 11 | 3 12 | 13 | 93 14 | 91 15 | 16 | 7 17 | 18 | 77 19 | 80 20 | 87 21 | 22 | 8 23 | 24 | 89 25 | 81 26 | 27 | 28 | IBLastGroupID 29 | 9 30 | IBOpenObjects 31 | 32 | 85 33 | 34 | IBSystem Version 35 | 7U16 36 | 37 | 38 | -------------------------------------------------------------------------------- /English.lproj/AboutBox~.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 124 93 356 241 0 0 1280 938 7 | IBFramework Version 8 | 364.0 9 | IBGroupedObjects 10 | 11 | 3 12 | 13 | 93 14 | 91 15 | 16 | 7 17 | 18 | 77 19 | 80 20 | 87 21 | 22 | 8 23 | 24 | 89 25 | 81 26 | 27 | 28 | IBLastGroupID 29 | 9 30 | IBOpenObjects 31 | 32 | 85 33 | 34 | IBSystem Version 35 | 7U16 36 | 37 | 38 | -------------------------------------------------------------------------------- /ServerPrefs.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazLog.h" 14 | 15 | #include "cheat_global.h" 16 | 17 | #import "StatusTextField.h" 18 | 19 | 20 | @interface ServerPrefs : NSObject 21 | { 22 | IBOutlet StatusTextField *ibStatusField; 23 | IBOutlet NSTextField *ibNameField; 24 | IBOutlet NSTextField *ibPortField; 25 | IBOutlet NSButton *ibStartButton; 26 | IBOutlet NSTableView *ibSessionTable; 27 | IBOutlet NSTextField *ibDefaultPortText; 28 | 29 | NSTimer *_tableTimer; 30 | } 31 | 32 | - (IBAction)ibSetListenPort:(id)sender; 33 | - (IBAction)ibSetBroadcast:(id)sender; 34 | 35 | - (IBAction)ibStartServer:(id)sender; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /TrackerScroller.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import "TrackerScroller.h" 14 | 15 | 16 | @implementation TrackerScroller 17 | 18 | 19 | - (id)delegate 20 | { 21 | return _delegate; 22 | } 23 | 24 | - (void)setDelegate:(id)delegate 25 | { 26 | _delegate = delegate; 27 | } 28 | 29 | 30 | - (void)mouseDown:(NSEvent *)theEvent 31 | { 32 | if ( [_delegate respondsToSelector:@selector(scrollerDidStartScrolling:)] ) { 33 | [_delegate scrollerDidStartScrolling:self]; 34 | } 35 | [super mouseDown:theEvent]; 36 | if ( [_delegate respondsToSelector:@selector(scrollerDidStopScrolling:)] ) { 37 | [_delegate scrollerDidStopScrolling:self]; 38 | } 39 | } 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /VariableTable.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | #include "ChazLog.h" 15 | 16 | #import "BetterTableView.h" 17 | 18 | #import "TrackerScroller.h" 19 | 20 | /* 21 | * This class lets you get which rows are currently visible and has a delegate 22 | * method which is called when the visible rows changes. 23 | */ 24 | 25 | 26 | @interface VariableTable : BetterTableView 27 | { 28 | BOOL _dontUpdate; 29 | BOOL _updatePending; 30 | NSRange _visibleRows; 31 | } 32 | 33 | - (NSRange)visibleRows; 34 | 35 | @end 36 | 37 | 38 | @interface NSObject ( VariableTableViewDelegate ) 39 | 40 | - (void)tableView:(NSTableView *)aTableView didChangeVisibleRows:(NSRange)rows; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Process.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | 14 | 15 | @interface Process : NSObject < NSCopying, NSCoding > 16 | { 17 | NSString *_name; 18 | NSString *_version; 19 | NSImage *_icon; 20 | pid_t _pid; 21 | } 22 | 23 | // initialization 24 | - (id)initWithName:(NSString *)name version:(NSString *)version icon:(NSImage *)icon pid:(pid_t)pid; 25 | - (id)initWithName:(NSString *)name version:(NSString *)version icon:(NSImage *)icon; 26 | - (id)initWithName:(NSString *)name version:(NSString *)version; 27 | 28 | // comparison 29 | - (BOOL)sameApplicationAs:(id)anObject; 30 | 31 | // accessors 32 | - (BOOL)isEmulated; 33 | - (NSString *)name; 34 | - (NSString *)version; 35 | - (NSImage *)icon; 36 | - (pid_t)pid; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /StatusTextField.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | 14 | 15 | @interface StatusTextField : NSTextField 16 | { 17 | NSString *myDefaultStatus; 18 | NSColor *myDefaultColor; 19 | 20 | NSTimer *myTimer; 21 | } 22 | 23 | - (void)setDefaultStatus:(NSString *)message; // defaults to black 24 | - (void)setDefaultStatus:(NSString *)message color:(NSColor *)color; 25 | 26 | - (void)setTemporaryStatus:(NSString *)message; // defaults to black 27 | - (void)setTemporaryStatus:(NSString *)message color:(NSColor *)color; // defaults to 4 seconds 28 | - (void)setTemporaryStatus:(NSString *)message duration:(NSTimeInterval)duration; 29 | - (void)setTemporaryStatus:(NSString *)message color:(NSColor *)color duration:(NSTimeInterval)duration; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /FadeView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | 15 | 16 | @interface FadeView : NSView 17 | { 18 | NSImage *_fadeImage; 19 | double _fadeAlpha; 20 | 21 | NSTimeInterval _fadeDuration; 22 | NSTimeInterval _fadeInterval; 23 | NSTimer *_fadeTimer; 24 | 25 | id _delegate; 26 | } 27 | 28 | - (NSImage *)image; 29 | - (NSTimeInterval)fadeDuration; 30 | - (NSTimeInterval)fadeInterval; 31 | - (double)alpha; 32 | 33 | - (void)setImage:(NSImage *)image; 34 | - (void)setFadeDuration:(NSTimeInterval)seconds; 35 | - (void)setFadeInterval:(NSTimeInterval)seconds; 36 | 37 | - (void)startFadeAnimation; 38 | - (void)stopFadeAnimation; 39 | 40 | - (id)delegate; 41 | - (void)setDelegate:(id)delegate; 42 | 43 | @end 44 | 45 | 46 | @interface NSObject ( FadeViewDelegate ) 47 | 48 | - (void)fadeViewFinishedAnimation:(FadeView *)theView; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /GeneralPrefs.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #include "cheat_global.h" 14 | 15 | 16 | @interface GeneralPrefs : NSObject 17 | { 18 | IBOutlet NSButton *ibWindowOrderButton; 19 | IBOutlet NSButton *ibAskForSaveButton; 20 | IBOutlet NSButton *ibFadeSmoothlyButton; 21 | IBOutlet NSButton *ibDisplayValuesButton; 22 | IBOutlet NSTextField *ibValueUpdateField; 23 | IBOutlet NSTextField *ibResultsDisplayedField; 24 | IBOutlet NSButton *ibSwitchVariablesButton; 25 | IBOutlet NSButton *ibStartEditingVarsButton; 26 | } 27 | 28 | - (IBAction)ibWindowOrderButton:(id)sender; 29 | - (IBAction)ibSetAskForSave:(id)sender; 30 | - (IBAction)ibSetFadeSmoothly:(id)sender; 31 | - (IBAction)ibDisplayValuesButton:(id)sender; 32 | - (IBAction)ibSetValueUpdate:(id)sender; 33 | - (IBAction)ibSetResultsDisplayed:(id)sender; 34 | - (IBAction)ibSwitchVariablesButton:(id)sender; 35 | - (IBAction)ibStartEditingVarsButton:(id)sender; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /English.lproj/Session~.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 545 63 356 407 0 0 1280 938 7 | IBEditorPositions 8 | 9 | 143 10 | 402 411 86 87 0 0 1280 1002 11 | 192 12 | 272 343 101 49 0 0 1280 1002 13 | 207 14 | 376 382 134 49 0 0 1280 1002 15 | 400 16 | 202 287 69 87 0 0 1280 1002 17 | 405 18 | 264 308 79 68 0 0 1280 1002 19 | 410 20 | 509 326 69 49 0 0 1280 1002 21 | 735 22 | 492 479 296 321 0 0 1280 938 23 | 777 24 | 627 581 72 68 0 0 1280 938 25 | 26 | IBFramework Version 27 | 364.0 28 | IBLockedObjects 29 | 30 | IBOldestOS 31 | 2 32 | IBOpenObjects 33 | 34 | 285 35 | 36 | IBSystem Version 37 | 7H63 38 | 39 | 40 | -------------------------------------------------------------------------------- /BetterTableView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | 14 | 15 | @interface BetterTableView : NSTableView 16 | { 17 | BOOL _canDelete; // YES if deleting is enabled 18 | BOOL _canCopyPaste; 19 | } 20 | 21 | // override super 22 | - (void)keyDown:(NSEvent *)theEvent; 23 | 24 | // new stuff 25 | - (BOOL)canDelete; 26 | - (void)setCanDelete:(BOOL)flag; 27 | 28 | - (BOOL)canCopyPaste; 29 | - (void)setCanCopyPaste:(BOOL)flag; 30 | 31 | // array of NSNumbers with the rows which are selected 32 | - (NSArray *)selectedRows; 33 | 34 | @end 35 | 36 | @interface NSObject(BetterTableViewDelegate) 37 | 38 | - (NSString *)tableViewPasteboardType:(NSTableView *)tableView; 39 | - (NSData *)tableView:(NSTableView *)tableView copyRows:(NSArray *)rows; 40 | - (void)tableView:(NSTableView *)tableView pasteRowsWithData:(NSData *)rowData; 41 | 42 | - (void)tableView:(NSTableView *)tableView deleteRows:(NSArray *)rows; 43 | 44 | - (BOOL)tableViewDidReceiveEnterKey:(NSTableView *)tableView; 45 | - (BOOL)tableViewDidReceiveSpaceKey:(NSTableView *)tableView; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /AppController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazLog.h" 14 | #include "cheat_global.h" 15 | 16 | #import "ChazUpdate.h" 17 | 18 | #import "CheatServer.h" 19 | 20 | 21 | @class AboutBoxController; 22 | @class HelpController; 23 | @class PreferenceController; 24 | 25 | 26 | @interface AppController : NSApplication 27 | { 28 | CheatServer *_server; 29 | 30 | AboutBoxController *_aboutBoxController; 31 | HelpController *_helpController; 32 | PreferenceController *_preferenceController; 33 | } 34 | 35 | // Interface Actions 36 | - (IBAction)newSearchWindow:(id)sender; 37 | - (IBAction)newBlankCheatWindow:(id)sender; 38 | 39 | - (IBAction)showAboutBoxWindow:(id)sender; 40 | - (IBAction)showPreferenceWindow:(id)sender; 41 | 42 | - (IBAction)launchHelpFile:(id)sender; 43 | - (IBAction)launchEmailMenu:(id)sender; 44 | - (IBAction)launchWebsiteMenu:(id)sender; 45 | 46 | - (IBAction)checkForUpdate:(id)sender; 47 | 48 | // Server Stuff 49 | - (CheatServer *)cheatServer; 50 | - (BOOL)startCheatServer; 51 | - (void)stopCheatServer; 52 | 53 | @end 54 | 55 | 56 | -------------------------------------------------------------------------------- /LocalCheater.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | 14 | #import "Cheater.h" 15 | 16 | #import "VMRegion.h" 17 | #import "ThreadedTask.h" 18 | 19 | #import "SearchContext.h" 20 | #import "DumpContext.h" 21 | 22 | 23 | @interface LocalCheater : Cheater 24 | { 25 | NSMutableArray *_processes; 26 | Process *_target; 27 | 28 | BOOL _isTargetPaused; 29 | 30 | ThreadedTask *_searchTask; 31 | ThreadedTask *_dumpTask; 32 | 33 | NSMutableArray *_searchResults; 34 | NSMutableArray *_savedResults; 35 | unsigned _returnLimit; 36 | 37 | NSTimer *_cheatTimer; 38 | NSArray *_cheatVariables; 39 | 40 | NSTimer *_watchTimer; 41 | NSArray *_watchVariables; 42 | NSRange _watchRange; 43 | 44 | BOOL _shouldCopy; 45 | } 46 | 47 | 48 | // copying vs references 49 | // ultimately, the client will need a separate copy 50 | // of whatever is passed back to it, but we can use 51 | // references instead of the delegate will make its 52 | // own copies (or not use anything directly). 53 | - (BOOL)shouldCopy; 54 | - (void)setShouldCopy:(BOOL)flag; 55 | 56 | 57 | @end 58 | 59 | 60 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | 2 | The Simplified BSD License 3 | 4 | Copyright (c) 2003-2011, Charles McGarvey et al. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | POSSIBILITY OF SUCH DAMAGE. 27 | 28 | -------------------------------------------------------------------------------- /ServerChild.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazLog.h" 14 | 15 | #import "MySocket.h" 16 | 17 | #import "LocalCheater.h" 18 | #import "Cheater.h" 19 | 20 | #include 21 | 22 | 23 | @interface ServerChild : NSObject < CheaterDelegate > 24 | { 25 | MySocket *_socket; 26 | NSString *_client; 27 | 28 | LocalCheater *_cheater; 29 | 30 | /* the current packet being read. */ 31 | TCPacketHeader _header; 32 | NSData *_parameters; 33 | 34 | id _delegate; 35 | } 36 | 37 | - (id)initWithSocket:(MySocket *)sock; 38 | - (id)initWithSocket:(MySocket *)sock delegate:(id)delegate; 39 | 40 | - (NSString *)host; 41 | - (NSString *)transfer; 42 | 43 | - (id)delegate; 44 | - (void)setDelegate:(id)delegate; 45 | 46 | @end 47 | 48 | 49 | @interface NSObject ( ServerChildDelegate ) 50 | 51 | // informs the cheat server of connection status 52 | - (void)serverChildConnected:(ServerChild *)theChild; 53 | - (void)serverChildDisconnected:(ServerChild *)theChild; 54 | 55 | // inform the cheat server something about the child changed. 56 | - (void)serverChildChanged:(ServerChild *)theChild; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /ChazLog.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #ifndef _ChazLog_h_ 14 | #define _ChazLog_h_ 15 | 16 | #if defined(__cplusplus) 17 | extern "C" { 18 | #endif 19 | 20 | #import 21 | 22 | 23 | /* Enable and disable logging to the standard console. */ 24 | void ChazLogEnable(); 25 | void ChazLogDisable(); 26 | 27 | /* Required for logging to a debug file. */ 28 | void ChazDebugSetup(); 29 | void ChazDebugCleanup(); 30 | 31 | /* Print a log message to the standard console. */ 32 | void ChazLog( NSString *format, ... ); 33 | /* Print a log message to the debug file (if available). */ 34 | void ChazDebug( NSString *format, ... ); 35 | 36 | /* Returns true if debug mode is active. */ 37 | BOOL ChazIsDebugging(); 38 | /* Returns the absolute filepath of the debug log. */ 39 | NSString *ChazDebugLogPath(); 40 | 41 | /* Makes ChazLog() equivalent to ChazDebug(). */ 42 | // call this after ChazDebugSetup() 43 | // this will automatically enable logs 44 | void ChazMapLogToDebug(); 45 | 46 | /* Opens the log file using the default text editor. */ 47 | void ChazOpenDebugLog(); 48 | 49 | 50 | #if defined(__cplusplus) 51 | } 52 | #endif 53 | 54 | 55 | #endif /* _ChazLog_h_ */ 56 | -------------------------------------------------------------------------------- /HelpController.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "HelpController.h" 13 | 14 | 15 | @implementation HelpController 16 | 17 | 18 | - (id)init 19 | { 20 | return [super initWithWindowNibName:@"Help"]; 21 | } 22 | 23 | - (void)windowDidLoad 24 | { 25 | NSString *filepath = [[NSBundle mainBundle] pathForResource:@"Help" ofType:@"html"]; 26 | NSURL *url; 27 | NSURLRequest *request; 28 | 29 | if ( !filepath ) { 30 | return; 31 | } 32 | 33 | url = [NSURL fileURLWithPath:filepath]; 34 | request = [NSURLRequest requestWithURL:url]; 35 | 36 | [[webView mainFrame] loadRequest:request]; 37 | [helpWindow center]; 38 | } 39 | 40 | 41 | - (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id)listener 42 | { 43 | NSURL *url = [request URL]; 44 | 45 | // open "http" and "mailto" links in a real browser or email client 46 | if ( [[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"mailto"] ) { 47 | [[NSWorkspace sharedWorkspace] openURL:url]; 48 | [listener ignore]; 49 | } 50 | [listener use]; 51 | } 52 | 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /ChazUpdate.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | #import "ChazLog.h" 15 | 16 | 17 | // This is my update system. It is extremely simple to use. Just pass the URL 18 | // where the version information can be obtained. The version information will 19 | // be loaded in the background and a dialog will show up presenting the user 20 | // with the results of the check. If userRequested is NO, then the system will 21 | // not do anything if an error occured or if there is no available update. 22 | // Depending on the tags given in the version file, the presented dialog can 23 | // have buttons which link to a "more info" page or a direct download, using the 24 | // default web browser of the system. 25 | 26 | 27 | // url can either be an NSURL or an NSString containing a valid URL. 28 | void ChazCheckForUpdate( id url, BOOL userRequested ); // uses default app name. 29 | void ChazCheckForUpdateWithName( id url, NSString *appName, BOOL userRequested ); 30 | 31 | // these return empty strings if they can't be determined. 32 | NSString *ChazAppName(); // returns the name ChazCheckForUpdate() uses. 33 | NSString *ChazAppVersion(); // returns the current version of the app. 34 | NSDate *ChazAppBuildDate(); // returns the build date used to check for updates. 35 | 36 | 37 | -------------------------------------------------------------------------------- /Conversions.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | 14 | #import "Variable.h" 15 | 16 | #ifndef _Conversions_h_ 17 | #define _Conversions_h_ 18 | 19 | 20 | #pragma mark Prototypes 21 | 22 | /* STRING -> VALUE */ 23 | // return YES for a successful conversion 24 | BOOL StringToInt64( NSString *string, SInt64 *value ); 25 | BOOL StringToInt32( NSString *string, SInt32 *value ); 26 | BOOL StringToInt16( NSString *string, SInt16 *value ); 27 | BOOL StringToInt8( NSString *string, SInt8 *value ); 28 | 29 | BOOL StringToUInt64( NSString *string, UInt64 *value ); 30 | BOOL StringToUInt32( NSString *string, UInt32 *value ); 31 | BOOL StringToUInt16( NSString *string, UInt16 *value ); 32 | BOOL StringToUInt8( NSString *string, UInt8 *value ); 33 | 34 | // general case: 35 | BOOL StringToValue( NSString *string, void *value, TCVariableType type ); 36 | 37 | /* VALUE -> STRING */ 38 | NSString *Int64ToString( SInt64 value ); 39 | NSString *Int32ToString( SInt32 value ); 40 | NSString *Int16ToString( SInt16 value ); 41 | NSString *Int8ToString( SInt8 value ); 42 | 43 | NSString *UInt64ToString( UInt64 value ); 44 | NSString *UInt32ToString( UInt32 value ); 45 | NSString *UInt16ToString( UInt16 value ); 46 | NSString *UInt8ToString( UInt8 value ); 47 | 48 | // general case: 49 | NSString *ValueToString( void *value, TCVariableType type ); 50 | 51 | 52 | #endif /* _Conversions_h_ */ 53 | -------------------------------------------------------------------------------- /cheat_global.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #ifndef _cheat_shared_H 13 | #define _cheat_shared_H 14 | 15 | 16 | // constants 17 | #define TCDefaultListenPort ( 51835 ) 18 | #define TCUpdateCheckURL ( @"http://www.dogcows.com/pub/mac/software.plist" ) 19 | 20 | #define TCDefaultFadeAnimation (0.15) 21 | 22 | 23 | // globals 24 | float extern gFadeAnimationDuration; 25 | 26 | 27 | // user default constants 28 | NSString extern *TCFirstLaunchPref; 29 | NSString extern *TCWindowsOnTopPref; 30 | NSString extern *TCUpdateCheckPref; 31 | NSString extern *TCDisplayValuesPref; 32 | NSString extern *TCValueUpdatePref; 33 | NSString extern *TCHitsDisplayedPref; 34 | NSString extern *TCRunServerPref; 35 | NSString extern *TCBroadcastNamePref; 36 | NSString extern *TCListenPortPref; 37 | NSString extern *TCFadeAnimationPref; 38 | NSString extern *TCAskForSavePref; 39 | NSString extern *TCSwitchVariablesPref; 40 | NSString extern *TCAutoStartEditingVarsPref; 41 | 42 | // notification constants 43 | NSString extern *TCServiceFoundNote; 44 | NSString extern *TCServiceRemovedNote; 45 | NSString extern *TCServerStartedNote; 46 | NSString extern *TCServerStoppedNote; 47 | NSString extern *TCServerConnectionsChangedNote; 48 | NSString extern *TCWindowsOnTopChangedNote; 49 | NSString extern *TCDisplayValuesChangedNote; 50 | NSString extern *TCHitsDisplayedChangedNote; 51 | 52 | 53 | void LaunchWebsite(); 54 | void LaunchEmail(); 55 | 56 | int MacOSXVersion(); 57 | NSString *ApplicationVersion( NSString *appPath ); 58 | 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /CheaterTypes.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import "CheaterTypes.h" 14 | 15 | 16 | TCArray TCMakeArray( unsigned count, unsigned size ) 17 | { 18 | TCArray array = (TCArray)malloc( sizeof(struct _TCArray) ); 19 | 20 | if ( array ) { 21 | array->_bytes = malloc( count * size ); 22 | 23 | if ( array->_bytes ) { 24 | array->_count = count; 25 | array->_size = size; 26 | array->_ownsBytes = YES; 27 | } 28 | else { 29 | free( array ); 30 | return NULL; 31 | } 32 | } 33 | return array; 34 | } 35 | 36 | TCArray TCMakeArrayWithBytes( unsigned count, unsigned size, void *bytes ) 37 | { 38 | TCArray array = TCMakeArray( count, size ); 39 | 40 | if ( array && bytes ) { 41 | memcpy( array->_bytes, bytes, count * size ); 42 | } 43 | return array; 44 | } 45 | 46 | void TCReleaseArray( TCArray array ) 47 | { 48 | if ( array && array->_ownsBytes ) { 49 | free( array->_bytes ); 50 | free( array ); 51 | } 52 | } 53 | 54 | 55 | void TCArrayAppendArray( TCArray array, TCArray other ) 56 | { 57 | unsigned oldCount = array->_count; 58 | unsigned count = oldCount + other->_count; 59 | 60 | if ( array->_size != other->_size ) { 61 | return; 62 | } 63 | 64 | TCArrayResize( array, count ); 65 | if ( array->_count == count ) { 66 | memcpy( array->_bytes + oldCount * array->_size, other->_bytes, other->_count * other->_size ); 67 | } 68 | } 69 | 70 | 71 | NSString *TCStringFromArray( TCArray array ) 72 | { 73 | return [NSString stringWithFormat:@"{%p,%u,%u}", array->_bytes, array->_count, array->_size]; 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /SearchData.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | 15 | #import "CheaterTypes.h" 16 | 17 | #import "Cheater.h" 18 | #import "Variable.h" 19 | 20 | #import "Process.h" 21 | 22 | @interface SearchData : NSObject 23 | { 24 | TCVariableType _variableType; 25 | TCIntegerSign _integerSign; 26 | TCSearchOperator _operator; 27 | TCSearchType _value; 28 | 29 | Variable *_variableValue; 30 | 31 | TCArray _addresses; 32 | TCArray _values; 33 | 34 | Process *_process; 35 | 36 | int _undoes; 37 | int _redoes; 38 | } 39 | 40 | // ACCESSORS 41 | - (void)setProcess:(Process *)process; 42 | 43 | - (TCVariableType)variableType; 44 | - (void)setVariableType:(TCVariableType)varType; 45 | 46 | - (TCIntegerSign)integerSign; 47 | - (void)setIntegerSign:(TCIntegerSign)sign; 48 | 49 | - (TCSearchOperator)searchOperator; 50 | - (void)setSearchOperator:(TCSearchOperator)op; 51 | 52 | - (TCSearchType)valueUsed; 53 | - (void)setValueUsed:(TCSearchType)value; 54 | 55 | - (Variable *)searchValue; 56 | - (void)setSearchValue:(Variable *)value; 57 | 58 | - (unsigned)numberOfResults; 59 | - (TCArray)addresses; 60 | - (void)setAddresses:(TCArray)addresses; 61 | - (TCArray)values; 62 | - (void)setValues:(TCArray)values; 63 | - (void)setValue:(Variable *)value atIndex:(unsigned)index; 64 | - (BOOL)valuesLoaded; 65 | - (Variable *)variableAtIndex:(unsigned)index; 66 | - (NSString *)stringForRow:(unsigned)rowIndex; 67 | 68 | - (BOOL)hasSearchedOnce; 69 | 70 | - (int)undoesLeft; 71 | - (int)redoesLeft; 72 | - (void)didAddResults; 73 | - (void)didUndo; 74 | - (void)didRedo; 75 | 76 | // this is convenient 77 | - (BOOL)isTypeInteger; 78 | 79 | // ACTIONS 80 | - (void)clearResults; 81 | 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeExtensions 11 | 12 | cheat 13 | 14 | CFBundleTypeIconFile 15 | icondoc.icns 16 | CFBundleTypeName 17 | Cheat Document 18 | CFBundleTypeOSTypes 19 | 20 | ???? 21 | 22 | CFBundleTypeRole 23 | Editor 24 | LSTypeIsPackage 25 | 26 | NSDocumentClass 27 | CheatDocument 28 | 29 | 30 | CFBundleExecutable 31 | The Cheat 32 | CFBundleGetInfoString 33 | The Cheat 1.2.5 34 | CFBundleIconFile 35 | icon.icns 36 | CFBundleIdentifier 37 | com.brokenzipper.TheCheat 38 | SecTaskAccess 39 | allowed 40 | CFBundleInfoDictionaryVersion 41 | 6.0 42 | CFBundleName 43 | The Cheat 44 | CFBundlePackageType 45 | APPL 46 | CFBundleShortVersionString 47 | 1.2.5 48 | CFBundleSignature 49 | chœt 50 | CFBundleURLTypes 51 | 52 | 53 | CFBundleURLName 54 | The Cheat 55 | CFBundleURLSchemes 56 | 57 | cheat 58 | 59 | 60 | 61 | CFBundleVersion 62 | 1.2.5 63 | NSAppleScriptEnabled 64 | YES 65 | NSMainNibFile 66 | MainMenu 67 | NSPrincipalClass 68 | AppController 69 | 70 | 71 | -------------------------------------------------------------------------------- /CheatServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazLog.h" 14 | 15 | #import "MySocket.h" 16 | 17 | #import "ServerChild.h" 18 | 19 | 20 | @interface CheatServer : NSObject 21 | { 22 | MySocket *_socket; // the socket that listens for connections 23 | NSNetService *_netService; // for rendezvous broadcasting 24 | 25 | int _port; // port the socket is listening on 26 | NSString *_name; // name the service is being broadcast as 27 | 28 | NSMutableArray *_children; // the server spawns 29 | 30 | id _delegate; 31 | } 32 | 33 | // initialization 34 | - (id)initWithDelegate:(id)delegate; 35 | 36 | // starting and stopping the server 37 | // it will automatically be stopped on dealloc. 38 | // pass nil for name to not broadcast. 39 | - (BOOL)listenOnPort:(int)port broadcast:(NSString *)name; 40 | - (void)stop; 41 | 42 | // accessing children 43 | // children are spawned by the server to handle remote sessions. 44 | // they are instances of the ServerChild class. 45 | - (int)childCount; 46 | - (NSArray *)children; 47 | - (void)removeChildAtIndex:(unsigned)index; 48 | 49 | // accessors 50 | - (BOOL)isListening; 51 | - (NSString *)host; 52 | - (int)port; 53 | - (NSString *)broadcast; 54 | 55 | - (id)delegate; 56 | - (void)setDelegate:(id)delegate; 57 | 58 | @end 59 | 60 | 61 | @interface NSObject ( CheatServerDelegate ) 62 | 63 | // when the server dies while running... would this ever happen? I doubt it. 64 | - (void)serverDisconnectedUnexpectedly:(CheatServer *)theServer; 65 | 66 | // broadcast failed, this is much more likely to happen. 67 | // note that the server will continue running. 68 | - (void)server:(CheatServer *)theServer failedToBroadcastName:(NSString *)theName; 69 | 70 | // a connection was made or lost with the server... 71 | - (void)serverChildrenChanged:(CheatServer *)theServer; 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /MenuExtras.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "MenuExtras.h" 13 | 14 | 15 | @implementation NSMenu ( MenuExtras ) 16 | 17 | 18 | - (void)removeItemWithTitle:(NSString *)title 19 | { 20 | int i, top = [self numberOfItems]; 21 | 22 | for ( i = 0; i < top; i++ ) 23 | { 24 | if ( [[[self itemAtIndex:i] title] isEqualToString:title] ) 25 | { 26 | [self removeItemAtIndex:i]; 27 | break; 28 | } 29 | } 30 | } 31 | 32 | - (void)removeAllItemsWithTitle:(NSString *)title 33 | { 34 | int i, top = [self numberOfItems] - 1; 35 | 36 | for ( i = top; i >= 0; i-- ) 37 | { 38 | if ( [[[self itemAtIndex:i] title] isEqualToString:title] ) 39 | { 40 | [self removeItemAtIndex:i]; 41 | } 42 | } 43 | } 44 | 45 | - (void)removeItemWithTag:(int)tag 46 | { 47 | int i, top = [self numberOfItems]; 48 | 49 | for ( i = 0; i < top; i++ ) 50 | { 51 | if ( [[self itemAtIndex:i] tag] == tag ) 52 | { 53 | [self removeItemAtIndex:i]; 54 | break; 55 | } 56 | } 57 | } 58 | 59 | - (void)removeItemWithRepresentedObject:(id)object 60 | { 61 | int i, top = [self numberOfItems]; 62 | 63 | for ( i = 0; i < top; i++ ) 64 | { 65 | if ( [[[self itemAtIndex:i] representedObject] isEqual:object] ) 66 | { 67 | [self removeItemAtIndex:i]; 68 | break; 69 | } 70 | } 71 | } 72 | 73 | 74 | - (void)removeAllItems 75 | { 76 | int i, top = [self numberOfItems]; 77 | 78 | for ( i = 0; i < top; i++ ) 79 | { 80 | [self removeItemAtIndex:0]; 81 | } 82 | } 83 | 84 | 85 | - (void)enableAllItems 86 | { 87 | int i, top = [self numberOfItems]; 88 | 89 | for ( i = 0; i < top; i++ ) 90 | { 91 | [[self itemAtIndex:i] setEnabled:YES]; 92 | } 93 | } 94 | 95 | - (void)disableAllItems 96 | { 97 | int i, top = [self numberOfItems]; 98 | 99 | for ( i = 0; i < top; i++ ) 100 | { 101 | [[self itemAtIndex:i] setEnabled:NO]; 102 | } 103 | } 104 | 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /CheatData.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | 14 | #import "Process.h" 15 | #import "Variable.h" 16 | 17 | 18 | @interface CheatData : NSObject < NSCoding > 19 | { 20 | NSString *myWindowTitle; 21 | NSString *myCheatInfo; 22 | 23 | Process *myProcess; 24 | NSMutableArray *myVariables; 25 | 26 | BOOL myRepeats; 27 | NSTimeInterval myRepeatInterval; 28 | } 29 | 30 | // ############################################################################# 31 | #pragma mark NSCoding 32 | // ############################################################################# 33 | 34 | - (id)initWithCoder:(NSCoder *)coder; 35 | - (void)encodeWithCoder:(NSCoder *)coder; 36 | 37 | 38 | // ############################################################################# 39 | #pragma mark Accessing Properties 40 | // ############################################################################# 41 | 42 | - (NSString *)windowTitle; 43 | - (NSString *)cheatInfo; 44 | - (NSString *)gameName; 45 | - (NSString *)gameVersion; 46 | - (Process *)process; 47 | - (BOOL)repeats; 48 | - (NSTimeInterval)repeatInterval; 49 | 50 | - (void)setWindowTitle:(NSString *)title; 51 | - (void)setCheatInfo:(NSString *)info; 52 | - (void)setProcess:(Process *)process; 53 | - (void)setRepeats:(BOOL)repeats; 54 | - (void)setRepeatInterval:(NSTimeInterval)interval; 55 | 56 | 57 | // ############################################################################# 58 | #pragma mark Variables 59 | // ############################################################################# 60 | 61 | - (NSArray *)variables; 62 | - (unsigned)variableCount; 63 | - (unsigned)indexOfVariable:(Variable *)variable; 64 | - (Variable *)variableAtIndex:(unsigned)index; 65 | - (Variable *)lastVariable; 66 | 67 | - (void)addVariable:(Variable *)variable; 68 | - (void)insertVariable:(Variable *)variable atIndex:(unsigned)index; 69 | 70 | - (void)removeAllVariables; 71 | - (void)removeVariable:(Variable *)variable; 72 | - (void)removeVariableAtIndex:(unsigned)index; 73 | 74 | - (NSArray *)enabledVariables; 75 | - (unsigned)enabledVariableCount; 76 | 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /AboutBoxController.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "AboutBoxController.h" 13 | 14 | 15 | @implementation AboutBoxController 16 | 17 | 18 | - (id)init 19 | { 20 | return [super initWithWindowNibName:@"AboutBox"]; 21 | } 22 | 23 | - (void)windowDidLoad 24 | { 25 | NSDictionary *attributes; 26 | NSAttributedString *string; 27 | 28 | // set the version string 29 | [ibNameVersionText setStringValue:[NSString stringWithFormat:@"Version %@", ChazAppVersion()]]; 30 | // set the built string 31 | [ibDateText setStringValue:[NSString stringWithFormat:@"Built %@", [ChazAppBuildDate() description]]]; 32 | 33 | // set the attributes for the website and email links 34 | attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor blueColor], NSForegroundColorAttributeName, 35 | [NSNumber numberWithBool:YES], NSUnderlineStyleAttributeName, 36 | [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]], NSFontAttributeName, nil]; 37 | 38 | string = [[NSAttributedString alloc] initWithString:[ibWebsiteButton title] attributes:attributes]; 39 | [ibWebsiteButton setAttributedTitle:string]; 40 | [string release]; 41 | string = [[NSAttributedString alloc] initWithString:[ibEmailButton title] attributes:attributes]; 42 | [ibEmailButton setAttributedTitle:string]; 43 | [string release]; 44 | 45 | attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor redColor], NSForegroundColorAttributeName, 46 | [NSNumber numberWithBool:YES], NSUnderlineStyleAttributeName, 47 | [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]], NSFontAttributeName, nil]; 48 | 49 | string = [[NSAttributedString alloc] initWithString:[ibWebsiteButton title] attributes:attributes]; 50 | [ibWebsiteButton setAttributedAlternateTitle:string]; 51 | [string release]; 52 | string = [[NSAttributedString alloc] initWithString:[ibEmailButton title] attributes:attributes]; 53 | [ibEmailButton setAttributedAlternateTitle:string]; 54 | [string release]; 55 | 56 | [[self window] center]; 57 | } 58 | 59 | 60 | - (IBAction)ibWebsiteButton:(id)sender 61 | { 62 | LaunchWebsite(); 63 | } 64 | 65 | - (IBAction)ibEmailButton:(id)sender 66 | { 67 | LaunchEmail(); 68 | } 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /English.lproj/Preferences.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = {copy = id; cut = id; delete = id; paste = id; }; 5 | CLASS = BetterTableView; 6 | LANGUAGE = ObjC; 7 | SUPERCLASS = NSTableView; 8 | }, 9 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 10 | { 11 | ACTIONS = { 12 | ibDisplayValuesButton = id; 13 | ibSetAskForSave = id; 14 | ibSetFadeSmoothly = id; 15 | ibSetResultsDisplayed = id; 16 | ibSetValueUpdate = id; 17 | ibStartEditingVarsButton = id; 18 | ibSwitchVariablesButton = id; 19 | ibWindowOrderButton = id; 20 | }; 21 | CLASS = GeneralPrefs; 22 | LANGUAGE = ObjC; 23 | OUTLETS = { 24 | ibAskForSaveButton = NSButton; 25 | ibDisplayValuesButton = NSButton; 26 | ibFadeSmoothlyButton = NSButton; 27 | ibResultsDisplayedField = NSTextField; 28 | ibStartEditingVarsButton = NSButton; 29 | ibSwitchVariablesButton = NSButton; 30 | ibValueUpdateField = NSTextField; 31 | ibWindowOrderButton = NSButton; 32 | }; 33 | SUPERCLASS = NSObject; 34 | }, 35 | {CLASS = NSObject; LANGUAGE = ObjC; }, 36 | { 37 | CLASS = PreferenceController; 38 | LANGUAGE = ObjC; 39 | OUTLETS = {ibGeneralView = NSView; ibServerView = NSView; ibUpdateCheckView = NSView; }; 40 | SUPERCLASS = NSWindowController; 41 | }, 42 | { 43 | ACTIONS = {ibSetBroadcast = id; ibSetListenPort = id; ibStartServer = id; }; 44 | CLASS = ServerPrefs; 45 | LANGUAGE = ObjC; 46 | OUTLETS = { 47 | ibDefaultPortText = NSTextField; 48 | ibNameField = NSTextField; 49 | ibPortField = NSTextField; 50 | ibSessionTable = NSTableView; 51 | ibStartButton = NSButton; 52 | ibStatusField = StatusTextField; 53 | }; 54 | SUPERCLASS = NSObject; 55 | }, 56 | {CLASS = StatusTextField; LANGUAGE = ObjC; SUPERCLASS = NSTextField; }, 57 | { 58 | ACTIONS = {ibAutoCheckButton = id; ibCheckNowButton = id; }; 59 | CLASS = UpdatePrefs; 60 | LANGUAGE = ObjC; 61 | OUTLETS = {ibAutoCheckButton = NSButton; }; 62 | SUPERCLASS = NSObject; 63 | } 64 | ); 65 | IBVersion = 1; 66 | } -------------------------------------------------------------------------------- /English.lproj/Preferences~.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = {copy = id; cut = id; delete = id; paste = id; }; 5 | CLASS = BetterTableView; 6 | LANGUAGE = ObjC; 7 | SUPERCLASS = NSTableView; 8 | }, 9 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 10 | { 11 | ACTIONS = { 12 | ibDisplayValuesButton = id; 13 | ibSetAskForSave = id; 14 | ibSetFadeSmoothly = id; 15 | ibSetResultsDisplayed = id; 16 | ibSetValueUpdate = id; 17 | ibStartEditingVarsButton = id; 18 | ibSwitchVariablesButton = id; 19 | ibWindowOrderButton = id; 20 | }; 21 | CLASS = GeneralPrefs; 22 | LANGUAGE = ObjC; 23 | OUTLETS = { 24 | ibAskForSaveButton = NSButton; 25 | ibDisplayValuesButton = NSButton; 26 | ibFadeSmoothlyButton = NSButton; 27 | ibResultsDisplayedField = NSTextField; 28 | ibStartEditingVarsButton = NSButton; 29 | ibSwitchVariablesButton = NSButton; 30 | ibValueUpdateField = NSTextField; 31 | ibWindowOrderButton = NSButton; 32 | }; 33 | SUPERCLASS = NSObject; 34 | }, 35 | {CLASS = NSObject; LANGUAGE = ObjC; }, 36 | { 37 | CLASS = PreferenceController; 38 | LANGUAGE = ObjC; 39 | OUTLETS = {ibGeneralView = NSView; ibServerView = NSView; ibUpdateCheckView = NSView; }; 40 | SUPERCLASS = NSWindowController; 41 | }, 42 | { 43 | ACTIONS = {ibSetBroadcast = id; ibSetListenPort = id; ibStartServer = id; }; 44 | CLASS = ServerPrefs; 45 | LANGUAGE = ObjC; 46 | OUTLETS = { 47 | ibDefaultPortText = NSTextField; 48 | ibNameField = NSTextField; 49 | ibPortField = NSTextField; 50 | ibSessionTable = NSTableView; 51 | ibStartButton = NSButton; 52 | ibStatusField = StatusTextField; 53 | }; 54 | SUPERCLASS = NSObject; 55 | }, 56 | {CLASS = StatusTextField; LANGUAGE = ObjC; SUPERCLASS = NSTextField; }, 57 | { 58 | ACTIONS = {ibAutoCheckButton = id; ibCheckNowButton = id; }; 59 | CLASS = UpdatePrefs; 60 | LANGUAGE = ObjC; 61 | OUTLETS = {ibAutoCheckButton = NSButton; }; 62 | SUPERCLASS = NSObject; 63 | } 64 | ); 65 | IBVersion = 1; 66 | } -------------------------------------------------------------------------------- /English.lproj/MainMenu~.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = { 5 | checkForUpdate = id; 6 | launchEmailMenu = id; 7 | launchHelpFile = id; 8 | launchWebsiteMenu = id; 9 | newBlankCheatWindow = id; 10 | newSearchWindow = id; 11 | showAboutBoxWindow = id; 12 | showPreferenceWindow = id; 13 | }; 14 | CLASS = AppController; 15 | LANGUAGE = ObjC; 16 | SUPERCLASS = NSApplication; 17 | }, 18 | { 19 | ACTIONS = { 20 | ibAddCheatVariable = id; 21 | ibClearSearch = id; 22 | ibDumpMemory = id; 23 | ibPauseTarget = id; 24 | ibRedo = id; 25 | ibRunEditVariablesSheet = id; 26 | ibRunPropertiesSheet = id; 27 | ibToggleSearchCheat = id; 28 | ibUndo = id; 29 | }; 30 | CLASS = FirstResponder; 31 | LANGUAGE = ObjC; 32 | SUPERCLASS = NSObject; 33 | }, 34 | { 35 | ACTIONS = { 36 | changeButton = id; 37 | disconnectButton = id; 38 | pauseButton = id; 39 | processMenuItem = id; 40 | searchButton = id; 41 | searchUnknownButton = id; 42 | serverMenuItem = id; 43 | serverMenuLocal = id; 44 | sizeMenu16bit = id; 45 | sizeMenu32bit = id; 46 | sizeMenu64bit = id; 47 | sizeMenu8bit = id; 48 | startButton = id; 49 | typeMenuFloat = id; 50 | typeMenuInteger = id; 51 | typeMenuString = id; 52 | typeMenuUnknown = id; 53 | }; 54 | CLASS = MyDocument; 55 | LANGUAGE = ObjC; 56 | OUTLETS = { 57 | addressTable = id; 58 | changeButton = id; 59 | changeTextField = id; 60 | cheatWindow = id; 61 | processMenu = id; 62 | processPopup = id; 63 | searchButton = id; 64 | searchPopup = id; 65 | searchTextField = id; 66 | searchUnknownButton = id; 67 | serverMenu = id; 68 | serverPopup = id; 69 | sizeMenu = id; 70 | sizePopup = id; 71 | startButton = id; 72 | statusBar = id; 73 | statusText = id; 74 | typeMenu = id; 75 | typePopup = id; 76 | typeTabs = id; 77 | variableValueText = id; 78 | }; 79 | SUPERCLASS = NSDocument; 80 | } 81 | ); 82 | IBVersion = 1; 83 | } -------------------------------------------------------------------------------- /StatusTextField.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "StatusTextField.h" 13 | 14 | 15 | @interface StatusTextField ( Private ) 16 | 17 | - (void)doTimer:(NSTimer *)timer; 18 | 19 | @end 20 | 21 | 22 | @implementation StatusTextField 23 | 24 | 25 | - (id)init 26 | { 27 | if ( self = [super init] ) { 28 | myTimer = nil; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)dealloc 34 | { 35 | [myDefaultStatus release]; 36 | [myTimer invalidate]; 37 | [myTimer release]; 38 | 39 | [super dealloc]; 40 | } 41 | 42 | 43 | - (void)setDefaultStatus:(NSString *)message 44 | { 45 | [self setDefaultStatus:message color:[NSColor blackColor]]; 46 | } 47 | 48 | - (void)setDefaultStatus:(NSString *)message color:(NSColor *)color 49 | { 50 | if ( !message ) { 51 | message = [NSString stringWithString:@""]; 52 | } 53 | if ( !color ) { 54 | color = [NSColor blackColor]; 55 | } 56 | // save the new values 57 | [message retain]; 58 | [myDefaultStatus release]; 59 | myDefaultStatus = message; 60 | // save the new values 61 | [color retain]; 62 | [myDefaultColor release]; 63 | myDefaultColor = color; 64 | // set the new default if there isn't already a temp showing 65 | if ( !myTimer ) { 66 | [self setStringValue:myDefaultStatus]; 67 | [self setTextColor:myDefaultColor]; 68 | } 69 | } 70 | 71 | 72 | - (void)setTemporaryStatus:(NSString *)message 73 | { 74 | [self setTemporaryStatus:message color:[NSColor blackColor]]; 75 | } 76 | 77 | - (void)setTemporaryStatus:(NSString *)message color:(NSColor *)color 78 | { 79 | [self setTemporaryStatus:message color:color duration:4.0]; 80 | } 81 | 82 | - (void)setTemporaryStatus:(NSString *)message duration:(NSTimeInterval)duration 83 | { 84 | [self setTemporaryStatus:message color:[NSColor blackColor] duration:duration]; 85 | } 86 | 87 | - (void)setTemporaryStatus:(NSString *)message color:(NSColor *)color duration:(NSTimeInterval)duration 88 | { 89 | // stop any current temporary status 90 | [myTimer invalidate]; 91 | [myTimer release]; 92 | 93 | if ( !message ) { 94 | message = [NSString stringWithString:@""]; 95 | } 96 | if ( !color ) { 97 | color = [NSColor blackColor]; 98 | } 99 | // set the new temporary status 100 | [self setStringValue:message]; 101 | [self setTextColor:color]; 102 | // start the timer 103 | myTimer = [[NSTimer scheduledTimerWithTimeInterval:duration target:self selector:@selector(doTimer:) userInfo:nil repeats:NO] retain]; 104 | } 105 | 106 | 107 | - (void)doTimer:(NSTimer *)timer 108 | { 109 | // kill the timer 110 | [myTimer release]; 111 | myTimer = nil; 112 | 113 | // set the default status 114 | if ( myDefaultStatus ) { 115 | [self setStringValue:myDefaultStatus]; 116 | } 117 | if ( myDefaultColor ) { 118 | [self setTextColor:myDefaultColor]; 119 | } 120 | } 121 | 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /Variable.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | 14 | #import "CheaterTypes.h" 15 | #import "Process.h" 16 | 17 | #include 18 | 19 | 20 | #define TC_MAX_VAR_SIZE (256) 21 | 22 | @interface Variable : NSObject < NSCoding > 23 | { 24 | TCAddress _address; 25 | BOOL _isValueValid; 26 | BOOL _enabled; 27 | 28 | #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED 29 | NSInteger _tag; 30 | #else 31 | int _tag; 32 | #endif 33 | 34 | Process *process; 35 | 36 | @public; 37 | // use the accessor methods unless you need fast access 38 | // do not change these variables directly or things will be screwed. 39 | TCVariableType _type; 40 | TCIntegerSign _integerSign; 41 | #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED 42 | NSUInteger _size; 43 | #else 44 | unsigned int _size; 45 | #endif 46 | void *_value; 47 | BOOL _isEmulated; 48 | } 49 | 50 | // ############################################################################# 51 | #pragma mark Initialization 52 | // ############################################################################# 53 | 54 | // type and sign can't be changed once variable is created. 55 | 56 | - (id)init; // default: TCInt32 57 | - (id)initWithType:(TCVariableType)type; // default: TCSigned 58 | - (id)initWithType:(TCVariableType)type integerSign:(TCIntegerSign)sign; 59 | 60 | - (void)setProcess:(Process *)process; 61 | - (Process *)process; 62 | 63 | - (BOOL)isEmulated; 64 | 65 | // ############################################################################# 66 | #pragma mark NSCoding 67 | // ############################################################################# 68 | 69 | - (id)initWithCoder:(NSCoder *)coder; 70 | - (void)encodeWithCoder:(NSCoder *)coder; 71 | 72 | // ############################################################################# 73 | #pragma mark Accessors 74 | // ############################################################################# 75 | 76 | - (TCVariableType)type; 77 | - (TCIntegerSign)integerSign; 78 | - (NSString *)typeString; 79 | 80 | - (TCAddress)address; 81 | - (void)setAddress:(TCAddress)addr; 82 | - (NSString *)addressString; 83 | - (BOOL)setAddressString:(NSString *)string; 84 | 85 | - (void const *)value; 86 | - (void)setValue:(void const *)value; 87 | - (void)setValue:(void const *)value size:(unsigned)size; 88 | - (NSString *)stringValue; 89 | - (BOOL)setStringValue:(NSString *)value; 90 | 91 | void bigEndianValue(void *buffer, Variable *variable); 92 | 93 | - (unsigned)valueSize; 94 | - (BOOL)isValueValid; 95 | 96 | - (BOOL)isEnabled; 97 | - (void)setEnabled:(BOOL)enabled; 98 | 99 | #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED 100 | - (NSInteger)tag; 101 | - (void)setTag:(NSInteger)tag; 102 | #else 103 | - (int)tag; 104 | - (void)setTag:(int)tag; 105 | #endif 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /FadeView.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import "FadeView.h" 14 | 15 | 16 | @interface FadeView ( PrivateAPI ) 17 | 18 | - (void)_fadeTimer:(NSTimer *)timer; 19 | 20 | @end 21 | 22 | 23 | @implementation FadeView 24 | 25 | 26 | - (id)init 27 | { 28 | if ( self = [super init] ) { 29 | [self setFadeDuration:1.0]; 30 | [self setFadeInterval:5.0/60.0]; 31 | } 32 | return self; 33 | } 34 | 35 | - (id)initWithFrame:(NSRect)frame 36 | { 37 | if ( self = [super initWithFrame:frame] ) { 38 | [self setFadeDuration:1.0]; 39 | [self setFadeInterval:5.0/60.0]; 40 | } 41 | return self; 42 | } 43 | 44 | - (void)dealloc 45 | { 46 | [self stopFadeAnimation]; 47 | [_fadeImage release]; 48 | [super dealloc]; 49 | } 50 | 51 | 52 | - (void)drawRect:(NSRect)rect 53 | { 54 | [_fadeImage dissolveToPoint:NSMakePoint(0,0) fraction:_fadeAlpha]; 55 | } 56 | 57 | 58 | - (NSImage *)image 59 | { 60 | return _fadeImage; 61 | } 62 | 63 | - (NSTimeInterval)fadeDuration 64 | { 65 | return _fadeDuration; 66 | } 67 | 68 | - (NSTimeInterval)fadeInterval 69 | { 70 | return _fadeInterval; 71 | } 72 | 73 | - (double)alpha 74 | { 75 | return _fadeAlpha; 76 | } 77 | 78 | 79 | - (void)setImage:(NSImage *)image 80 | { 81 | [image retain]; 82 | [_fadeImage release]; 83 | _fadeImage = image; 84 | } 85 | 86 | - (void)setFadeDuration:(NSTimeInterval)seconds 87 | { 88 | if ( seconds != 0.0 ) { 89 | _fadeDuration = seconds; 90 | } 91 | else { 92 | _fadeDuration = 1.0; 93 | } 94 | } 95 | 96 | - (void)setFadeInterval:(NSTimeInterval)seconds 97 | { 98 | _fadeInterval = seconds; 99 | } 100 | 101 | - (void)startFadeAnimation 102 | { 103 | [self stopFadeAnimation]; 104 | 105 | _fadeAlpha = 1.0; 106 | [self setNeedsDisplay:YES]; 107 | 108 | _fadeTimer = [[NSTimer scheduledTimerWithTimeInterval:_fadeInterval target:self selector:@selector(_fadeTimer:) userInfo:nil repeats:YES] retain]; 109 | [[NSRunLoop currentRunLoop] addTimer:_fadeTimer forMode:NSEventTrackingRunLoopMode]; 110 | [[NSRunLoop currentRunLoop] addTimer:_fadeTimer forMode:NSModalPanelRunLoopMode]; 111 | [self release]; 112 | } 113 | 114 | - (void)stopFadeAnimation 115 | { 116 | if ( _fadeTimer ) { 117 | [self retain]; 118 | [_fadeTimer invalidate]; 119 | [_fadeTimer release]; 120 | _fadeTimer = nil; 121 | } 122 | } 123 | 124 | - (void)_fadeTimer:(NSTimer *)timer 125 | { 126 | _fadeAlpha -= [timer timeInterval] / _fadeDuration; 127 | [self setNeedsDisplay:YES]; 128 | 129 | if ( _fadeAlpha <= 0.0 ) { 130 | [self stopFadeAnimation]; 131 | if ( [_delegate respondsToSelector:@selector(fadeViewFinishedAnimation:)] ) { 132 | [_delegate fadeViewFinishedAnimation:self]; 133 | } 134 | } 135 | } 136 | 137 | 138 | - (id)delegate 139 | { 140 | return _delegate; 141 | } 142 | 143 | - (void)setDelegate:(id)delegate 144 | { 145 | _delegate = delegate; 146 | } 147 | 148 | 149 | @end 150 | -------------------------------------------------------------------------------- /SearchContext.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | #include "ChazLog.h" 15 | 16 | #import "CheaterTypes.h" 17 | #import "Searching.h" 18 | #import "VMRegion.h" 19 | #import "Variable.h" 20 | 21 | 22 | #define TC_BUFFER_SIZE (8192) 23 | // used when buffers are expanded; use a multiple for 4096 because 24 | // the virtual memory system uses those sizes for optimization. 25 | 26 | #define TC_EPSILON (0.1) 27 | // defines the accuracy for floating point comparisons 28 | 29 | 30 | @interface SearchContext : NSObject 31 | { 32 | /* 33 | * So here's the big, bad, rather ugly search context class. 34 | * There is quite a bit to keep track of, as you can see. 35 | */ 36 | 37 | TCVariableType _variableType; 38 | TCIntegerSign _integerSign; 39 | TCSearchOperator _operator; 40 | TCSearchType _searchType; 41 | 42 | // for fast access while iterating through the task loop. 43 | @public; 44 | 45 | pid_t process; // the pid of the process being searched 46 | unsigned regionCount; // estimation of the # of regions used for progress reporting 47 | VMRegion lastRegion; // used to find the next region to search 48 | 49 | Variable *value; // the value to compare against (TCGivenValue searches) 50 | BOOL (*compareFunc)(void const *, void const*); // comparison function 51 | 52 | TCArray addresses; // array to store hit addresses 53 | TCArray values; // parallel array to store hit values 54 | TCArray regions; // array of addresses, one for each region which contains a hit 55 | TCArray perRegion; // number of variables found for each region 56 | unsigned numberOfResults; // actual number of hits so far 57 | 58 | TCArray lastAddresses; // the addresses of variables to check 59 | TCArray lastValues; // the values to compare against (TCLastValue searches) 60 | TCArray lastRegions; // optimizes "again" searches 61 | TCArray lastPerRegion; // parallels lastRegions 62 | 63 | void *buffer; // the working buffer for reading in memory from the other app 64 | unsigned bufferSize; // size of the working buffer 65 | 66 | // pointers 67 | void *valuePtr, *lastValuePtr; 68 | TCAddress *addressPtr, *lastAddressPtr; 69 | TCAddress *lastRegionPtr; 70 | unsigned *lastPerRegionPtr; 71 | 72 | int progress; // 0-100 73 | } 74 | 75 | // Initialization 76 | 77 | // this initializer must be used to create a context for a first-time search 78 | - (id)initWithPID:(pid_t)pid searchOperator:(TCSearchOperator)op value:(Variable *)val; 79 | // these initializers take data from the last search that was performed 80 | - (id)initWithLastContext:(SearchContext *)context searchOperator:(TCSearchOperator)op; 81 | - (id)initWithLastContext:(SearchContext *)context searchOperator:(TCSearchOperator)op value:(Variable *)val; 82 | 83 | // Accessors 84 | 85 | - (TCVariableType)variableType; 86 | - (TCIntegerSign)integerSign; 87 | - (TCSearchOperator)searchOperator; 88 | 89 | - (BOOL (*)(void const *, void const *))compareFunction; 90 | - (int (*)(id, unsigned))iterationFunction; 91 | 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /ChazLog.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #include "ChazLog.h" 14 | 15 | #include "stdio.h" 16 | #include "stdlib.h" 17 | 18 | 19 | // PrivateAPI 20 | void static _ChazPrint( FILE *output, NSString *format, va_list args ); 21 | 22 | 23 | // Static Globals 24 | BOOL static _gLogEnabled = YES; 25 | FILE static *_gLogFile = stdout; 26 | FILE static *_gDebugFile = NULL; 27 | 28 | 29 | #pragma mark - 30 | #pragma mark Setup 31 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 32 | 33 | void ChazLogEnable() 34 | { 35 | _gLogEnabled = YES; 36 | } 37 | 38 | void ChazLogDisable() 39 | { 40 | if ( _gLogFile != _gDebugFile ) { 41 | _gLogEnabled = NO; 42 | } 43 | } 44 | 45 | 46 | void ChazDebugSetup() 47 | { 48 | NSString *filepath = ChazDebugLogPath(); 49 | FILE *file; 50 | 51 | // look for debug file 52 | file = fopen( [filepath lossyCString], "r+" ); 53 | 54 | if ( !file ) { 55 | // there is no debug file or we don't have permissions 56 | return; 57 | } 58 | 59 | fclose( file ); 60 | 61 | _gDebugFile = fopen( [filepath lossyCString], "w" ); 62 | 63 | ChazDebug( @"Debug log found (obviously). Entering debug mode." ); 64 | } 65 | 66 | void ChazDebugCleanup() 67 | { 68 | if ( _gDebugFile ) { 69 | ChazDebug( @"Debug log cleaned up." ); 70 | 71 | fclose ( _gDebugFile ); 72 | } 73 | } 74 | 75 | 76 | #pragma mark - 77 | #pragma mark Logs 78 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 79 | 80 | void ChazLog( NSString *format, ... ) 81 | { 82 | va_list args; 83 | 84 | if ( !_gLogEnabled ) { 85 | return; 86 | } 87 | 88 | va_start( args, format ); 89 | // print log to standard i/o 90 | _ChazPrint( _gLogFile, format, args ); 91 | va_end( args ); 92 | } 93 | 94 | void ChazDebug( NSString *format, ... ) 95 | { 96 | va_list args; 97 | 98 | if ( !_gDebugFile ) { 99 | return; 100 | } 101 | 102 | va_start( args, format ); 103 | // print log to the debug file 104 | _ChazPrint( _gDebugFile, format, args ); 105 | va_end( args ); 106 | } 107 | 108 | 109 | #pragma mark - 110 | #pragma mark Miscellaneous 111 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 112 | 113 | BOOL ChazIsDebugging() 114 | { 115 | return (_gDebugFile != NULL); 116 | } 117 | 118 | NSString *ChazDebugLogPath() 119 | { 120 | // get filepath 121 | return [[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"debug.txt"]; 122 | } 123 | 124 | 125 | void ChazMapLogToDebug() 126 | { 127 | if ( _gDebugFile ) { 128 | _gLogEnabled = YES; 129 | _gLogFile = _gDebugFile; 130 | } 131 | } 132 | 133 | 134 | void ChazOpenDebugLog() 135 | { 136 | [[NSWorkspace sharedWorkspace] openFile:ChazDebugLogPath()]; 137 | } 138 | 139 | 140 | #pragma mark - 141 | #pragma mark PrivateAPI 142 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 143 | 144 | void _ChazPrint( FILE *output, NSString *format, va_list args ) 145 | { 146 | NSString *string; 147 | 148 | // get formatted string 149 | string = [[NSString alloc] initWithFormat:format arguments:args]; 150 | 151 | fprintf( output, "[%s] %s\n", [[[NSDate date] descriptionWithCalendarFormat:@"%Y-%m-%d %H:%M:%S.%F" 152 | timeZone:nil 153 | locale:nil] lossyCString], [string lossyCString] ); 154 | fflush( output ); 155 | 156 | [string release]; 157 | } 158 | 159 | 160 | -------------------------------------------------------------------------------- /VariableTable.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import "VariableTable.h" 14 | 15 | 16 | @interface VariableTable ( PrivateAPI ) 17 | 18 | - (void)_setVisibleRows:(NSRange)rows; 19 | 20 | @end 21 | 22 | 23 | @implementation VariableTable 24 | 25 | 26 | - (void)awakeFromNib 27 | { 28 | NSScrollView *scrollView = (NSScrollView *)[(NSClipView *)[self superview] superview]; 29 | NSScroller *oldScroller = [[scrollView verticalScroller] retain]; 30 | 31 | TrackerScroller *scroller = [[TrackerScroller alloc] initWithFrame:[oldScroller frame]]; 32 | 33 | [scroller setControlSize:[oldScroller controlSize]]; 34 | [scroller setFloatValue:[oldScroller floatValue] knobProportion:[oldScroller knobProportion]]; 35 | [scroller setControlTint:[oldScroller controlTint]]; 36 | 37 | // set the new scroller 38 | [scrollView setHasVerticalScroller:NO]; 39 | [scrollView setVerticalScroller:scroller]; 40 | [scrollView setHasVerticalScroller:YES]; 41 | 42 | [scroller setDelegate:self]; 43 | [scroller release]; 44 | [oldScroller release]; 45 | 46 | /*if ( [super respondsToSelector:@selector(awakeFromNib)] ) { 47 | [super awakeFromNib]; 48 | }*/ 49 | } 50 | 51 | 52 | - (NSRange)visibleRows 53 | { 54 | return _visibleRows; 55 | } 56 | 57 | - (void)_setVisibleRows:(NSRange)rows 58 | { 59 | _visibleRows = rows; 60 | } 61 | 62 | 63 | - (void)reloadData 64 | { 65 | if ( _dontUpdate ) { 66 | _updatePending = YES; 67 | return; 68 | } 69 | 70 | [super reloadData]; 71 | 72 | NSRange range = [self rowsInRect:[(NSClipView *)[self superview] documentVisibleRect]]; 73 | id delegate = [self delegate]; 74 | 75 | if ( !NSEqualRanges( range, _visibleRows ) ) { 76 | [self _setVisibleRows:range]; 77 | if ( [delegate respondsToSelector:@selector(tableView:didChangeVisibleRows:)] ) { 78 | [delegate tableView:self didChangeVisibleRows:range]; 79 | } 80 | } 81 | } 82 | 83 | 84 | - (void)keyDown:(NSEvent *)theEvent 85 | { 86 | _dontUpdate = YES; 87 | [super keyDown:theEvent]; 88 | } 89 | 90 | - (void)keyUp:(NSEvent *)theEvent 91 | { 92 | NSRange range = [self rowsInRect:[(NSClipView *)[self superview] documentVisibleRect]]; 93 | id delegate = [self delegate]; 94 | 95 | [super keyUp:theEvent]; 96 | 97 | _dontUpdate = NO; 98 | 99 | if ( !NSEqualRanges( range, _visibleRows ) ) { 100 | [self _setVisibleRows:range]; 101 | if ( [delegate respondsToSelector:@selector(tableView:didChangeVisibleRows:)] ) { 102 | [delegate tableView:self didChangeVisibleRows:range]; 103 | } 104 | } 105 | else if ( _updatePending ) { 106 | [self reloadData]; 107 | _updatePending = NO; 108 | } 109 | } 110 | 111 | - (void)scrollerDidStartScrolling:(TrackerScroller *)scroller 112 | { 113 | _dontUpdate = YES; 114 | } 115 | 116 | - (void)scrollerDidStopScrolling:(TrackerScroller *)scroller 117 | { 118 | NSRange range = [self rowsInRect:[(NSClipView *)[self superview] documentVisibleRect]]; 119 | id delegate = [self delegate]; 120 | 121 | _dontUpdate = NO; 122 | 123 | if ( !NSEqualRanges( range, _visibleRows ) ) { 124 | [self _setVisibleRows:range]; 125 | if ( [delegate respondsToSelector:@selector(tableView:didChangeVisibleRows:)] ) { 126 | [delegate tableView:self didChangeVisibleRows:range]; 127 | } 128 | } 129 | else if ( _updatePending ) { 130 | [self reloadData]; 131 | _updatePending = NO; 132 | } 133 | } 134 | 135 | 136 | @end 137 | -------------------------------------------------------------------------------- /PreferenceController.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "PreferenceController.h" 13 | 14 | 15 | @implementation PreferenceController 16 | 17 | 18 | - (id)init 19 | { 20 | if ( self = [super initWithWindowNibName:@"Preferences"] ) 21 | { 22 | [self setWindowFrameAutosaveName:@"TCPreferencWindowPosition"]; 23 | } 24 | return self; 25 | } 26 | 27 | - (void)dealloc 28 | { 29 | [_toolbar release]; 30 | [_contentView release]; 31 | [super dealloc]; 32 | } 33 | 34 | 35 | - (void)windowDidLoad 36 | { 37 | _toolbar = [[NSToolbar alloc] initWithIdentifier:@"TCPreferencesToolbar"]; 38 | [_toolbar setDelegate:self]; 39 | [_toolbar setVisible:YES]; 40 | [[self window] setToolbar:_toolbar]; 41 | 42 | _contentView = [[[self window] contentView] retain]; 43 | 44 | [self initialInterfaceSetup]; 45 | } 46 | 47 | 48 | - (void)initialInterfaceSetup 49 | { 50 | [self chooseGeneral:self]; 51 | } 52 | 53 | 54 | - (void)chooseGeneral:(id)object 55 | { 56 | NSWindow *window = [self window]; 57 | [self switchToView:ibGeneralView]; 58 | [window setTitle:@"General"]; 59 | if ( MacOSXVersion() >= 0x1030 ) { 60 | [_toolbar setSelectedItemIdentifier:@"General"]; 61 | } 62 | } 63 | 64 | - (void)chooseServer:(id)object 65 | { 66 | NSWindow *window = [self window]; 67 | [self switchToView:ibServerView]; 68 | [window setTitle:@"Server"]; 69 | if ( MacOSXVersion() >= 0x1030 ) { 70 | [_toolbar setSelectedItemIdentifier:@"Server"]; 71 | } 72 | } 73 | 74 | - (void)chooseUpdate:(id)object 75 | { 76 | NSWindow *window = [self window]; 77 | [self switchToView:ibUpdateCheckView]; 78 | [window setTitle:@"Update Check"]; 79 | if ( MacOSXVersion() >= 0x1030 ) { 80 | [_toolbar setSelectedItemIdentifier:@"Update Check"]; 81 | } 82 | } 83 | 84 | - (void)switchToView:(NSView *)view 85 | { 86 | NSWindow *window = [self window]; 87 | NSRect frame = [window frame]; 88 | float xdif, ydif; 89 | 90 | if ( view == [window contentView] ) { 91 | return; 92 | } 93 | 94 | xdif = [view frame].size.width - [[window contentView] frame].size.width; 95 | ydif = [view frame].size.height - [[window contentView] frame].size.height; 96 | 97 | frame.size.width += xdif; 98 | frame.size.height += ydif; 99 | frame.origin.y -= ydif; 100 | 101 | // switch to the new view 102 | [window setContentView:_contentView]; 103 | [window setFrame:frame display:YES animate:YES]; 104 | [window setContentView:view]; 105 | [window makeFirstResponder:view]; 106 | } 107 | 108 | 109 | - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag 110 | { 111 | NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; 112 | 113 | [item setLabel:itemIdentifier]; 114 | [item setPaletteLabel:itemIdentifier]; 115 | [item setImage:[NSImage imageNamed:itemIdentifier]]; 116 | [item setTarget:self]; 117 | [item setAction:NSSelectorFromString( [NSString stringWithFormat:@"choose%@:", itemIdentifier] )]; 118 | 119 | return [item autorelease]; 120 | } 121 | 122 | - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar 123 | { 124 | return [NSArray arrayWithObjects:@"General", @"Update", @"Server", nil]; 125 | } 126 | 127 | - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar 128 | { 129 | return [NSArray arrayWithObjects:@"General", @"Update", @"Server", nil]; 130 | } 131 | 132 | - (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar 133 | { 134 | return [NSArray arrayWithObjects:@"General", @"Update", @"Server", nil]; 135 | } 136 | 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /Searching.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import 14 | 15 | #import "ThreadedTask.h" 16 | #import "SearchContext.h" 17 | 18 | #import "VMRegion.h" 19 | 20 | 21 | extern __inline__ void ReportSearchProgress( ThreadedTask *task, unsigned iteration, unsigned regions, int *progress ); 22 | 23 | 24 | 25 | /* 26 | * Search iteration functions: 27 | * The first set is the generic one, the other is for strings. 28 | */ 29 | 30 | int SearchIteration( ThreadedTask *task, unsigned iteration ); 31 | int SearchIterationAgain( ThreadedTask *task, unsigned iteration ); 32 | int SearchIterationLastValue( ThreadedTask *task, unsigned iteration ); 33 | 34 | int SearchStringIteration( ThreadedTask *task, unsigned iteration ); 35 | int SearchStringIterationAgain( ThreadedTask *task, unsigned iteration ); 36 | int SearchStringIterationLastValue( ThreadedTask *task, unsigned iteration ); 37 | 38 | 39 | /* 40 | * Compare functions... 41 | * "Function( first, second)" -> "first [operator] second" 42 | */ 43 | BOOL EqualInt64( void const *first, void const *second ); 44 | BOOL EqualInt32( void const *first, void const *second ); 45 | BOOL EqualInt16( void const *first, void const *second ); 46 | BOOL EqualInt8( void const *first, void const *second ); 47 | BOOL EqualUInt64( void const *first, void const *second ); 48 | BOOL EqualUInt32( void const *first, void const *second ); 49 | BOOL EqualUInt16( void const *first, void const *second ); 50 | BOOL EqualUInt8( void const *first, void const *second ); 51 | BOOL EqualFloat( void const *first, void const *second ); 52 | BOOL EqualDouble( void const *first, void const *second ); 53 | 54 | BOOL NotEqualInt64( void const *first, void const *second ); 55 | BOOL NotEqualInt32( void const *first, void const *second ); 56 | BOOL NotEqualInt16( void const *first, void const *second ); 57 | BOOL NotEqualInt8( void const *first, void const *second ); 58 | BOOL NotEqualUInt64( void const *first, void const *second ); 59 | BOOL NotEqualUInt32( void const *first, void const *second ); 60 | BOOL NotEqualUInt16( void const *first, void const *second ); 61 | BOOL NotEqualUInt8( void const *first, void const *second ); 62 | BOOL NotEqualFloat( void const *first, void const *second ); 63 | BOOL NotEqualDouble( void const *first, void const *second ); 64 | 65 | BOOL LessThanInt64( void const *first, void const *second ); 66 | BOOL LessThanInt32( void const *first, void const *second ); 67 | BOOL LessThanInt16( void const *first, void const *second ); 68 | BOOL LessThanInt8( void const *first, void const *second ); 69 | BOOL LessThanUInt64( void const *first, void const *second ); 70 | BOOL LessThanUInt32( void const *first, void const *second ); 71 | BOOL LessThanUInt16( void const *first, void const *second ); 72 | BOOL LessThanUInt8( void const *first, void const *second ); 73 | BOOL LessThanFloat( void const *first, void const *second ); 74 | BOOL LessThanDouble( void const *first, void const *second ); 75 | 76 | BOOL GreaterThanInt64( void const *first, void const *second ); 77 | BOOL GreaterThanInt32( void const *first, void const *second ); 78 | BOOL GreaterThanInt16( void const *first, void const *second ); 79 | BOOL GreaterThanInt8( void const *first, void const *second ); 80 | BOOL GreaterThanUInt64( void const *first, void const *second ); 81 | BOOL GreaterThanUInt32( void const *first, void const *second ); 82 | BOOL GreaterThanUInt16( void const *first, void const *second ); 83 | BOOL GreaterThanUInt8( void const *first, void const *second ); 84 | BOOL GreaterThanFloat( void const *first, void const *second ); 85 | BOOL GreaterThanDouble( void const *first, void const *second ); 86 | 87 | /* Strings are handled by special iteration functions. */ 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /English.lproj/CheatDocument.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = {copy = id; cut = id; delete = id; paste = id; }; 5 | CLASS = BetterTableView; 6 | LANGUAGE = ObjC; 7 | SUPERCLASS = NSTableView; 8 | }, 9 | { 10 | ACTIONS = { 11 | ibAddCheatVariable = id; 12 | ibAddSearchVariable = id; 13 | ibCancelDump = id; 14 | ibCancelSearch = id; 15 | ibCheat = id; 16 | ibClearSearch = id; 17 | ibDumpMemory = id; 18 | ibEndCustomServerSheet = id; 19 | ibEndEditVariablesSheet = id; 20 | ibEndPasswordSheet = id; 21 | ibEndPropertiesSheet = id; 22 | ibPauseTarget = id; 23 | ibRedo = id; 24 | ibResumeTarget = id; 25 | ibRunCustomServerSheet = id; 26 | ibRunEditVariablesSheet = id; 27 | ibRunPasswordSheet = id; 28 | ibRunPropertiesSheet = id; 29 | ibSearch = id; 30 | ibSetCheatRepeats = id; 31 | ibSetCustomCheater = id; 32 | ibSetIntegerSign = id; 33 | ibSetLocalCheater = id; 34 | ibSetNoCheater = id; 35 | ibSetOperator = id; 36 | ibSetProcess = id; 37 | ibSetRemoteCheater = id; 38 | ibSetRepeatInterval = id; 39 | ibSetValueUsed = id; 40 | ibSetVariableEnabled = id; 41 | ibSetVariableType = id; 42 | ibStopCheat = id; 43 | ibToggleSearchCheat = id; 44 | ibUndo = id; 45 | }; 46 | CLASS = CheatDocument; 47 | LANGUAGE = ObjC; 48 | OUTLETS = { 49 | ibCheatButton = NSButton; 50 | ibCheatContentView = NSView; 51 | ibCheatInfoField = NSTextField; 52 | ibCheatInfoText = NSTextField; 53 | ibCheatRepeatAuxText = NSTextField; 54 | ibCheatRepeatButton = NSButton; 55 | ibCheatRepeatField = NSTextField; 56 | ibCheatVariableTable = BetterTableView; 57 | ibCustomServerSheet = NSWindow; 58 | ibEditVariablesSheet = NSWindow; 59 | ibNewValueField = NSTextField; 60 | ibPasswordField = NSTextField; 61 | ibPasswordSheet = NSWindow; 62 | ibPlaceView = NSView; 63 | ibPortField = NSTextField; 64 | ibProcessPopup = NSPopUpButton; 65 | ibPropertiesSheet = NSWindow; 66 | ibSearchButton = NSButton; 67 | ibSearchClearButton = NSButton; 68 | ibSearchContentView = NSView; 69 | ibSearchIntegerSignMatrix = NSMatrix; 70 | ibSearchOperatorPopup = NSPopUpButton; 71 | ibSearchTypePopup = NSPopUpButton; 72 | ibSearchValueField = NSTextField; 73 | ibSearchValueUsedMatrix = NSMatrix; 74 | ibSearchVariableButton = NSButton; 75 | ibSearchVariableTable = VariableTable; 76 | ibServerField = NSTextField; 77 | ibServerPopup = NSPopUpButton; 78 | ibStatusBar = NSProgressIndicator; 79 | ibStatusText = StatusTextField; 80 | ibWindow = NSWindow; 81 | ibWindowTitleField = NSTextField; 82 | }; 83 | SUPERCLASS = NSDocument; 84 | }, 85 | { 86 | ACTIONS = {fadeToCheatMode = id; fadeToSessionMode = id; }; 87 | CLASS = FirstResponder; 88 | LANGUAGE = ObjC; 89 | SUPERCLASS = NSObject; 90 | }, 91 | {CLASS = NSObject; LANGUAGE = ObjC; }, 92 | {CLASS = StatusTextField; LANGUAGE = ObjC; SUPERCLASS = NSTextField; }, 93 | {CLASS = VariableTable; LANGUAGE = ObjC; SUPERCLASS = BetterTableView; } 94 | ); 95 | IBVersion = 1; 96 | } -------------------------------------------------------------------------------- /English.lproj/CheatDocument~.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = {copy = id; cut = id; delete = id; paste = id; }; 5 | CLASS = BetterTableView; 6 | LANGUAGE = ObjC; 7 | SUPERCLASS = NSTableView; 8 | }, 9 | { 10 | ACTIONS = { 11 | ibAddCheatVariable = id; 12 | ibAddSearchVariable = id; 13 | ibCancelDump = id; 14 | ibCancelSearch = id; 15 | ibCheat = id; 16 | ibClearSearch = id; 17 | ibDumpMemory = id; 18 | ibEndCustomServerSheet = id; 19 | ibEndEditVariablesSheet = id; 20 | ibEndPasswordSheet = id; 21 | ibEndPropertiesSheet = id; 22 | ibPauseTarget = id; 23 | ibRedo = id; 24 | ibResumeTarget = id; 25 | ibRunCustomServerSheet = id; 26 | ibRunEditVariablesSheet = id; 27 | ibRunPasswordSheet = id; 28 | ibRunPropertiesSheet = id; 29 | ibSearch = id; 30 | ibSetCheatRepeats = id; 31 | ibSetCustomCheater = id; 32 | ibSetIntegerSign = id; 33 | ibSetLocalCheater = id; 34 | ibSetNoCheater = id; 35 | ibSetOperator = id; 36 | ibSetProcess = id; 37 | ibSetRemoteCheater = id; 38 | ibSetRepeatInterval = id; 39 | ibSetValueUsed = id; 40 | ibSetVariableEnabled = id; 41 | ibSetVariableType = id; 42 | ibStopCheat = id; 43 | ibToggleSearchCheat = id; 44 | ibUndo = id; 45 | }; 46 | CLASS = CheatDocument; 47 | LANGUAGE = ObjC; 48 | OUTLETS = { 49 | ibCheatButton = NSButton; 50 | ibCheatContentView = NSView; 51 | ibCheatInfoField = NSTextField; 52 | ibCheatInfoText = NSTextField; 53 | ibCheatRepeatAuxText = NSTextField; 54 | ibCheatRepeatButton = NSButton; 55 | ibCheatRepeatField = NSTextField; 56 | ibCheatVariableTable = NSTableView; 57 | ibCustomServerSheet = NSWindow; 58 | ibEditVariablesSheet = NSWindow; 59 | ibNewValueField = NSTextField; 60 | ibPasswordField = NSTextField; 61 | ibPasswordSheet = NSWindow; 62 | ibPlaceView = NSView; 63 | ibPortField = NSTextField; 64 | ibProcessPopup = NSPopUpButton; 65 | ibPropertiesSheet = NSWindow; 66 | ibSearchButton = NSButton; 67 | ibSearchClearButton = NSButton; 68 | ibSearchContentView = NSView; 69 | ibSearchIntegerSignMatrix = NSMatrix; 70 | ibSearchOperatorPopup = NSPopUpButton; 71 | ibSearchTypePopup = NSPopUpButton; 72 | ibSearchValueField = NSTextField; 73 | ibSearchValueUsedMatrix = NSMatrix; 74 | ibSearchVariableButton = NSButton; 75 | ibSearchVariableTable = VariableTable; 76 | ibServerField = NSTextField; 77 | ibServerPopup = NSPopUpButton; 78 | ibStatusBar = NSProgressIndicator; 79 | ibStatusText = StatusTextField; 80 | ibVariableEnableButton = NSButton; 81 | ibWindow = NSWindow; 82 | ibWindowTitleField = NSTextField; 83 | }; 84 | SUPERCLASS = NSDocument; 85 | }, 86 | { 87 | ACTIONS = {fadeToCheatMode = id; fadeToSessionMode = id; }; 88 | CLASS = FirstResponder; 89 | LANGUAGE = ObjC; 90 | SUPERCLASS = NSObject; 91 | }, 92 | {CLASS = NSObject; LANGUAGE = ObjC; }, 93 | {CLASS = StatusTextField; LANGUAGE = ObjC; SUPERCLASS = NSTextField; }, 94 | {CLASS = VariableTable; LANGUAGE = ObjC; SUPERCLASS = BetterTableView; } 95 | ); 96 | IBVersion = 1; 97 | } -------------------------------------------------------------------------------- /cheat_global.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "cheat_global.h" 13 | 14 | #import 15 | 16 | 17 | // globals 18 | float gFadeAnimationDuration = TCDefaultFadeAnimation; 19 | 20 | 21 | // user default constants 22 | NSString *TCFirstLaunchPref = nil; 23 | NSString *TCWindowsOnTopPref = @"TCWindowsOnTopPref"; 24 | NSString *TCUpdateCheckPref = @"TCUpdateCheckPref"; 25 | NSString *TCDisplayValuesPref = @"TCDisplayValuesPref"; 26 | NSString *TCValueUpdatePref = @"TCValueUpdatePref"; 27 | NSString *TCHitsDisplayedPref = @"TCHitsDisplayedPref"; 28 | NSString *TCRunServerPref = @"TCRunServerPref"; 29 | NSString *TCBroadcastNamePref = @"TCBroadcastNamePref"; 30 | NSString *TCListenPortPref = @"TCListenPortPref"; 31 | NSString *TCFadeAnimationPref = @"TCFadeAnimationPref"; 32 | NSString *TCAskForSavePref = @"TCAskForSavePref"; 33 | NSString *TCSwitchVariablesPref = @"TCSwitchVariablesPref"; 34 | NSString *TCAutoStartEditingVarsPref = @"TCAutoStartEditingVarsPref"; 35 | 36 | 37 | // notification constants 38 | NSString *TCServiceFoundNote = @"TCServiceFoundNote"; 39 | NSString *TCServiceRemovedNote = @"TCServiceRemovedNote"; 40 | NSString *TCServerStartedNote = @"TCServerStartedNote"; 41 | NSString *TCServerStoppedNote = @"TCServerStoppedNote"; 42 | NSString *TCServerConnectionsChangedNote = @"TCServerConnectionsChangedNote"; 43 | NSString *TCWindowsOnTopChangedNote = @"TCWindowsOnTopChangedNote"; 44 | NSString *TCDisplayValuesChangedNote = @"TCDisplayValuesChangedNote"; 45 | NSString *TCHitsDisplayedChangedNote = @"TCHitsDisplayedChangedNote"; 46 | 47 | 48 | void LaunchWebsite() 49 | { 50 | [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.brokenzipper.com/"]]; 51 | } 52 | 53 | void LaunchEmail() 54 | { 55 | //[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"mailto:chaz@brokenzipper.com?subject=The%20Cheat%20Feedback"]]; 56 | /* Ed Palma will act as a contact person for The Cheat. */ 57 | [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.brokenzipper.com/contact.html"]]; 58 | } 59 | 60 | 61 | int MacOSXVersion() 62 | { 63 | SInt32 static version = -1; 64 | 65 | if ( version != -1 ) { 66 | return (int)version; 67 | } 68 | 69 | // get the version 70 | if ( Gestalt( gestaltSystemVersion, &version ) != noErr ) { 71 | return -1; 72 | } 73 | return (int)version; 74 | } 75 | 76 | NSString *ApplicationVersion( NSString *appPath ) 77 | { 78 | NSString *tVersion = nil; 79 | NSBundle *tBundle = [NSBundle bundleWithPath:appPath]; 80 | 81 | if ( tBundle ) { 82 | NSDictionary *tInfoDictionary; 83 | 84 | tInfoDictionary = [tBundle infoDictionary]; 85 | 86 | if ( tInfoDictionary ) { 87 | tVersion = [tInfoDictionary objectForKey:@"CFBundleShortVersionString"]; 88 | if ( !tVersion ) { 89 | tVersion = [tInfoDictionary objectForKey:@"CFBundleVersion"]; 90 | } 91 | } 92 | } 93 | else { 94 | CFBundleRef tBundleRef; 95 | short resNum = 0; 96 | 97 | tBundleRef = CFBundleCreate( NULL, (CFURLRef)[NSURL fileURLWithPath:appPath] ); 98 | 99 | if ( tBundleRef ) { 100 | resNum = CFBundleOpenBundleResourceMap( tBundleRef ); 101 | } 102 | 103 | if ( resNum != 0 ) { 104 | VersRecHndl tVersionHandle; 105 | unsigned long tNumVersion; 106 | 107 | tVersionHandle = (VersRecHndl)Get1IndResource( 'vers', 1 ); 108 | 109 | if ( tVersionHandle ) { 110 | tNumVersion = *((unsigned long *) &((*tVersionHandle)->numericVersion)); 111 | 112 | if ( (tNumVersion & 0x00040000) != 0 ) { 113 | tVersion = [NSString stringWithFormat:@"%d.%d.%d", (tNumVersion & 0xFF000000)>>24, (tNumVersion & 0x00F00000)>>20, (tNumVersion & 0x000F0000)>>16]; 114 | } 115 | else { 116 | tVersion = [NSString stringWithFormat:@"%d.%d", (tNumVersion & 0xFF000000)>>24, (tNumVersion & 0x00F00000)>>20]; 117 | } 118 | } 119 | 120 | } 121 | if ( tBundleRef ) { 122 | CFBundleCloseBundleResourceMap( tBundleRef, resNum ); 123 | // Release Memory 124 | CFRelease( tBundleRef ); 125 | } 126 | } 127 | return tVersion; 128 | } 129 | -------------------------------------------------------------------------------- /CheaterTypes.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #ifndef _CheaterTypes_H 14 | #define _CheaterTypes_H 15 | 16 | #import 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | 24 | /* Compiler macros */ 25 | #if defined( __cplusplus ) 26 | #define CHEAT_EXPORT extern "C" 27 | #define CHEAT_IMPORT extern "C" 28 | #else 29 | #define CHEAT_EXPORT extern 30 | #define CHEAT_IMPORT extern 31 | #endif 32 | 33 | #if !defined( CHEAT_STATIC_INLINE ) 34 | #define CHEAT_STATIC_INLINE static __inline__ 35 | #endif 36 | 37 | #if !defined( CHEAT_EXTERN_INLINE ) 38 | #define CHEAT_EXTERN_INLINE extern __inline__ 39 | #endif 40 | 41 | 42 | #pragma mark - 43 | #pragma mark Miscellaneous Types 44 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 45 | 46 | typedef mach_vm_address_t TCAddress; 47 | 48 | 49 | typedef unsigned char TCVariableType; 50 | enum { 51 | TCInt64 = 0, 52 | TCInt32 = 1, // default 53 | TCInt16 = 2, 54 | TCInt8 = 3, 55 | TCString = 4, 56 | TCFloat = 5, 57 | TCDouble = 6 58 | }; 59 | 60 | typedef unsigned char TCIntegerSign; 61 | enum { 62 | TCSigned = 0, // default 63 | TCUnsigned = 1 64 | }; 65 | 66 | typedef unsigned char TCSearchOperator; 67 | enum { 68 | TCEqual = 0, // default 69 | TCNotEqual = 1, 70 | TCLessThan = 2, 71 | TCGreaterThan = 3, 72 | TCLessThanOrEqual = 4, // not used 73 | TCGreaterThanOrEqual = 5 // not used 74 | }; 75 | 76 | typedef unsigned char TCSearchType; 77 | enum { 78 | TCGivenValue = 0, // default 79 | TCLastValue = 1 80 | }; 81 | 82 | 83 | #pragma mark - 84 | #pragma mark TCArray 85 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 86 | 87 | typedef struct _TCArray 88 | { 89 | void *_bytes; 90 | unsigned _count; 91 | unsigned _size; 92 | BOOL _ownsBytes; 93 | } *TCArray; 94 | 95 | 96 | #pragma mark - 97 | #pragma mark Exported Array Functions 98 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 99 | 100 | CHEAT_EXPORT TCArray TCMakeArray( unsigned count, unsigned size ); 101 | CHEAT_EXPORT TCArray TCMakeArrayWithBytes( unsigned count, unsigned size, void *bytes ); 102 | CHEAT_EXPORT void TCReleaseArray( TCArray array ); 103 | 104 | CHEAT_EXPORT void TCArrayAppendArray( TCArray array, TCArray other ); 105 | 106 | CHEAT_EXPORT NSString *TCStringFromArray( TCArray array ); 107 | 108 | 109 | #pragma mark - 110 | #pragma mark Imported Array Functions 111 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 112 | 113 | CHEAT_STATIC_INLINE void *TCArrayBytes( TCArray array ) 114 | { 115 | return array->_bytes; 116 | } 117 | 118 | CHEAT_STATIC_INLINE unsigned TCArrayElementCount( TCArray array ) 119 | { 120 | return array->_count; 121 | } 122 | 123 | CHEAT_STATIC_INLINE unsigned TCArrayElementSize( TCArray array ) 124 | { 125 | return array->_size; 126 | } 127 | 128 | CHEAT_STATIC_INLINE void const *TCArrayElementAtIndex( TCArray array, unsigned index ) 129 | { 130 | return array->_bytes + index * array->_size; 131 | } 132 | 133 | CHEAT_STATIC_INLINE void TCArraySetElementAtIndex( TCArray array, unsigned index, void const *element ) 134 | { 135 | memcpy( array->_bytes + index * array->_size, element, array->_size ); 136 | } 137 | 138 | CHEAT_STATIC_INLINE void TCArrayResize( TCArray array, unsigned count ) 139 | { 140 | void *bytes = realloc( array->_bytes, count * array->_size ); 141 | 142 | if ( bytes ) { 143 | array->_bytes = bytes; 144 | array->_count = count; 145 | } 146 | } 147 | 148 | CHEAT_STATIC_INLINE TCArray TCArrayCopyElements( TCArray array, unsigned count ) 149 | { 150 | return TCMakeArrayWithBytes( MIN(array->_count,count), array->_size, array->_bytes ); 151 | } 152 | 153 | CHEAT_STATIC_INLINE TCArray TCArrayCopy( TCArray array ) 154 | { 155 | return TCArrayCopyElements( array, array->_count ); 156 | } 157 | 158 | CHEAT_STATIC_INLINE TCArray TCArrayCopyContainer( TCArray array, unsigned count ) 159 | { 160 | TCArray copy = TCMakeArray( MIN(array->_count,count), array->_size ); 161 | copy->_bytes = array->_bytes; 162 | copy->_ownsBytes = NO; 163 | return copy; 164 | } 165 | 166 | CHEAT_STATIC_INLINE void TCArrayFill( TCArray array, int filler ) 167 | { 168 | memset( array->_bytes, filler, array->_count * array->_size ); 169 | } 170 | 171 | 172 | 173 | #endif /* _CheaterTypes_H */ 174 | 175 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import 14 | #import 15 | #import 16 | #include "ChazLog.h" 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | /* 23 | * I think this function was ripped from the iHaxGamez project, so it 24 | * remains licensed under the GPL. 25 | */ 26 | void authMe(char * FullPathToMe) 27 | { 28 | // get authorization as root 29 | 30 | OSStatus myStatus; 31 | 32 | // set up Authorization Item 33 | AuthorizationItem myItems[1]; 34 | myItems[0].name = kAuthorizationRightExecute; 35 | myItems[0].valueLength = 0; 36 | myItems[0].value = NULL; 37 | myItems[0].flags = 0; 38 | 39 | // Set up Authorization Rights 40 | AuthorizationRights myRights; 41 | myRights.count = sizeof (myItems) / sizeof (myItems[0]); 42 | myRights.items = myItems; 43 | 44 | // set up Authorization Flags 45 | AuthorizationFlags myFlags; 46 | myFlags = 47 | kAuthorizationFlagDefaults | 48 | kAuthorizationFlagInteractionAllowed | 49 | kAuthorizationFlagExtendRights; 50 | 51 | // Create an Authorization Ref using Objects above. NOTE: Login bod comes up with this call. 52 | AuthorizationRef myAuthorizationRef; 53 | myStatus = AuthorizationCreate (&myRights, kAuthorizationEmptyEnvironment, myFlags, &myAuthorizationRef); 54 | 55 | if (myStatus == errAuthorizationSuccess) 56 | { 57 | // prepare communication path - used to signal that process is loaded 58 | FILE *myCommunicationsPipe = NULL; 59 | char myReadBuffer[] = " "; 60 | 61 | // run this app in GOD mode by passing authorization ref and comm pipe (asynchoronous call to external application) 62 | myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef,FullPathToMe,kAuthorizationFlagDefaults,nil,&myCommunicationsPipe); 63 | 64 | // external app is running asynchronously - it will send to stdout when loaded 65 | if (myStatus == errAuthorizationSuccess) 66 | { 67 | read (fileno (myCommunicationsPipe), myReadBuffer, sizeof (myReadBuffer)); 68 | fclose(myCommunicationsPipe); 69 | } 70 | 71 | // release authorization reference 72 | myStatus = AuthorizationFree (myAuthorizationRef, kAuthorizationFlagDestroyRights); 73 | } 74 | } 75 | 76 | /* 77 | * I think this function was ripped from the iHaxGamez project, so it 78 | * remains licensed under the GPL. 79 | */ 80 | bool checkExecutablePermissions(void) 81 | { 82 | NSDictionary *applicationAttributes = [[NSFileManager defaultManager] fileAttributesAtPath:[[NSBundle mainBundle] executablePath] traverseLink: YES]; 83 | 84 | // We expect 2755 as octal (1517 as decimal, -rwxr-sr-x as extended notation) 85 | return ([applicationAttributes filePosixPermissions] == 1517 && [[applicationAttributes fileGroupOwnerAccountName] isEqualToString: @"procmod"]); 86 | } 87 | 88 | /* 89 | * I think this function was ripped from the iHaxGamez project, so it 90 | * remains licensed under the GPL. 91 | */ 92 | bool amIWorthy(void) 93 | { 94 | // running as root? 95 | AuthorizationRef myAuthRef; 96 | OSStatus stat = AuthorizationCopyPrivilegedReference(&myAuthRef,kAuthorizationFlagDefaults); 97 | 98 | return stat == errAuthorizationSuccess || checkExecutablePermissions(); 99 | } 100 | 101 | int main( int argc, char *argv[] ) 102 | { 103 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 104 | 105 | ChazLogDisable(); 106 | 107 | ChazDebugSetup(); 108 | ChazMapLogToDebug(); 109 | 110 | #ifdef __ppc__ 111 | // PPC machines whose operating system is below leopard do not need authorization 112 | SInt32 osxMajorVersion; 113 | Gestalt(gestaltSystemVersionMinor, &osxMajorVersion); 114 | if (osxMajorVersion < 5) 115 | { 116 | [pool release]; 117 | return NSApplicationMain(argc, (const char **) argv); 118 | } 119 | #endif 120 | 121 | if (amIWorthy()) 122 | { 123 | #ifndef _DEBUG 124 | printf("Don't forget to flush! ;-) "); // signal back to close caller 125 | #endif 126 | fflush(stdout); 127 | 128 | [pool release]; 129 | return NSApplicationMain(argc, (const char **) argv); 130 | } 131 | else 132 | { 133 | authMe(argv[0]); 134 | [pool release]; 135 | return 0; 136 | } 137 | 138 | ChazDebugCleanup(); 139 | } 140 | -------------------------------------------------------------------------------- /GeneralPrefs.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "GeneralPrefs.h" 13 | 14 | 15 | @implementation GeneralPrefs 16 | 17 | 18 | - (void)awakeFromNib 19 | { 20 | // set initial states 21 | [ibWindowOrderButton setState:[[NSUserDefaults standardUserDefaults] boolForKey:TCWindowsOnTopPref]]; 22 | [ibAskForSaveButton setState:[[NSUserDefaults standardUserDefaults] boolForKey:TCAskForSavePref]]; 23 | if ( [[NSUserDefaults standardUserDefaults] floatForKey:TCFadeAnimationPref] > 0.0 ) { 24 | [ibFadeSmoothlyButton setState:NSOnState]; 25 | } 26 | else { 27 | [ibFadeSmoothlyButton setState:NSOffState]; 28 | } 29 | [ibDisplayValuesButton setState:[[NSUserDefaults standardUserDefaults] boolForKey:TCDisplayValuesPref]]; 30 | [ibValueUpdateField setFloatValue:[[NSUserDefaults standardUserDefaults] floatForKey:TCValueUpdatePref]]; 31 | [ibValueUpdateField setEnabled:[ibDisplayValuesButton state]]; 32 | [ibResultsDisplayedField setIntValue:[[NSUserDefaults standardUserDefaults] integerForKey:TCHitsDisplayedPref]]; 33 | 34 | [ibSwitchVariablesButton setState:[[NSUserDefaults standardUserDefaults] boolForKey:TCSwitchVariablesPref]]; 35 | [ibStartEditingVarsButton setState:[[NSUserDefaults standardUserDefaults] boolForKey:TCAutoStartEditingVarsPref]]; 36 | [ibStartEditingVarsButton setEnabled:[ibSwitchVariablesButton state]]; 37 | } 38 | 39 | 40 | - (IBAction)ibWindowOrderButton:(id)sender 41 | { 42 | BOOL pref = [sender state]; 43 | [[NSUserDefaults standardUserDefaults] setBool:pref forKey:TCWindowsOnTopPref]; 44 | // notify currently opened windows of the change 45 | [[NSNotificationCenter defaultCenter] postNotificationName:TCWindowsOnTopChangedNote object:[NSNumber numberWithBool:pref]]; 46 | } 47 | 48 | - (IBAction)ibSetAskForSave:(id)sender 49 | { 50 | BOOL pref = [sender state]; 51 | [[NSUserDefaults standardUserDefaults] setBool:pref forKey:TCAskForSavePref]; 52 | } 53 | 54 | - (IBAction)ibSetFadeSmoothly:(id)sender 55 | { 56 | float fade; 57 | 58 | if ( [sender state] == NSOnState ) { 59 | fade = TCDefaultFadeAnimation; 60 | } 61 | else { 62 | fade = 0.0; 63 | } 64 | [[NSUserDefaults standardUserDefaults] setFloat:fade forKey:TCFadeAnimationPref]; 65 | gFadeAnimationDuration = fade; 66 | } 67 | 68 | - (IBAction)ibDisplayValuesButton:(id)sender 69 | { 70 | BOOL flag = [ibDisplayValuesButton state]; 71 | [[NSUserDefaults standardUserDefaults] setBool:flag forKey:TCDisplayValuesPref]; 72 | 73 | [ibValueUpdateField setEnabled:flag]; 74 | 75 | // notify currently opened windows of the change 76 | [[NSNotificationCenter defaultCenter] postNotificationName:TCDisplayValuesChangedNote object:nil]; 77 | } 78 | 79 | - (IBAction)ibSetValueUpdate:(id)sender 80 | { 81 | float value = [sender floatValue]; 82 | 83 | if ( value < 0.1 ) { 84 | value = 0.1; 85 | [sender setFloatValue:value]; 86 | } 87 | 88 | [[NSUserDefaults standardUserDefaults] setFloat:value forKey:TCValueUpdatePref]; 89 | 90 | // notify currently opened windows of the change 91 | [[NSNotificationCenter defaultCenter] postNotificationName:TCDisplayValuesChangedNote object:nil]; 92 | } 93 | 94 | - (IBAction)ibSetResultsDisplayed:(id)sender 95 | { 96 | int value = [ibResultsDisplayedField intValue]; 97 | 98 | if ( value < 0 ) { 99 | value = 0; 100 | [ibResultsDisplayedField setIntValue:value]; 101 | } 102 | 103 | [[NSUserDefaults standardUserDefaults] setInteger:value forKey:TCHitsDisplayedPref]; 104 | 105 | // notify currently opened windows of the change 106 | [[NSNotificationCenter defaultCenter] postNotificationName:TCHitsDisplayedChangedNote object:nil]; 107 | } 108 | 109 | 110 | - (IBAction)ibSwitchVariablesButton:(id)sender 111 | { 112 | BOOL flag = [ibSwitchVariablesButton state]; 113 | [[NSUserDefaults standardUserDefaults] setBool:flag forKey:TCSwitchVariablesPref]; 114 | 115 | [ibStartEditingVarsButton setEnabled:[ibSwitchVariablesButton state]]; 116 | if ( !flag ) { 117 | [ibStartEditingVarsButton setState:NO]; 118 | [[NSUserDefaults standardUserDefaults] setBool:NO forKey:TCAutoStartEditingVarsPref]; 119 | } 120 | } 121 | 122 | - (IBAction)ibStartEditingVarsButton:(id)sender 123 | { 124 | BOOL flag = [ibStartEditingVarsButton state]; 125 | [[NSUserDefaults standardUserDefaults] setBool:flag forKey:TCAutoStartEditingVarsPref]; 126 | } 127 | 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /English.lproj/Session~.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = {switchToFullScreen = id; }; 5 | CLASS = CMOpenGLView; 6 | LANGUAGE = ObjC; 7 | SUPERCLASS = NSOpenGLView; 8 | }, 9 | {CLASS = CMStatusView; LANGUAGE = ObjC; SUPERCLASS = NSTextField; }, 10 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 11 | { 12 | ACTIONS = { 13 | cancelButton = id; 14 | changeButton = id; 15 | clearSearchButton = id; 16 | okButton = id; 17 | pauseButton = id; 18 | processMenuItem = id; 19 | recurringChangeButton = id; 20 | redoMenu = id; 21 | searchButton = id; 22 | serverMenuDisconnect = id; 23 | serverMenuItem = id; 24 | serverMenuLocal = id; 25 | sizePopup = id; 26 | typePopup = id; 27 | undoMenu = id; 28 | }; 29 | CLASS = MyDocument; 30 | LANGUAGE = ObjC; 31 | OUTLETS = { 32 | addressTable = NSTableView; 33 | cancelButton = NSButton; 34 | changeButton = NSButton; 35 | changeSecondsCombo = NSComboBox; 36 | changeSheet = NSWindow; 37 | changeTextField = NSTextField; 38 | cheatWindow = NSWindow; 39 | clearSearchButton = NSButton; 40 | decimalSizeMenu = NSMenu; 41 | descriptionText = NSTextField; 42 | integerSizeMenu = NSMenu; 43 | okButton = NSButton; 44 | pauseButton = NSButton; 45 | processMenu = NSMenu; 46 | processPopup = NSPopUpButton; 47 | recurringChangeButton = NSButton; 48 | searchButton = NSButton; 49 | searchRadioMatrix = NSMatrix; 50 | searchTextField = NSTextField; 51 | serverMenu = NSMenu; 52 | serverPopup = NSPopUpButton; 53 | sizePopup = NSPopUpButton; 54 | statusBar = NSProgressIndicator; 55 | statusText = NSTextField; 56 | stringSizeMenu = NSMenu; 57 | typeMenu = NSMenu; 58 | typePopup = NSPopUpButton; 59 | }; 60 | SUPERCLASS = NSDocument; 61 | }, 62 | { 63 | ACTIONS = { 64 | cancelButton = id; 65 | changeButton = id; 66 | clearSearchButton = id; 67 | okButton = id; 68 | pauseButton = id; 69 | processMenuItem = id; 70 | recurringChangeButton = id; 71 | redo = id; 72 | searchButton = id; 73 | serverMenuDisconnect = id; 74 | serverMenuItem = id; 75 | serverMenuLocal = id; 76 | sizePopup = id; 77 | typePopup = id; 78 | undo = id; 79 | }; 80 | CLASS = SessionController; 81 | LANGUAGE = ObjC; 82 | OUTLETS = { 83 | addressTable = NSTableView; 84 | cancelButton = NSButton; 85 | changeButton = NSButton; 86 | changeSecondsCombo = NSComboBox; 87 | changeSheet = NSWindow; 88 | changeTextField = NSTextField; 89 | cheatWindow = NSWindow; 90 | clearSearchButton = NSButton; 91 | decimalSizeMenu = NSMenu; 92 | descriptionText = NSTextField; 93 | integerSizeMenu = NSMenu; 94 | okButton = NSButton; 95 | pauseButton = NSButton; 96 | processMenu = NSMenu; 97 | processPopup = NSPopUpButton; 98 | recurringChangeButton = NSButton; 99 | searchButton = NSButton; 100 | searchRadioMatrix = NSMatrix; 101 | searchTextField = NSTextField; 102 | serverMenu = NSMenu; 103 | serverPopup = NSPopUpButton; 104 | sizePopup = NSPopUpButton; 105 | statusBar = NSProgressIndicator; 106 | statusText = CMStatusView; 107 | stringSizeMenu = NSMenu; 108 | typeMenu = NSMenu; 109 | typePopup = NSPopUpButton; 110 | }; 111 | SUPERCLASS = NSWindowController; 112 | } 113 | ); 114 | IBVersion = 1; 115 | } -------------------------------------------------------------------------------- /MySocket.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | /* 14 | * MySocket is my 24 hour hackjob. There are other classes which would have 15 | * done a better job, but I found them to be too slow. This class wraps 16 | * around BSD sockets directly. It uses two threads for both asynchronous 17 | * reads and writes. Performance still isn't spectacular... I measure about 18 | * 58 MB/s average when transfering to localhost. 19 | * The way the old The Cheat did networking was by spawning a new thread for 20 | * each connection (for both serving and receiving). I thought that this way 21 | * would be more efficient, but the old way is noticeably faster. I may go 22 | * back to that way eventually, after all it isn't that many threads. 23 | */ 24 | 25 | /* 26 | * June 21 2005 - Chaz 27 | * I have written a much more robust socket wrapper for another project that 28 | * could be re-emplemented into The Cheat. It is cleaner code and has very 29 | * nice statistics tracking features. I'm going on my mission tomorrow. This 30 | * will have to wait two years or so. ;) 31 | */ 32 | 33 | #import 34 | #import "ChazLog.h" 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #include 46 | 47 | 48 | /* 49 | * This class has a few limitations which may not be obvious. First, it will 50 | * only send back delegate methods on the Main thread, not necessarily the 51 | * same thread used to create the socket. There is no way to time out a read 52 | * or write action. There is no way to just read "all" data possible; you 53 | * must specify how much data to receive. 54 | */ 55 | 56 | 57 | @interface MySocket : NSObject 58 | { 59 | int _sockfd; 60 | 61 | NSMutableArray *_readQueue; 62 | NSMutableArray *_writeQueue; 63 | NSMutableData *_unclaimedData; 64 | NSRecursiveLock *_readLock; 65 | NSRecursiveLock *_writeLock; 66 | 67 | unsigned _flags; 68 | unsigned _bytesRead; 69 | unsigned _bytesWritten; 70 | NSTimeInterval _startTime; 71 | 72 | unsigned _lastBytesRead; 73 | unsigned _lastBytesWritten; 74 | NSTimeInterval _lastBytesReadTime; 75 | NSTimeInterval _lastBytesWrittenTime; 76 | 77 | id _delegate; 78 | } 79 | 80 | /* INITIALIZATION */ 81 | - (id)initWithDelegate:(id)delegate; 82 | 83 | /* CONNECTING/ACCEPTING */ 84 | - (BOOL)connectToHost:(NSString *)host port:(int)port; 85 | - (BOOL)connectToAddress:(const struct sockaddr *)addr length:(unsigned)addrLen; 86 | - (BOOL)connectToAddressWithData:(NSData *)addr; 87 | - (BOOL)listenOnPort:(int)port; 88 | // returns YES on success 89 | 90 | /* OBVIOUS */ 91 | - (void)disconnect; 92 | // the disconnect delegate method will NOT be called. 93 | // it is only called when the socket is disconnect by remote or by error. 94 | // absolutely NO delegate methods are sent after this (until reconnecting). 95 | 96 | /* READING & WRITING */ 97 | - (void)readDataToLength:(unsigned)len tag:(int)tag; 98 | - (void)writeData:(NSData *)data tag:(int)tag; 99 | - (void)writeBytes:(void const *)bytes length:(unsigned)len tag:(int)tag; 100 | /* Nope, there is no way to time out a request. */ 101 | 102 | /* STATISTICS */ 103 | - (unsigned)bytesRead; 104 | - (unsigned)bytesWritten; 105 | /* the above accessors can be accessed after the socket is disconnected to get 106 | the grand total amount of traffic passed through the socket. */ 107 | - (NSTimeInterval)timeConnected; 108 | - (double)readSpeed; // bytes/sec 109 | - (double)writeSpeed; // bytes/sec 110 | /* These speeds are averaged out using the last time these methods were called. 111 | The more often you call these methods the more accurate they will be. */ 112 | 113 | - (NSString *)localHost; 114 | - (int)localPort; 115 | - (NSString *)remoteHost; 116 | - (int)remotePort; 117 | 118 | - (BOOL)isConnected; 119 | - (BOOL)isListener; 120 | 121 | /* CONVENIENCE */ 122 | + (NSData *)addressWithHost:(NSString *)host port:(int)port; 123 | 124 | /* DELEGATION */ 125 | - (id)delegate; 126 | - (void)setDelegate:(id)delegate; 127 | 128 | @end 129 | 130 | 131 | @interface NSObject ( MySocketDelegate ) 132 | 133 | /* DELEGATE METHODS */ 134 | - (void)socketDidDisconnect:(MySocket *)mySocket; 135 | - (void)socket:(MySocket *)mySocket didAcceptSocket:(MySocket *)newSocket; 136 | - (void)socket:(MySocket *)mySocket didReadData:(NSData *)theData tag:(int)tag; 137 | - (void)socket:(MySocket *)mySocket didWriteDataWithTag:(int)tag; 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /Cheater.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazLog.h" 14 | 15 | #import "CheaterTypes.h" 16 | 17 | #import "Process.h" 18 | #import "Variable.h" 19 | 20 | 21 | // The network protocol The Cheat uses is way simple. the header is 22 | // a fixed size: 24 bytes. Immediately following the header is the 23 | // packet data. 24 | 25 | typedef struct _TCPacketHeader 26 | { 27 | unsigned nifty; // always the same: 'DENT' or 0x44454E54. 28 | unsigned size; // the size of the packet (excluding this header). 29 | char name[16]; // NULL-terminated string describing the packet. 30 | } TCPacketHeader; 31 | 32 | 33 | // network definitions 34 | #define TC_NIFTY (0x44454E54) 35 | 36 | 37 | @interface Cheater : NSObject 38 | { 39 | BOOL _isConnected; 40 | BOOL _isAuthenticated; 41 | id _delegate; 42 | } 43 | 44 | // ############################################################################# 45 | #pragma mark Initialization 46 | // ############################################################################# 47 | 48 | - (id)initWithDelegate:(id)delegate; 49 | 50 | // delegation 51 | - (id)delegate; 52 | - (void)setDelegate:(id)delegate; 53 | 54 | // accessors 55 | - (BOOL)isConnected; 56 | - (BOOL)isAuthenticated; 57 | - (NSString *)hostAddress; 58 | 59 | // ############################################################################# 60 | #pragma mark Cheating Control 61 | // ############################################################################# 62 | 63 | // Methods with AUTH require authentication. 64 | 65 | - (void)connect; 66 | - (void)disconnect; 67 | - (void)authenticateWithPassword:(NSString *)password; 68 | 69 | - (void)getProcessList; 70 | 71 | - (void)setTarget:(Process *)target; 72 | - (void)pauseTarget; // AUTH 73 | - (void)resumeTarget; // AUTH 74 | 75 | - (void)limitReturnedResults:(unsigned)limit; 76 | - (void)searchForVariable:(Variable *)var comparison:(TCSearchOperator)op; // AUTH 77 | - (void)searchLastValuesComparison:(TCSearchOperator)op; // AUTH 78 | - (void)cancelSearch; // AUTH 79 | - (void)clearSearch; // AUTH 80 | 81 | - (void)getMemoryDump; // AUTH 82 | - (void)cancelMemoryDump; // AUTH 83 | 84 | - (void)makeVariableChanges:(NSArray *)variables repeat:(BOOL)doRepeat interval:(NSTimeInterval)repeatInterval; // AUTH 85 | - (void)stopChangingVariables; // AUTH 86 | 87 | - (void)undo; // AUTH 88 | - (void)redo; // AUTH 89 | 90 | - (void)watchVariablesAtIndex:(unsigned)index count:(unsigned)count interval:(NSTimeInterval)checkInterval; // AUTH 91 | - (void)stopWatchingVariables; // AUTH 92 | 93 | @end 94 | 95 | 96 | // ############################################################################# 97 | @protocol CheaterDelegate 98 | // ############################################################################# 99 | 100 | - (void)cheaterDidConnect:(Cheater *)cheater; 101 | - (void)cheaterDidDisconnect:(Cheater *)cheater; 102 | 103 | - (void)cheaterRequiresAuthentication:(Cheater *)cheater; 104 | - (void)cheaterRejectedPassword:(Cheater *)cheater; 105 | - (void)cheaterAcceptedPassword:(Cheater *)cheater; 106 | 107 | - (void)cheater:(Cheater *)cheater didFindProcesses:(NSArray *)processes; 108 | - (void)cheater:(Cheater *)cheater didAddProcess:(Process *)process; 109 | - (void)cheater:(Cheater *)cheater didRemoveProcess:(Process *)process; 110 | 111 | - (void)cheater:(Cheater *)cheater didSetTarget:(Process *)target; 112 | - (void)cheaterPausedTarget:(Cheater *)cheater; 113 | - (void)cheaterResumedTarget:(Cheater *)cheater; 114 | 115 | - (void)cheater:(Cheater *)cheater didFindVariables:(TCArray)variables actualAmount:(unsigned)count; 116 | - (void)cheater:(Cheater *)cheater didFindValues:(TCArray)values; 117 | - (void)cheaterDidCancelSearch:(Cheater *)cheater; 118 | - (void)cheaterDidClearSearch:(Cheater *)cheater; 119 | 120 | - (void)cheater:(Cheater *)cheater didDumpMemory:(NSData *)memoryDump; 121 | - (void)cheaterDidCancelMemoryDump:(Cheater *)cheater; 122 | 123 | - (void)cheater:(Cheater *)cheater didChangeVariables:(unsigned)changeCount; 124 | - (void)cheaterDidStopChangingVariables:(Cheater *)cheater; 125 | 126 | - (void)cheater:(Cheater *)cheater didReportProgress:(int)progress; 127 | 128 | - (void)cheater:(Cheater *)cheater didRevertToVariables:(TCArray)variables actualAmount:(unsigned)count; 129 | 130 | - (void)cheaterDidUndo:(Cheater *)cheater; 131 | - (void)cheaterDidRedo:(Cheater *)cheater; 132 | 133 | - (void)cheater:(Cheater *)cheater variableAtIndex:(unsigned)index didChangeTo:(Variable *)variable; 134 | 135 | - (void)cheater:(Cheater *)cheater didFailLastRequest:(NSString *)reason; 136 | - (void)cheater:(Cheater *)cheater echo:(NSString *)message; 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /SearchData.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | 13 | #import "SearchData.h" 14 | 15 | 16 | @implementation SearchData 17 | 18 | 19 | - (id)init 20 | { 21 | if ( self = [super init] ) { 22 | [self setVariableType:TCInt32]; 23 | [self setIntegerSign:TCSigned]; 24 | [self setSearchOperator:TCEqual]; 25 | [self setValueUsed:TCGivenValue]; 26 | 27 | _undoes = -1; 28 | _redoes = 0; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)dealloc 34 | { 35 | [_variableValue release]; 36 | TCReleaseArray( _addresses ); 37 | TCReleaseArray( _values ); 38 | [super dealloc]; 39 | } 40 | 41 | 42 | - (void)setProcess:(Process *)process 43 | { 44 | [process retain]; 45 | [_process release]; 46 | _process = process; 47 | } 48 | 49 | 50 | - (TCVariableType)variableType 51 | { 52 | return _variableType; 53 | } 54 | 55 | - (void)setVariableType:(TCVariableType)varType 56 | { 57 | // can't change the variable type when there has been a search 58 | if ( ![self hasSearchedOnce] ) { 59 | _variableType = varType; 60 | } 61 | } 62 | 63 | 64 | - (TCIntegerSign)integerSign 65 | { 66 | return _integerSign; 67 | } 68 | 69 | - (void)setIntegerSign:(TCIntegerSign)sign 70 | { 71 | // can't change the integer sign when there has been a search 72 | if ( ![self hasSearchedOnce] ) { 73 | _integerSign = sign; 74 | } 75 | } 76 | 77 | 78 | - (TCSearchOperator)searchOperator 79 | { 80 | return _operator; 81 | } 82 | 83 | - (void)setSearchOperator:(TCSearchOperator)op 84 | { 85 | _operator = op; 86 | } 87 | 88 | 89 | - (TCSearchType)valueUsed 90 | { 91 | if ( ![self hasSearchedOnce] ) { 92 | // if there is no search, then use search value no matter what 93 | _value = TCGivenValue; 94 | } 95 | return _value; 96 | } 97 | 98 | - (void)setValueUsed:(TCSearchType)value 99 | { 100 | _value = value; 101 | } 102 | 103 | 104 | - (Variable *)searchValue 105 | { 106 | if ( !_variableValue ) { 107 | // create a zero value if there is none 108 | _variableValue = [[Variable alloc] init]; 109 | [_variableValue setProcess:_process]; 110 | } 111 | return _variableValue; 112 | } 113 | 114 | - (void)setSearchValue:(Variable *)value 115 | { 116 | [value retain]; 117 | [_variableValue release]; 118 | _variableValue = value; 119 | } 120 | 121 | 122 | - (unsigned)numberOfResults 123 | { 124 | if ( _addresses ) { 125 | return TCArrayElementCount( _addresses ); 126 | } 127 | return 0; 128 | } 129 | 130 | - (TCArray)addresses 131 | { 132 | return _addresses; 133 | } 134 | 135 | - (void)setAddresses:(TCArray)addresses 136 | { 137 | TCReleaseArray( _addresses ); 138 | _addresses = addresses; 139 | 140 | if ( !_addresses ) { 141 | // clear the undoes and redoes if the search is cleared 142 | _undoes = -1; 143 | _redoes = 0; 144 | } 145 | 146 | // clear the stored values 147 | [self setValues:NULL]; 148 | } 149 | 150 | - (TCArray)values 151 | { 152 | return _values; 153 | } 154 | 155 | - (void)setValues:(TCArray)values 156 | { 157 | TCReleaseArray( _values ); 158 | _values = values; 159 | } 160 | 161 | - (void)setValue:(Variable *)value atIndex:(unsigned)index 162 | { 163 | if ( _values ) { 164 | if ( index < TCArrayElementCount( _values ) ) { 165 | TCArraySetElementAtIndex( _values, index, [value value] ); 166 | } 167 | } 168 | 169 | } 170 | 171 | - (BOOL)valuesLoaded 172 | { 173 | return ( _values != NULL ); 174 | } 175 | 176 | - (Variable *)variableAtIndex:(unsigned)index 177 | { 178 | if ( [self hasSearchedOnce] ) { 179 | Variable *var = [[Variable alloc] initWithType:[self variableType] integerSign:[self integerSign]]; 180 | [var setAddress:*(TCAddress *)TCArrayElementAtIndex( [self addresses], index )]; 181 | if ( [self valuesLoaded] ) { 182 | [var setValue:TCArrayElementAtIndex( [self values], index ) size:TCArrayElementSize([self values])]; 183 | } 184 | return [var autorelease]; 185 | } 186 | return nil; 187 | } 188 | 189 | - (NSString *)stringForRow:(unsigned)rowIndex 190 | { 191 | Variable *var = [self variableAtIndex:rowIndex]; 192 | 193 | if ( var ) { 194 | if ( [self valuesLoaded] ) { 195 | if ( [var type] == TCString ) { 196 | return [NSString stringWithFormat:@"%@ = \"%@\"", [var addressString], [var stringValue]]; 197 | } 198 | else { 199 | return [NSString stringWithFormat:@"%@ = %@", [var addressString], [var stringValue]]; 200 | } 201 | } 202 | else { 203 | return [var addressString]; 204 | } 205 | } 206 | return @""; 207 | } 208 | 209 | 210 | - (BOOL)hasSearchedOnce 211 | { 212 | return ( _addresses != NULL ); 213 | } 214 | 215 | 216 | - (int)undoesLeft 217 | { 218 | return _undoes; 219 | } 220 | 221 | - (int)redoesLeft 222 | { 223 | return _redoes; 224 | } 225 | 226 | - (void)didAddResults 227 | { 228 | _undoes++; 229 | _redoes = 0; 230 | } 231 | 232 | - (void)didUndo 233 | { 234 | _undoes--; 235 | _redoes++; 236 | } 237 | 238 | - (void)didRedo 239 | { 240 | _undoes++; 241 | _redoes--; 242 | } 243 | 244 | 245 | - (BOOL)isTypeInteger 246 | { 247 | return _variableType <= TCInt8; 248 | } 249 | 250 | 251 | - (void)clearResults 252 | { 253 | [self setAddresses:NULL]; 254 | } 255 | 256 | 257 | @end 258 | -------------------------------------------------------------------------------- /CheatData.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "CheatData.h" 13 | 14 | 15 | @implementation CheatData 16 | 17 | 18 | // ############################################################################# 19 | #pragma mark Initialization 20 | // ############################################################################# 21 | 22 | - (id)init 23 | { 24 | if ( self = [super init] ) 25 | { 26 | // set defaults 27 | [self setWindowTitle:@""]; 28 | [self setCheatInfo:@""]; 29 | [self setProcess:[[[Process alloc] initWithName:@"No Target Set" version:@""] autorelease]]; 30 | 31 | myRepeats = NO; 32 | myRepeatInterval = 5.0; 33 | 34 | // create objects 35 | myVariables = [[NSMutableArray alloc] init]; 36 | } 37 | return self; 38 | } 39 | 40 | - (void)dealloc 41 | { 42 | // release objects 43 | [myWindowTitle release]; 44 | [myCheatInfo release]; 45 | [myProcess release]; 46 | [myVariables release]; 47 | 48 | [super dealloc]; 49 | } 50 | 51 | 52 | // ############################################################################# 53 | #pragma mark NSCoding 54 | // ############################################################################# 55 | 56 | - (id)initWithCoder:(NSCoder *)coder 57 | { 58 | if ( self = [super init] ) 59 | { 60 | [self setWindowTitle:[coder decodeObject]]; 61 | [self setCheatInfo:[coder decodeObject]]; 62 | [self setProcess:[coder decodeObject]]; 63 | myVariables = [[coder decodeObject] retain]; 64 | [coder decodeValueOfObjCType:@encode(BOOL) at:&myRepeats]; 65 | [coder decodeValueOfObjCType:@encode(NSTimeInterval) at:&myRepeatInterval]; 66 | } 67 | return self; 68 | } 69 | 70 | - (void)encodeWithCoder:(NSCoder *)coder 71 | { 72 | [coder encodeObject:myWindowTitle]; 73 | [coder encodeObject:myCheatInfo]; 74 | [coder encodeObject:myProcess]; 75 | [coder encodeObject:myVariables]; 76 | [coder encodeValueOfObjCType:@encode(BOOL) at:&myRepeats]; 77 | [coder encodeValueOfObjCType:@encode(NSTimeInterval) at:&myRepeatInterval]; 78 | } 79 | 80 | 81 | // ############################################################################# 82 | #pragma mark Accessing Properties 83 | // ############################################################################# 84 | 85 | 86 | - (NSString *)windowTitle 87 | { 88 | return myWindowTitle; 89 | } 90 | 91 | - (NSString *)cheatInfo 92 | { 93 | return myCheatInfo; 94 | } 95 | 96 | - (NSString *)gameName 97 | { 98 | return [myProcess name]; 99 | } 100 | 101 | - (NSString *)gameVersion 102 | { 103 | return [myProcess version]; 104 | } 105 | 106 | - (Process *)process 107 | { 108 | return myProcess; 109 | } 110 | 111 | - (BOOL)repeats 112 | { 113 | return myRepeats; 114 | } 115 | 116 | - (NSTimeInterval)repeatInterval 117 | { 118 | return myRepeatInterval; 119 | } 120 | 121 | 122 | - (void)setWindowTitle:(NSString *)title 123 | { 124 | if ( !title ) { 125 | title = [NSString stringWithString:@""]; 126 | } 127 | [title retain]; 128 | [myWindowTitle release]; 129 | myWindowTitle = title; 130 | } 131 | 132 | - (void)setCheatInfo:(NSString *)info 133 | { 134 | if ( !info ) { 135 | info = [NSString stringWithString:@"Description not provided."]; 136 | } 137 | [info retain]; 138 | [myCheatInfo release]; 139 | myCheatInfo = info; 140 | } 141 | 142 | - (void)setProcess:(Process *)process 143 | { 144 | [process retain]; 145 | [myProcess release]; 146 | myProcess = process; 147 | } 148 | 149 | - (void)setRepeats:(BOOL)repeats 150 | { 151 | myRepeats = repeats; 152 | } 153 | 154 | - (void)setRepeatInterval:(NSTimeInterval)interval 155 | { 156 | myRepeatInterval = interval; 157 | } 158 | 159 | 160 | // ############################################################################# 161 | #pragma mark Variables 162 | // ############################################################################# 163 | 164 | - (NSArray *)variables 165 | { 166 | return [NSArray arrayWithArray:myVariables]; 167 | } 168 | 169 | - (unsigned)variableCount 170 | { 171 | return [myVariables count]; 172 | } 173 | 174 | - (unsigned)indexOfVariable:(Variable *)variable 175 | { 176 | return [myVariables indexOfObject:variable]; 177 | } 178 | 179 | - (Variable *)variableAtIndex:(unsigned)index 180 | { 181 | return [myVariables objectAtIndex:index]; 182 | } 183 | 184 | - (Variable *)lastVariable 185 | { 186 | return [myVariables lastObject]; 187 | } 188 | 189 | 190 | - (void)addVariable:(Variable *)variable 191 | { 192 | [myVariables addObject:variable]; 193 | } 194 | 195 | - (void)insertVariable:(Variable *)variable atIndex:(unsigned)index 196 | { 197 | [myVariables insertObject:variable atIndex:index]; 198 | } 199 | 200 | 201 | - (void)removeAllVariables 202 | { 203 | [myVariables removeAllObjects]; 204 | } 205 | 206 | - (void)removeVariable:(Variable *)variable 207 | { 208 | [myVariables removeObject:variable]; 209 | } 210 | 211 | - (void)removeVariableAtIndex:(unsigned)index 212 | { 213 | [myVariables removeObjectAtIndex:index]; 214 | } 215 | 216 | 217 | - (NSArray *)enabledVariables 218 | { 219 | NSMutableArray *vars; 220 | int i, top; 221 | 222 | top = [myVariables count]; 223 | vars = [[NSMutableArray alloc] init]; 224 | 225 | for ( i = 0; i < top; i++ ) { 226 | Variable *var = [myVariables objectAtIndex:i]; 227 | if ( [var isEnabled] ) { 228 | [vars addObject:var]; 229 | } 230 | } 231 | return [vars autorelease]; 232 | } 233 | 234 | - (unsigned)enabledVariableCount 235 | { 236 | return [[self enabledVariables] count]; 237 | } 238 | 239 | 240 | @end 241 | -------------------------------------------------------------------------------- /ServerPrefs.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "ServerPrefs.h" 13 | 14 | #include "cheat_global.h" 15 | 16 | #import "AppController.h" 17 | 18 | #import "CheatServer.h" 19 | #import "ServerChild.h" 20 | 21 | 22 | @interface ServerPrefs ( PrivateAPI ) 23 | 24 | - (void)_serverStarted:(NSNotification *)note; 25 | - (void)_serverStopped:(NSNotification *)note; 26 | - (void)_childrenChanged:(NSNotification *)note; 27 | 28 | @end 29 | 30 | 31 | @implementation ServerPrefs 32 | 33 | 34 | - (id)init 35 | { 36 | if ( self = [super init] ) { 37 | NSNotificationCenter *nc= [NSNotificationCenter defaultCenter]; 38 | 39 | // register for server notifications 40 | [nc addObserver:self selector:@selector(_serverStarted:) name:TCServerStartedNote object:nil]; 41 | [nc addObserver:self selector:@selector(_serverStopped:) name:TCServerStoppedNote object:nil]; 42 | [nc addObserver:self selector:@selector(_childrenChanged:) name:TCServerConnectionsChangedNote object:nil]; 43 | } 44 | return self; 45 | } 46 | 47 | - (void)dealloc 48 | { 49 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 50 | [super dealloc]; 51 | } 52 | 53 | 54 | - (void)awakeFromNib 55 | { 56 | [ibDefaultPortText setStringValue:[NSString stringWithFormat:@"Default cheat port is %i.", TCDefaultListenPort]]; 57 | 58 | // set initial states 59 | [ibNameField setStringValue:[[NSUserDefaults standardUserDefaults] objectForKey:TCBroadcastNamePref]]; 60 | [ibPortField setIntValue:[[NSUserDefaults standardUserDefaults] integerForKey:TCListenPortPref]]; 61 | 62 | if ( [[NSApp cheatServer] isListening] ) { 63 | [self _serverStarted:nil]; 64 | } 65 | else { 66 | [self _serverStopped:nil]; 67 | } 68 | } 69 | 70 | 71 | 72 | - (IBAction)ibSetListenPort:(id)sender 73 | { 74 | short unsigned port = [ibPortField intValue]; 75 | 76 | if ( port < 1024 ) { 77 | port = TCDefaultListenPort; 78 | [sender setIntValue:port]; 79 | } 80 | 81 | [[NSUserDefaults standardUserDefaults] setInteger:[ibPortField intValue] forKey:TCListenPortPref]; 82 | } 83 | 84 | - (IBAction)ibSetBroadcast:(id)sender 85 | { 86 | [[NSUserDefaults standardUserDefaults] setObject:[ibNameField stringValue] forKey:TCBroadcastNamePref]; 87 | } 88 | 89 | - (IBAction)ibStartServer:(id)sender 90 | { 91 | CheatServer *server = [NSApp cheatServer]; 92 | 93 | [self ibSetListenPort:nil]; 94 | [self ibSetBroadcast:nil]; 95 | 96 | if ( [server isListening] ) { 97 | // stop it 98 | [[NSUserDefaults standardUserDefaults] setBool:NO forKey:TCRunServerPref]; 99 | [NSApp stopCheatServer]; 100 | } 101 | else { 102 | [[NSUserDefaults standardUserDefaults] setBool:YES forKey:TCRunServerPref]; 103 | if ( ![NSApp startCheatServer] ) { 104 | // cheat server failed to start 105 | NSBeginAlertSheet( @"The Cheat could not start the server.", @"OK", nil, nil, [sender window], nil, NULL, NULL, NULL, 106 | @"The cheat server failed to start. Make sure the port is not in use by another program and try again." ); 107 | } 108 | } 109 | } 110 | 111 | 112 | - (int)numberOfRowsInTableView:(NSTableView *)table 113 | { 114 | CheatServer *server = [NSApp cheatServer]; 115 | if ( [server isListening] ) { 116 | return [server childCount]; 117 | } 118 | return 0; 119 | } 120 | 121 | - (id)tableView:(NSTableView *)table objectValueForTableColumn:(NSTableColumn *)column row:(int)row 122 | { 123 | NSString *identifier = [column identifier]; 124 | ServerChild *child; 125 | 126 | child = [[[NSApp cheatServer] children] objectAtIndex:row]; 127 | 128 | return [child valueForKey:identifier]; 129 | } 130 | 131 | - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)column row:(int)row 132 | { 133 | 134 | } 135 | 136 | - (BOOL)tableView:(NSTableView *)aTableView shouldSelectTableColumn:(NSTableColumn *)aTableColumn 137 | { 138 | return NO; 139 | } 140 | 141 | - (void)tableView:(NSTableView *)aTableView deleteRows:(NSArray *)rows 142 | { 143 | int i, len; 144 | 145 | len = [rows count]; 146 | for ( i = len-1; i >= 0; i-- ) { 147 | [[NSApp cheatServer] removeChildAtIndex:[[rows objectAtIndex:i] unsignedIntValue]]; 148 | } 149 | // reselect the last item if the selection is now invalid 150 | len = [[NSApp cheatServer] childCount] - 1; 151 | if ( [aTableView selectedRow] > len ) { 152 | [aTableView selectRow:len byExtendingSelection:NO]; 153 | } 154 | [aTableView reloadData]; 155 | } 156 | 157 | 158 | - (void)_serverStarted:(NSNotification *)note 159 | { 160 | CheatServer *server = [NSApp cheatServer]; 161 | int port; 162 | // server is running 163 | port = [server port]; 164 | if ( port != TCDefaultListenPort ) { 165 | [ibStatusField setDefaultStatus:[NSString stringWithFormat:@"cheat://%@:%i", [server host], port]]; 166 | } 167 | else { 168 | [ibStatusField setDefaultStatus:[NSString stringWithFormat:@"cheat://%@", [server host]]]; 169 | } 170 | [ibNameField setEnabled:NO]; 171 | [ibPortField setEnabled:NO]; 172 | [ibStartButton setTitle:@"Stop Server"]; 173 | [ibSessionTable reloadData]; 174 | 175 | _tableTimer = [[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(_childrenChanged:) 176 | userInfo:nil repeats:YES] retain]; 177 | } 178 | 179 | - (void)_serverStopped:(NSNotification *)note 180 | { 181 | // server is not running 182 | [ibStatusField setDefaultStatus:@"Not Running"]; 183 | [ibNameField setEnabled:YES]; 184 | [ibPortField setEnabled:YES]; 185 | [ibStartButton setTitle:@"Start Server"]; 186 | [ibSessionTable reloadData]; 187 | 188 | [_tableTimer invalidate]; 189 | [_tableTimer release]; 190 | _tableTimer = nil; 191 | } 192 | 193 | - (void)_childrenChanged:(NSNotification *)note 194 | { 195 | [ibSessionTable reloadData]; 196 | } 197 | 198 | 199 | @end 200 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | The Cheat 3 | ========= 4 | 5 | ![The Cheat Logo](http://chazmcgarvey.github.com/thecheat/img/thecheat.png) 6 | 7 | This is the legendary universal game trainer for Mac OS X. This program 8 | enables you to search the memory address space of another running process and 9 | even do a little covert *tweaking*. The most apparent (and awesome) 10 | application for this gem is changing the values of interesting variables 11 | within games in real time. Yeah, that might be considered cheating, which is 12 | where this little program gets its name. Here is a rundown of the most 13 | notable features: 14 | 15 | * Search for many types of variables, including strings, integers, and 16 | floating point numbers. 17 | * Bonjour-aware networking allows you to cheat remotely from another computer. 18 | * File saving and opening. Once you find a cheat, save it and maybe it will 19 | work next time. 20 | 21 | ![Screenshot](http://chazmcgarvey.github.com/thecheat/img/screenshot1.png) 22 | 23 | License 24 | ------- 25 | 26 | This software is licensed according to the terms and conditions of the 27 | [BSD 2-Clause License](http://www.opensource.org/licenses/bsd-license.php). 28 | Please see the COPYING file for more information. 29 | 30 | Download 31 | -------- 32 | 33 | The latest and greatest release is 34 | [The Cheat 1.2.5](http://chazmcgarvey.github.com/thecheat/thecheat-1.2.5.dmg), 35 | an Intel/PPC binary released on 22 Nov 2010. 36 | Older releases are available at . 37 | 38 | Size: 711K 39 | MD5: 429b54298b804bc5e9343ac179eba428 40 | 41 | Getting Started 42 | --------------- 43 | 44 | This software is not necessarily easy to use if you are new and inexperienced. 45 | The target audience for this software includes software developers and 46 | hardcore gamers. It will help if you know a few things about bits and bytes. 47 | Nevertheless, the documentation available is pretty good, so if you have the 48 | desire and a little bit of time to learn some new things, you won't have any 49 | problems. 50 | 51 | The Cheat has a built-in help document. It reads like a user manual, but it 52 | isn't very long and has a lot of useful information to get new users started 53 | quickly, so go read it. You will find it from the application's `Help` menu. 54 | 55 | If you are using an Intel Mac, reports suggest that you must set a certain 56 | kernel option in order for The Cheat to work. Open up `Terminal.app` and 57 | enter this, typing your password when prompted: 58 | 59 | sudo sysctl -w kern.tfp.policy=1 60 | 61 | ![Screenshot](http://chazmcgarvey.github.com/thecheat/img/screenshot2.jpg) 62 | 63 | Alternatives 64 | ------------ 65 | 66 | If thecheat just doesn't do it for you, there are a couple clones that you can 67 | try. I've never used them, but they could be more up-to-date and better 68 | supported by their respective project maintainers: 69 | 70 | * [iHaxGamez](http://www.ihaxgamez.com/) 71 | * [Bit Slicer](http://zorg.tejat.net/programs#bitslicer) 72 | 73 | Frequently Asked Questions 74 | -------------------------- 75 | 76 | ### Is it possible to cheat multi-player games? 77 | 78 | Maybe. Probably not. You can try, but most modern servers have consistency 79 | checks in order to detect cheating. Some server operators have low tolerance 80 | for multi-player cheating, so it's possible to get your account banned if 81 | you're not careful. Basically, I don't recommend cheating in a multi-player 82 | setting. If you choose to try, you do so at your own peril. 83 | 84 | ### Can I cheat online Flash games? 85 | 86 | Generally, yes. Again, it depends on the exact nature of the program and what 87 | you're trying to accomplish. There are several video tutorials on YouTube 88 | demonstrating some Flash games being cheated; search around for inspiration. 89 | 90 | ### Why do my saved cheats not work the next time I try to use them? 91 | 92 | Sometimes they will, sometimes they won't. It will work as long as the 93 | variables have the same addresses every time the program runs. The older the 94 | program, the higher the chance that this is true and that saved cheats will 95 | work. If you want the technical answer, read on. It depends on the game and 96 | where the variable exists in the address space of the process you're cheating. 97 | If the variable is static, global, or even on the stack (and assuming the 98 | address space isn't subject to randomization for security purposes), then the 99 | addresses may remain the same each time. On the other hand, variables that 100 | are created on the heap are subject to pseudo-random placement by the 101 | allocator, so their addresses may change unexpectedly, even while the program 102 | is running. 103 | 104 | There's not much you can do about it if the variable's address changes. 105 | You've just got to search for it each time. Bummer! 106 | 107 | ### Can I apply multiple cheats at the same time? 108 | 109 | Yep. Once you add a variable, it will appear in the list if you're in cheat 110 | mode. To add more cheats, just go back to search mode, clear the current 111 | search, and look for the next one. Once you've found all the cheats you want, 112 | you can apply one or more cheats from the cheat mode. 113 | 114 | ### Why do I need to authenticate as an Administrator to use The Cheat? 115 | 116 | It used to be possible back around the time of Mac OS X 10.3 or so to use the 117 | virtual memory "backdoor" functions without Admin rights. Those were good 118 | days. Fast-forward to today: These newfangled versions of Mac OS X (perhaps 119 | starting with 10.4 or 10.5?) don't trust regular users with the kind of power 120 | The Cheat is meant to provide. So that's it; you have to authenticate in 121 | order to use the virtual memory functions provided by the kernel, and that's 122 | the only reason. The Cheat certainly doesn't do anything devious with those 123 | elevated privileges, and the source code is open in case you want to check 124 | that for yourself. 125 | 126 | ### Why do my searches keep returning zero search results? 127 | 128 | Maybe the variable you're searching for is not the type you expect, or maybe 129 | its value is masked or obfuscated in a way that is making it hard to find. If 130 | you are fluent in assembly code and competent with a debugger, you may be able 131 | to find the code that reads or writes the variable you're looking for. In 132 | that case, the debugger should be able to tell you where the variable is. 133 | Almost anything can be done, given enough time, the right tools, and the right 134 | knowledge. 135 | 136 | -------------------------------------------------------------------------------- /VMRegion.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // VMRegion 0.1 4 | // Virtual Memory Wrapper 5 | // 6 | // Copyright (c) 2004, Charles McGarvey 7 | // All rights reserved. 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, are 10 | // permitted provided that the following conditions are met: 11 | // 12 | // 1. Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // 2. Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 22 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 24 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 28 | // DAMAGE. 29 | // 30 | 31 | #import 32 | 33 | #include 34 | #include 35 | 36 | 37 | /* Compiler macros */ 38 | #if defined( __cplusplus ) 39 | #define VMREGION_EXPORT extern "C" 40 | #define VMREGION_IMPORT extern "C" 41 | #else 42 | #define VMREGION_EXPORT extern 43 | #define VMREGION_IMPORT extern 44 | #endif 45 | 46 | #if !defined( VMREGION_STATIC_INLINE ) 47 | #define VMREGION_STATIC_INLINE static __inline__ 48 | #endif 49 | 50 | #if !defined( VMREGION_EXTERN_INLINE ) 51 | #define VMREGION_EXTERN_INLINE extern __inline__ 52 | #endif 53 | 54 | 55 | // attributes of memory regions 56 | enum _VMRegionAttributes 57 | { 58 | VMREGION_READABLE = 1, 59 | VMREGION_WRITABLE = 2, 60 | VMREGION_EXECUTABLE = 4 61 | }; 62 | 63 | 64 | #pragma mark - 65 | #pragma mark VMRegion 66 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 67 | 68 | typedef struct _VMRegion 69 | { 70 | // process information 71 | pid_t _process; 72 | // region information 73 | mach_vm_address_t _address; 74 | mach_vm_size_t _size; 75 | unsigned _attributes; 76 | } VMRegion; 77 | 78 | // common regions 79 | VMREGION_EXPORT const VMRegion VMNullRegion; /* <0,0,0> */ 80 | 81 | 82 | #pragma mark - 83 | #pragma mark Utility VM Functions 84 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 85 | 86 | // get the number of regions a process has. 87 | unsigned VMCountRegions( pid_t process ); 88 | unsigned VMCountRegionsWithAttributes( pid_t process, unsigned attribs ); 89 | 90 | // these functions return allocated VMRegion objects. 91 | // use VMReleaseRegion(1) to free up used memory. 92 | // returns nil on error or if there is no region after prevRegion. 93 | // pass nil for prevRegion to access the first region. 94 | VMRegion VMNextRegion( pid_t process, VMRegion previous ); 95 | VMRegion VMNextRegionWithAttributes( pid_t process, VMRegion previous, unsigned attribs ); 96 | 97 | // UTILITY functions - stop/resume processes 98 | // returns YES on success, NO on failure 99 | VMREGION_STATIC_INLINE BOOL VMStopProcess( pid_t process ) { return (kill( process, SIGSTOP ) == 0); } 100 | VMREGION_STATIC_INLINE BOOL VMContinueProcess( pid_t process ) { return (kill( process, SIGCONT ) == 0); } 101 | 102 | // lower-level reading/writing functions 103 | // the returned NSData object should be retained by the caller. 104 | NSData *VMReadData( pid_t process, mach_vm_address_t address, mach_vm_size_t size ); 105 | BOOL VMReadBytes( pid_t process, mach_vm_address_t address, void *bytes, mach_vm_size_t *size ); // size is # bytes read after call 106 | BOOL VMWriteData( pid_t process, mach_vm_address_t address, NSData *data ); // returns YES on success, NO on failure 107 | BOOL VMWriteBytes( pid_t process, mach_vm_address_t address, const void *bytes, mach_vm_size_t size ); 108 | 109 | 110 | #pragma mark - 111 | #pragma mark Exported VM Functions 112 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 113 | 114 | VMREGION_EXPORT VMRegion VMMakeRegion( pid_t process, mach_vm_address_t address, mach_vm_size_t size ); 115 | 116 | VMREGION_EXPORT BOOL VMRegionSetData( VMRegion region, NSData *data ); 117 | 118 | VMREGION_EXPORT NSString *VMStringFromRegion( VMRegion region ); 119 | 120 | 121 | #pragma mark - 122 | #pragma mark Imported VM Functions 123 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 124 | 125 | VMREGION_STATIC_INLINE mach_vm_address_t VMRegionProcess( VMRegion region ) 126 | { 127 | return region._process; 128 | } 129 | 130 | VMREGION_STATIC_INLINE mach_vm_address_t VMRegionAddress( VMRegion region ) 131 | { 132 | return region._address; 133 | } 134 | 135 | VMREGION_STATIC_INLINE mach_vm_size_t VMRegionSize( VMRegion region ) 136 | { 137 | return region._size; 138 | } 139 | 140 | VMREGION_STATIC_INLINE unsigned VMRegionAttributes( VMRegion region ) 141 | { 142 | return region._attributes; 143 | } 144 | 145 | VMREGION_STATIC_INLINE BOOL VMRegionReadable( VMRegion region ) 146 | { 147 | return region._attributes & VMREGION_READABLE; 148 | } 149 | 150 | VMREGION_STATIC_INLINE BOOL VMRegionWritable( VMRegion region ) 151 | { 152 | return region._attributes & VMREGION_WRITABLE; 153 | } 154 | 155 | VMREGION_STATIC_INLINE BOOL VMRegionExecutable( VMRegion region ) 156 | { 157 | return region._attributes & VMREGION_EXECUTABLE; 158 | } 159 | 160 | 161 | VMREGION_STATIC_INLINE NSData *VMRegionData( VMRegion region ) 162 | { 163 | return VMReadData( region._process, region._address, region._size ); 164 | } 165 | 166 | VMREGION_STATIC_INLINE BOOL VMRegionBytes( VMRegion region, void *bytes, mach_vm_size_t *size ) 167 | { 168 | *size = region._size; 169 | return VMReadBytes( region._process, region._address, bytes, size ); 170 | } 171 | 172 | 173 | 174 | VMREGION_STATIC_INLINE BOOL VMRegionIsNotNull( VMRegion region ) 175 | { 176 | return (region._process != 0); 177 | } 178 | 179 | VMREGION_STATIC_INLINE BOOL VMEqualRegions( VMRegion region1, VMRegion region2 ) 180 | { 181 | return (region1._process == region2._process && 182 | region1._address == region2._address && 183 | region1._size == region2._size && 184 | region1._attributes == region2._attributes); 185 | } 186 | 187 | 188 | -------------------------------------------------------------------------------- /BetterTableView.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "BetterTableView.h" 13 | 14 | 15 | @interface BetterTableView ( PrivateAPI ) 16 | 17 | - (NSString *)_copyString; 18 | 19 | - (IBAction)copy:(id)sender; 20 | - (IBAction)paste:(id)sender; 21 | - (IBAction)cut:(id)sender; 22 | - (IBAction)delete:(id)sender; 23 | 24 | @end 25 | 26 | 27 | @implementation BetterTableView 28 | 29 | 30 | - (id)init 31 | { 32 | if ( self = [super init] ) { 33 | _canCopyPaste = YES; 34 | _canDelete = YES; 35 | } 36 | return self; 37 | } 38 | 39 | - (id)initWithCoder:(NSCoder *)coder 40 | { 41 | if ( self = [super initWithCoder:coder] ) { 42 | _canCopyPaste = YES; 43 | _canDelete = YES; 44 | } 45 | return self; 46 | } 47 | 48 | 49 | - (BOOL)validateMenuItem:(NSMenuItem *)menuItem 50 | { 51 | SEL selector = [menuItem action]; 52 | 53 | if ( selector == @selector(selectAll:) ) { 54 | return YES; 55 | } 56 | // support copy/paste 57 | if ( _canCopyPaste ) { 58 | if ( selector == @selector(paste:) ) { 59 | id delegate = [self delegate]; 60 | NSPasteboard *pb = [NSPasteboard generalPasteboard]; 61 | NSString *type = nil; 62 | // allow the delegate specify the type of data 63 | if ( [delegate respondsToSelector:@selector(tableViewPasteboardType:)] ) { 64 | type = [delegate tableViewPasteboardType:self]; 65 | } 66 | if ( type && [pb availableTypeFromArray:[NSArray arrayWithObject:type]] ) { 67 | return YES; 68 | } 69 | } 70 | if ( [self selectedRow] != -1 ) { 71 | if ( selector == @selector(copy:) ) { 72 | return YES; 73 | } 74 | else if ( selector == @selector(cut:) || selector == @selector(delete:) ) { 75 | return _canDelete; 76 | } 77 | } 78 | } 79 | return NO; 80 | } 81 | 82 | - (IBAction)copy:(id)sender 83 | { 84 | if ( _canCopyPaste && [self selectedRow] != -1 ) { 85 | id delegate = [self delegate]; 86 | NSPasteboard *pb = [NSPasteboard generalPasteboard]; 87 | NSString *type = nil; 88 | // allow the delegate specify the type of data 89 | if ( [delegate respondsToSelector:@selector(tableViewPasteboardType:)] ) { 90 | type = [delegate tableViewPasteboardType:self]; 91 | } 92 | if ( type ) { 93 | [pb declareTypes:[NSArray arrayWithObjects:NSStringPboardType, type, nil] owner:self]; 94 | // allow the delegate to copy data 95 | if ( [delegate respondsToSelector:@selector(tableView:copyRows:)] ) { 96 | [pb setData:[delegate tableView:self copyRows:[self selectedRows]] forType:type]; 97 | } 98 | } 99 | else { 100 | [pb declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:self]; 101 | } 102 | [pb setString:[self _copyString] forType:NSStringPboardType]; 103 | } 104 | } 105 | 106 | - (IBAction)paste:(id)sender 107 | { 108 | if ( _canCopyPaste ) { 109 | id delegate = [self delegate]; 110 | NSPasteboard *pb = [NSPasteboard generalPasteboard]; 111 | NSString *type = nil; 112 | // allow the delegate specify the type of data 113 | if ( [delegate respondsToSelector:@selector(tableViewPasteboardType:)] ) { 114 | type = [delegate tableViewPasteboardType:self]; 115 | } 116 | if ( type && [pb availableTypeFromArray:[NSArray arrayWithObject:type]] ) { 117 | // allow the delegate to paste data 118 | if ( [delegate respondsToSelector:@selector(tableView:pasteRowsWithData:)] ) { 119 | [delegate tableView:self pasteRowsWithData:[pb dataForType:type]]; 120 | } 121 | } 122 | } 123 | } 124 | 125 | - (IBAction)cut:(id)sender 126 | { 127 | [self copy:sender]; 128 | [self delete:sender]; 129 | } 130 | 131 | - (IBAction)delete:(id)sender 132 | { 133 | if ( _canDelete && [self selectedRow] != -1 ) { 134 | id delegate = [self delegate]; 135 | if ( [delegate respondsToSelector:@selector(tableView:deleteRows:)] ) { 136 | [delegate tableView:self deleteRows:[self selectedRows]]; 137 | } 138 | } 139 | } 140 | 141 | 142 | - (void)keyDown:(NSEvent *)theEvent 143 | { 144 | unsigned short keyCode = [theEvent keyCode]; 145 | // if something is selected and deleting is enabled and the delete key was pressed 146 | if ( _canDelete && [self selectedRow] != -1 && (keyCode == 0x75 || keyCode == 0x33) ) { 147 | // a delete key was pressed 148 | [self delete:nil]; 149 | return; 150 | } 151 | else if ( keyCode == 0x24 || keyCode == 0x4C ) { 152 | id delegate = [self delegate]; 153 | if ( [delegate respondsToSelector:@selector(tableViewDidReceiveEnterKey:)] ) { 154 | if ( [delegate tableViewDidReceiveEnterKey:self] ) { 155 | return; 156 | } 157 | } 158 | } 159 | else if ( keyCode == 0x31 ) { 160 | // space key 161 | id delegate = [self delegate]; 162 | if ( [delegate respondsToSelector:@selector(tableViewDidReceiveSpaceKey:)] ) { 163 | if ( [delegate tableViewDidReceiveSpaceKey:self] ) { 164 | return; 165 | } 166 | } 167 | } 168 | [super keyDown:theEvent]; 169 | } 170 | 171 | 172 | // NEW STUFF HERE 173 | 174 | - (BOOL)canDelete 175 | { 176 | return _canDelete; 177 | } 178 | 179 | - (void)setCanDelete:(BOOL)flag 180 | { 181 | _canDelete = flag; 182 | } 183 | 184 | 185 | - (BOOL)canCopyPaste 186 | { 187 | return _canCopyPaste; 188 | } 189 | 190 | - (void)setCanCopyPaste:(BOOL)flag 191 | { 192 | _canCopyPaste = flag; 193 | } 194 | 195 | 196 | - (NSArray *)selectedRows 197 | { 198 | return [[self selectedRowEnumerator] allObjects]; 199 | } 200 | 201 | 202 | // PRIVATE METHODS 203 | 204 | - (NSString *)_copyString 205 | { 206 | NSArray *rows, *columns; 207 | int i, j, top, columnCount; 208 | NSMutableString *string; 209 | id delegate = [self delegate]; 210 | 211 | // check delegate 212 | if ( ![delegate respondsToSelector:@selector(tableView:objectValueForTableColumn:row:)] ) { 213 | return @""; 214 | } 215 | 216 | string = [[NSMutableString alloc] init]; 217 | 218 | columns = [self tableColumns]; 219 | columnCount = [self numberOfColumns]; 220 | 221 | // loop thru all selected cells and put the text into the string 222 | rows = [self selectedRows]; 223 | top = [rows count]; 224 | for ( i = 0; i < top; i++ ) { 225 | int row = [[rows objectAtIndex:i] unsignedIntValue]; 226 | for ( j = 0; j < columnCount; j++ ) { 227 | id object = [delegate tableView:self objectValueForTableColumn:[columns objectAtIndex:j] row:row]; 228 | [string appendFormat:@"%@%@", j > 0? @"\t" : @"", object]; 229 | } 230 | if ( i + 1 != top ) { 231 | [string appendString:@"\n"]; 232 | } 233 | } 234 | return [string autorelease]; 235 | } 236 | 237 | 238 | @end 239 | -------------------------------------------------------------------------------- /Cheater.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "LocalCheater.h" 13 | 14 | 15 | @implementation Cheater 16 | 17 | 18 | // ############################################################################# 19 | #pragma mark Initialization 20 | // ############################################################################# 21 | 22 | - (id)initWithDelegate:(id)delegate 23 | { 24 | if ( self = [self init] ) { 25 | // set the delegate 26 | [self setDelegate:delegate]; 27 | ChazLog( @"init Cheater %p", self ); 28 | } 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | ChazLog( @"dealloc Cheater %p", self ); 35 | [super dealloc]; 36 | } 37 | 38 | 39 | - (id)delegate 40 | { 41 | return _delegate; 42 | } 43 | 44 | - (void)setDelegate:(id)delegate 45 | { 46 | // make sure the delegate is not nil and that it conforms to the CheaterDelegate 47 | if ( [delegate conformsToProtocol:@protocol(CheaterDelegate)] ) { 48 | _delegate = delegate; 49 | } 50 | else { 51 | _delegate = nil; 52 | } 53 | } 54 | 55 | 56 | - (BOOL)isConnected 57 | { 58 | return _isConnected; 59 | } 60 | 61 | - (BOOL)isAuthenticated 62 | { 63 | return _isAuthenticated; 64 | } 65 | 66 | - (NSString *)hostAddress 67 | { 68 | return @""; 69 | } 70 | 71 | 72 | // ############################################################################# 73 | #pragma mark Cheating Control 74 | // ############################################################################# 75 | 76 | - (void)connect 77 | { 78 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 79 | NSStringFromClass(isa), 80 | NSStringFromSelector(_cmd)]; 81 | } 82 | 83 | - (void)disconnect 84 | { 85 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 86 | NSStringFromClass(isa), 87 | NSStringFromSelector(_cmd)]; 88 | } 89 | 90 | - (void)authenticateWithPassword:(NSString *)password 91 | { 92 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 93 | NSStringFromClass(isa), 94 | NSStringFromSelector(_cmd)]; 95 | } 96 | 97 | 98 | - (void)getProcessList 99 | { 100 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 101 | NSStringFromClass(isa), 102 | NSStringFromSelector(_cmd)]; 103 | } 104 | 105 | 106 | - (void)setTarget:(Process *)target 107 | { 108 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 109 | NSStringFromClass(isa), 110 | NSStringFromSelector(_cmd)]; 111 | } 112 | 113 | - (void)pauseTarget 114 | { 115 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 116 | NSStringFromClass(isa), 117 | NSStringFromSelector(_cmd)]; 118 | } 119 | 120 | - (void)resumeTarget 121 | { 122 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 123 | NSStringFromClass(isa), 124 | NSStringFromSelector(_cmd)]; 125 | } 126 | 127 | 128 | - (void)limitReturnedResults:(unsigned)limit 129 | { 130 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 131 | NSStringFromClass(isa), 132 | NSStringFromSelector(_cmd)]; 133 | } 134 | 135 | - (void)searchForVariable:(Variable *)data comparison:(TCSearchOperator)op 136 | { 137 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 138 | NSStringFromClass(isa), 139 | NSStringFromSelector(_cmd)]; 140 | } 141 | 142 | - (void)searchLastValuesComparison:(TCSearchOperator)op 143 | { 144 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 145 | NSStringFromClass(isa), 146 | NSStringFromSelector(_cmd)]; 147 | } 148 | 149 | - (void)cancelSearch 150 | { 151 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 152 | NSStringFromClass(isa), 153 | NSStringFromSelector(_cmd)]; 154 | } 155 | 156 | - (void)clearSearch 157 | { 158 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 159 | NSStringFromClass(isa), 160 | NSStringFromSelector(_cmd)]; 161 | } 162 | 163 | - (void)getMemoryDump 164 | { 165 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 166 | NSStringFromClass(isa), 167 | NSStringFromSelector(_cmd)]; 168 | } 169 | 170 | - (void)cancelMemoryDump 171 | { 172 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 173 | NSStringFromClass(isa), 174 | NSStringFromSelector(_cmd)]; 175 | } 176 | 177 | 178 | - (void)makeVariableChanges:(NSArray *)variables repeat:(BOOL)doRepeat interval:(NSTimeInterval)repeatInterval 179 | { 180 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 181 | NSStringFromClass(isa), 182 | NSStringFromSelector(_cmd)]; 183 | } 184 | 185 | - (void)stopChangingVariables 186 | { 187 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 188 | NSStringFromClass(isa), 189 | NSStringFromSelector(_cmd)]; 190 | } 191 | 192 | 193 | - (void)undo 194 | { 195 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 196 | NSStringFromClass(isa), 197 | NSStringFromSelector(_cmd)]; 198 | } 199 | 200 | - (void)redo 201 | { 202 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 203 | NSStringFromClass(isa), 204 | NSStringFromSelector(_cmd)]; 205 | } 206 | 207 | 208 | - (void)watchVariablesAtIndex:(unsigned)index count:(unsigned)count interval:(NSTimeInterval)checkInterval 209 | { 210 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 211 | NSStringFromClass(isa), 212 | NSStringFromSelector(_cmd)]; 213 | } 214 | 215 | - (void)stopWatchingVariables 216 | { 217 | [NSException raise:@"TCNotImplemented" format:@"The subclass of Cheater (%@) needs to implement selector %@.", 218 | NSStringFromClass(isa), 219 | NSStringFromSelector(_cmd)]; 220 | } 221 | 222 | 223 | @end 224 | -------------------------------------------------------------------------------- /Process.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "Process.h" 13 | 14 | #if defined(__i386__) || defined(__x86_64__) 15 | #import 16 | #import 17 | #endif 18 | 19 | @interface Process ( PrivateAPI ) 20 | 21 | - (void)_setName:(NSString *)name; 22 | - (void)_setVersion:(NSString *)version; 23 | - (void)_setIcon:(NSImage *)icon; 24 | - (void)_setPID:(pid_t)pid; 25 | 26 | @end 27 | 28 | 29 | @implementation Process 30 | 31 | 32 | - (id)initWithName:(NSString *)name version:(NSString *)version icon:(NSImage *)icon pid:(pid_t)pid 33 | { 34 | if ( self = [super init] ) { 35 | [self _setName:name]; 36 | [self _setVersion:version]; 37 | [self _setIcon:icon]; 38 | [self _setPID:pid]; 39 | } 40 | return self; 41 | } 42 | 43 | - (id)initWithName:(NSString *)name version:(NSString *)version icon:(NSImage *)icon 44 | { 45 | return [self initWithName:name version:version icon:icon pid:0]; 46 | } 47 | 48 | - (id)initWithName:(NSString *)name version:(NSString *)version 49 | { 50 | return [self initWithName:name version:version icon:nil pid:0]; 51 | } 52 | 53 | - (void)dealloc 54 | { 55 | // release local objects 56 | [_name release]; 57 | [_version release]; 58 | [_icon release]; 59 | 60 | [super dealloc]; 61 | } 62 | 63 | 64 | // ############################################################################# 65 | #pragma mark NSCoding 66 | // ############################################################################# 67 | 68 | - (id)copyWithZone:(NSZone *)zone 69 | { 70 | return [[Process allocWithZone:zone] initWithName:_name version:_version icon:_icon pid:_pid]; 71 | } 72 | 73 | 74 | // ############################################################################# 75 | #pragma mark NSCoding 76 | // ############################################################################# 77 | 78 | - (id)initWithCoder:(NSCoder *)coder 79 | { 80 | if ( self = [super init] ) 81 | { 82 | [self _setName:[coder decodeObject]]; 83 | [self _setVersion:[coder decodeObject]]; 84 | //[self setIcon:[coder decodeObject]]; 85 | [coder decodeValueOfObjCType:@encode(pid_t) at:&_pid]; 86 | } 87 | return self; 88 | } 89 | 90 | - (void)encodeWithCoder:(NSCoder *)coder 91 | { 92 | [coder encodeObject:_name]; 93 | [coder encodeObject:_version]; 94 | //[coder encodeObject:_icon]; 95 | [coder encodeValueOfObjCType:@encode(pid_t) at:&_pid]; 96 | } 97 | 98 | 99 | #pragma mark NSObject Override 100 | 101 | - (BOOL)isEqual:(id)anObject 102 | { 103 | if ( [_name isEqualToString:[(Process *)anObject name]] && 104 | [_version isEqualToString:[(Process *)anObject version]] && 105 | _pid == [(Process *)anObject pid] ) { 106 | // they are the same process 107 | return YES; 108 | } 109 | return NO; 110 | } 111 | 112 | #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED 113 | - (NSUInteger)hash 114 | #else 115 | - (unsigned int)hash 116 | #endif 117 | { 118 | return [[NSString stringWithFormat:@"%@%@%u", _name, _version, _pid] hash]; 119 | } 120 | 121 | 122 | - (BOOL)sameApplicationAs:(id)anObject 123 | { 124 | if ( [_name isEqualToString:[(Process *)anObject name]] && 125 | [_version isEqualToString:[(Process *)anObject version]] ) { 126 | // they are the same application 127 | return YES; 128 | } 129 | return NO; 130 | } 131 | 132 | #pragma mark Detecting Emulation 133 | 134 | #if defined(__i386__) || defined(__x86_64__) 135 | // http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_exec_a/universal_binary_exec_a.html 136 | static int sysctlbyname_with_pid (const char *name, pid_t pid, 137 | void *oldp, size_t *oldlenp, 138 | void *newp, size_t newlen) 139 | { 140 | if (pid == 0) { 141 | if (sysctlbyname(name, oldp, oldlenp, newp, newlen) == -1) { 142 | fprintf(stderr, "sysctlbyname_with_pid(0): sysctlbyname failed:" 143 | "%s\n", strerror(errno)); 144 | return -1; 145 | } 146 | } else { 147 | int mib[CTL_MAXNAME+1]; 148 | size_t len = CTL_MAXNAME; 149 | if (sysctlnametomib(name, mib, &len) == -1) { 150 | fprintf(stderr, "sysctlbyname_with_pid: sysctlnametomib failed:" 151 | "%s\n", strerror(errno)); 152 | return -1; 153 | } 154 | mib[len] = pid; 155 | len++; 156 | if (sysctl(mib, len, oldp, oldlenp, newp, newlen) == -1) { 157 | fprintf(stderr, "sysctlbyname_with_pid: sysctl failed:" 158 | "%s\n", strerror(errno)); 159 | return -1; 160 | } 161 | } 162 | return 0; 163 | } 164 | 165 | // http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_exec_a/universal_binary_exec_a.html 166 | static int is_pid_native (pid_t pid) 167 | { 168 | int ret = 0; 169 | size_t sz = sizeof(ret); 170 | 171 | if (sysctlbyname_with_pid("sysctl.proc_native", pid, 172 | &ret, &sz, NULL, 0) == -1) { 173 | if (errno == ENOENT) { 174 | return 1; 175 | } 176 | fprintf(stderr, "is_pid_native: sysctlbyname_with_pid failed:" 177 | "%s\n", strerror(errno)); 178 | return -1; 179 | } 180 | return ret; 181 | } 182 | #endif 183 | 184 | - (BOOL)isEmulated 185 | { 186 | BOOL isEmulated = NO; 187 | #if defined(__i386__) || defined(__x86_64__) 188 | if (is_pid_native(_pid) == 0) 189 | { 190 | isEmulated = YES; 191 | } 192 | #endif 193 | 194 | return isEmulated; 195 | } 196 | 197 | #pragma mark Accessors 198 | 199 | - (NSString *)name 200 | { 201 | return _name; 202 | } 203 | 204 | - (NSString *)version 205 | { 206 | return _version; 207 | } 208 | 209 | - (NSImage *)icon 210 | { 211 | return _icon; 212 | } 213 | 214 | - (pid_t)pid 215 | { 216 | return _pid; 217 | } 218 | 219 | 220 | - (void)_setName:(NSString *)name 221 | { 222 | if ( !name ) { 223 | name = [NSString stringWithString:@"Unknown Process"]; 224 | } 225 | [name retain]; 226 | [_name release]; 227 | _name = name; 228 | } 229 | 230 | - (void)_setVersion:(NSString *)version 231 | { 232 | if ( !version ) { 233 | version = [NSString stringWithString:@"Unknown Version"]; 234 | } 235 | [version retain]; 236 | [_version release]; 237 | _version = version; 238 | } 239 | 240 | - (void)_setIcon:(NSImage *)icon 241 | { 242 | [icon retain]; 243 | [_icon release]; 244 | _icon = icon; 245 | 246 | // resize new image 247 | [_icon setScalesWhenResized:YES]; 248 | [_icon setSize:NSMakeSize(16,16)]; 249 | } 250 | 251 | - (void)_setPID:(pid_t)pid 252 | { 253 | _pid = pid; 254 | } 255 | 256 | 257 | @end 258 | -------------------------------------------------------------------------------- /CheatServer.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import "CheatServer.h" 13 | 14 | 15 | @interface CheatServer ( PrivateAPI ) 16 | 17 | // delegate methods 18 | - (void)_performDelegateSelector:(SEL)selector; 19 | - (void)_performDelegateSelector:(SEL)selector withObject:(id)object; 20 | 21 | @end 22 | 23 | 24 | @implementation CheatServer 25 | 26 | 27 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 28 | #pragma mark Initialization 29 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 30 | 31 | 32 | - (id)initWithDelegate:(id)delegate 33 | { 34 | if ( self = [super init] ) { 35 | _delegate = delegate; 36 | } 37 | return self; 38 | } 39 | 40 | - (void)dealloc 41 | { 42 | [self stop]; 43 | [super dealloc]; 44 | } 45 | 46 | 47 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 48 | #pragma mark Starting/Stopping 49 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 50 | 51 | - (BOOL)listenOnPort:(int)port broadcast:(NSString *)name 52 | { 53 | if ( [self isListening] ) { 54 | // already running 55 | return NO; 56 | } 57 | 58 | // start the server 59 | _socket = [[MySocket alloc] initWithDelegate:self]; 60 | if ( ![_socket listenOnPort:port] ) { 61 | [_socket release]; 62 | _socket = nil; 63 | return NO; 64 | } 65 | 66 | _children = [[NSMutableArray alloc] init]; 67 | 68 | _port = port; 69 | _name = [name retain]; 70 | 71 | // start the rendezvous broadcast 72 | if ( _name ) { // domain: @"local." 73 | _netService = [[NSNetService alloc] initWithDomain:@"" type:@"_cheat._tcp." name:_name port:port]; 74 | [_netService setDelegate:self]; 75 | [_netService publish]; 76 | } 77 | 78 | return YES; 79 | } 80 | 81 | - (void)stop 82 | { 83 | // close the listener 84 | [_socket disconnect]; 85 | [_socket release]; 86 | _socket = nil; 87 | 88 | // if broadcasting, stop 89 | [_netService stop]; 90 | _netService = nil; 91 | 92 | [_children release]; 93 | _children = nil; 94 | 95 | _port = 0; 96 | [_name release]; 97 | _name = nil; 98 | } 99 | 100 | 101 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 102 | #pragma mark Accessing Children 103 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 104 | 105 | 106 | - (int)childCount 107 | { 108 | return [_children count]; 109 | } 110 | 111 | - (NSArray *)children 112 | { 113 | return [NSArray arrayWithArray:_children]; 114 | } 115 | 116 | - (void)removeChildAtIndex:(unsigned)index 117 | { 118 | [_children removeObjectAtIndex:index]; 119 | } 120 | 121 | 122 | - (void)serverChildConnected:(ServerChild *)theChild 123 | { 124 | if ( [self isListening] ) { 125 | //[_children addObject:theChild]; 126 | [self _performDelegateSelector:@selector(serverChildrenChanged:)]; 127 | } 128 | } 129 | 130 | - (void)serverChildDisconnected:(ServerChild *)theChild 131 | { 132 | if ( [self isListening] ) { 133 | [_children removeObject:theChild]; 134 | [self _performDelegateSelector:@selector(serverChildrenChanged:)]; 135 | } 136 | } 137 | 138 | - (void)serverChildChanged:(ServerChild *)theChild 139 | { 140 | [self _performDelegateSelector:@selector(serverChildrenChanged:)]; 141 | } 142 | 143 | 144 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 145 | #pragma mark MySocketDelegate 146 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 147 | 148 | 149 | - (void)socket:(MySocket *)mySocket didAcceptSocket:(MySocket *)newSocket 150 | { 151 | ChazLog( @"CheatServer - MySocket accepted another one!!" ); 152 | 153 | ServerChild *child; 154 | 155 | // create a new child 156 | child = [[ServerChild alloc] initWithSocket:newSocket delegate:self]; 157 | [_children addObject:child]; 158 | [child release]; 159 | } 160 | 161 | - (void)socketDidDisconnect:(MySocket *)mySocket 162 | { 163 | ChazLog( @"CheatServer - MySocket disconnected: %p", mySocket ); 164 | [self _performDelegateSelector:@selector(serverDisconnectedUnexpectedly:)]; 165 | } 166 | 167 | 168 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 169 | #pragma mark NetService Delegate 170 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 171 | 172 | 173 | - (void)netServiceWillPublish:(NSNetService *)sender 174 | { 175 | ChazLog( @"service will publish" ); 176 | //[sender resolve]; 177 | } 178 | 179 | - (void)netService:(NSNetService *)sender didNotPublish:(NSDictionary *)errorDict 180 | { 181 | ChazLog( @"service did not publish" ); 182 | // just inform the delegate and let it decide what to do 183 | [self _performDelegateSelector:@selector(server:failedToBroadcastName:) withObject:[sender name]]; 184 | } 185 | 186 | - (void)netServiceDidStop:(NSNetService *)sender 187 | { 188 | ChazLog( @"service stopped" ); 189 | [sender release]; 190 | } 191 | 192 | 193 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 194 | #pragma mark Delegate Methods 195 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 196 | 197 | 198 | - (void)_performDelegateSelector:(SEL)selector 199 | { 200 | if ( [_delegate respondsToSelector:selector] ) { 201 | [_delegate performSelector:selector withObject:self]; 202 | } 203 | } 204 | 205 | - (void)_performDelegateSelector:(SEL)selector withObject:(id)object 206 | { 207 | if ( [_delegate respondsToSelector:selector] ) { 208 | [_delegate performSelector:selector withObject:self withObject:object]; 209 | } 210 | } 211 | 212 | 213 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 214 | #pragma mark Accessors 215 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 216 | 217 | - (BOOL)isListening 218 | { 219 | return _socket != nil; 220 | } 221 | 222 | - (NSString *)host 223 | { 224 | return [_socket localHost]; 225 | } 226 | 227 | - (int)port 228 | { 229 | return _port; 230 | } 231 | 232 | - (NSString *)broadcast 233 | { 234 | return _name; 235 | } 236 | 237 | - (id)delegate 238 | { 239 | return _delegate; 240 | } 241 | 242 | - (void)setDelegate:(id)delegate 243 | { 244 | _delegate = delegate; 245 | } 246 | 247 | 248 | @end 249 | -------------------------------------------------------------------------------- /CheatDocument.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The Cheat - The legendary universal game trainer for Mac OS X. 4 | * http://www.brokenzipper.com/trac/wiki/TheCheat 5 | * 6 | * Copyright (c) 2003-2011, Charles McGarvey et al. 7 | * 8 | * Distributable under the terms and conditions of the 2-clause BSD 9 | * license; see the file COPYING for the legal text of the license. 10 | */ 11 | 12 | #import 13 | #import "ChazLog.h" 14 | #include "cheat_global.h" 15 | 16 | #import "VariableTable.h" 17 | #import "FadeView.h" 18 | #import "MenuExtras.h" 19 | #import "StatusTextField.h" 20 | 21 | #import "CheatData.h" 22 | #import "SearchData.h" 23 | 24 | #import "LocalCheater.h" 25 | #import "RemoteCheater.h" 26 | #import "Variable.h" 27 | 28 | #import "AppController.h" 29 | 30 | 31 | typedef unsigned TCDocumentMode; 32 | enum { 33 | TCSearchMode = 0, 34 | TCCheatMode = 1 35 | }; 36 | 37 | 38 | typedef unsigned TCDocumentStatus; 39 | enum { 40 | TCIdleStatus = 0, 41 | TCSearchingStatus = 1, 42 | TCCheatingStatus = 2, 43 | TCDumpingStatus = 3 44 | }; 45 | 46 | 47 | @interface CheatDocument : NSDocument 48 | { 49 | // WINDOW INTERFACE 50 | IBOutlet NSWindow *ibWindow; 51 | IBOutlet NSPopUpButton *ibServerPopup; 52 | IBOutlet NSPopUpButton *ibProcessPopup; 53 | IBOutlet NSView *ibPlaceView; 54 | IBOutlet StatusTextField *ibStatusText; 55 | IBOutlet NSProgressIndicator *ibStatusBar; 56 | 57 | // SEARCH MODE INTERFACE 58 | IBOutlet NSView *ibSearchContentView; 59 | IBOutlet NSPopUpButton *ibSearchTypePopup; 60 | IBOutlet NSMatrix *ibSearchIntegerSignMatrix; 61 | IBOutlet NSPopUpButton *ibSearchOperatorPopup; 62 | IBOutlet NSMatrix *ibSearchValueUsedMatrix; 63 | IBOutlet NSTextField *ibSearchValueField; 64 | IBOutlet VariableTable *ibSearchVariableTable; 65 | IBOutlet NSButton *ibSearchClearButton; 66 | IBOutlet NSButton *ibSearchButton; 67 | IBOutlet NSButton *ibSearchVariableButton; 68 | 69 | // CHEAT MODE INTERFACE 70 | IBOutlet NSView *ibCheatContentView; 71 | IBOutlet NSTextField *ibCheatInfoText; 72 | IBOutlet BetterTableView *ibCheatVariableTable; 73 | IBOutlet NSButton *ibCheatRepeatButton; 74 | IBOutlet NSTextField *ibCheatRepeatAuxText; 75 | IBOutlet NSTextField *ibCheatRepeatField; 76 | IBOutlet NSButton *ibCheatButton; 77 | 78 | // PROPERTIES INTERFACE 79 | IBOutlet NSWindow *ibPropertiesSheet; 80 | IBOutlet NSTextField *ibWindowTitleField; 81 | IBOutlet NSTextField *ibCheatInfoField; 82 | 83 | // PASSWORD INTERFACE 84 | IBOutlet NSWindow *ibPasswordSheet; 85 | IBOutlet NSTextField *ibPasswordField; 86 | 87 | // CUSTOM SERVER INTERFACE 88 | IBOutlet NSWindow *ibCustomServerSheet; 89 | IBOutlet NSTextField *ibServerField; 90 | IBOutlet NSTextField *ibPortField; 91 | 92 | // EDIT VARIABLES INTERFACE 93 | IBOutlet NSWindow *ibEditVariablesSheet; 94 | IBOutlet NSTextField *ibNewValueField; 95 | 96 | NSResponder *_lastResponder; 97 | 98 | // ### IMPORTANT STUFF ### 99 | BOOL _connectsOnOpen; // set whether connects automatically on open 100 | TCDocumentMode _mode; // 'search' or 'cheat' mode 101 | FadeView *_fadeView; // facilitates the fade animation 102 | 103 | TCDocumentStatus _status; // what the user is doing 104 | BOOL _isCancelingTask; // is what the user doing being cancelled 105 | BOOL _isTargetPaused; // is the currently selected process paused 106 | 107 | id _serverObject; // the object represented by the current server 108 | Process *_process; // the currently selected process 109 | 110 | CheatData *_cheatData; // container for the document data 111 | SearchData *_searchData; // container for the search data 112 | 113 | Cheater *_cheater; // the local or remote object to handle the cheating 114 | 115 | // rendezvous support 116 | NSNetService *_resolvingService; 117 | } 118 | 119 | // ############################################################################# 120 | #pragma mark Service Finding 121 | // ############################################################################# 122 | 123 | + (NSArray *)cheatServices; 124 | 125 | // ############################################################################# 126 | #pragma mark Changing Mode 127 | // ############################################################################# 128 | 129 | // used to set the mode before the nib is loaded. 130 | // do not use after that. 131 | - (void)setMode:(TCDocumentMode)mode; 132 | 133 | // use this after the nib is loaded. 134 | - (void)switchToCheatMode; 135 | - (void)switchToSearchMode; 136 | 137 | // ############################################################################# 138 | #pragma mark Accessors 139 | // ############################################################################# 140 | 141 | - (NSString *)defaultStatusString; 142 | - (BOOL)isLoadedFromFile; 143 | 144 | - (void)addServer:(NSMenuItem *)item; 145 | - (void)removeServerWithObject:(id)serverObject; 146 | 147 | // ############################################################################# 148 | #pragma mark Interface 149 | // ############################################################################# 150 | 151 | - (void)updateInterface; 152 | - (void)setDocumentChanged; 153 | 154 | - (void)setActualResults:(unsigned)count; 155 | 156 | // ############################################################################# 157 | #pragma mark Utility 158 | // ############################################################################# 159 | 160 | + (void)setGlobalTarget:(Process *)target; 161 | + (Process *)globalTarget; 162 | 163 | - (void)showError:(NSString *)error; 164 | 165 | // this doesn't update the interface 166 | // so explicitly call updateInterface after use. 167 | - (BOOL)shouldConnectWithServer:(NSMenuItem *)item; 168 | - (void)selectConnectedCheater; 169 | - (void)connectWithServer:(NSMenuItem *)item; 170 | - (void)disconnectFromCheater; 171 | 172 | - (void)setConnectOnOpen:(BOOL)flag; 173 | - (void)connectWithURL:(NSString *)url; 174 | 175 | - (void)watchVariables; 176 | 177 | 178 | @end 179 | 180 | 181 | // ############################################################################# 182 | 183 | @interface CheatDocument ( DocInterfaceActions ) 184 | 185 | - (IBAction)ibSetLocalCheater:(id)sender; 186 | - (IBAction)ibSetRemoteCheater:(id)sender; 187 | - (IBAction)ibSetCustomCheater:(id)sender; 188 | - (IBAction)ibSetNoCheater:(id)sender; 189 | 190 | - (IBAction)ibSetProcess:(id)sender; 191 | 192 | - (IBAction)ibSetVariableType:(id)sender; 193 | - (IBAction)ibSetIntegerSign:(id)sender; 194 | - (IBAction)ibSetOperator:(id)sender; 195 | - (IBAction)ibSetValueUsed:(id)sender; 196 | 197 | - (IBAction)ibClearSearch:(id)sender; 198 | - (IBAction)ibSearch:(id)sender; 199 | - (IBAction)ibAddSearchVariable:(id)sender; 200 | 201 | - (IBAction)ibSetCheatRepeats:(id)sender; 202 | - (IBAction)ibSetRepeatInterval:(id)sender; 203 | - (IBAction)ibCheat:(id)sender; 204 | 205 | - (IBAction)ibRunPropertiesSheet:(id)sender; 206 | - (IBAction)ibEndPropertiesSheet:(id)sender; 207 | 208 | - (IBAction)ibRunPasswordSheet:(id)sender; 209 | - (IBAction)ibEndPasswordSheet:(id)sender; 210 | 211 | - (IBAction)ibRunCustomServerSheet:(id)sender; 212 | - (IBAction)ibEndCustomServerSheet:(id)sender; 213 | 214 | - (IBAction)ibRunEditVariablesSheet:(id)sender; 215 | - (IBAction)ibEndEditVariablesSheet:(id)sender; 216 | 217 | - (IBAction)ibPauseTarget:(id)sender; 218 | - (IBAction)ibResumeTarget:(id)sender; 219 | 220 | - (IBAction)ibCancelSearch:(id)sender; 221 | - (IBAction)ibStopCheat:(id)sender; 222 | 223 | - (IBAction)ibDumpMemory:(id)sender; 224 | - (IBAction)ibCancelDump:(id)sender; 225 | 226 | - (IBAction)ibAddCheatVariable:(id)sender; 227 | - (IBAction)ibSetVariableEnabled:(id)sender; 228 | 229 | - (IBAction)ibToggleSearchCheat:(id)sender; 230 | 231 | - (IBAction)ibUndo:(id)sender; 232 | - (IBAction)ibRedo:(id)sender; 233 | 234 | @end 235 | 236 | 237 | // ############################################################################# 238 | 239 | @interface CheatDocument ( DocCheaterDelegate ) < CheaterDelegate > 240 | 241 | @end 242 | 243 | -------------------------------------------------------------------------------- /English.lproj/MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBClasses 6 | 7 | 8 | ACTIONS 9 | 10 | ibAddCheatVariable 11 | id 12 | ibAddSearchVariable 13 | id 14 | ibCancelDump 15 | id 16 | ibCancelSearch 17 | id 18 | ibCheat 19 | id 20 | ibClearSearch 21 | id 22 | ibDumpMemory 23 | id 24 | ibEndCustomServerSheet 25 | id 26 | ibEndEditVariablesSheet 27 | id 28 | ibEndPasswordSheet 29 | id 30 | ibEndPropertiesSheet 31 | id 32 | ibPauseTarget 33 | id 34 | ibRedo 35 | id 36 | ibResumeTarget 37 | id 38 | ibRunCustomServerSheet 39 | id 40 | ibRunEditVariablesSheet 41 | id 42 | ibRunPasswordSheet 43 | id 44 | ibRunPropertiesSheet 45 | id 46 | ibSearch 47 | id 48 | ibSetCheatRepeats 49 | id 50 | ibSetCustomCheater 51 | id 52 | ibSetIntegerSign 53 | id 54 | ibSetLocalCheater 55 | id 56 | ibSetNoCheater 57 | id 58 | ibSetOperator 59 | id 60 | ibSetProcess 61 | id 62 | ibSetRemoteCheater 63 | id 64 | ibSetRepeatInterval 65 | id 66 | ibSetValueUsed 67 | id 68 | ibSetVariableEnabled 69 | id 70 | ibSetVariableType 71 | id 72 | ibStopCheat 73 | id 74 | ibToggleSearchCheat 75 | id 76 | ibUndo 77 | id 78 | 79 | CLASS 80 | CheatDocument 81 | LANGUAGE 82 | ObjC 83 | OUTLETS 84 | 85 | ibCheatButton 86 | NSButton 87 | ibCheatContentView 88 | NSView 89 | ibCheatInfoField 90 | NSTextField 91 | ibCheatInfoText 92 | NSTextField 93 | ibCheatRepeatAuxText 94 | NSTextField 95 | ibCheatRepeatButton 96 | NSButton 97 | ibCheatRepeatField 98 | NSTextField 99 | ibCheatVariableTable 100 | BetterTableView 101 | ibCustomServerSheet 102 | NSWindow 103 | ibEditVariablesSheet 104 | NSWindow 105 | ibNewValueField 106 | NSTextField 107 | ibPasswordField 108 | NSTextField 109 | ibPasswordSheet 110 | NSWindow 111 | ibPlaceView 112 | NSView 113 | ibPortField 114 | NSTextField 115 | ibProcessPopup 116 | NSPopUpButton 117 | ibPropertiesSheet 118 | NSWindow 119 | ibSearchButton 120 | NSButton 121 | ibSearchClearButton 122 | NSButton 123 | ibSearchContentView 124 | NSView 125 | ibSearchIntegerSignMatrix 126 | NSMatrix 127 | ibSearchOperatorPopup 128 | NSPopUpButton 129 | ibSearchTypePopup 130 | NSPopUpButton 131 | ibSearchValueField 132 | NSTextField 133 | ibSearchValueUsedMatrix 134 | NSMatrix 135 | ibSearchVariableButton 136 | NSButton 137 | ibSearchVariableTable 138 | VariableTable 139 | ibServerField 140 | NSTextField 141 | ibServerPopup 142 | NSPopUpButton 143 | ibStatusBar 144 | NSProgressIndicator 145 | ibStatusText 146 | StatusTextField 147 | ibWindow 148 | NSWindow 149 | ibWindowTitleField 150 | NSTextField 151 | 152 | SUPERCLASS 153 | NSDocument 154 | 155 | 156 | CLASS 157 | BetterTableView 158 | LANGUAGE 159 | ObjC 160 | SUPERCLASS 161 | NSTableView 162 | 163 | 164 | CLASS 165 | NSMenu 166 | LANGUAGE 167 | ObjC 168 | SUPERCLASS 169 | NSObject 170 | 171 | 172 | CLASS 173 | StatusTextField 174 | LANGUAGE 175 | ObjC 176 | SUPERCLASS 177 | NSTextField 178 | 179 | 180 | ACTIONS 181 | 182 | ibAddCheatVariable 183 | id 184 | ibCancelSearch 185 | id 186 | ibClearSearch 187 | id 188 | ibDumpMemory 189 | id 190 | ibPauseTarget 191 | id 192 | ibRedo 193 | id 194 | ibRunEditVariablesSheet 195 | id 196 | ibRunPropertiesSheet 197 | id 198 | ibToggleSearchCheat 199 | id 200 | ibUndo 201 | id 202 | 203 | CLASS 204 | FirstResponder 205 | LANGUAGE 206 | ObjC 207 | SUPERCLASS 208 | NSObject 209 | 210 | 211 | CLASS 212 | NSObject 213 | LANGUAGE 214 | ObjC 215 | 216 | 217 | CLASS 218 | VariableTable 219 | LANGUAGE 220 | ObjC 221 | SUPERCLASS 222 | BetterTableView 223 | 224 | 225 | ACTIONS 226 | 227 | checkForUpdate 228 | id 229 | launchEmailMenu 230 | id 231 | launchHelpFile 232 | id 233 | launchWebsiteMenu 234 | id 235 | newBlankCheatWindow 236 | id 237 | newSearchWindow 238 | id 239 | showAboutBoxWindow 240 | id 241 | showPreferenceWindow 242 | id 243 | 244 | CLASS 245 | AppController 246 | LANGUAGE 247 | ObjC 248 | SUPERCLASS 249 | NSApplication 250 | 251 | 252 | IBVersion 253 | 1 254 | 255 | 256 | --------------------------------------------------------------------------------