3 * The Cheat - The legendary universal game trainer for Mac OS X.
4 * http://www.brokenzipper.com/trac/wiki/TheCheat
6 * Copyright (c) 2003-2011, Charles McGarvey et al.
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.
12 #import "cheat_global.h"
14 #import <Carbon/Carbon.h>
18 float gFadeAnimationDuration
= TCDefaultFadeAnimation
;
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";
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";
50 [[NSWorkspace sharedWorkspace
] openURL
:[NSURL URLWithString
:@
"http://www.brokenzipper.com/"]];
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"]];
63 SInt32
static version
= -1;
65 if ( version
!= -1 ) {
70 if ( Gestalt( gestaltSystemVersion
, &version
) != noErr
) {
76 NSString
*ApplicationVersion( NSString
*appPath
)
78 NSString
*tVersion
= nil;
79 NSBundle
*tBundle
= [NSBundle bundleWithPath
:appPath
];
82 NSDictionary
*tInfoDictionary
;
84 tInfoDictionary
= [tBundle infoDictionary
];
86 if ( tInfoDictionary
) {
87 tVersion
= [tInfoDictionary objectForKey
:@
"CFBundleShortVersionString"];
89 tVersion
= [tInfoDictionary objectForKey
:@
"CFBundleVersion"];
94 CFBundleRef tBundleRef
;
97 tBundleRef
= CFBundleCreate( NULL
, (CFURLRef
)[NSURL fileURLWithPath
:appPath
] );
100 resNum
= CFBundleOpenBundleResourceMap( tBundleRef
);
104 VersRecHndl tVersionHandle
;
105 unsigned long tNumVersion
;
107 tVersionHandle
= (VersRecHndl
)Get1IndResource( 'vers', 1 );
109 if ( tVersionHandle
) {
110 tNumVersion
= *((unsigned long *) &((*tVersionHandle
)->numericVersion
));
112 if ( (tNumVersion
& 0x00040000) != 0 ) {
113 tVersion
= [NSString stringWithFormat
:@
"%d.%d.%d", (tNumVersion
& 0xFF000000)>>24, (tNumVersion
& 0x00F00000)>>20, (tNumVersion
& 0x000F0000)>>16];
116 tVersion
= [NSString stringWithFormat
:@
"%d.%d", (tNumVersion
& 0xFF000000)>>24, (tNumVersion
& 0x00F00000)>>20];
122 CFBundleCloseBundleResourceMap( tBundleRef
, resNum
);
124 CFRelease( tBundleRef
);