Re: Update to swordedit
Posted: Fri Apr 23, 2010 9:34 pm
only windows. lets hope noone else gets the same error
Your source for Mac game mods.
http://www.macgamingmods.com/forum/
http://www.macgamingmods.com/forum/viewtopic.php?f=101&t=13289
Code: Select all
- (void)awakeFromNib
{
//Set the process ID
haloProcessID = 1675;
BOOL needsAuthorizationCheck = YES;
#ifdef __ppc__
// PPC machines whose operating system is below leopard do not need authorization
SInt32 osxMinorVersion;
Gestalt(gestaltSystemVersionMinor, &osxMinorVersion);
if (osxMinorVersion < 5)
{
needsAuthorizationCheck = NO;
}
#endif
if (needsAuthorizationCheck)
{
if (amIWorthy())
{
// when the app restarts from asking the user his adminstator's password, the app isn't activated for some reason, so we'll activate it
//[NSApp activateIgnoringOtherApps:YES];
#ifndef _DEBUG
// if we don't print this, the old instance of the app will stll be alive. this behavior is wanted in debug mode because xcode's debugger will remain opened
printf("Don't forget to flush! ;-) "); // signal back to close caller
#endif
fflush(stdout);
[NSApp setDelegate:self];
/* Beta experation code */
NSString *nowString = [NSString stringWithUTF8String:__DATE__];
NSCalendarDate *nowDate = [NSCalendarDate dateWithNaturalLanguageString:nowString];
NSCalendarDate *expireDate = [nowDate addTimeInterval:(60 * 60 * 24 * 10)];
/*if ([expireDate earlierDate:[NSDate date]] == expireDate)
{
NSRunAlertPanel(@"Beta Expired!",@"Your swordedit beta has expired!",@"Oh woes me!", nil, nil);
[[NSApplication sharedApplication] terminate:self];
}
else
{
NSRunAlertPanel(@"Welcome to the beta.", [[NSString stringWithString:@"swordedit beta expires on "] stringByAppendingString:[expireDate description]], @"I feel blessed!", nil, nil);
}*/
/* End beta experation code */
userDefaults = [NSUserDefaults standardUserDefaults];
[self loadPrefs];
if (!bitmapFilePath)
{
[self selectBitmapLocation];
}
[mainWindow makeKeyAndOrderFront:self];
//[mainWindow center];
NSString *autoa = [NSString stringWithContentsOfFile:@"/tmp/starlight.auto"];
if (autoa)
{
NSArray *settings = [autoa componentsSeparatedByString:@","];
NSString *pat = [settings objectAtIndex:0];
if ([[NSFileManager defaultManager] fileExistsAtPath:pat])
{
//[selecte center];
//[selecte makeKeyAndOrderFront:nil];
[[NSApplication sharedApplication] beginSheet:selecte modalForWindow:[rendView window] modalDelegate:self didEndSelector:nil contextInfo:self];
[tpro setUsesThreadedAnimation:YES];
[tpro startAnimation:nil];
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(LoadMaps:) userInfo:pat repeats:NO];
}
}
}
else
{
extern char *gExecutablePath;
authMe(gExecutablePath);
[[NSApplication sharedApplication] terminate:nil];
}
}
}
Code: Select all
//Set the process ID
haloProcessID = 1675;
We need to see the whole thing to be able to tell why it is crashing.nil wrote:It'd be easier if you uploaded the source code (and presumably the Xcode project) as you should, whenever you release a new build to the public, anyway. I can only see what's occurring in the one method you posted.
This logic is completely wrong? The PID isn't always the same, and it would rarely be a random number like 1675. Perhaps you're grabbing the PID elsewhere in your program, but I can't tell from what you've posted. In any case, that code should be omitted.Code: Select all
//Set the process ID haloProcessID = 1675;
Also, you can't assume Halo Demo is open when the user opens swordedit, nor can you assume once it's open that it won't be relaunched. You will need to keep track of when Halo Demo launches and terminates and grab the new PID in those situations, and be able to handle when Halo Demo isn't running.
Code: Select all
2010-04-24 14:03:26.554 swordedit[10606:e07] *** WARNING: Method selectRow:byExtendingSelection: in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000008
0x00012749 in -[RenderView applicationWillTerminate:] ()
(gdb)