mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-27 19:10:44 +00:00
Merge branch 'master' of https://github.com/LIJI32/SameBoy
This commit is contained in:
commit
e7a5be70c2
@ -327,7 +327,7 @@ static void infraredStateChanged(GB_gameboy_t *gb, bool on)
|
|||||||
GB_set_pixels_output(&gb, self.view.pixels);
|
GB_set_pixels_output(&gb, self.view.pixels);
|
||||||
if (self.vramWindow.isVisible) {
|
if (self.vramWindow.isVisible) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
|
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSWindowStyleMaskFullScreen) != 0;
|
||||||
[self reloadVRAMData: nil];
|
[self reloadVRAMData: nil];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -408,14 +408,14 @@ static void infraredStateChanged(GB_gameboy_t *gb, bool on)
|
|||||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"GBNotificationsUsed"]) {
|
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"GBNotificationsUsed"]) {
|
||||||
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
|
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
|
||||||
for (NSUserNotification *notification in [center scheduledNotifications]) {
|
for (NSUserNotification *notification in [center scheduledNotifications]) {
|
||||||
if ([notification.identifier isEqualToString:self.fileName]) {
|
if ([notification.identifier isEqualToString:self.fileURL.path]) {
|
||||||
[center removeScheduledNotification:notification];
|
[center removeScheduledNotification:notification];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NSUserNotification *notification in [center deliveredNotifications]) {
|
for (NSUserNotification *notification in [center deliveredNotifications]) {
|
||||||
if ([notification.identifier isEqualToString:self.fileName]) {
|
if ([notification.identifier isEqualToString:self.fileURL.path]) {
|
||||||
[center removeDeliveredNotification:notification];
|
[center removeDeliveredNotification:notification];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -482,21 +482,21 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
[self.audioClient stop];
|
[self.audioClient stop];
|
||||||
self.audioClient = nil;
|
self.audioClient = nil;
|
||||||
self.view.mouseHidingEnabled = NO;
|
self.view.mouseHidingEnabled = NO;
|
||||||
GB_save_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sav"] UTF8String]);
|
GB_save_battery(&gb, [[[self.fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sav"].path UTF8String]);
|
||||||
GB_save_cheats(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"cht"] UTF8String]);
|
GB_save_cheats(&gb, [[[self.fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"cht"].path UTF8String]);
|
||||||
unsigned time_to_alarm = GB_time_to_alarm(&gb);
|
unsigned time_to_alarm = GB_time_to_alarm(&gb);
|
||||||
|
|
||||||
if (time_to_alarm) {
|
if (time_to_alarm) {
|
||||||
[NSUserNotificationCenter defaultUserNotificationCenter].delegate = (id)[NSApp delegate];
|
[NSUserNotificationCenter defaultUserNotificationCenter].delegate = (id)[NSApp delegate];
|
||||||
NSUserNotification *notification = [[NSUserNotification alloc] init];
|
NSUserNotification *notification = [[NSUserNotification alloc] init];
|
||||||
NSString *friendlyName = [[self.fileName lastPathComponent] stringByDeletingPathExtension];
|
NSString *friendlyName = [[self.fileURL lastPathComponent] stringByDeletingPathExtension];
|
||||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\([^)]+\\)|\\[[^\\]]+\\]" options:0 error:nil];
|
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\([^)]+\\)|\\[[^\\]]+\\]" options:0 error:nil];
|
||||||
friendlyName = [regex stringByReplacingMatchesInString:friendlyName options:0 range:NSMakeRange(0, [friendlyName length]) withTemplate:@""];
|
friendlyName = [regex stringByReplacingMatchesInString:friendlyName options:0 range:NSMakeRange(0, [friendlyName length]) withTemplate:@""];
|
||||||
friendlyName = [friendlyName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
friendlyName = [friendlyName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||||
|
|
||||||
notification.title = [NSString stringWithFormat:@"%@ Played an Alarm", friendlyName];
|
notification.title = [NSString stringWithFormat:@"%@ Played an Alarm", friendlyName];
|
||||||
notification.informativeText = [NSString stringWithFormat:@"%@ requested your attention by playing a scheduled alarm", friendlyName];
|
notification.informativeText = [NSString stringWithFormat:@"%@ requested your attention by playing a scheduled alarm", friendlyName];
|
||||||
notification.identifier = self.fileName;
|
notification.identifier = self.fileURL.path;
|
||||||
notification.deliveryDate = [NSDate dateWithTimeIntervalSinceNow:time_to_alarm];
|
notification.deliveryDate = [NSDate dateWithTimeIntervalSinceNow:time_to_alarm];
|
||||||
notification.soundName = NSUserNotificationDefaultSoundName;
|
notification.soundName = NSUserNotificationDefaultSoundName;
|
||||||
[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification];
|
[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification];
|
||||||
@ -507,7 +507,7 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
|
|
||||||
- (void) start
|
- (void) start
|
||||||
{
|
{
|
||||||
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
|
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSWindowStyleMaskFullScreen) != 0;
|
||||||
if (master) {
|
if (master) {
|
||||||
[master start];
|
[master start];
|
||||||
return;
|
return;
|
||||||
@ -667,7 +667,7 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.consoleWindow.title = [NSString stringWithFormat:@"Debug Console – %@", [[self.fileURL path] lastPathComponent]];
|
self.consoleWindow.title = [NSString stringWithFormat:@"Debug Console – %@", [self.fileURL.path lastPathComponent]];
|
||||||
self.debuggerSplitView.dividerColor = [NSColor clearColor];
|
self.debuggerSplitView.dividerColor = [NSColor clearColor];
|
||||||
if (@available(macOS 11.0, *)) {
|
if (@available(macOS 11.0, *)) {
|
||||||
self.memoryWindow.toolbarStyle = NSWindowToolbarStyleExpanded;
|
self.memoryWindow.toolbarStyle = NSWindowToolbarStyleExpanded;
|
||||||
@ -827,18 +827,18 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
NSString *rom_warnings = [self captureOutputForBlock:^{
|
NSString *rom_warnings = [self captureOutputForBlock:^{
|
||||||
GB_debugger_clear_symbols(&gb);
|
GB_debugger_clear_symbols(&gb);
|
||||||
if ([[self.fileType pathExtension] isEqualToString:@"isx"]) {
|
if ([[self.fileType pathExtension] isEqualToString:@"isx"]) {
|
||||||
GB_load_isx(&gb, [self.fileName UTF8String]);
|
GB_load_isx(&gb, self.fileURL.path.UTF8String);
|
||||||
GB_load_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"ram"] UTF8String]);
|
GB_load_battery(&gb, [[self.fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"ram"].path.UTF8String);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GB_load_rom(&gb, [self.fileName UTF8String]);
|
GB_load_rom(&gb, [self.fileURL.path UTF8String]);
|
||||||
}
|
}
|
||||||
GB_load_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sav"] UTF8String]);
|
GB_load_battery(&gb, [[self.fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sav"].path.UTF8String);
|
||||||
GB_load_cheats(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"cht"] UTF8String]);
|
GB_load_cheats(&gb, [[self.fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"cht"].path.UTF8String);
|
||||||
[self.cheatWindowController cheatsUpdated];
|
[self.cheatWindowController cheatsUpdated];
|
||||||
GB_debugger_load_symbol_file(&gb, [[[NSBundle mainBundle] pathForResource:@"registers" ofType:@"sym"] UTF8String]);
|
GB_debugger_load_symbol_file(&gb, [[[NSBundle mainBundle] pathForResource:@"registers" ofType:@"sym"] UTF8String]);
|
||||||
GB_debugger_load_symbol_file(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sym"] UTF8String]);
|
GB_debugger_load_symbol_file(&gb, [[self.fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sym"].path.UTF8String);
|
||||||
}];
|
}];
|
||||||
if (rom_warnings && !rom_warning_issued) {
|
if (rom_warnings && !rom_warning_issued) {
|
||||||
rom_warning_issued = true;
|
rom_warning_issued = true;
|
||||||
@ -1145,7 +1145,7 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
{
|
{
|
||||||
bool __block success = false;
|
bool __block success = false;
|
||||||
[self performAtomicBlock:^{
|
[self performAtomicBlock:^{
|
||||||
success = GB_save_state(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:[NSString stringWithFormat:@"s%ld", (long)[sender tag] ]] UTF8String]) == 0;
|
success = GB_save_state(&gb, [[self.fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:[NSString stringWithFormat:@"s%ld", (long)[sender tag] ]].path.UTF8String) == 0;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -1159,7 +1159,7 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
bool __block success = false;
|
bool __block success = false;
|
||||||
NSString *error =
|
NSString *error =
|
||||||
[self captureOutputForBlock:^{
|
[self captureOutputForBlock:^{
|
||||||
success = GB_load_state(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:[NSString stringWithFormat:@"s%ld", (long)[sender tag] ]] UTF8String]) == 0;
|
success = GB_load_state(&gb, [[self.fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:[NSString stringWithFormat:@"s%ld", (long)[sender tag] ]].path.UTF8String) == 0;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -1790,14 +1790,14 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||||||
NSSavePanel * savePanel = [NSSavePanel savePanel];
|
NSSavePanel * savePanel = [NSSavePanel savePanel];
|
||||||
[savePanel setAllowedFileTypes:@[@"png"]];
|
[savePanel setAllowedFileTypes:@[@"png"]];
|
||||||
[savePanel beginSheetModalForWindow:self.printerFeedWindow completionHandler:^(NSInteger result) {
|
[savePanel beginSheetModalForWindow:self.printerFeedWindow completionHandler:^(NSInteger result) {
|
||||||
if (result == NSFileHandlingPanelOKButton) {
|
if (result == NSModalResponseOK) {
|
||||||
[savePanel orderOut:self];
|
[savePanel orderOut:self];
|
||||||
CGImageRef cgRef = [self.feedImageView.image CGImageForProposedRect:NULL
|
CGImageRef cgRef = [self.feedImageView.image CGImageForProposedRect:NULL
|
||||||
context:nil
|
context:nil
|
||||||
hints:nil];
|
hints:nil];
|
||||||
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgRef];
|
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgRef];
|
||||||
[imageRep setSize:(NSSize){160, self.feedImageView.image.size.height / 2}];
|
[imageRep setSize:(NSSize){160, self.feedImageView.image.size.height / 2}];
|
||||||
NSData *data = [imageRep representationUsingType:NSPNGFileType properties:@{}];
|
NSData *data = [imageRep representationUsingType:NSBitmapImageFileTypePNG properties:@{}];
|
||||||
[data writeToURL:savePanel.URL atomically:NO];
|
[data writeToURL:savePanel.URL atomically:NO];
|
||||||
[self.printerFeedWindow setIsVisible:NO];
|
[self.printerFeedWindow setIsVisible:NO];
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GBImageView : NSImageView
|
@interface GBImageView : NSImageView
|
||||||
@property (nonatomic, strong) NSArray *horizontalGrids;
|
@property (nonatomic, strong) NSArray<GBImageViewGridConfiguration *> *horizontalGrids;
|
||||||
@property (nonatomic, strong) NSArray *verticalGrids;
|
@property (nonatomic, strong) NSArray<GBImageViewGridConfiguration *> *verticalGrids;
|
||||||
@property (nonatomic) bool displayScrollRect;
|
@property (nonatomic) bool displayScrollRect;
|
||||||
@property NSRect scrollRect;
|
@property NSRect scrollRect;
|
||||||
@property (nonatomic, weak) IBOutlet id<GBImageViewDelegate> delegate;
|
@property (nonatomic, weak) IBOutlet id<GBImageViewDelegate> delegate;
|
||||||
|
Loading…
Reference in New Issue
Block a user