Cocoa Port: The Cheat Database Viewer now displays the current game's serial and CRC to help users verify the existence of a game in the database file.
This commit is contained in:
parent
6c5941689f
commit
751ab0255b
File diff suppressed because it is too large
Load Diff
|
@ -46,6 +46,8 @@
|
||||||
BOOL isSelectedGameTheCurrentGame;
|
BOOL isSelectedGameTheCurrentGame;
|
||||||
NSInteger currentGameTableRowIndex;
|
NSInteger currentGameTableRowIndex;
|
||||||
NSString *currentGameIndexString;
|
NSString *currentGameIndexString;
|
||||||
|
NSString *currentGameSerial;
|
||||||
|
NSUInteger currentGameCRC;
|
||||||
|
|
||||||
NSString *errorMajorString;
|
NSString *errorMajorString;
|
||||||
NSString *errorMinorString;
|
NSString *errorMinorString;
|
||||||
|
@ -71,6 +73,9 @@
|
||||||
@property (assign) BOOL isFileLoading;
|
@property (assign) BOOL isFileLoading;
|
||||||
@property (assign) BOOL isCurrentGameFound;
|
@property (assign) BOOL isCurrentGameFound;
|
||||||
@property (assign) BOOL isSelectedGameTheCurrentGame;
|
@property (assign) BOOL isSelectedGameTheCurrentGame;
|
||||||
|
@property (retain, nonatomic) NSString *currentGameSerial;
|
||||||
|
@property (assign, nonatomic) NSUInteger currentGameCRC;
|
||||||
|
@property (readonly, nonatomic) NSString *currentGameCRCString;
|
||||||
|
|
||||||
@property (assign) NSString *errorMajorString;
|
@property (assign) NSString *errorMajorString;
|
||||||
@property (assign) NSString *errorMinorString;
|
@property (assign) NSString *errorMinorString;
|
||||||
|
@ -80,10 +85,9 @@
|
||||||
- (void) loadFileOnThread:(id)object;
|
- (void) loadFileOnThread:(id)object;
|
||||||
- (void) loadFileDidFinish:(NSNotification *)aNotification;
|
- (void) loadFileDidFinish:(NSNotification *)aNotification;
|
||||||
- (void) updateWindow;
|
- (void) updateWindow;
|
||||||
|
+ (void) setCurrentGameForAllWindowsSerial:(NSString *)serialString crc:(NSUInteger)crc;
|
||||||
- (void) validateGameTableFonts;
|
- (void) validateGameTableFonts;
|
||||||
+ (void) validateGameTableFontsForAllWindows;
|
|
||||||
- (BOOL) validateWillAddColumn;
|
- (BOOL) validateWillAddColumn;
|
||||||
+ (void) validateWillAddColumnForAllWindows;
|
|
||||||
- (void) showErrorSheet:(NSInteger)errorCode;
|
- (void) showErrorSheet:(NSInteger)errorCode;
|
||||||
- (void) didEndErrorSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
|
- (void) didEndErrorSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,9 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
@synthesize isFileLoading;
|
@synthesize isFileLoading;
|
||||||
@synthesize isCurrentGameFound;
|
@synthesize isCurrentGameFound;
|
||||||
@synthesize isSelectedGameTheCurrentGame;
|
@synthesize isSelectedGameTheCurrentGame;
|
||||||
|
@dynamic currentGameSerial;
|
||||||
|
@synthesize currentGameCRC;
|
||||||
|
@dynamic currentGameCRCString;
|
||||||
|
|
||||||
@synthesize errorMajorString;
|
@synthesize errorMajorString;
|
||||||
@synthesize errorMinorString;
|
@synthesize errorMinorString;
|
||||||
|
@ -66,6 +69,8 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
isSelectedGameTheCurrentGame = NO;
|
isSelectedGameTheCurrentGame = NO;
|
||||||
currentGameIndexString = [[NSString alloc] initWithString:@"NSNotFound"];
|
currentGameIndexString = [[NSString alloc] initWithString:@"NSNotFound"];
|
||||||
currentGameTableRowIndex = NSNotFound;
|
currentGameTableRowIndex = NSNotFound;
|
||||||
|
currentGameSerial = nil;
|
||||||
|
currentGameCRC = 0;
|
||||||
errorMajorString = @"No error has occurred!";
|
errorMajorString = @"No error has occurred!";
|
||||||
errorMinorString = @"This is just a placeholder message for initialization purposes.";
|
errorMinorString = @"This is just a placeholder message for initialization purposes.";
|
||||||
|
|
||||||
|
@ -261,10 +266,34 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
[gameTable deselectAll:nil];
|
[gameTable deselectAll:nil];
|
||||||
[gameTable selectRowIndexes:selectedRows byExtendingSelection:NO];
|
[gameTable selectRowIndexes:selectedRows byExtendingSelection:NO];
|
||||||
|
|
||||||
|
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
||||||
|
CocoaDSCheatManager *cheatManager = [delegate cdsCheats];
|
||||||
|
[self setCurrentGameSerial:[cheatManager currentGameCode]];
|
||||||
|
[self setCurrentGameCRC:[cheatManager currentGameCRC]];
|
||||||
|
|
||||||
[self validateGameTableFonts];
|
[self validateGameTableFonts];
|
||||||
[self selectCurrentGame:nil];
|
[self selectCurrentGame:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (void) setCurrentGameForAllWindowsSerial:(NSString *)serialString crc:(NSUInteger)crc
|
||||||
|
{
|
||||||
|
if (cheatDatabaseWindowList == nil)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CheatDatabaseWindowController *windowController in cheatDatabaseWindowList)
|
||||||
|
{
|
||||||
|
[windowController setCurrentGameSerial:serialString];
|
||||||
|
[windowController setCurrentGameCRC:crc];
|
||||||
|
|
||||||
|
[windowController validateGameTableFonts];
|
||||||
|
[[windowController gameTable] setNeedsDisplay];
|
||||||
|
|
||||||
|
[windowController validateWillAddColumn];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void) validateGameTableFonts
|
- (void) validateGameTableFonts
|
||||||
{
|
{
|
||||||
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
||||||
|
@ -279,12 +308,9 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *currentGameCode = [cheatManager currentGameCode];
|
|
||||||
const NSUInteger currentGameCRC = [cheatManager currentGameCRC];
|
|
||||||
|
|
||||||
for (CocoaDSCheatDBGame *game in [gameListController content])
|
for (CocoaDSCheatDBGame *game in [gameListController content])
|
||||||
{
|
{
|
||||||
if ( ([game crc] == currentGameCRC) && ([[game serial] isEqualToString:currentGameCode]) )
|
if ( ([game crc] == [self currentGameCRC]) && ([[game serial] isEqualToString:[self currentGameSerial]]) )
|
||||||
{
|
{
|
||||||
[currentGameIndexString release];
|
[currentGameIndexString release];
|
||||||
currentGameIndexString = [[NSString alloc] initWithFormat:@"%llu", (unsigned long long)[game index]];
|
currentGameIndexString = [[NSString alloc] initWithFormat:@"%llu", (unsigned long long)[game index]];
|
||||||
|
@ -294,20 +320,6 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void) validateGameTableFontsForAllWindows
|
|
||||||
{
|
|
||||||
if (cheatDatabaseWindowList == nil)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (CheatDatabaseWindowController *windowController in cheatDatabaseWindowList)
|
|
||||||
{
|
|
||||||
[windowController validateGameTableFonts];
|
|
||||||
[[windowController gameTable] setNeedsDisplay];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) validateWillAddColumn
|
- (BOOL) validateWillAddColumn
|
||||||
{
|
{
|
||||||
BOOL showWillAddColumn = NO;
|
BOOL showWillAddColumn = NO;
|
||||||
|
@ -325,7 +337,7 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
|
|
||||||
if ( (delegate != nil) && (cheatManager != nil) && ([selectedGame serial] != nil) )
|
if ( (delegate != nil) && (cheatManager != nil) && ([selectedGame serial] != nil) )
|
||||||
{
|
{
|
||||||
showWillAddColumn = ([[selectedGame serial] isEqualToString:[cheatManager currentGameCode]]) && ([selectedGame crc] == [cheatManager currentGameCRC]);
|
showWillAddColumn = ([[selectedGame serial] isEqualToString:currentGameSerial]) && ([selectedGame crc] == currentGameCRC);
|
||||||
}
|
}
|
||||||
|
|
||||||
NSTableColumn *willAddColumn = [entryOutline tableColumnWithIdentifier:@"willAdd"];
|
NSTableColumn *willAddColumn = [entryOutline tableColumnWithIdentifier:@"willAdd"];
|
||||||
|
@ -336,19 +348,6 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
return showWillAddColumn;
|
return showWillAddColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void) validateWillAddColumnForAllWindows
|
|
||||||
{
|
|
||||||
if (cheatDatabaseWindowList == nil)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (CheatDatabaseWindowController *windowController in cheatDatabaseWindowList)
|
|
||||||
{
|
|
||||||
[windowController validateWillAddColumn];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) showErrorSheet:(NSInteger)errorCode
|
- (void) showErrorSheet:(NSInteger)errorCode
|
||||||
{
|
{
|
||||||
switch (errorCode)
|
switch (errorCode)
|
||||||
|
@ -486,6 +485,45 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
return @"---";
|
return @"---";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setCurrentGameSerial:(NSString *)newString
|
||||||
|
{
|
||||||
|
NSString *oldString = currentGameSerial;
|
||||||
|
currentGameSerial = [newString retain];
|
||||||
|
[oldString release];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) currentGameSerial
|
||||||
|
{
|
||||||
|
if ( (currentGameSerial != nil) && ([currentGameSerial length] > 0) )
|
||||||
|
{
|
||||||
|
return currentGameSerial;
|
||||||
|
}
|
||||||
|
|
||||||
|
return @"---";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setCurrentGameCRC:(NSUInteger)crc
|
||||||
|
{
|
||||||
|
[self willChangeValueForKey:@"currentGameCRCString"];
|
||||||
|
currentGameCRC = crc;
|
||||||
|
[self didChangeValueForKey:@"currentGameCRCString"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSUInteger) currentGameCRC
|
||||||
|
{
|
||||||
|
return currentGameCRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) currentGameCRCString
|
||||||
|
{
|
||||||
|
if (currentGameCRC != 0)
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"%08lX", (unsigned long)currentGameCRC];
|
||||||
|
}
|
||||||
|
|
||||||
|
return @"---";
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark IBActions
|
#pragma mark IBActions
|
||||||
|
|
||||||
|
@ -582,9 +620,7 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *currentGameCode = [cheatManager currentGameCode];
|
if ( ([self currentGameSerial] == nil) || ([self currentGameCRC] == 0) )
|
||||||
NSUInteger currentGameCRC = [cheatManager currentGameCRC];
|
|
||||||
if ( (currentGameCode == nil) || (currentGameCRC == 0) )
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -598,7 +634,7 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
NSInteger selectedIndex = [gameTable selectedRow];
|
NSInteger selectedIndex = [gameTable selectedRow];
|
||||||
CocoaDSCheatDBGame *selectedGame = (CocoaDSCheatDBGame *)[[gameListController arrangedObjects] objectAtIndex:selectedIndex];
|
CocoaDSCheatDBGame *selectedGame = (CocoaDSCheatDBGame *)[[gameListController arrangedObjects] objectAtIndex:selectedIndex];
|
||||||
|
|
||||||
if ( (![[selectedGame serial] isEqualToString:currentGameCode]) || ([selectedGame crc] != currentGameCRC) )
|
if ( (![[selectedGame serial] isEqualToString:[self currentGameSerial]]) || ([selectedGame crc] != [self currentGameCRC]) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -631,9 +667,7 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *currentGameCode = [cheatManager currentGameCode];
|
if ( ([self currentGameSerial] == nil) || ([self currentGameCRC] == 0) )
|
||||||
NSUInteger currentGameCRC = [cheatManager currentGameCRC];
|
|
||||||
if ( (currentGameCode == nil) || (currentGameCRC == 0) )
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -643,7 +677,7 @@ NSMutableArray *cheatDatabaseWindowList = nil;
|
||||||
NSArray *arrangedObjects = (NSArray *)[gameListController arrangedObjects];
|
NSArray *arrangedObjects = (NSArray *)[gameListController arrangedObjects];
|
||||||
for (CocoaDSCheatDBGame *game in arrangedObjects)
|
for (CocoaDSCheatDBGame *game in arrangedObjects)
|
||||||
{
|
{
|
||||||
if ( ([game crc] == currentGameCRC) && ([[game serial] isEqualToString:currentGameCode]) )
|
if ( ([game crc] == [self currentGameCRC]) && ([[game serial] isEqualToString:[self currentGameSerial]]) )
|
||||||
{
|
{
|
||||||
selectionIndex = [arrangedObjects indexOfObject:game];
|
selectionIndex = [arrangedObjects indexOfObject:game];
|
||||||
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:selectionIndex];
|
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:selectionIndex];
|
||||||
|
|
|
@ -122,8 +122,7 @@
|
||||||
[cheatListController setContent:[cheatManager sessionList]];
|
[cheatListController setContent:[cheatManager sessionList]];
|
||||||
|
|
||||||
[self setCheatSearchViewByStyle:CheatSearchStyle_ExactValue];
|
[self setCheatSearchViewByStyle:CheatSearchStyle_ExactValue];
|
||||||
[CheatDatabaseWindowController validateWillAddColumnForAllWindows];
|
[CheatDatabaseWindowController setCurrentGameForAllWindowsSerial:[cheatManager currentGameCode] crc:[cheatManager currentGameCRC]];
|
||||||
[CheatDatabaseWindowController validateGameTableFontsForAllWindows];
|
|
||||||
|
|
||||||
didStartSuccessfully = YES;
|
didStartSuccessfully = YES;
|
||||||
return didStartSuccessfully;
|
return didStartSuccessfully;
|
||||||
|
@ -143,8 +142,7 @@
|
||||||
[self setCurrentGameCRC:0];
|
[self setCurrentGameCRC:0];
|
||||||
[self setCdsCheats:nil];
|
[self setCdsCheats:nil];
|
||||||
|
|
||||||
[CheatDatabaseWindowController validateWillAddColumnForAllWindows];
|
[CheatDatabaseWindowController setCurrentGameForAllWindowsSerial:nil crc:0];
|
||||||
[CheatDatabaseWindowController validateGameTableFontsForAllWindows];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) addToList:(id)sender
|
- (IBAction) addToList:(id)sender
|
||||||
|
|
Loading…
Reference in New Issue