mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-06-01 02:41:30 +00:00
Hex editor now edits hex, NovaTools touched up
This commit is contained in:
parent
58db8daf9b
commit
bc2c081e61
|
@ -13,6 +13,7 @@
|
|||
|
||||
if( [type length] == 4 && [[resIDView stringValue] length] > 0 )
|
||||
{
|
||||
// I could use +[Resource resourceOfType:andID:inDocument:] != nil, but that would be much slower
|
||||
Resource *resource;
|
||||
NSEnumerator *enumerator = [[[document dataSource] resources] objectEnumerator];
|
||||
while( resource = [enumerator nextObject] )
|
||||
|
|
|
@ -2,21 +2,6 @@
|
|||
#import "ResourceDocument.h"
|
||||
#import "ResourceDataSource.h"
|
||||
|
||||
// should these be above or below "@implementation Resource" ?
|
||||
NSString *ResourceWillChangeNotification = @"ResourceWillChangeNotification";
|
||||
NSString *ResourceNameWillChangeNotification = @"ResourceNameWillChangeNotification";
|
||||
NSString *ResourceTypeWillChangeNotification = @"ResourceTypeWillChangeNotification";
|
||||
NSString *ResourceIDWillChangeNotification = @"ResourceIDWillChangeNotification";
|
||||
NSString *ResourceAttributesWillChangeNotification = @"ResourceAttributesWillChangeNotification";
|
||||
NSString *ResourceDataWillChangeNotification = @"ResourceDataWillChangeNotification";
|
||||
|
||||
NSString *ResourceNameDidChangeNotification = @"ResourceNameDidChangeNotification";
|
||||
NSString *ResourceTypeDidChangeNotification = @"ResourceTypeDidChangeNotification";
|
||||
NSString *ResourceIDDidChangeNotification = @"ResourceIDDidChangeNotification";
|
||||
NSString *ResourceAttributesDidChangeNotification = @"ResourceAttributesDidChangeNotification";
|
||||
NSString *ResourceDataDidChangeNotification = @"ResourceDataDidChangeNotification";
|
||||
NSString *ResourceDidChangeNotification = @"ResourceDidChangeNotification";
|
||||
|
||||
@implementation Resource
|
||||
|
||||
- (id)init
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
IBOutlet NSWindow *mainWindow;
|
||||
IBOutlet NSOutlineView *outlineView;
|
||||
|
||||
NSMutableDictionary *toolbarItems;
|
||||
NSMutableArray *resources;
|
||||
HFSUniStr255 *fork; // name of fork to save to, usually empty string (data fork) or 'RESOURCE_FORK' as returned from FSGetResourceForkName()
|
||||
NSString *creator;
|
||||
|
|
|
@ -15,6 +15,7 @@ NSString *DocumentInfoDidChangeNotification = @"DocumentInfoDidChangeNotificat
|
|||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
toolbarItems = [[NSMutableDictionary alloc] init];
|
||||
resources = [[NSMutableArray alloc] init];
|
||||
fork = nil;
|
||||
return self;
|
||||
|
@ -25,6 +26,7 @@ NSString *DocumentInfoDidChangeNotification = @"DocumentInfoDidChangeNotificat
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
if( fork ) DisposePtr( (Ptr) fork );
|
||||
[resources release];
|
||||
[toolbarItems release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -119,6 +121,69 @@ static NSString *RKShowInfoItemIdentifier = @"com.nickshanks.resknife.toolbar.sh
|
|||
{
|
||||
/* This routine should become invalid once toolbars are integrated into nib files */
|
||||
|
||||
NSToolbarItem *item;
|
||||
[toolbarItems removeAllObjects]; // just in case this method is called more than once per document (which it shouldn't be!)
|
||||
|
||||
item = [[NSToolbarItem alloc] initWithItemIdentifier:RKCreateItemIdentifier];
|
||||
[item setLabel:NSLocalizedString(@"Create", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Create", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Create New Resource", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Create"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(showCreateResourceSheet:)];
|
||||
[toolbarItems setObject:item forKey:RKCreateItemIdentifier];
|
||||
[item release];
|
||||
|
||||
item = [[NSToolbarItem alloc] initWithItemIdentifier:RKDeleteItemIdentifier];
|
||||
[item setLabel:NSLocalizedString(@"Delete", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Delete", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Delete Selected Resource", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Delete"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(clear:)];
|
||||
[toolbarItems setObject:item forKey:RKDeleteItemIdentifier];
|
||||
[item release];
|
||||
|
||||
item = [[NSToolbarItem alloc] initWithItemIdentifier:RKEditItemIdentifier];
|
||||
[item setLabel:NSLocalizedString(@"Edit", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Edit", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Edit Resource In Default Editor", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Edit"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(openResources:)];
|
||||
[toolbarItems setObject:item forKey:RKEditItemIdentifier];
|
||||
[item release];
|
||||
|
||||
item = [[NSToolbarItem alloc] initWithItemIdentifier:RKEditHexItemIdentifier];
|
||||
[item setLabel:NSLocalizedString(@"Edit Hex", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Edit Hex", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Edit Resource As Hexadecimal", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Edit Hex"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(openResourcesAsHex:)];
|
||||
[toolbarItems setObject:item forKey:RKEditHexItemIdentifier];
|
||||
[item release];
|
||||
|
||||
item = [[NSToolbarItem alloc] initWithItemIdentifier:RKSaveItemIdentifier];
|
||||
[item setLabel:NSLocalizedString(@"Save", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Save", nil)];
|
||||
[item setToolTip:[NSString stringWithFormat:NSLocalizedString(@"Save To %@ Fork", nil), !fork? NSLocalizedString(@"Data", nil) : NSLocalizedString(@"Resource", nil)]];
|
||||
[item setImage:[NSImage imageNamed:@"Save"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(saveDocument:)];
|
||||
[toolbarItems setObject:item forKey:RKSaveItemIdentifier];
|
||||
[item release];
|
||||
|
||||
item = [[NSToolbarItem alloc] initWithItemIdentifier:RKShowInfoItemIdentifier];
|
||||
[item setLabel:NSLocalizedString(@"Show Info", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Show Info", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Show Resource Information Window", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Show Info"]];
|
||||
[item setTarget:[NSApp delegate]];
|
||||
[item setAction:@selector(showInfo:)];
|
||||
[toolbarItems setObject:item forKey:RKShowInfoItemIdentifier];
|
||||
[item release];
|
||||
|
||||
if( [windowController window] == mainWindow )
|
||||
{
|
||||
NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier:RKToolbarIdentifier] autorelease];
|
||||
|
@ -129,77 +194,15 @@ static NSString *RKShowInfoItemIdentifier = @"com.nickshanks.resknife.toolbar.sh
|
|||
[toolbar setAllowsUserCustomization:YES];
|
||||
[toolbar setDisplayMode:NSToolbarDisplayModeDefault];
|
||||
|
||||
// attach toolbar to window
|
||||
// attach toolbar to window
|
||||
[toolbar setDelegate:self];
|
||||
[mainWindow setToolbar:toolbar];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
|
||||
{
|
||||
NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier] autorelease];
|
||||
|
||||
if( [itemIdentifier isEqualToString:RKCreateItemIdentifier] )
|
||||
{
|
||||
[item setLabel:NSLocalizedString(@"Create", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Create", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Create New Resource", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Create"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(showCreateResourceSheet:)];
|
||||
return item;
|
||||
}
|
||||
else if( [itemIdentifier isEqualToString:RKDeleteItemIdentifier] )
|
||||
{
|
||||
[item setLabel:NSLocalizedString(@"Delete", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Delete", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Delete Selected Resource", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Delete"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(clear:)];
|
||||
return item;
|
||||
}
|
||||
else if( [itemIdentifier isEqualToString:RKEditItemIdentifier] )
|
||||
{
|
||||
[item setLabel:NSLocalizedString(@"Edit", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Edit", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Edit Resource In Default Editor", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Edit"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(openResources:)];
|
||||
return item;
|
||||
}
|
||||
else if( [itemIdentifier isEqualToString:RKEditHexItemIdentifier] )
|
||||
{
|
||||
[item setLabel:NSLocalizedString(@"Edit Hex", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Edit Hex", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Edit Resource As Hexadecimal", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Edit Hex"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(openResourcesAsHex:)];
|
||||
return item;
|
||||
}
|
||||
else if( [itemIdentifier isEqualToString:RKSaveItemIdentifier] )
|
||||
{
|
||||
[item setLabel:NSLocalizedString(@"Save", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Save", nil)];
|
||||
[item setToolTip:[NSString stringWithFormat:NSLocalizedString(@"Save To %@ Fork", nil), !fork? NSLocalizedString(@"Data", nil) : NSLocalizedString(@"Resource", nil)]];
|
||||
[item setImage:[NSImage imageNamed:@"Save"]];
|
||||
[item setTarget:self];
|
||||
[item setAction:@selector(saveDocument:)];
|
||||
return item;
|
||||
}
|
||||
else if( [itemIdentifier isEqualToString:RKShowInfoItemIdentifier] )
|
||||
{
|
||||
[item setLabel:NSLocalizedString(@"Show Info", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Show Info", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Show Resource Information Window", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"Show Info"]];
|
||||
[item setTarget:[NSApp delegate]];
|
||||
[item setAction:@selector(showInfo:)];
|
||||
return item;
|
||||
}
|
||||
else return nil;
|
||||
return [toolbarItems objectForKey:itemIdentifier];
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
|
||||
|
|
Binary file not shown.
|
@ -3,14 +3,14 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>248 107 356 240 0 0 1024 746 </string>
|
||||
<string>279 92 422 584 0 0 1152 848 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<string>263.2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>6</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q45</string>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Binary file not shown.
|
@ -11,6 +11,8 @@
|
|||
IBOutlet NSTextView *hex;
|
||||
IBOutlet NSTextView *offset;
|
||||
IBOutlet NSTextField *message;
|
||||
|
||||
BOOL editedLow;
|
||||
}
|
||||
|
||||
- (NSString *)offsetRepresentation:(NSData *)data;
|
||||
|
@ -25,4 +27,7 @@
|
|||
- (NSTextView *)hex;
|
||||
- (NSTextView *)ascii;
|
||||
|
||||
- (BOOL)editedLow;
|
||||
- (void)setEditedLow:(BOOL)flag;
|
||||
|
||||
@end
|
|
@ -5,6 +5,13 @@
|
|||
|
||||
@implementation HexEditorDelegate
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if( self ) editedLow = NO;
|
||||
return self;
|
||||
}
|
||||
|
||||
/* data re-representation methods */
|
||||
|
||||
- (NSString *)offsetRepresentation:(NSData *)data;
|
||||
|
@ -207,4 +214,14 @@
|
|||
return ascii;
|
||||
}
|
||||
|
||||
- (BOOL)editedLow
|
||||
{
|
||||
return editedLow;
|
||||
}
|
||||
|
||||
- (void)setEditedLow:(BOOL)flag
|
||||
{
|
||||
editedLow = flag;
|
||||
}
|
||||
|
||||
@end
|
|
@ -52,8 +52,8 @@
|
|||
newRange.location += 3;
|
||||
}
|
||||
|
||||
// select return character if selecting ascii
|
||||
else if( self == (id) [[self delegate] ascii] )
|
||||
// select return character if selecting ascii - no longer necessary as there's a one-to-one for ascii
|
||||
/* else if( self == (id) [[self delegate] ascii] )
|
||||
{
|
||||
// if ascii selection goes up to sixteenth byte on last line, select return character too
|
||||
if( (charRange.length + charRange.location) % 17 == 16)
|
||||
|
@ -70,60 +70,78 @@
|
|||
else newRange.length += 1;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
// call the superclass to update the selection
|
||||
[super setSelectedRange:newRange affinity:affinity stillSelecting:NO];
|
||||
}
|
||||
|
||||
/* NSResponder overrides */
|
||||
|
||||
- (IBAction)insertText:(NSString *)string
|
||||
- (void)insertText:(NSString *)string
|
||||
{
|
||||
NSLog( @"Inserting text: %@", string );
|
||||
/* if( hexWindow->editingHex ) // editing in hexadecimal
|
||||
NSRange selection = [self rangeForUserTextChange], byteSelection;
|
||||
NSMutableData *data = [[[[self window] windowController] data] mutableCopy];
|
||||
NSData *replaceData = [NSData dataWithBytes:[string cString] length:[string cStringLength]];
|
||||
|
||||
// get selection range
|
||||
if( self == (id) [[self delegate] hex] )
|
||||
byteSelection = [[self delegate] byteRangeFromHexRange:selection];
|
||||
else if( self == (id) [[self delegate] ascii] )
|
||||
byteSelection = [[self delegate] byteRangeFromAsciiRange:selection];
|
||||
else
|
||||
{
|
||||
Boolean deletePrev = false; // delete prev typing to add new one
|
||||
if( hexWindow->editedHigh ) // edited high bits already
|
||||
{
|
||||
// shift typed char into high bits and add new low char
|
||||
if( charCode >= 0x30 && charCode <= 0x39 ) charCode -= 0x30; // 0 to 9
|
||||
else if( charCode >= 0x61 && charCode <= 0x66 ) charCode -= 0x57; // a to f
|
||||
else if( charCode >= 0x93 && charCode <= 0x98 ) charCode -= 0x8A; // A to F
|
||||
else break;
|
||||
hexWindow->hexChar <<= 4; // store high bit
|
||||
hexWindow->hexChar += charCode & 0x0F; // add low bit
|
||||
hexWindow->selStart += 1;
|
||||
hexWindow->selEnd = hexWindow->selStart;
|
||||
hexWindow->editedHigh = false;
|
||||
deletePrev = true;
|
||||
}
|
||||
else // editing low bits
|
||||
{
|
||||
// put typed char into low bits
|
||||
if( charCode >= 0x30 && charCode <= 0x39 ) charCode -= 0x30; // 0 to 9
|
||||
else if( charCode >= 0x61 && charCode <= 0x66 ) charCode -= 0x57; // a to f
|
||||
else if( charCode >= 0x93 && charCode <= 0x98 ) charCode -= 0x8A; // A to F
|
||||
else break;
|
||||
hexWindow->hexChar = charCode & 0x0F;
|
||||
hexWindow->editedHigh = true;
|
||||
}
|
||||
hexWindow->InsertBytes( nil, hexWindow->selStart - hexWindow->selEnd, hexWindow->selEnd ); // remove selection
|
||||
hexWindow->selEnd = hexWindow->selStart;
|
||||
if( deletePrev )
|
||||
{
|
||||
hexWindow->InsertBytes( nil, -1, hexWindow->selStart ); // remove previous hex char
|
||||
hexWindow->InsertBytes( &hexWindow->hexChar, 1, hexWindow->selStart -1 ); // insert typed char (bug fix hack)
|
||||
}
|
||||
else hexWindow->InsertBytes( &hexWindow->hexChar, 1, hexWindow->selStart ); // insert typed char
|
||||
NSLog( @"Inserting text into illegal object: %@", self );
|
||||
return;
|
||||
}
|
||||
else // editing in ascii
|
||||
|
||||
if( self == (id) [[self delegate] hex] )
|
||||
{
|
||||
hexWindow->InsertBytes( nil, hexWindow->selStart - hexWindow->selEnd, hexWindow->selEnd ); // remove selection
|
||||
hexWindow->selEnd = hexWindow->selStart;
|
||||
hexWindow->InsertBytes( &charCode, 1, hexWindow->selStart ); // insert typed char
|
||||
hexWindow->selStart += 1;
|
||||
hexWindow->selEnd = hexWindow->selStart;
|
||||
}*/
|
||||
// bug: iteration through each character in string is broken, paste not yet mapped to this function
|
||||
int i;
|
||||
for( i= 0; i < [string cStringLength]; i++ )
|
||||
{
|
||||
char typedChar = [string characterAtIndex:i];
|
||||
if( typedChar >= 0x30 && typedChar <= 0x39 ) typedChar -= 0x30; // 0 to 9
|
||||
else if( typedChar >= 0x41 && typedChar <= 0x46 ) typedChar -= 0x37; // A to F
|
||||
else if( typedChar >= 0x61 && typedChar <= 0x66 ) typedChar -= 0x57; // a to f
|
||||
else return;
|
||||
|
||||
if( [[self delegate] editedLow] ) // edited low bits already
|
||||
{
|
||||
// select & retrieve old byte so it gets replaced
|
||||
char prevByte;
|
||||
byteSelection = NSMakeRange(byteSelection.location -1, 1);
|
||||
[data getBytes:&prevByte range:byteSelection];
|
||||
|
||||
// shift typed char into high bits and add new low char
|
||||
prevByte <<= 4; // store high bit
|
||||
prevByte += typedChar & 0x0F; // add low bit
|
||||
replaceData = [NSData dataWithBytes:&prevByte length:1];
|
||||
[[self delegate] setEditedLow:NO];
|
||||
}
|
||||
else // editing low bits
|
||||
{
|
||||
// put typed char into low bits
|
||||
typedChar &= 0x0F;
|
||||
replaceData = [NSData dataWithBytes:&typedChar length:1];
|
||||
[[self delegate] setEditedLow:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// replace bytes (updates views implicitly)
|
||||
[data replaceBytesInRange:byteSelection withBytes:[replaceData bytes] length:[replaceData length]];
|
||||
[[(HexWindowController *)[[self window] windowController] resource] setData:data];
|
||||
|
||||
// set the new selection/insertion point
|
||||
byteSelection.location++;
|
||||
byteSelection.length = 0;
|
||||
if( self == (id) [[self delegate] hex] )
|
||||
selection = [[self delegate] hexRangeFromByteRange:byteSelection];
|
||||
else if( self == (id) [[self delegate] ascii] )
|
||||
selection = [[self delegate] asciiRangeFromByteRange:byteSelection];
|
||||
[self setSelectedRange:selection];
|
||||
[data release];
|
||||
}
|
||||
|
||||
- (IBAction)deleteBackward:(id)sender
|
||||
|
@ -134,7 +152,13 @@
|
|||
// get selection range
|
||||
if( self == (id) [[self delegate] hex] )
|
||||
byteSelection = [[self delegate] byteRangeFromHexRange:selection];
|
||||
else byteSelection = [[self delegate] byteRangeFromAsciiRange:selection];
|
||||
else if( self == (id) [[self delegate] ascii] )
|
||||
byteSelection = [[self delegate] byteRangeFromAsciiRange:selection];
|
||||
else
|
||||
{
|
||||
NSLog( @"Inserting text into illegal object: %@", self );
|
||||
return;
|
||||
}
|
||||
|
||||
// adjust selection if is insertion point
|
||||
if( byteSelection.length == 0 && selection.location > 0 )
|
||||
|
@ -163,7 +187,13 @@
|
|||
// get selection range
|
||||
if( self == (id) [[self delegate] hex] )
|
||||
byteSelection = [[self delegate] byteRangeFromHexRange:selection];
|
||||
else byteSelection = [[self delegate] byteRangeFromAsciiRange:selection];
|
||||
else if( self == (id) [[self delegate] ascii] )
|
||||
byteSelection = [[self delegate] byteRangeFromAsciiRange:selection];
|
||||
else
|
||||
{
|
||||
NSLog( @"Inserting text into illegal object: %@", self );
|
||||
return;
|
||||
}
|
||||
|
||||
// adjust selection if is insertion point
|
||||
if( byteSelection.length == 0 && selection.location < [[self string] length] -1 )
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
// normal methods
|
||||
- (void)viewDidScroll:(NSNotification *)notification;
|
||||
- (void)resourceNameDidChange:(NSNotification *)notification;
|
||||
- (void)resourceDataDidChange:(NSNotification *)notification;
|
||||
- (void)refreshData:(NSData *)data;
|
||||
|
||||
|
|
|
@ -4,20 +4,6 @@
|
|||
|
||||
@implementation HexWindowController
|
||||
|
||||
NSString *ResourceWillChangeNotification = @"ResourceWillChangeNotification";
|
||||
NSString *ResourceNameWillChangeNotification = @"ResourceNameWillChangeNotification";
|
||||
NSString *ResourceTypeWillChangeNotification = @"ResourceTypeWillChangeNotification";
|
||||
NSString *ResourceIDWillChangeNotification = @"ResourceIDWillChangeNotification";
|
||||
NSString *ResourceAttributesWillChangeNotification = @"ResourceAttributesWillChangeNotification";
|
||||
NSString *ResourceDataWillChangeNotification = @"ResourceDataWillChangeNotification";
|
||||
|
||||
NSString *ResourceNameDidChangeNotification = @"ResourceNameDidChangeNotification";
|
||||
NSString *ResourceTypeDidChangeNotification = @"ResourceTypeDidChangeNotification";
|
||||
NSString *ResourceIDDidChangeNotification = @"ResourceIDDidChangeNotification";
|
||||
NSString *ResourceAttributesDidChangeNotification = @"ResourceAttributesDidChangeNotification";
|
||||
NSString *ResourceDataDidChangeNotification = @"ResourceDataDidChangeNotification";
|
||||
NSString *ResourceDidChangeNotification = @"ResourceDidChangeNotification";
|
||||
|
||||
- (id)initWithResource:(id)newResource
|
||||
{
|
||||
self = [self initWithWindowNibName:@"HexWindow"];
|
||||
|
@ -67,6 +53,7 @@ NSString *ResourceDidChangeNotification = @"ResourceDidChangeNotification";
|
|||
[self refreshData:[resource data]];
|
||||
|
||||
// we don't want this notification until we have a window! (Only register for notifications on the resource we're editing)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceNameDidChange:) name:ResourceNameDidChangeNotification object:resource];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:resource];
|
||||
|
||||
// put other notifications here too, just for togetherness
|
||||
|
@ -125,6 +112,13 @@ NSString *ResourceDidChangeNotification = @"ResourceDidChangeNotification";
|
|||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewDidScroll:) name:NSViewBoundsDidChangeNotification object:asciiClip];
|
||||
}
|
||||
|
||||
- (void)resourceNameDidChange:(NSNotification *)notification
|
||||
{
|
||||
if( ![[(id <ResKnifeResourceProtocol>)[notification object] name] isEqualToString:@""] )
|
||||
[[self window] setTitle:[(id <ResKnifeResourceProtocol>)[notification object] name]];
|
||||
else [[self window] setTitle:NSLocalizedStringFromTableInBundle(@"Untitled Resource", @"Localizable", [NSBundle mainBundle], nil)];
|
||||
}
|
||||
|
||||
- (void)resourceDataDidChange:(NSNotification *)notification
|
||||
{
|
||||
// ensure it's our resource which got changed (should always be true, we don't register for other resource notifications)
|
||||
|
|
21
Cocoa/Plug-Ins/Notifications.m
Normal file
21
Cocoa/Plug-Ins/Notifications.m
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* Notifications.
|
||||
Include this file in your target to access these notifications.
|
||||
|
||||
Note: when using internal notifications in your own plug-in, DO NOT use [NSNotificationCenter defaultCenter]. This is an application-wide notificaton center, use of it by plug-ins for their own means (i.e. not interacting with ResKnife) can cause conflicts with other plug-ins. You should create your own notification center and post to that.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NSString *ResourceWillChangeNotification = @"ResourceWillChangeNotification";
|
||||
NSString *ResourceNameWillChangeNotification = @"ResourceNameWillChangeNotification";
|
||||
NSString *ResourceTypeWillChangeNotification = @"ResourceTypeWillChangeNotification";
|
||||
NSString *ResourceIDWillChangeNotification = @"ResourceIDWillChangeNotification";
|
||||
NSString *ResourceAttributesWillChangeNotification = @"ResourceAttributesWillChangeNotification";
|
||||
NSString *ResourceDataWillChangeNotification = @"ResourceDataWillChangeNotification";
|
||||
|
||||
NSString *ResourceNameDidChangeNotification = @"ResourceNameDidChangeNotification";
|
||||
NSString *ResourceTypeDidChangeNotification = @"ResourceTypeDidChangeNotification";
|
||||
NSString *ResourceIDDidChangeNotification = @"ResourceIDDidChangeNotification";
|
||||
NSString *ResourceAttributesDidChangeNotification = @"ResourceAttributesDidChangeNotification";
|
||||
NSString *ResourceDataDidChangeNotification = @"ResourceDataDidChangeNotification";
|
||||
NSString *ResourceDidChangeNotification = @"ResourceDidChangeNotification";
|
|
@ -31,7 +31,7 @@
|
|||
@end
|
||||
|
||||
// Resource notifications
|
||||
// Note: when using internal notifications in your own plug-in, DO NOT use [NSNotificationCenter defaultCenter]. This is an application-wide notificaton center, use of it by plug-ins for their own means (i.e. not interacting with ResKnife) can cause conflicts with other plug-ins. You should create your own notification center and post to that.
|
||||
// See note in Notifications.m about usage
|
||||
extern NSString *ResourceWillChangeNotification;
|
||||
extern NSString *ResourceNameWillChangeNotification;
|
||||
extern NSString *ResourceTypeWillChangeNotification;
|
||||
|
|
|
@ -4,20 +4,6 @@
|
|||
|
||||
@implementation TemplateWindowController
|
||||
|
||||
NSString *ResourceWillChangeNotification = @"ResourceWillChangeNotification";
|
||||
NSString *ResourceNameWillChangeNotification = @"ResourceNameWillChangeNotification";
|
||||
NSString *ResourceTypeWillChangeNotification = @"ResourceTypeWillChangeNotification";
|
||||
NSString *ResourceIDWillChangeNotification = @"ResourceIDWillChangeNotification";
|
||||
NSString *ResourceAttributesWillChangeNotification = @"ResourceAttributesWillChangeNotification";
|
||||
NSString *ResourceDataWillChangeNotification = @"ResourceDataWillChangeNotification";
|
||||
|
||||
NSString *ResourceNameDidChangeNotification = @"ResourceNameDidChangeNotification";
|
||||
NSString *ResourceTypeDidChangeNotification = @"ResourceTypeDidChangeNotification";
|
||||
NSString *ResourceIDDidChangeNotification = @"ResourceIDDidChangeNotification";
|
||||
NSString *ResourceAttributesDidChangeNotification = @"ResourceAttributesDidChangeNotification";
|
||||
NSString *ResourceDataDidChangeNotification = @"ResourceDataDidChangeNotification";
|
||||
NSString *ResourceDidChangeNotification = @"ResourceDidChangeNotification";
|
||||
|
||||
- (id)initWithResource:(id)newResource
|
||||
{
|
||||
return [self initWithResources:newResource, nil];
|
||||
|
|
|
@ -598,8 +598,8 @@ OSStatus HandleKeyDown( WindowRef window, unsigned char charCode, EventModifiers
|
|||
{
|
||||
// shift typed char into high bits and add new low char
|
||||
if( charCode >= 0x30 && charCode <= 0x39 ) charCode -= 0x30; // 0 to 9
|
||||
else if( charCode >= 0x41 && charCode <= 0x46 ) charCode -= 0x37; // A to F
|
||||
else if( charCode >= 0x61 && charCode <= 0x66 ) charCode -= 0x57; // a to f
|
||||
else if( charCode >= 0x93 && charCode <= 0x98 ) charCode -= 0x8A; // A to F
|
||||
else break;
|
||||
hexWindow->hexChar <<= 4; // store high bit
|
||||
hexWindow->hexChar += charCode & 0x0F; // add low bit
|
||||
|
@ -612,8 +612,8 @@ OSStatus HandleKeyDown( WindowRef window, unsigned char charCode, EventModifiers
|
|||
{
|
||||
// put typed char into low bits
|
||||
if( charCode >= 0x30 && charCode <= 0x39 ) charCode -= 0x30; // 0 to 9
|
||||
else if( charCode >= 0x41 && charCode <= 0x46 ) charCode -= 0x37; // A to F
|
||||
else if( charCode >= 0x61 && charCode <= 0x66 ) charCode -= 0x57; // a to f
|
||||
else if( charCode >= 0x93 && charCode <= 0x98 ) charCode -= 0x8A; // A to F
|
||||
else break;
|
||||
hexWindow->hexChar = charCode & 0x0F;
|
||||
hexWindow->editedHigh = true;
|
||||
|
|
Binary file not shown.
|
@ -1,4 +1,5 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "Structs.h"
|
||||
#import "DataSource.h"
|
||||
|
||||
#import "ResKnifePluginProtocol.h"
|
||||
|
@ -18,4 +19,6 @@
|
|||
- (void)setUndoManager:(NSUndoManager *)newUndoManager;
|
||||
- (IBAction)toggleResID:(id)sender;
|
||||
|
||||
- (void)resourceNameDidChange:(NSNotification *)notification;
|
||||
|
||||
@end
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
resource = [(id)newResource retain];
|
||||
undoManager = [[NSUndoManager alloc] init];
|
||||
|
||||
// load the window from the nib file and set it's title
|
||||
[self window]; // implicitly loads nib
|
||||
if( [newResource name] && ![[newResource name] isEqualToString:@""] )
|
||||
[[self window] setTitle:[NSString stringWithFormat:@"%@: %@", [[self window] title], [newResource name]]];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -42,6 +46,12 @@
|
|||
{
|
||||
NSBundle *plugBundle = [NSBundle bundleWithIdentifier:@"au.com.sutherland-studios.resknife.novatools"];
|
||||
|
||||
/* NSLog( @"path: %@", [[NSBundle mainBundle] pathForAuxiliaryExecutable:@"NovaTools"] );
|
||||
NSLog( @"path: %@", [[NSBundle mainBundle] pathForResource:@"NovaTools" ofType:nil] );
|
||||
NSLog( @"path: %@", [[NSBundle mainBundle] pathForResource:@"NovaTools" ofType:nil inDirectory:@"PlugIns"] );
|
||||
NSLog( @"path: %@", [[[NSBundle mainBundle] builtInPlugInsPath] stringByAppendingPathComponent:@"NovaTools.plugin"] );
|
||||
NSLog( @"path: %@", [[NSBundle bundleWithIdentifier:@"au.com.sutherland-studios.resknife.novatools"] bundlePath] );
|
||||
*/
|
||||
[super windowDidLoad];
|
||||
|
||||
// create the data sources (here because this is called just before they are applied to the combo boxes)
|
||||
|
@ -50,6 +60,7 @@
|
|||
shipDataSource = [[DataSource alloc] initForType:[plugBundle localizedStringForKey:@"ship" value:@"" table:@"Resource Types"]];
|
||||
|
||||
// we don't want this notification until we have a window!
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceNameDidChange:) name:ResourceNameDidChangeNotification object:resource];
|
||||
// bug: only registers for notifications on the resource we're editing, need dependant resources too (pass nil for object?)
|
||||
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:resource];
|
||||
}
|
||||
|
@ -79,4 +90,15 @@
|
|||
NSLog( @"%@", [resource type] );
|
||||
}
|
||||
|
||||
- (void)resourceNameDidChange:(NSNotification *)notification
|
||||
{
|
||||
NSString *prefix;
|
||||
NSScanner *scanner = [NSScanner scannerWithString:[[self window] title]];
|
||||
if( ![scanner scanUpToString:@":" intoString:&prefix] )
|
||||
prefix = [[self window] title];
|
||||
if( ![[(id <ResKnifeResourceProtocol>)[notification object] name] isEqualToString:@""] )
|
||||
[[self window] setTitle:[NSString stringWithFormat:@"%@: %@", prefix, [(id <ResKnifeResourceProtocol>)[notification object] name]]];
|
||||
else [[self window] setTitle:prefix];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
719
NovaTools/Structs.h
Normal file
719
NovaTools/Structs.h
Normal file
|
@ -0,0 +1,719 @@
|
|||
/* Nova Resource structures */
|
||||
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
typedef struct RLEPixelData
|
||||
{
|
||||
// 'rl‘#' resource
|
||||
short width; // pixel width (max for all frames)
|
||||
short height; // pixel height (max for all frames)
|
||||
short depth; // bit depth (8/16/32)
|
||||
short palette; // color table 'clut' ID (0 for default)
|
||||
short nframes; // number of frames in this resource
|
||||
short reserved1;
|
||||
short reserved2;
|
||||
short reserved3;
|
||||
char tokens[]; // the RLE token data (variable size array)
|
||||
} RLEPixelData;
|
||||
|
||||
#define kRLEResourceHeaderSize (sizeof(RLEPixelData) - 1)
|
||||
|
||||
typedef struct CharRec
|
||||
{
|
||||
long startCash;
|
||||
short startShipType;
|
||||
short startSystem[4];
|
||||
short startGovt[4];
|
||||
short startStatus[4];
|
||||
short startKills;
|
||||
short introPictID[4];
|
||||
short introPictDelay[4];
|
||||
short introTextID;
|
||||
char OnStart[256];
|
||||
short Flags;
|
||||
short startDay;
|
||||
short startMonth;
|
||||
short startYear;
|
||||
char Prefix[16];
|
||||
char Suffix[16];
|
||||
short UnusedA[8];
|
||||
} CharRec;
|
||||
|
||||
typedef struct CronRec
|
||||
{
|
||||
short FirstDay;
|
||||
short FirstMonth;
|
||||
short FirstYear;
|
||||
short LastDay;
|
||||
short LastMonth;
|
||||
short LastYear;
|
||||
short Random;
|
||||
short Duration;
|
||||
short PreHoldoff;
|
||||
short PostHoldoff;
|
||||
short IndNewsStr;
|
||||
short Flags;
|
||||
// EnableOn: packed array[0..254] of char;
|
||||
// OnStart: packed array[0..254] of char;
|
||||
// OnEnd: packed array[0..255] of char;
|
||||
char cdata[766];
|
||||
long Contributes0;
|
||||
long Contributes1;
|
||||
long Require0;
|
||||
long Require1;
|
||||
short NewsGovt[4];
|
||||
short GovtNewsString[4];
|
||||
} CronRec;
|
||||
|
||||
typedef struct SpinRec
|
||||
{
|
||||
short SpritesID;
|
||||
short MasksID;
|
||||
short xSize;
|
||||
short ySize;
|
||||
short nx;
|
||||
short ny;
|
||||
} SpinRec;
|
||||
|
||||
typedef struct ShanRec
|
||||
{
|
||||
short BaseImageID;
|
||||
short BaseMaskID;
|
||||
short BaseSetCount;
|
||||
short BaseXSize;
|
||||
short BaseYSize;
|
||||
short BaseTransp;
|
||||
|
||||
short AltImageID;
|
||||
short AltMaskID;
|
||||
short AltSetCount;
|
||||
short AltXSize;
|
||||
short AltYSize;
|
||||
|
||||
short GlowImageID;
|
||||
short GlowMaskID;
|
||||
short GlowXSize;
|
||||
short GlowYSize;
|
||||
|
||||
short LightImageID;
|
||||
short LightMaskID;
|
||||
short LightXSize;
|
||||
short LightYSize;
|
||||
|
||||
short WeapImageID;
|
||||
short WeapMaskID;
|
||||
short WeapXSize;
|
||||
short WeapYSize;
|
||||
|
||||
short Flags;
|
||||
|
||||
short AnimDelay;
|
||||
short WeapDecay;
|
||||
short FramesPer;
|
||||
short BlinkMode;
|
||||
short BlinkA;
|
||||
short BlinkB;
|
||||
short BlinkC;
|
||||
short BlinkD;
|
||||
|
||||
short ShieldImgID;
|
||||
short ShieldMaskID;
|
||||
short ShieldXSize;
|
||||
short ShieldYSize;
|
||||
|
||||
short GunPosX[4];
|
||||
short GunPosY[4];
|
||||
short TurretPosX[4];
|
||||
short TurretPosY[4];
|
||||
short GuidedPosX[4];
|
||||
short GuidedPosY[4];
|
||||
short BeamPosX[4];
|
||||
short BeamPosY[4];
|
||||
|
||||
short UpCompressX;
|
||||
short UpCompressY;
|
||||
short DnCompressX;
|
||||
short DnCompressY;
|
||||
|
||||
short GunPosZ[4];
|
||||
short TurretPosZ[4];
|
||||
short GuidedPosZ[4];
|
||||
short BeamPosZ[4];
|
||||
|
||||
short UnusedA[8];
|
||||
|
||||
} ShanRec;
|
||||
|
||||
typedef struct SystRec
|
||||
{
|
||||
short xPos;
|
||||
short yPos;
|
||||
short con[16];
|
||||
short nav[16];
|
||||
short DudeTypes[8];
|
||||
short Probs[8];
|
||||
short AvgShips;
|
||||
short Govt;
|
||||
short Message;
|
||||
short Asteroids;
|
||||
short Interference;
|
||||
short Person[8];
|
||||
short PersonProb[8];
|
||||
long BkgndColor;
|
||||
short Murk;
|
||||
short AstTypes;
|
||||
char Visiblility[256];
|
||||
short ReinfFleet;
|
||||
short ReinfTime;
|
||||
short ReinfIntrval;
|
||||
short UnusedA[8];
|
||||
} SystRec;
|
||||
|
||||
typedef struct SpobRec
|
||||
{
|
||||
short xPos;
|
||||
short yPos;
|
||||
short spobType;
|
||||
long Flags;
|
||||
short Tribute;
|
||||
short TechLevel;
|
||||
short SpecialTech1;
|
||||
short SpecialTech2;
|
||||
short SpecialTech3;
|
||||
short Govt;
|
||||
short MinCoolness;
|
||||
short CustPicID;
|
||||
short CustSndID;
|
||||
short DefDude;
|
||||
short DefCount;
|
||||
short Flags2;
|
||||
short AnimDelay;
|
||||
short Frame0Bias;
|
||||
short HyperLink[8];
|
||||
// OnDominate: packed array[0..254] of char;
|
||||
// OnRelease: packed array[0..254] of char;
|
||||
char cdata[510];
|
||||
long Fee;
|
||||
short Gravity;
|
||||
short Weapon;
|
||||
long Strength;
|
||||
short DeadType;
|
||||
short DeadTime;
|
||||
short ExplodType;
|
||||
// OnDestroy : packed array[0..254] of char;
|
||||
// OnRegen : packed array[0..254] of char;
|
||||
char cdata2[510];
|
||||
short SpecialTech4;
|
||||
short SpecialTech5;
|
||||
short SpecialTech6;
|
||||
short SpecialTech7;
|
||||
short SpecialTech8;
|
||||
short UnusedA[8];
|
||||
} SpobRec;
|
||||
|
||||
typedef struct ShipRec
|
||||
{
|
||||
short holds;
|
||||
short Shield;
|
||||
short Accel;
|
||||
short Speed;
|
||||
short Maneuver;
|
||||
short Fuel;
|
||||
short freeMass;
|
||||
short Armor;
|
||||
short ShieldRegen;
|
||||
short WType[4];
|
||||
short WCount[4];
|
||||
short Ammo[4];
|
||||
short MaxGun;
|
||||
short MaxTur;
|
||||
short TechLevel;
|
||||
long Cost;
|
||||
short DeathDelay;
|
||||
short ArmorRech;
|
||||
short Explode1;
|
||||
short Explode2;
|
||||
short DispWeight;
|
||||
short Mass;
|
||||
short Length;
|
||||
short InherentAI;
|
||||
short Crew;
|
||||
short Strength;
|
||||
short InherentGovt;
|
||||
short Flags;
|
||||
short PodCount;
|
||||
short DefaultItems[4];
|
||||
short ItemCount[4];
|
||||
short FuelRegen;
|
||||
short SkillVar;
|
||||
short Flags2;
|
||||
long Contributes0;
|
||||
long Contributes1;
|
||||
// Availability: packed array[0..254] of char;
|
||||
// AppearOn: packed array[0..254] of char;
|
||||
// OnPurchase: packed array[0..255] of char;
|
||||
|
||||
char cdata1[766];
|
||||
|
||||
short Deionize;
|
||||
short IonizeMax;
|
||||
short KeyCarried;
|
||||
short DefaultItems2[4];
|
||||
short ItemCount2[4];
|
||||
long Require0;
|
||||
long Require1;
|
||||
|
||||
short BuyRandom;
|
||||
short HireRandom;
|
||||
|
||||
short unusedBlock[34];
|
||||
|
||||
// OnCapture: packed array[0..254] of char;
|
||||
// OnRetire: packed array[0..254] of char;
|
||||
// ShortName: packed array[0..63] of char;
|
||||
// CommName: packed array[0..31] of char;
|
||||
// LongName: packed array[0..127] of char;
|
||||
// MovieFile: packed array[0..31] of char;
|
||||
|
||||
char cdata2[766];
|
||||
|
||||
short WType2[4];
|
||||
short WCount2[4];
|
||||
short Ammo2[4];
|
||||
|
||||
// SubTitle: packed array[0..63] of char;
|
||||
char cdata3[64];
|
||||
short Flags3;
|
||||
short UpgradeTo;
|
||||
long EscUpgrdCost;
|
||||
long EscSellValue;
|
||||
short EscortType;
|
||||
short UnusedA[8];
|
||||
} ShipRec;
|
||||
|
||||
typedef struct DescRec
|
||||
{
|
||||
char Description[1];
|
||||
} DescRec;
|
||||
|
||||
typedef struct DescCodaRec
|
||||
{
|
||||
short Graphic;
|
||||
char Movie[32];
|
||||
short Flags;
|
||||
} DescCodaRec;
|
||||
|
||||
typedef struct WeapRec
|
||||
{
|
||||
short Reload;
|
||||
short Count;
|
||||
short MassDmg;
|
||||
short EnergyDmg;
|
||||
short Guidance;
|
||||
short Speed;
|
||||
short AmmoType;
|
||||
short Graphic;
|
||||
short Inaccuracy;
|
||||
short Sound;
|
||||
short Impact;
|
||||
short ExplodType;
|
||||
short ProxRadius;
|
||||
short BlastRadius;
|
||||
short Flags;
|
||||
short Seeker;
|
||||
short SmokeSet;
|
||||
short Decay;
|
||||
short Particles;
|
||||
short PartVel;
|
||||
short PartLifeMin;
|
||||
short PartLifeMax;
|
||||
long PartColor;
|
||||
short BeamLength;
|
||||
short BeamWidth;
|
||||
short Falloff;
|
||||
long BeamColor;
|
||||
long CoronaColor;
|
||||
short SubCount;
|
||||
short SubType;
|
||||
short SubTheta;
|
||||
short SubLimit;
|
||||
short ProxSafety;
|
||||
short Flags2;
|
||||
short Ionization;
|
||||
short HitParticles;
|
||||
short HitPartLife;
|
||||
short HitPartVel;
|
||||
long HitPartColor;
|
||||
short Recoil;
|
||||
short ExitType;
|
||||
short BurstCount;
|
||||
short BurstReload;
|
||||
short JamVuln1;
|
||||
short JamVuln2;
|
||||
short JamVuln3;
|
||||
short JamVuln4;
|
||||
short Flags3;
|
||||
short Durability;
|
||||
short GuidedTurn;
|
||||
short MaxAmmo;
|
||||
short LiDensity;
|
||||
short LiAmplitude;
|
||||
long IonizeColor;
|
||||
short UnusedA[8];
|
||||
} WeapRec;
|
||||
|
||||
typedef struct OutfRec
|
||||
{
|
||||
short DispWeight;
|
||||
short Mass;
|
||||
short TechLevel;
|
||||
short ModType;
|
||||
short ModVal;
|
||||
short Max;
|
||||
short Flags;
|
||||
long Cost;
|
||||
short ModType2;
|
||||
short ModVal2;
|
||||
short ModType3;
|
||||
short ModVal3;
|
||||
short ModType4;
|
||||
short ModVal4;
|
||||
long Contributes0;
|
||||
long Contributes1;
|
||||
long Require0;
|
||||
long Require1;
|
||||
// Availability: packed array[0..254] of char;
|
||||
// OnPurchase: packed array[0..254] of char;
|
||||
// OnSell: packed array[0..254] of char;
|
||||
// ShortName: packed array[0..63] of char;
|
||||
// LCName: packed array[0..63] of char;
|
||||
// LCPlural: packed array[0..64] of char;
|
||||
char cdata[958];
|
||||
short ItemClass;
|
||||
short ScanMask;
|
||||
short BuyRandom;
|
||||
short RequireGovt;
|
||||
short UnusedA[8];
|
||||
} OutfRec;
|
||||
|
||||
|
||||
typedef struct DudeRec
|
||||
{
|
||||
short AIType;
|
||||
short Govt;
|
||||
short Booty;
|
||||
short InfoTypes;
|
||||
short ShipTypes[16];
|
||||
short Probs[16];
|
||||
short UnusedA[8];
|
||||
} DudeRec;
|
||||
|
||||
typedef struct GovtRec
|
||||
{
|
||||
short VoiceType;
|
||||
short Flags;
|
||||
short Flags2;
|
||||
short ScanFine;
|
||||
short CrimeTol;
|
||||
short SmugPenalty;
|
||||
short DisabPenalty;
|
||||
short BoardPenalty;
|
||||
short KillPenalty;
|
||||
short ShootPenalty;
|
||||
short InitialRec;
|
||||
short MaxOdds;
|
||||
short Classes[4];
|
||||
short Allies[4];
|
||||
short Enemies[4];
|
||||
short SkillMult;
|
||||
short ScanMask;
|
||||
char CommName[16];
|
||||
char TargetCode[16];
|
||||
long Require0;
|
||||
long Require1;
|
||||
short InhJam[4];
|
||||
char MediumName[64];
|
||||
long color;
|
||||
long ShipColor;
|
||||
short intf;
|
||||
short NewsPict;
|
||||
short UnusedA[8];
|
||||
} GovtRec;
|
||||
|
||||
|
||||
typedef struct MisnRec
|
||||
{
|
||||
short AvailStel;
|
||||
short Unused1;
|
||||
short AvailLoc;
|
||||
short AvailRecord;
|
||||
short AvailRating;
|
||||
short AvailRandom;
|
||||
short TravelStel;
|
||||
short ReturnStel;
|
||||
short CargoType;
|
||||
short CargoQty;
|
||||
short PickupMode;
|
||||
short DropoffMode;
|
||||
short ScanGovt;
|
||||
short Unused2;
|
||||
long PayVal;
|
||||
short ShipCount;
|
||||
short ShipSyst;
|
||||
short ShipDude;
|
||||
short ShipGoal;
|
||||
short ShipBehav;
|
||||
short ShipNameID;
|
||||
short ShipStart;
|
||||
short CompGovt;
|
||||
short CompReward;
|
||||
short ShipSubTitle;
|
||||
short BriefText;
|
||||
short QuickBrief;
|
||||
short LoadCargText;
|
||||
short DropCargText;
|
||||
short CompText;
|
||||
short FailText;
|
||||
short TimeLimit;
|
||||
short CanAbort;
|
||||
short ShipDoneText;
|
||||
short Unused3;
|
||||
short AuxShipCount;
|
||||
short AuxShipDude;
|
||||
short AuxShipSyst;
|
||||
short Unused4;
|
||||
short Flags;
|
||||
short Flags2;
|
||||
short Unused6;
|
||||
short Unused7;
|
||||
short RefuseText;
|
||||
short AvailShipType;
|
||||
// AvailBits: packed array[0..254] of char;
|
||||
// OnAccept: packed array[0..254] of char;
|
||||
// OnRefuse: packed array[0..254] of char;
|
||||
// OnSuccess: packed array[0..254] of char;
|
||||
// OnFailure: packed array[0..254] of char;
|
||||
// OnAbort: packed array[0..254] of char;
|
||||
|
||||
char cdata[1530];
|
||||
|
||||
long Require0;
|
||||
long Require1;
|
||||
short DatePostInc;
|
||||
// OnShipDone: packed array[0..254] of char;
|
||||
// AcceptButton: packed array[0..31] of char;
|
||||
// RefuseButton: packed array[0..31] of char;
|
||||
char cdata2[320];
|
||||
short DispWeight;
|
||||
|
||||
short UnusedA[8];
|
||||
} MisnRec;
|
||||
|
||||
typedef struct PersRec
|
||||
{
|
||||
short LinkSyst;
|
||||
short Govt;
|
||||
short AIType;
|
||||
short Aggress;
|
||||
short Coward;
|
||||
short ShipType;
|
||||
short WeapType[4];
|
||||
short WeapCount[4];
|
||||
short AmmoLoad[4];
|
||||
long Credits;
|
||||
short ShieldMod;
|
||||
short HailPict;
|
||||
short CommQuote;
|
||||
short HailQuote;
|
||||
short LinkMission;
|
||||
short Flags;
|
||||
char ActivateOn[256];
|
||||
short GrantClass;
|
||||
short GrantCount;
|
||||
short GrantProb;
|
||||
char SubTitle[64];
|
||||
long ShipColor;
|
||||
short Flags2;
|
||||
short UnusedA[8];
|
||||
} PersRec;
|
||||
|
||||
typedef struct DeqtRec
|
||||
{
|
||||
short Flags;
|
||||
} DeqtRec;
|
||||
|
||||
typedef struct YearRec
|
||||
{
|
||||
short Day;
|
||||
short Month;
|
||||
short Year;
|
||||
char Prefix[16];
|
||||
char Suffix[15];
|
||||
} YearRec;
|
||||
|
||||
typedef struct OopsRec
|
||||
{
|
||||
short Stellar;
|
||||
short Commodity;
|
||||
short PriceDelta;
|
||||
short Duration;
|
||||
short Freq;
|
||||
char ActivateOn[256];
|
||||
short UnusedA[8];
|
||||
} OopsRec;
|
||||
|
||||
typedef struct NebuRec
|
||||
{
|
||||
short XPos;
|
||||
short YPos;
|
||||
short XSize;
|
||||
short YSize;
|
||||
// ActiveOn: packed array[0..254] of char;
|
||||
// OnExplore: packed array[0..254] of char;
|
||||
char cdata[510];
|
||||
short UnusedA[8];
|
||||
} NebuRec;
|
||||
|
||||
typedef struct BoomRec
|
||||
{
|
||||
short FrameAdvance;
|
||||
short SoundIndex;
|
||||
short GraphicIndex;
|
||||
} BoomRec;
|
||||
|
||||
typedef struct FletRec
|
||||
{
|
||||
short LeadShipType;
|
||||
short EscortShipType[4];
|
||||
short EscortMin[4];
|
||||
short EscortMax[4];
|
||||
short Govt;
|
||||
short LinkSyst;
|
||||
char ActivateOn[256];
|
||||
short Quote;
|
||||
short Flags;
|
||||
short UnusedA[8];
|
||||
} FletRec;
|
||||
|
||||
typedef struct JunkRec
|
||||
{
|
||||
short SoldAt[8];
|
||||
short BoughtAt[8];
|
||||
short BasePrice;
|
||||
short Flags;
|
||||
short ScanMask;
|
||||
// LCName: packed array[0..63] of char;
|
||||
// Abbrev: packed array[0..63] of char;
|
||||
// BuyOn: packed array[0..254] of char;
|
||||
// SellOn: packed array[0..254] of char;
|
||||
char cdata[638];
|
||||
} JunkRec;
|
||||
|
||||
typedef struct RankRec
|
||||
{
|
||||
short Weight;
|
||||
short Govt;
|
||||
short PriceMod;
|
||||
long Salary;
|
||||
long SalaryCap;
|
||||
long Contributes0;
|
||||
long Contributes1;
|
||||
short flags;
|
||||
// ConvName: packed array[0..63] of char;
|
||||
// ShortName: packed array[0..63] of char;
|
||||
char cdata[128];
|
||||
} RankRec;
|
||||
|
||||
|
||||
typedef struct RoidRec
|
||||
{
|
||||
short Strength;
|
||||
short spinRate;
|
||||
short yieldType;
|
||||
short yieldQty;
|
||||
short partCount;
|
||||
long partColor;
|
||||
short fragType[2];
|
||||
short fragCount;
|
||||
short ExplodeType;
|
||||
short Mass;
|
||||
short UnusedA[8];
|
||||
} RoidRec;
|
||||
|
||||
typedef struct ColrRec
|
||||
{
|
||||
long ButtonUp;
|
||||
long ButtonDown;
|
||||
long ButtonGrey;
|
||||
char MenuFont[64];
|
||||
short MenuFontSize;
|
||||
long MenuColor1;
|
||||
long MenuColor2;
|
||||
long GridBright;
|
||||
long GridDim;
|
||||
// p2c: Structs.p, line 696: Warning: Symbol 'RECT' is not defined [221]
|
||||
Rect ProgArea;
|
||||
long ProgBright;
|
||||
long ProgDim;
|
||||
long ProgOutline;
|
||||
|
||||
short Button1x;
|
||||
short Button1y;
|
||||
short Button2x;
|
||||
short Button2y;
|
||||
short Button3x;
|
||||
short Button3y;
|
||||
short Button4x;
|
||||
short Button4y;
|
||||
short Button5x;
|
||||
short Button5y;
|
||||
short Button6x;
|
||||
short Button6y;
|
||||
|
||||
long FloatingMap;
|
||||
long ListText;
|
||||
long ListBkgnd;
|
||||
long ListHilite;
|
||||
long EscortHilite;
|
||||
|
||||
char ButtonFont[64];
|
||||
short ButtonFontSz;
|
||||
|
||||
short LogoX;
|
||||
short LogoY;
|
||||
|
||||
short RolloverX;
|
||||
short RolloverY;
|
||||
|
||||
short Slide1x;
|
||||
short Slide1y;
|
||||
short Slide2x;
|
||||
short Slide2y;
|
||||
short Slide3x;
|
||||
short Slide3y;
|
||||
|
||||
} ColrRec;
|
||||
|
||||
typedef struct IntfRec
|
||||
{
|
||||
long BrightText;
|
||||
long DimText;
|
||||
Rect RadarArea;
|
||||
long BrightRadar;
|
||||
long DimRadar;
|
||||
Rect ShieldArea;
|
||||
long Shield;
|
||||
Rect ArmorArea;
|
||||
long Armor;
|
||||
Rect FuelArea;
|
||||
long FuelFull;
|
||||
long FuelPartial;
|
||||
Rect NavArea;
|
||||
Rect WeapArea;
|
||||
Rect TargArea;
|
||||
Rect CargoArea;
|
||||
char StatusFont[64];
|
||||
short StatFontSize;
|
||||
short SubtitleSize;
|
||||
short StatusBkgnd;
|
||||
} IntfRec;
|
|
@ -3,5 +3,6 @@
|
|||
|
||||
@interface BoomWindowController : NovaWindowController
|
||||
{
|
||||
BoomRec *boomRec;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -7,10 +7,8 @@
|
|||
self = [self initWithWindowNibName:@"boom"];
|
||||
if( !self ) return nil;
|
||||
|
||||
// load the window from the nib file and set it's title
|
||||
[self window]; // implicitly loads nib
|
||||
if( [newResource name] && ![[newResource name] isEqualToString:@""] )
|
||||
[[self window] setTitle:[NSString stringWithFormat:@"%@: %@", [[self window] title], [newResource name]]];
|
||||
boomRec = (BoomRec *)calloc(1,sizeof(BoomRec));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
6
NovaTools/boom/English.lproj/boom.nib/info.nib
generated
6
NovaTools/boom/English.lproj/boom.nib/info.nib
generated
|
@ -3,14 +3,14 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>220 152 356 240 0 0 1152 848 </string>
|
||||
<string>120 159 356 240 0 0 1152 848 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<string>263.2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q110</string>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
BIN
NovaTools/boom/English.lproj/boom.nib/objects.nib
generated
BIN
NovaTools/boom/English.lproj/boom.nib/objects.nib
generated
Binary file not shown.
|
@ -30,11 +30,6 @@
|
|||
government3 = [[NSNumber alloc] initWithShort:130];
|
||||
government4 = [[NSNumber alloc] initWithShort:131];
|
||||
|
||||
// load the window from the nib file and set it's title
|
||||
[self window]; // implicitly loads nib
|
||||
if( [newResource name] && ![[newResource name] isEqualToString:@""] )
|
||||
[[self window] setTitle:[NSString stringWithFormat:@"%@: %@", [[self window] title], [newResource name]]];
|
||||
[self update];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -80,6 +75,7 @@
|
|||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(controlTextDidEndEditing:) name:NSControlTextDidEndEditingNotification object:governmentField4];
|
||||
|
||||
// finally, show the window
|
||||
[self update];
|
||||
[self showWindow:self];
|
||||
}
|
||||
|
||||
|
|
4
NovaTools/char/English.lproj/char.nib/info.nib
generated
4
NovaTools/char/English.lproj/char.nib/info.nib
generated
|
@ -20,10 +20,6 @@
|
|||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
<string>3</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>137</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
|
|
BIN
NovaTools/char/English.lproj/char.nib/objects.nib
generated
BIN
NovaTools/char/English.lproj/char.nib/objects.nib
generated
Binary file not shown.
|
@ -6,11 +6,6 @@
|
|||
{
|
||||
self = [self initWithWindowNibName:@"colr"];
|
||||
if( !self ) return nil;
|
||||
|
||||
// load the window from the nib file and set it's title
|
||||
[self window]; // implicitly loads nib
|
||||
if( [newResource name] && ![[newResource name] isEqualToString:@""] )
|
||||
[[self window] setTitle:[NSString stringWithFormat:@"%@: %@", [[self window] title], [newResource name]]];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,17 +11,13 @@
|
|||
startDate = [[NSCalendarDate date] retain];
|
||||
endDate = [[[NSCalendarDate date] dateByAddingYears:0 months:1 days:0 hours:0 minutes:0 seconds:0] retain];
|
||||
|
||||
// load the window from the nib file and set it's title
|
||||
[self window]; // implicitly loads nib
|
||||
if( [newResource name] && ![[newResource name] isEqualToString:@""] )
|
||||
[[self window] setTitle:[NSString stringWithFormat:@"%@: %@", [[self window] title], [newResource name]]];
|
||||
[self update];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
[super windowDidLoad];
|
||||
[self update];
|
||||
[self showWindow:self];
|
||||
}
|
||||
|
||||
|
|
|
@ -6,11 +6,6 @@
|
|||
{
|
||||
self = [self initWithWindowNibName:@"desc"];
|
||||
if( !self ) return nil;
|
||||
|
||||
// load the window from the nib file and set it's title
|
||||
[self window]; // implicitly loads nib
|
||||
if( [newResource name] && ![[newResource name] isEqualToString:@""] )
|
||||
[[self window] setTitle:[NSString stringWithFormat:@"%@: %@", [[self window] title], [newResource name]]];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,7 @@
|
|||
files = (
|
||||
F53544420226752901A80001,
|
||||
F53544500226B5F501A80001,
|
||||
F5C9ECD4027F474A01A8010C,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
};
|
||||
|
@ -492,6 +493,7 @@
|
|||
};
|
||||
F57CEE0B0189C95101A8010B = {
|
||||
children = (
|
||||
F5C9ECCE027F474A01A8010C,
|
||||
F5502C4001C579FF01C57124,
|
||||
F5CDEBAB01FC893201A80001,
|
||||
F5EF839F020C08E601A80001,
|
||||
|
@ -592,6 +594,7 @@
|
|||
F5EF83B1020C08E601A80001,
|
||||
F5EF83B3020C08E601A80001,
|
||||
F54E6226021B6A0901A80001,
|
||||
F5C9ECD2027F474A01A8010C,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
};
|
||||
|
@ -610,6 +613,7 @@
|
|||
};
|
||||
F58A183F0278353501A8010C = {
|
||||
children = (
|
||||
F5C9ECD8027F562201A8010C,
|
||||
F543AFDB027B2A5001A8010C,
|
||||
F543AFDC027B2A5001A8010C,
|
||||
F58A18410278355D01A8010C,
|
||||
|
@ -1071,6 +1075,7 @@
|
|||
F5B588710156D40B01000001,
|
||||
F5D0CBD2022744C701A80001,
|
||||
F5DF1C070254AD8801A80001,
|
||||
F5C9ECD0027F474A01A8010C,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
};
|
||||
|
@ -1371,7 +1376,9 @@
|
|||
refType = 2;
|
||||
};
|
||||
F5B588450156D40B01000001 = {
|
||||
fileEncoding = 10;
|
||||
isa = PBXFileReference;
|
||||
lineEnding = 0;
|
||||
name = English;
|
||||
path = English.lproj/Localizable.strings;
|
||||
refType = 4;
|
||||
|
@ -2868,6 +2875,46 @@
|
|||
);
|
||||
isa = PBXRezBuildPhase;
|
||||
};
|
||||
F5C9ECCE027F474A01A8010C = {
|
||||
isa = PBXFileReference;
|
||||
path = Notifications.m;
|
||||
refType = 4;
|
||||
};
|
||||
F5C9ECD0027F474A01A8010C = {
|
||||
fileRef = F5C9ECCE027F474A01A8010C;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5C9ECD2027F474A01A8010C = {
|
||||
fileRef = F5C9ECCE027F474A01A8010C;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5C9ECD4027F474A01A8010C = {
|
||||
fileRef = F5C9ECCE027F474A01A8010C;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5C9ECD6027F474A01A8010C = {
|
||||
fileRef = F5C9ECCE027F474A01A8010C;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5C9ECD8027F562201A8010C = {
|
||||
isa = PBXFileReference;
|
||||
path = Structs.h;
|
||||
refType = 4;
|
||||
};
|
||||
F5C9ECD9027F562201A8010C = {
|
||||
fileRef = F5C9ECD8027F562201A8010C;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5CDEBAB01FC893201A80001 = {
|
||||
isa = PBXFileReference;
|
||||
path = ResKnifeResourceProtocol.h;
|
||||
|
@ -3167,6 +3214,7 @@
|
|||
F58F6BAD025BE14801A8010C,
|
||||
F58A18430278355D01A8010C,
|
||||
F543AFDD027B2A5001A8010C,
|
||||
F5C9ECD9027F562201A8010C,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
};
|
||||
|
@ -3194,6 +3242,7 @@
|
|||
F58F6B95025BD97801A8010C,
|
||||
F58A18420278355D01A8010C,
|
||||
F543AFDE027B2A5001A8010C,
|
||||
F5C9ECD6027F474A01A8010C,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user