From c64aa9d19abf4530e41316c282d82e5f98706eee Mon Sep 17 00:00:00 2001 From: Serena Date: Tue, 14 Feb 2023 19:11:32 +0300 Subject: [PATCH] address concerns --- CMakeLists.txt | 4 +- Core/Config.cpp | 2 +- Core/Config.h | 4 +- SDL/MacOSBarItems.h | 21 --- SDL/MacOSBarItems.mm | 326 ---------------------------------- SDL/SDLMain.cpp | 10 +- UI/DarwinFileSystemServices.h | 7 - UI/GameSettingsScreen.cpp | 28 +-- 8 files changed, 12 insertions(+), 390 deletions(-) delete mode 100644 SDL/MacOSBarItems.h delete mode 100644 SDL/MacOSBarItems.mm diff --git a/CMakeLists.txt b/CMakeLists.txt index 82887d0a59..27dfcf93ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1231,9 +1231,9 @@ elseif(TARGET SDL2::SDL2) endif() set(nativeExtraLibs ${nativeExtraLibs} SDL2::SDL2) if(APPLE) - set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm SDL/SDLCocoaMetalLayer.h SDL/SDLCocoaMetalLayer.mm SDL/MacOSBarItems.mm SDL/MacOSBarItems.h UI/DarwinFileSystemServices.mm UI/DarwinFileSystemServices.h Common/Battery/AppleBatteryClient.m) + set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm SDL/SDLCocoaMetalLayer.h SDL/SDLCocoaMetalLayer.mm SDL/CocoaBarItems.mm SDL/CocoaBarItems.h UI/DarwinFileSystemServices.mm UI/DarwinFileSystemServices.h Common/Battery/AppleBatteryClient.m) set_source_files_properties(UI/DarwinFileSystemServices.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) - set_source_files_properties(SDL/MacOSBarItems.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + set_source_files_properties(SDL/CocoaBarItems.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) set_source_files_properties(Common/Battery/AppleBatteryClient.m PROPERTIES COMPILE_FLAGS -fobjc-arc) set(nativeExtraLibs ${nativeExtraLibs} ${COCOA_LIBRARY} ${QUARTZ_CORE_LIBRARY} ${IOKIT_LIBRARY}) elseif(USING_EGL) diff --git a/Core/Config.cpp b/Core/Config.cpp index d55ae00703..bbfa50c66c 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1301,7 +1301,7 @@ void Config::SetAppendedConfigIni(const Path &path) { appendedConfigFileName_ = path; } -void Config::updateAfterSettingAutoFrameSkip() { +void Config::UpdateAfterSettingAutoFrameSkip() { if (bAutoFrameSkip && iFrameSkip == 0) { iFrameSkip = 1; } diff --git a/Core/Config.h b/Core/Config.h index 4e9bd0e3d2..e6c0dbbea1 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -573,9 +573,7 @@ public: bool LoadAppendedConfig(); void SetAppendedConfigIni(const Path &path); - - void updateAfterSettingAutoFrameSkip(); - + void UpdateAfterSettingAutoFrameSkip(); protected: void LoadStandardControllerIni(); void LoadLangValuesMapping(); diff --git a/SDL/MacOSBarItems.h b/SDL/MacOSBarItems.h deleted file mode 100644 index 379530e362..0000000000 --- a/SDL/MacOSBarItems.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// MacOSBarItems.h -// PPSSPP -// -// Created by Serena on 06/02/2023. -// - -#ifndef MacOSBarItems_h -#define MacOSBarItems_h - -#ifdef __cplusplus -extern "C" { -#endif - -void initBarItemsForApp(); - -#ifdef __cplusplus -} -#endif - -#endif /* MacOSBarItems_h */ diff --git a/SDL/MacOSBarItems.mm b/SDL/MacOSBarItems.mm deleted file mode 100644 index 1e262a0158..0000000000 --- a/SDL/MacOSBarItems.mm +++ /dev/null @@ -1,326 +0,0 @@ -// -// MacOSBarItems.mm -// PPSSPP -// -// Created by Serena on 06/02/2023. -// - -#include "Common/System/System.h" -#include "Common/System/NativeApp.h" -#include "Core/Config.h" -#include "Common/Data/Text/I18n.h" -#include "Common/StringUtils.h" -#import - -#ifdef __cplusplus -extern "C" { -#endif - -// NSMenuItem requires the use of an objective-c selector (aka the devil's greatest trick) -// So we have to make this class -@interface BarItemsManager : NSObject -+(instancetype)sharedInstance; --(void)setupAppBarItems; -@property (assign) NSMenu *openMenu; -@property (assign) std::shared_ptr mainSettingsLocalization; -@end - -void initBarItemsForApp() { - [[BarItemsManager sharedInstance] setupAppBarItems]; -} - -// im soooooo sorry for whoever had to read this impl -@implementation BarItemsManager -+ (instancetype)sharedInstance { - static BarItemsManager *stub; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - stub = [BarItemsManager new]; - stub.mainSettingsLocalization = GetI18NCategory("MainSettings"); - }); - - return stub; -} - --(void)setupAppBarItems { - NSMenuItem *openMenuItem = [[NSMenuItem alloc] init]; - openMenuItem.submenu = [self makeOpenSubmenu]; - - NSMenuItem *graphicsMenuItem = [[NSMenuItem alloc] init]; - graphicsMenuItem.submenu = [self makeGraphicsMenu]; - - NSMenuItem *audioMenuItem = [[NSMenuItem alloc] init]; - audioMenuItem.submenu = [self makeAudioMenu]; - - [NSApplication.sharedApplication.menu addItem:openMenuItem]; - [NSApplication.sharedApplication.menu addItem:graphicsMenuItem]; - [NSApplication.sharedApplication.menu addItem:audioMenuItem]; -} - --(NSMenu *)makeOpenSubmenu { - NSMenu *menu = [[NSMenu alloc] initWithTitle:@"File"]; - NSMenuItem *openWithSystemFolderBrowserItem = [[NSMenuItem alloc] initWithTitle:@"Open..." action:@selector(openSystemFileBrowser) keyEquivalent:@"o"]; - openWithSystemFolderBrowserItem.keyEquivalentModifierMask = NSEventModifierFlagCommand; - openWithSystemFolderBrowserItem.enabled = YES; - openWithSystemFolderBrowserItem.target = self; - [menu addItem:openWithSystemFolderBrowserItem]; - self.openMenu = menu; - - [self addOpenRecentlyItem]; - return menu; -} - --(NSMenu *)makeGraphicsMenu { - NSMenu *parent = [[NSMenu alloc] initWithTitle:@(self.mainSettingsLocalization->T("Graphics"))]; - NSMenu *backendsMenu = [[NSMenu alloc] init]; - - auto graphicsLocalization = GetI18NCategory("Graphics"); -#define GRAPHICS_LOCALIZED(key) @(graphicsLocalization->T(key)) - - NSMenuItem *gpuBackendItem = [[NSMenuItem alloc] initWithTitle:GRAPHICS_LOCALIZED("Backend") action:nil keyEquivalent:@""]; - - std::vector allowed = [self allowedGPUBackends]; - for (int i = 0; i < allowed.size(); i++) { - NSMenuItem *backendMenuItem = [[NSMenuItem alloc] initWithTitle:@(GPUBackendToString(allowed[i]).c_str()) action: @selector(setCurrentGPUBackend:) keyEquivalent: @""]; - backendMenuItem.tag = i; - backendMenuItem.target = self; - backendMenuItem.state = [self controlStateForBool: g_Config.iGPUBackend == (int)allowed[i]]; - [backendsMenu addItem:backendMenuItem]; - } - - gpuBackendItem.submenu = backendsMenu; - [parent addItem:gpuBackendItem]; - - [parent addItem:[NSMenuItem separatorItem]]; - -#define MENU_ITEM(variableName, localizedTitleName, SEL, ConfigurationValueName) \ -NSMenuItem *variableName = [[NSMenuItem alloc] initWithTitle:GRAPHICS_LOCALIZED(localizedTitleName) action:SEL keyEquivalent:@""]; \ -variableName.target = self; \ -variableName.state = [self controlStateForBool: ConfigurationValueName]; - - MENU_ITEM(softwareRendering, "Software Rendering", @selector(toggleSoftwareRendering:), g_Config.bSoftwareRendering) - [parent addItem:softwareRendering]; - - MENU_ITEM(vsyncItem, "VSync", @selector(toggleVSync:), g_Config.bVSync) - [parent addItem:vsyncItem]; - - MENU_ITEM(fullScreenItem, "Fullscreen", @selector(toggleFullScreen:), g_Config.bFullScreen) - [parent addItem:fullScreenItem]; - - [parent addItem:[NSMenuItem separatorItem]]; - - MENU_ITEM(autoFrameSkip, "Auto FrameSkip", @selector(toggleAutoFrameSkip:), g_Config.bAutoFrameSkip) - [parent addItem:autoFrameSkip]; - - [parent addItem:[NSMenuItem separatorItem]]; - - MENU_ITEM(fpsCounterItem, "Show FPS Counter", @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER) - fpsCounterItem.tag = (int)ShowStatusFlags::FPS_COUNTER; - - MENU_ITEM(speedCounterItem, "Show Speed", @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::SPEED_COUNTER) - speedCounterItem.tag = (int)ShowStatusFlags::SPEED_COUNTER; - - MENU_ITEM(batteryPercentItem, "Show battery %", @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::BATTERY_PERCENT) - batteryPercentItem.tag = (int)ShowStatusFlags::BATTERY_PERCENT; - - [parent addItem:[NSMenuItem separatorItem]]; - [parent addItem:fpsCounterItem]; - [parent addItem:speedCounterItem]; - [parent addItem:batteryPercentItem]; - - [[NSNotificationCenter defaultCenter] addObserverForName:@"ConfigDidChange" object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) { - NSString *value = [note object]; - // NOTE: Though it may seem like it, - // the next few lines were not written by yandere dev - if ([value isEqualToString:@"VSync"]) { - vsyncItem.state = [self controlStateForBool: g_Config.bVSync]; - } else if ([value isEqualToString:@"FullScreen"]) { - fullScreenItem.state = [self controlStateForBool: g_Config.bFullScreen]; - } else if ([value isEqualToString:@"SoftwareRendering"]) { - softwareRendering.state = [self controlStateForBool: g_Config.bSoftwareRendering]; - } else if ([value isEqualToString:@"AutoFrameSkip"]) { - autoFrameSkip.state = [self controlStateForBool: g_Config.bAutoFrameSkip]; - } else if ([value isEqualToString:@"ShowFPSCounter"]) { - fpsCounterItem.state = [self controlStateForBool:g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER]; - } else if ([value isEqualToString:@"ShowSpeed"]) { - speedCounterItem.state = [self controlStateForBool:g_Config.iShowStatusFlags & (int)ShowStatusFlags::SPEED_COUNTER]; - } else if ([value isEqualToString:@"BatteryPercent"]) { - batteryPercentItem.state = [self controlStateForBool:g_Config.iShowStatusFlags & (int)ShowStatusFlags::BATTERY_PERCENT]; - } - }]; -#undef MENU_ITEM -#undef GRAPHICS_LOCALIZED - return parent; -} - --(NSMenu *)makeAudioMenu { - NSMenu *parent = [[NSMenu alloc] initWithTitle:@(self.mainSettingsLocalization->T("Audio"))]; - auto audioLocalization = GetI18NCategory("Audio"); - - NSMenuItem *enableSoundItem = [[NSMenuItem alloc] initWithTitle:@(audioLocalization->T("Enable Sound")) action:@selector(toggleSound:) keyEquivalent:@""]; - enableSoundItem.target = self; - enableSoundItem.state = [self controlStateForBool: g_Config.bEnableSound]; - [parent addItem:enableSoundItem]; - - NSMenuItem *deviceListItem = [[NSMenuItem alloc] initWithTitle:@(audioLocalization->T("Device")) action:nil keyEquivalent:@""]; - deviceListItem.submenu = [self makeAudioListMenuWithItem:deviceListItem]; - [parent addItem:deviceListItem]; - - [[NSNotificationCenter defaultCenter] addObserverForName:@"AudioConfChanged" object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) { - NSString *value = [note object]; - if ([value isEqualToString:@"EnableSound"]) { - enableSoundItem.state = [self controlStateForBool:g_Config.bEnableSound]; - } - }]; - - return parent; -} - --(NSMenu *)makeAudioListMenuWithItem: (NSMenuItem *)callerItem { - __block NSMenu *theMenu = [[NSMenu alloc] init]; - std::vector audioDeviceList; - SplitString(System_GetProperty(SYSPROP_AUDIO_DEVICE_LIST), '\0', audioDeviceList); - - for (int i = 0; i < audioDeviceList.size(); i++) { - std::string itemName = audioDeviceList[i]; - NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@(itemName.c_str()) action:@selector(setAudioItem:) keyEquivalent:@""]; - item.tag = i; - item.target = self; - item.state = [self controlStateForBool:g_Config.sAudioDevice == itemName]; - [theMenu addItem:item]; - } - - [[NSNotificationCenter defaultCenter] addObserverForName:@"AudioConfigurationHasChanged" object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) { - NSString *value = [note object]; - if ([value isEqualToString: @"DeviceAddedOrChanged"]) { - callerItem.submenu = [self makeAudioListMenuWithItem:callerItem]; - } else if ([value isEqualToString:@"CurrentDeviceWasChanged"]) { - // set the new item to be the selected one - dispatch_async(dispatch_get_main_queue(), ^{ - for (NSMenuItem *item in theMenu.itemArray) - item.state = [self controlStateForBool:g_Config.sAudioDevice == audioDeviceList[item.tag]]; - }); - } - }]; - - return theMenu; -} - --(void) setAudioItem: (NSMenuItem *)sender { - std::vector audioDeviceList; - SplitString(System_GetProperty(SYSPROP_AUDIO_DEVICE_LIST), '\0', audioDeviceList); - - std::string theItemSelected = audioDeviceList[sender.tag]; - if (theItemSelected == g_Config.sAudioDevice) - return; // device already selected - - g_Config.sAudioDevice = theItemSelected; - for (NSMenuItem *item in sender.menu.itemArray) { - item.state = [self controlStateForBool:g_Config.sAudioDevice == theItemSelected]; - } - - System_SendMessage("audio_resetDevice", ""); -} - -#define TOGGLE_METHOD(name, ConfigValueName, ...) \ --(void)toggle##name: (NSMenuItem *)item { \ -ConfigValueName = !ConfigValueName; \ -__VA_ARGS__; /* for any additional updates */ \ -item.state = [self controlStateForBool: ConfigValueName]; \ -} - -TOGGLE_METHOD(Sound, g_Config.bEnableSound) -TOGGLE_METHOD(AutoFrameSkip, g_Config.bAutoFrameSkip, g_Config.updateAfterSettingAutoFrameSkip()) -TOGGLE_METHOD(SoftwareRendering, g_Config.bSoftwareRendering) -TOGGLE_METHOD(FullScreen, g_Config.bFullScreen, System_SendMessage("toggle_fullscreen", g_Config.UseFullScreen() ? "1" : "0")) -TOGGLE_METHOD(VSync, g_Config.bVSync) -#undef TOGGLE_METHOD - --(void)setToggleShowCounterItem: (NSMenuItem *)item { - [self addOrRemoveInteger:(int)item.tag to:&g_Config.iShowStatusFlags]; - item.state = [self controlStateForBool:g_Config.iShowStatusFlags & item.tag]; -} - --(void)addOrRemoveInteger: (int)integer to: (int *)r { - if (integer & *r) { - *r -= integer; - } else { - *r |= integer; - } -} - --(void)setCurrentGPUBackend: (NSMenuItem *)sender { - std::vector allowed = [self allowedGPUBackends]; - if (allowed.size() == 1) { - printf("only one item, bailing"); - return; - } - - g_Config.iGPUBackend = (int)(allowed[sender.tag]); - sender.state = NSControlStateValueOn; - - for (NSMenuItem *item in sender.menu.itemArray) { - // deselect the previously selected item - if (item.state == NSControlStateValueOn && item.tag != sender.tag) { - item.state = NSControlStateValueOff; - break; - } - } -} - --(NSControlStateValue) controlStateForBool: (BOOL)boolValue { - return boolValue ? NSControlStateValueOn : NSControlStateValueOff; -} - --(std::vector)allowedGPUBackends { - std::vector allBackends = { - GPUBackend::OPENGL, GPUBackend::VULKAN, - GPUBackend::DIRECT3D11, GPUBackend::DIRECT3D9 - }; - - std::vector allowed; - - for (GPUBackend backend : allBackends) { - if (g_Config.IsBackendEnabled(backend)) { - allowed.push_back(backend); - } - } - - return allowed; -} - --(void)addOpenRecentlyItem { - std::vector recentIsos = g_Config.RecentIsos(); - NSMenuItem *openRecent = [[NSMenuItem alloc] initWithTitle:@"Open Recent" action:nil keyEquivalent:@""]; - NSMenu *recentsMenu = [[NSMenu alloc] init]; - if (recentIsos.empty()) - openRecent.enabled = NO; - - for (int i = 0; i < recentIsos.size(); i++) { - std::string filename = Path(recentIsos[i]).GetFilename(); - NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@(filename.c_str()) action:@selector(openRecentItem:) keyEquivalent:@""]; - item.target = self; - [recentsMenu addItem:item]; - } - - openRecent.submenu = recentsMenu; - [self.openMenu addItem:openRecent]; -} - --(void)openRecentItem: (NSMenuItem *)item { - NativeMessageReceived("browse_fileSelect", g_Config.RecentIsos()[item.tag].c_str()); -} - --(void)openSystemFileBrowser { - System_SendMessage("browse_folder", ""); -} - -- (void)dealloc { - [NSNotificationCenter.defaultCenter removeObserver:self]; -} - -@end - -#ifdef __cplusplus -} -#endif diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 68e792f7b7..8e2bf12dfb 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -60,12 +60,10 @@ SDLJoystick *joystick = NULL; #if PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(IOS) #include "UI/DarwinFileSystemServices.h" -#else -#define PostDarwinNotificationIfPossible(name, value) #endif #if PPSSPP_PLATFORM(MAC) -#include "MacOSBarItems.h" +#include "CocoaBarItems.h" #endif GlobalUIState lastUIState = UISTATE_MENU; @@ -854,8 +852,8 @@ int main(int argc, char *argv[]) { bool windowHidden = false; #if PPSSPP_PLATFORM(MAC) - // setup menu items for macOS - initBarItemsForApp(); + // setup menu items for macOS + initBarItemsForApp(); #endif while (true) { @@ -1156,7 +1154,6 @@ int main(int argc, char *argv[]) { if (doAutoSwitch || g_Config.sAudioDevice == name) { StopSDLAudioDevice(); InitSDLAudioDevice(name ? name : ""); - PostDarwinNotificationIfPossible("AudioConfigurationHasChanged", "DeviceAddedOrChanged"); } } break; @@ -1164,7 +1161,6 @@ int main(int argc, char *argv[]) { if (event.adevice.iscapture == 0 && event.adevice.which == audioDev) { StopSDLAudioDevice(); InitSDLAudioDevice(); - PostDarwinNotificationIfPossible("AudioConfigurationHasChanged", "DeviceAddedOrChanged"); } break; #endif diff --git a/UI/DarwinFileSystemServices.h b/UI/DarwinFileSystemServices.h index 53f7fc655d..bf12556a91 100644 --- a/UI/DarwinFileSystemServices.h +++ b/UI/DarwinFileSystemServices.h @@ -33,10 +33,3 @@ private: #endif // PPSSPP_PLATFORM(IOS) }; -void PostDarwinNotification(const char *name, const char *value); - -#if PPSSPP_PLATFORM(MAC) -// Currently, this is just macOS only -// to update the top bar -#define PostDarwinNotificationIfPossible(name, value) PostDarwinNotification(name, value) -#endif diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index ffd82fd1fb..9c7c6b5c5d 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -95,18 +95,6 @@ extern AndroidAudioState *g_audioState; #endif -#if PPSSPP_PLATFORM(MAC) -#define OnClickPostDarwinNotification(Target, NotifName, NotifValue) \ -Target->OnClick.Add([&](UI::EventParams &) -> UI::EventReturn { \ - PostDarwinNotificationIfPossible(NotifName, NotifValue); \ - return UI::EVENT_DONE; \ -}); - -#else -#define PostDarwinNotificationIfPossible(name, value) -#define OnClickPostDarwinNotification -#endif - GameSettingsScreen::GameSettingsScreen(const Path &gamePath, std::string gameID, bool editThenRestore) : UIDialogScreenWithGameBackground(gamePath), gameID_(gameID), editThenRestore_(editThenRestore) { prevInflightFrames_ = g_Config.iInflightFrames; @@ -359,7 +347,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings) if (deviceType != DEVICE_TYPE_VR) { CheckBox *softwareGPU = graphicsSettings->Add(new CheckBox(&g_Config.bSoftwareRendering, gr->T("Software Rendering", "Software Rendering (slow)"))); - OnClickPostDarwinNotification(softwareGPU, "ConfigDidChange", "SoftwareRendering") softwareGPU->SetEnabled(!PSP_IsInited()); } @@ -394,7 +381,10 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings) #if !(PPSSPP_PLATFORM(ANDROID) || defined(USING_QT_UI) || PPSSPP_PLATFORM(UWP) || PPSSPP_PLATFORM(IOS)) CheckBox *vSync = graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gr->T("VSync"))); - OnClickPostDarwinNotification(vSync, "ConfigDidChange", "VSync") + vSync->OnClick.Add([=](EventParams &e) { + NativeResized(); + return UI::EVENT_CONTINUE; + }); #endif #if PPSSPP_PLATFORM(ANDROID) @@ -612,12 +602,9 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings) graphicsSettings->Add(new ItemHeader(gr->T("Overlay Information"))); BitCheckBox *showFPSCtr = graphicsSettings->Add(new BitCheckBox(&g_Config.iShowStatusFlags, (int)ShowStatusFlags::FPS_COUNTER, gr->T("Show FPS Counter"))); - OnClickPostDarwinNotification(showFPSCtr, "ConfigDidChange", "ShowFPSCounter") BitCheckBox *showSpeed = graphicsSettings->Add(new BitCheckBox(&g_Config.iShowStatusFlags, (int)ShowStatusFlags::SPEED_COUNTER, gr->T("Show Speed"))); - OnClickPostDarwinNotification(showSpeed, "ConfigDidChange", "ShowSpeed") #ifdef CAN_DISPLAY_CURRENT_BATTERY_CAPACITY BitCheckBox *showBattery = graphicsSettings->Add(new BitCheckBox(&g_Config.iShowStatusFlags, (int)ShowStatusFlags::BATTERY_PERCENT, gr->T("Show Battery %"))); - OnClickPostDarwinNotification(showBattery, "ConfigDidChange", "BatteryPercent") #endif graphicsSettings->Add(new CheckBox(&g_Config.bShowDebugStats, gr->T("Show Debug Statistics")))->OnClick.Handle(this, &GameSettingsScreen::OnJitAffectingSetting); @@ -631,7 +618,6 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) { audioSettings->Add(new ItemHeader(ms->T("Audio"))); CheckBox *enableSound = audioSettings->Add(new CheckBox(&g_Config.bEnableSound,a->T("Enable Sound"))); - OnClickPostDarwinNotification(enableSound, "AudioConfChanged", "EnableSound") PopupSliderChoice *volume = audioSettings->Add(new PopupSliderChoice(&g_Config.iGlobalVolume, VOLUME_OFF, VOLUME_FULL, a->T("Global volume"), screenManager())); volume->SetEnabledPtr(&g_Config.bEnableSound); @@ -1190,8 +1176,7 @@ UI::LinearLayout *GameSettingsScreen::AddTab(const char *tag, const std::string } UI::EventReturn GameSettingsScreen::OnAutoFrameskip(UI::EventParams &e) { - g_Config.updateAfterSettingAutoFrameSkip(); - PostDarwinNotificationIfPossible("ConfigChanged", "AutoFrameSkip"); + g_Config.UpdateAfterSettingAutoFrameSkip(); return UI::EVENT_DONE; } @@ -1336,14 +1321,12 @@ UI::EventReturn GameSettingsScreen::OnChangeBackground(UI::EventParams &e) { } UI::EventReturn GameSettingsScreen::OnFullscreenChange(UI::EventParams &e) { - PostDarwinNotificationIfPossible("ConfigDidChange", "FullScreen"); g_Config.iForceFullScreen = -1; System_SendMessage("toggle_fullscreen", g_Config.UseFullScreen() ? "1" : "0"); return UI::EVENT_DONE; } UI::EventReturn GameSettingsScreen::OnFullscreenMultiChange(UI::EventParams &e) { - PostDarwinNotificationIfPossible("ConfigDidChange", "FullScreen"); System_SendMessage("toggle_fullscreen", g_Config.UseFullScreen() ? "1" : "0"); return UI::EVENT_DONE; } @@ -1575,7 +1558,6 @@ UI::EventReturn GameSettingsScreen::OnAudioDevice(UI::EventParams &e) { g_Config.sAudioDevice.clear(); } System_SendMessage("audio_resetDevice", ""); - PostDarwinNotificationIfPossible("AudioConfigurationHasChanged", "CurrentDeviceWasChanged"); return UI::EVENT_DONE; }