git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 4db047c7d1d07c016e61f3393e51819cb439b959
parent 6f9da353bd06221332007cdeeffbe87216103834
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sun, 24 Jul 2022 14:24:03 +0300

Make GBP selectable in Cocoa

Diffstat:
MCocoa/Document.m17++++++++++++++++-
MCocoa/GBApp.m1+
MCocoa/GBPreferencesWindow.h1+
MCocoa/GBPreferencesWindow.m20+++++++++++++++++++-
MCocoa/Preferences.xib16+++++++++++-----
5 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/Cocoa/Document.m b/Cocoa/Document.m @@ -281,7 +281,7 @@ static void infraredStateChanged(GB_gameboy_t *gb, bool on) return GB_MODEL_MGB; case MODEL_AGB: - return GB_MODEL_AGB; + return (GB_model_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"GBAGBModel"]; } } @@ -799,6 +799,12 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency) object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(agbModelChanged) + name:@"GBAGBModelChanged" + object:nil]; + + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateVolume) name:@"GBVolumeChanged" object:nil]; @@ -2130,6 +2136,15 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency) modelsChanging = false; } +- (void)agbModelChanged +{ + modelsChanging = true; + if (current_model == MODEL_AGB) { + [self reset:nil]; + } + modelsChanging = false; +} + - (void)setFileURL:(NSURL *)fileURL { [super setFileURL:fileURL]; diff --git a/Cocoa/GBApp.m b/Cocoa/GBApp.m @@ -70,6 +70,7 @@ static uint32_t color_to_int(NSColor *color) @"GBDMGModel": @(GB_MODEL_DMG_B), @"GBCGBModel": @(GB_MODEL_CGB_E), + @"GBAGBModel": @(GB_MODEL_AGB_A), @"GBSGBModel": @(GB_MODEL_SGB2), @"GBRumbleMode": @(GB_RUMBLE_CARTRIDGE_ONLY), diff --git a/Cocoa/GBPreferencesWindow.h b/Cocoa/GBPreferencesWindow.h @@ -27,6 +27,7 @@ @property IBOutlet NSPopUpButton *dmgPopupButton; @property IBOutlet NSPopUpButton *sgbPopupButton; @property IBOutlet NSPopUpButton *cgbPopupButton; +@property IBOutlet NSPopUpButton *agbPopupButton; @property IBOutlet NSPopUpButton *preferredJoypadButton; @property IBOutlet NSPopUpButton *playerListButton; @property IBOutlet NSButton *autoUpdatesCheckbox; diff --git a/Cocoa/GBPreferencesWindow.m b/Cocoa/GBPreferencesWindow.m @@ -26,7 +26,7 @@ NSButton *_controllersFocusCheckbox; NSEventModifierFlags previousModifiers; - NSPopUpButton *_dmgPopupButton, *_sgbPopupButton, *_cgbPopupButton; + NSPopUpButton *_dmgPopupButton, *_sgbPopupButton, *_cgbPopupButton, *_agbPopupButton; NSPopUpButton *_preferredJoypadButton; NSPopUpButton *_rumbleModePopupButton; NSPopUpButton *_hotkey1PopupButton; @@ -796,6 +796,17 @@ static inline NSString *keyEquivalentString(NSMenuItem *item) return _cgbPopupButton; } +- (void)setAgbPopupButton:(NSPopUpButton *)agbPopupButton +{ + _agbPopupButton = agbPopupButton; + [_agbPopupButton selectItemWithTag:[[NSUserDefaults standardUserDefaults] integerForKey:@"GBAGBModel"]]; +} + +- (NSPopUpButton *)agbPopupButton +{ + return _agbPopupButton; +} + - (IBAction)dmgModelChanged:(id)sender { [[NSUserDefaults standardUserDefaults] setObject:@([sender selectedTag]) @@ -818,6 +829,13 @@ static inline NSString *keyEquivalentString(NSMenuItem *item) [[NSNotificationCenter defaultCenter] postNotificationName:@"GBCGBModelChanged" object:nil]; } +- (IBAction)agbModelChanged:(id)sender +{ + [[NSUserDefaults standardUserDefaults] setObject:@([sender selectedTag]) + forKey:@"GBAGBModel"]; + [[NSNotificationCenter defaultCenter] postNotificationName:@"GBAGBModelChanged" object:nil]; +} + - (IBAction)reloadButtonsData:(id)sender { [self.controlsTableView reloadData]; diff --git a/Cocoa/Preferences.xib b/Cocoa/Preferences.xib @@ -83,6 +83,7 @@ <outlet property="displayBorderPopupButton" destination="R9D-FV-bpd" id="VfO-b4-gqH"/> <outlet property="dmgPopupButton" destination="LFw-Uk-cPR" id="KDw-i2-k4u"/> <outlet property="frameBlendingModePopupButton" destination="lxk-db-Sxv" id="wzt-uo-TE6"/> + <outlet property="agbPopupButton" destination="3Dl-S6-O7c" id="Ffl-v0-b5S"/> <outlet property="graphicsFilterPopupButton" destination="6pP-kK-EEC" id="LS7-HY-kHC"/> <outlet property="highpassFilterPopupButton" destination="T69-6N-dhT" id="0p6-4m-hb1"/> <outlet property="hotkey1PopupButton" destination="qsH-w5-Rja" id="TFr-p8-IYo"/> @@ -527,18 +528,23 @@ <popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3Dl-S6-O7c"> <rect key="frame" x="28" y="17" width="262" height="26"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="CPU AGB A (GBA, GB Player)" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="519" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" selectedItem="8bk-wP-Cbr" id="EhC-I2-5Th"> + <popUpButtonCell key="cell" type="push" title="CPU AGB A (GBA)" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="519" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" selectedItem="8bk-wP-Cbr" id="EhC-I2-5Th"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="menu"/> <menu key="menu" autoenablesItems="NO" id="b2b-jo-SrI"> <items> <menuItem title="CPU AGB 0 (Early GBA)" tag="518" enabled="NO" id="75z-Yy-XaY"/> - <menuItem title="CPU AGB A (GBA, GB Player)" state="on" tag="519" id="8bk-wP-Cbr"/> + <menuItem title="CPU AGB A (GBA)" state="on" tag="519" id="8bk-wP-Cbr"/> + <menuItem title="CPU AGB A (Game Boy Player)" tag="551" id="NUf-wA-pHI"/> <menuItem title="CPU AGB B (GBA SP)" tag="520" enabled="NO" id="jIE-v4-768"/> - <menuItem title="CPU AGB E (Late GBA SP, GB Player)" tag="521" enabled="NO" id="w7s-kh-HaZ"/> + <menuItem title="CPU AGB E (Late GBA SP)" tag="521" enabled="NO" id="w7s-kh-HaZ"/> + <menuItem title="CPU AGB E (Late Game Boy Player)" tag="553" enabled="NO" id="egH-fX-wob"/> </items> </menu> </popUpButtonCell> + <connections> + <action selector="agbModelChanged:" target="QvC-M9-y7g" id="e97-J4-dmH"/> + </connections> </popUpButton> </subviews> <point key="canvasLocation" x="-501" y="693.5"/> @@ -631,7 +637,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <clipView key="contentView" focusRingType="none" ambiguous="YES" drawsBackground="NO" id="AMs-PO-nid"> <rect key="frame" x="1" y="1" width="255" height="209"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <autoresizingMask key="autoresizingMask"/> <subviews> <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" id="UDd-IJ-fxX"> <rect key="frame" x="0.0" y="0.0" width="255" height="209"/> @@ -1035,7 +1041,7 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/> <clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="5Al-aC-tq8"> <rect key="frame" x="1" y="1" width="158" height="316"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <autoresizingMask key="autoresizingMask"/> <subviews> <tableView focusRingType="none" verticalHuggingPriority="750" ambiguous="YES" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" columnResizing="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" id="ZVn-bk-duk"> <rect key="frame" x="0.0" y="0.0" width="158" height="316"/>

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.