diff --git a/desmume/src/frontend/cocoa/translations/English.lproj/CheatDatabaseViewer.xib b/desmume/src/frontend/cocoa/translations/English.lproj/CheatDatabaseViewer.xib index f4df17c48..bca64a637 100644 --- a/desmume/src/frontend/cocoa/translations/English.lproj/CheatDatabaseViewer.xib +++ b/desmume/src/frontend/cocoa/translations/English.lproj/CheatDatabaseViewer.xib @@ -56,7 +56,7 @@ 268 - {{17, 452}, {60, 14}} + {{17, 453}, {60, 14}} YES @@ -166,7 +166,7 @@ 265 - {{429, 414}, {103, 14}} + {{429, 412}, {103, 14}} YES @@ -185,7 +185,7 @@ 266 - {{82, 451}, {444, 16}} + {{82, 452}, {444, 16}} YES @@ -209,7 +209,7 @@ 265 - {{534, 414}, {89, 14}} + {{534, 412}, {89, 14}} YES @@ -229,7 +229,7 @@ 265 - {{449, 397}, {83, 14}} + {{449, 394}, {83, 14}} YES @@ -251,7 +251,7 @@ YES - {{534, 397}, {89, 14}} + {{534, 394}, {89, 14}} YES @@ -335,7 +335,7 @@ 265 - {{434, 431}, {98, 14}} + {{434, 430}, {98, 14}} YES @@ -351,19 +351,101 @@ NO 1 - + 268 - {{17, 422}, {90, 14}} + {{17, 414}, {90, 14}} YES - + 68157504 4326400 Game Search: - + + + + + NO + 1 + + + + 265 + {{303, 412}, {36, 14}} + + + YES + + 68157504 + 71435264 + CRC: + + LucidaGrande-Bold + 11 + 16 + + + + + + NO + 1 + + + + 265 + {{294, 430}, {45, 14}} + + + YES + + 68157504 + 71435264 + Serial: + + + + + + NO + 1 + + + + 265 + {{340, 412}, {83, 14}} + + + YES + + 70254657 + 4330496 + + + CRC + + + + + NO + 1 + + + + 265 + {{340, 430}, {83, 14}} + + + YES + + 70254657 + 4330496 + + + gameCode + @@ -373,7 +455,7 @@ 265 - {{534, 431}, {89, 14}} + {{534, 430}, {89, 14}} YES @@ -393,7 +475,7 @@ 265 - {{529, 444}, {96, 28}} + {{529, 445}, {96, 28}} _NS:610 @@ -453,7 +535,7 @@ 269 - {{304, 35.5}, {32, 32}} + {{304, 33}, {32, 32}} _NS:4186 @@ -473,7 +555,7 @@ 256 - {638, 87} + {638, 84.5} _NS:1843 @@ -590,7 +672,7 @@ - 361 + 347 70 10000 @@ -648,8 +730,8 @@ - 70 - 70 + 80 + 80 3.4028234663852886e+38 75497536 @@ -677,8 +759,8 @@ - 86 - 86 + 90 + 90 3.4028234663852886e+38 75497536 @@ -730,7 +812,7 @@ 1 - {{1, 17}, {638, 87}} + {{1, 17}, {638, 84.5}} _NS:1841 @@ -779,7 +861,7 @@ 4 - {640, 105} + {640, 102.5} _NS:1839 @@ -794,7 +876,7 @@ 1 - {640, 105} + {640, 102.5} _NS:1030 @@ -818,7 +900,7 @@ 256 - {638, 214} + {638, 208.5} _NS:1718 @@ -976,7 +1058,7 @@ - {{1, 17}, {638, 214}} + {{1, 17}, {638, 208.5}} _NS:1716 @@ -1025,7 +1107,7 @@ 4 - {640, 232} + {640, 226.5} _NS:1714 @@ -1040,14 +1122,14 @@ 1 - {{0, 115}, {640, 233}} + {{0, 112.5}, {640, 227.5}} _NS:1033 NSView - {{0, 41}, {640, 348}} + {{0, 41}, {640, 340}} _NS:1028 @@ -1060,7 +1142,7 @@ YES - {{20, 397}, {265, 22}} + {{20, 389}, {265, 22}} _NS:845 @@ -1129,21 +1211,21 @@ NO 1 - + 265 - {{288, 393}, {136, 28}} + {{289, 385}, {136, 28}} _NS:610 YES - + 67108864 134348800 Select Current Game _NS:610 - + -2038284288 129 @@ -1330,7 +1412,7 @@ 69206017 272633856 - + LucidaGrande-Bold 13 16 @@ -1397,7 +1479,7 @@ NO - + 268 {{17, 148}, {446, 17}} @@ -1405,21 +1487,21 @@ _NS:4068 YES - + 70254657 272634880 - + Major String _NS:4068 - + NO 1 - + 268 {{17, 44}, {446, 96}} @@ -1427,14 +1509,14 @@ _NS:4068 YES - + 69206017 272764928 Minor String _NS:4068 - + @@ -1964,17 +2046,17 @@ selectCurrentGame: - + 196 enabled: isCurrentGameFound - + - + enabled: isCurrentGameFound enabled @@ -1989,7 +2071,7 @@ enabled: isCurrentGameFound - + enabled: isCurrentGameFound @@ -2005,7 +2087,7 @@ enabled: isCurrentGameFound - + enabled: isCurrentGameFound @@ -2021,7 +2103,7 @@ enabled: isCurrentGameFound - + enabled: isCurrentGameFound @@ -2060,7 +2142,7 @@ - + 2 @@ -2094,7 +2176,7 @@ - + 2 @@ -2128,7 +2210,7 @@ - + 2 @@ -2153,10 +2235,10 @@ value: errorMajorString - + - + value: errorMajorString value @@ -2169,10 +2251,10 @@ value: errorMajorString - + - + value: errorMajorString value @@ -2185,10 +2267,10 @@ value: errorMinorString - + - + value: errorMinorString value @@ -2203,7 +2285,7 @@ predicate: filterPredicate - + predicate: filterPredicate @@ -2232,7 +2314,7 @@ predicate2: filterPredicate - + predicate2: filterPredicate @@ -2251,7 +2333,7 @@ serial CONTAINS[cd] $value - + 2 @@ -2281,12 +2363,52 @@ crcString CONTAINS[cd] $value - + 2 222 + + + selectCurrentGameButton + + + + 229 + + + + value: currentGameSerial + + + + + + value: currentGameSerial + value + currentGameSerial + 2 + + + 238 + + + + value: currentGameCRCString + + + + + + value: currentGameCRCString + value + currentGameCRCString + 2 + + + 241 + @@ -2344,8 +2466,12 @@ - - + + + + + + @@ -2548,9 +2674,9 @@ YES - + - + @@ -2907,59 +3033,115 @@ 187 - + YES - + 188 - - + + 190 - + YES - + 191 - - + + 210 - + YES - + 211 - - + + 213 - + YES - + 214 - - + + + + + 230 + + + YES + + + + + + 231 + + + + + 232 + + + YES + + + + + + 233 + + + + + 234 + + + YES + + + + + + 235 + + + YES + + + + + + 236 + + + + + 237 + + @@ -3015,6 +3197,18 @@ 214.IBPluginDependency 22.IBPluginDependency 23.IBPluginDependency + 230.IBPluginDependency + 230.IBViewBoundsToFrameTransform + 231.IBPluginDependency + 232.IBPluginDependency + 232.IBViewBoundsToFrameTransform + 233.IBPluginDependency + 234.IBPluginDependency + 234.IBViewBoundsToFrameTransform + 235.IBPluginDependency + 235.IBViewBoundsToFrameTransform + 236.IBPluginDependency + 237.IBPluginDependency 25.IBPluginDependency 26.IBPluginDependency 27.IBPluginDependency @@ -3137,7 +3331,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABD2gAAw9sAAA + P4AAAL+AAABBiAAAw9kAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3160,6 +3354,26 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABDlYAAw9YAAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABDkQAAw90AAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABDhgAAw9eAAA + + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABDkQAAw92AAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3285,10 +3499,10 @@ - 228 + 241 - + YES CheatDatabaseWindowController @@ -3362,6 +3576,7 @@ errorSheet gameListController gameTable + selectCurrentGameButton splitView @@ -3371,6 +3586,7 @@ NSWindow NSArrayController NSTableView + NSButton NSSplitView @@ -3383,6 +3599,7 @@ errorSheet gameListController gameTable + selectCurrentGameButton splitView @@ -3407,6 +3624,10 @@ gameTable NSTableView + + selectCurrentGameButton + NSButton + splitView NSSplitView @@ -3414,616 +3635,8 @@ - IBProjectSource - userinterface/CheatDatabaseWindowController.h - - - - - YES - - NSActionCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSActionCell.h - - - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSArrayController - NSObjectController - - IBFrameworkSource - AppKit.framework/Headers/NSArrayController.h - - - - NSButton - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSButton.h - - - - NSButtonCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSButtonCell.h - - - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSController - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSController.h - - - - NSDrawer - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSImageCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSImageCell.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSNumberFormatter - NSFormatter - - IBFrameworkSource - Foundation.framework/Headers/NSNumberFormatter.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CIImageProvider.h - - - - NSObjectController - NSController - - IBFrameworkSource - AppKit.framework/Headers/NSObjectController.h - - - - NSOutlineView - NSTableView - - - - NSProgressIndicator - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSProgressIndicator.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSScrollView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSScrollView.h - - - - NSScroller - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSScroller.h - - - - NSSearchField - NSTextField - - IBFrameworkSource - AppKit.framework/Headers/NSSearchField.h - - - - NSSearchFieldCell - NSTextFieldCell - - IBFrameworkSource - AppKit.framework/Headers/NSSearchFieldCell.h - - - - NSSplitView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSSplitView.h - - - - NSTableColumn - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableColumn.h - - - - NSTableHeaderView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSTableHeaderView.h - - - - NSTableView - NSControl - - - - NSText - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.h - - - - NSTextView - NSText - - IBFrameworkSource - AppKit.framework/Headers/NSTextView.h - - - - NSTreeController - NSObjectController - - IBFrameworkSource - AppKit.framework/Headers/NSTreeController.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h - - - - NSWindowController - NSResponder - - showWindow: - id - - - showWindow: - - showWindow: - id - - - - IBFrameworkSource - AppKit.framework/Headers/NSWindowController.h + IBDocumentRelativeSource + ../../userinterface/CheatDatabaseWindowController.h diff --git a/desmume/src/frontend/cocoa/userinterface/CheatDatabaseWindowController.h b/desmume/src/frontend/cocoa/userinterface/CheatDatabaseWindowController.h index 95bd72cdc..e8f1622a4 100644 --- a/desmume/src/frontend/cocoa/userinterface/CheatDatabaseWindowController.h +++ b/desmume/src/frontend/cocoa/userinterface/CheatDatabaseWindowController.h @@ -46,6 +46,8 @@ BOOL isSelectedGameTheCurrentGame; NSInteger currentGameTableRowIndex; NSString *currentGameIndexString; + NSString *currentGameSerial; + NSUInteger currentGameCRC; NSString *errorMajorString; NSString *errorMinorString; @@ -71,6 +73,9 @@ @property (assign) BOOL isFileLoading; @property (assign) BOOL isCurrentGameFound; @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 *errorMinorString; @@ -80,10 +85,9 @@ - (void) loadFileOnThread:(id)object; - (void) loadFileDidFinish:(NSNotification *)aNotification; - (void) updateWindow; ++ (void) setCurrentGameForAllWindowsSerial:(NSString *)serialString crc:(NSUInteger)crc; - (void) validateGameTableFonts; -+ (void) validateGameTableFontsForAllWindows; - (BOOL) validateWillAddColumn; -+ (void) validateWillAddColumnForAllWindows; - (void) showErrorSheet:(NSInteger)errorCode; - (void) didEndErrorSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; diff --git a/desmume/src/frontend/cocoa/userinterface/CheatDatabaseWindowController.mm b/desmume/src/frontend/cocoa/userinterface/CheatDatabaseWindowController.mm index b6fd6de68..2ec9cb352 100644 --- a/desmume/src/frontend/cocoa/userinterface/CheatDatabaseWindowController.mm +++ b/desmume/src/frontend/cocoa/userinterface/CheatDatabaseWindowController.mm @@ -43,6 +43,9 @@ @implementation CheatDatabaseWindowController @synthesize isFileLoading; @synthesize isCurrentGameFound; @synthesize isSelectedGameTheCurrentGame; +@dynamic currentGameSerial; +@synthesize currentGameCRC; +@dynamic currentGameCRCString; @synthesize errorMajorString; @synthesize errorMinorString; @@ -66,6 +69,8 @@ - (id) initWithWindowNibName:(NSString *)windowNibName delegate:(CheatWindowDele isSelectedGameTheCurrentGame = NO; currentGameIndexString = [[NSString alloc] initWithString:@"NSNotFound"]; currentGameTableRowIndex = NSNotFound; + currentGameSerial = nil; + currentGameCRC = 0; errorMajorString = @"No error has occurred!"; errorMinorString = @"This is just a placeholder message for initialization purposes."; @@ -261,10 +266,34 @@ - (void) updateWindow [gameTable deselectAll:nil]; [gameTable selectRowIndexes:selectedRows byExtendingSelection:NO]; + CheatWindowDelegate *delegate = [self cheatManagerDelegate]; + CocoaDSCheatManager *cheatManager = [delegate cdsCheats]; + [self setCurrentGameSerial:[cheatManager currentGameCode]]; + [self setCurrentGameCRC:[cheatManager currentGameCRC]]; + [self validateGameTableFonts]; [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 { CheatWindowDelegate *delegate = [self cheatManagerDelegate]; @@ -279,12 +308,9 @@ - (void) validateGameTableFonts return; } - NSString *currentGameCode = [cheatManager currentGameCode]; - const NSUInteger currentGameCRC = [cheatManager currentGameCRC]; - 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 = [[NSString alloc] initWithFormat:@"%llu", (unsigned long long)[game index]]; @@ -294,20 +320,6 @@ - (void) validateGameTableFonts } } -+ (void) validateGameTableFontsForAllWindows -{ - if (cheatDatabaseWindowList == nil) - { - return; - } - - for (CheatDatabaseWindowController *windowController in cheatDatabaseWindowList) - { - [windowController validateGameTableFonts]; - [[windowController gameTable] setNeedsDisplay]; - } -} - - (BOOL) validateWillAddColumn { BOOL showWillAddColumn = NO; @@ -325,7 +337,7 @@ - (BOOL) validateWillAddColumn 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"]; @@ -336,19 +348,6 @@ - (BOOL) validateWillAddColumn return showWillAddColumn; } -+ (void) validateWillAddColumnForAllWindows -{ - if (cheatDatabaseWindowList == nil) - { - return; - } - - for (CheatDatabaseWindowController *windowController in cheatDatabaseWindowList) - { - [windowController validateWillAddColumn]; - } -} - - (void) showErrorSheet:(NSInteger)errorCode { switch (errorCode) @@ -486,6 +485,45 @@ - (NSString *) isEncryptedString 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 IBActions @@ -582,9 +620,7 @@ - (IBAction) addSelected:(id)sender return; } - NSString *currentGameCode = [cheatManager currentGameCode]; - NSUInteger currentGameCRC = [cheatManager currentGameCRC]; - if ( (currentGameCode == nil) || (currentGameCRC == 0) ) + if ( ([self currentGameSerial] == nil) || ([self currentGameCRC] == 0) ) { return; } @@ -598,7 +634,7 @@ - (IBAction) addSelected:(id)sender NSInteger selectedIndex = [gameTable selectedRow]; 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; } @@ -631,9 +667,7 @@ - (IBAction) selectCurrentGame:(id)sender return; } - NSString *currentGameCode = [cheatManager currentGameCode]; - NSUInteger currentGameCRC = [cheatManager currentGameCRC]; - if ( (currentGameCode == nil) || (currentGameCRC == 0) ) + if ( ([self currentGameSerial] == nil) || ([self currentGameCRC] == 0) ) { return; } @@ -643,7 +677,7 @@ - (IBAction) selectCurrentGame:(id)sender NSArray *arrangedObjects = (NSArray *)[gameListController 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]; NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:selectionIndex]; diff --git a/desmume/src/frontend/cocoa/userinterface/cheatWindowDelegate.mm b/desmume/src/frontend/cocoa/userinterface/cheatWindowDelegate.mm index 53a421d09..9c35b251c 100644 --- a/desmume/src/frontend/cocoa/userinterface/cheatWindowDelegate.mm +++ b/desmume/src/frontend/cocoa/userinterface/cheatWindowDelegate.mm @@ -122,8 +122,7 @@ - (BOOL) cheatSystemStart:(CocoaDSCheatManager *)cheatManager [cheatListController setContent:[cheatManager sessionList]]; [self setCheatSearchViewByStyle:CheatSearchStyle_ExactValue]; - [CheatDatabaseWindowController validateWillAddColumnForAllWindows]; - [CheatDatabaseWindowController validateGameTableFontsForAllWindows]; + [CheatDatabaseWindowController setCurrentGameForAllWindowsSerial:[cheatManager currentGameCode] crc:[cheatManager currentGameCRC]]; didStartSuccessfully = YES; return didStartSuccessfully; @@ -143,8 +142,7 @@ - (void) cheatSystemEnd [self setCurrentGameCRC:0]; [self setCdsCheats:nil]; - [CheatDatabaseWindowController validateWillAddColumnForAllWindows]; - [CheatDatabaseWindowController validateGameTableFontsForAllWindows]; + [CheatDatabaseWindowController setCurrentGameForAllWindowsSerial:nil crc:0]; } - (IBAction) addToList:(id)sender