2 // **********************************************************************
3 // The Cheat - A universal game cheater for Mac OS X
4 // (C) 2003-2005 Chaz McGarvey (BrokenZipper)
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 1, or (at your option)
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #import "cheat_global.h"
23 #import <Carbon/Carbon.h>
27 float gFadeAnimationDuration
= TCDefaultFadeAnimation
;
30 // user default constants
31 NSString
*TCFirstLaunchPref
= nil;
32 NSString
*TCWindowsOnTopPref
= @
"TCWindowsOnTopPref";
33 NSString
*TCUpdateCheckPref
= @
"TCUpdateCheckPref";
34 NSString
*TCDisplayValuesPref
= @
"TCDisplayValuesPref";
35 NSString
*TCValueUpdatePref
= @
"TCValueUpdatePref";
36 NSString
*TCHitsDisplayedPref
= @
"TCHitsDisplayedPref";
37 NSString
*TCRunServerPref
= @
"TCRunServerPref";
38 NSString
*TCBroadcastNamePref
= @
"TCBroadcastNamePref";
39 NSString
*TCListenPortPref
= @
"TCListenPortPref";
40 NSString
*TCFadeAnimationPref
= @
"TCFadeAnimationPref";
41 NSString
*TCAskForSavePref
= @
"TCAskForSavePref";
42 NSString
*TCSwitchVariablesPref
= @
"TCSwitchVariablesPref";
43 NSString
*TCAutoStartEditingVarsPref
= @
"TCAutoStartEditingVarsPref";
46 // notification constants
47 NSString
*TCServiceFoundNote
= @
"TCServiceFoundNote";
48 NSString
*TCServiceRemovedNote
= @
"TCServiceRemovedNote";
49 NSString
*TCServerStartedNote
= @
"TCServerStartedNote";
50 NSString
*TCServerStoppedNote
= @
"TCServerStoppedNote";
51 NSString
*TCServerConnectionsChangedNote
= @
"TCServerConnectionsChangedNote";
52 NSString
*TCWindowsOnTopChangedNote
= @
"TCWindowsOnTopChangedNote";
53 NSString
*TCDisplayValuesChangedNote
= @
"TCDisplayValuesChangedNote";
54 NSString
*TCHitsDisplayedChangedNote
= @
"TCHitsDisplayedChangedNote";
59 [[NSWorkspace sharedWorkspace
] openURL
:[NSURL URLWithString
:@
"http://www.brokenzipper.com/"]];
64 //[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"mailto:chaz@brokenzipper.com?subject=The%20Cheat%20Feedback"]];
65 /* Ed Palma will act as a contact person for The Cheat. */
66 [[NSWorkspace sharedWorkspace
] openURL
:[NSURL URLWithString
:@
"http://www.brokenzipper.com/contact.html"]];
72 SInt32
static version
= -1;
74 if ( version
!= -1 ) {
79 if ( Gestalt( gestaltSystemVersion
, &version
) != noErr
) {
85 NSString
*ApplicationVersion( NSString
*appPath
)
87 NSString
*tVersion
= nil;
88 NSBundle
*tBundle
= [NSBundle bundleWithPath
:appPath
];
91 NSDictionary
*tInfoDictionary
;
93 tInfoDictionary
= [tBundle infoDictionary
];
95 if ( tInfoDictionary
) {
96 tVersion
= [tInfoDictionary objectForKey
:@
"CFBundleShortVersionString"];
98 tVersion
= [tInfoDictionary objectForKey
:@
"CFBundleVersion"];
103 CFBundleRef tBundleRef
;
106 tBundleRef
= CFBundleCreate( NULL
, (CFURLRef
)[NSURL fileURLWithPath
:appPath
] );
109 resNum
= CFBundleOpenBundleResourceMap( tBundleRef
);
113 VersRecHndl tVersionHandle
;
114 unsigned long tNumVersion
;
116 tVersionHandle
= (VersRecHndl
)Get1IndResource( 'vers', 1 );
118 if ( tVersionHandle
) {
119 tNumVersion
= *((unsigned long *) &((*tVersionHandle
)->numericVersion
));
121 if ( (tNumVersion
& 0x00040000) != 0 ) {
122 tVersion
= [NSString stringWithFormat
:@
"%d.%d.%d", (tNumVersion
& 0xFF000000)>>24, (tNumVersion
& 0x00F00000)>>20, (tNumVersion
& 0x000F0000)>>16];
125 tVersion
= [NSString stringWithFormat
:@
"%d.%d", (tNumVersion
& 0xFF000000)>>24, (tNumVersion
& 0x00F00000)>>20];
131 CFBundleCloseBundleResourceMap( tBundleRef
, resNum
);
133 CFRelease( tBundleRef
);