Page 2 of 4

Re: Update to swordedit

Posted: Fri Apr 23, 2010 9:34 pm
by kiddten
only windows. lets hope noone else gets the same error

Re: Update to swordedit

Posted: Fri Apr 23, 2010 9:37 pm
by Samuco
It's probably because of PPC. You'll have to ask nil about this one.
Anyone else get that error?

Re: Update to swordedit

Posted: Fri Apr 23, 2010 10:09 pm
by nil
I got a kernel panic on my PPC. I haven't tested it out on an intel. Be careful, peoples.

I don't know what to make of that error message. Do you do anything bizarre after the application launches? It helps if you post the source code, too.

Re: Update to swordedit

Posted: Fri Apr 23, 2010 10:42 pm
by Samuco
Well, it asks for an admin password. Here's the nib code:

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];
		}
	}
	
}

Re: Update to swordedit

Posted: Fri Apr 23, 2010 10:44 pm
by Samuco
It also attempts to load vehicles. Were you hosting a game when you opened it?

Re: Update to swordedit

Posted: Fri Apr 23, 2010 11:23 pm
by kiddten
i wasn't running anything but finder and firefox.

Re: Update to swordedit

Posted: Sat Apr 24, 2010 1:37 am
by Samuco
Try it with this condition:
1. Halo demo open
2. Hosting your own game

Have you got an intel computer nil?

Re: Update to swordedit

Posted: Sat Apr 24, 2010 1:52 am
by kiddten
with halo open it doesn't kernel panic. interesting. thank you.

Re: Update to swordedit

Posted: Sat Apr 24, 2010 1:56 am
by Samuco
Here's my theory: When the kernel tries to read the memory of a non-existant program, the computer gets confused. Snow Leopard is smarter, and doesn't really mind.
Try hosting a game (if you tell me the name and password, ill join :)) and test whether live swordedit works.

Re: Update to swordedit

Posted: Sat Apr 24, 2010 6:27 am
by 2310
Awesome! I would imagine this could be used to test secret areas of a map that would otherwise need complex steps to get to. It could also be used to objectively observe live player behavior on maps, especially for balancing asymmetrical maps.

Re: Update to swordedit

Posted: Sat Apr 24, 2010 7:26 am
by Fonzeh
This...

Is WHAT IM TALKING ABOUT!

Also, if you could build a feature that allows you to fly around the map while the other players continue playing, that'd be perfect.

Re: Update to swordedit

Posted: Sat Apr 24, 2010 9:44 am
by nil
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.

Code: Select all

//Set the process ID
haloProcessID = 1675;
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.

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.

Re: Update to swordedit

Posted: Sat Apr 24, 2010 9:52 am
by dirk
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.

Code: Select all

//Set the process ID
haloProcessID = 1675;
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.

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.
We need to see the whole thing to be able to tell why it is crashing.

----
Source was released under GPL,
http://code.google.com/p/swordedit/

You need to release the source, I remember that beta code from when sword originally posted it for the collective to test.

Re: Update to swordedit

Posted: Sat Apr 24, 2010 9:57 am
by nil
One more thing - you should have haloProcessID be 0 when Halo Demo is not running. I'd guess that reading/writing to a PID of 0 won't cause the kernel to be mad, though of course, you should make all efforts against reading/writing to something that isn't open anyway.

Re: Update to swordedit

Posted: Sat Apr 24, 2010 10:05 am
by dirk
One more thing, someone needs to learn how to use GDB:

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) 
I did not experience a kernel panic when running the PPC version on my Intel mac and I think only because I was running it in GDB at the time.