mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 04:39:34 +00:00
fixes
This commit is contained in:
parent
645407fa74
commit
84849d9d32
@ -6,6 +6,8 @@
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include "UI/DarwinFileSystemServices.h"
|
||||
#include "Common/File/Path.h"
|
||||
#include "Common/System/System.h"
|
||||
#include "Common/System/NativeApp.h"
|
||||
#include "Core/Config.h"
|
||||
@ -30,7 +32,6 @@ void initBarItemsForApp() {
|
||||
[[BarItemsManager sharedInstance] setupAppBarItems];
|
||||
}
|
||||
|
||||
// im soooooo sorry for whoever had to read this impl
|
||||
@implementation BarItemsManager
|
||||
+ (instancetype)sharedInstance {
|
||||
static BarItemsManager *stub;
|
||||
@ -52,8 +53,25 @@ void initBarItemsForApp() {
|
||||
graphicsMenuItem.submenu = [self makeGraphicsMenu];
|
||||
graphicsMenuItem.submenu.delegate = self;
|
||||
|
||||
NSMenuItem *helpMenuItem = [[NSMenuItem alloc] init];
|
||||
helpMenuItem.submenu = [self makeHelpMenu];
|
||||
|
||||
[NSApplication.sharedApplication.menu addItem:openMenuItem];
|
||||
[NSApplication.sharedApplication.menu addItem:graphicsMenuItem];
|
||||
[NSApplication.sharedApplication.menu addItem:helpMenuItem];
|
||||
|
||||
NSString *windowMenuItemTitle = @"Window";
|
||||
// Rearrange 'Window' to be behind 'Help'
|
||||
for (NSMenuItem *item in NSApplication.sharedApplication.menu.itemArray) {
|
||||
if ([item.title isEqualToString:windowMenuItemTitle]) {
|
||||
[NSApplication.sharedApplication.menu removeItem:item];
|
||||
// 'Help' is the last item in the bar
|
||||
// so we can just use `NSApplication.sharedApplication.menu.numberOfItems - 1`
|
||||
// as it's index
|
||||
[NSApplication.sharedApplication.menu insertItem:item atIndex:NSApplication.sharedApplication.menu.numberOfItems - 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)menuNeedsUpdate:(NSMenu *)menu {
|
||||
@ -92,6 +110,26 @@ void initBarItemsForApp() {
|
||||
return @(self.mainSettingsLocalization->T(key));
|
||||
}
|
||||
|
||||
-(NSMenu *)makeHelpMenu {
|
||||
NSMenu *menu = [[NSMenu alloc] initWithTitle:@"Help"];
|
||||
NSMenuItem *githubItem = [[NSMenuItem alloc] initWithTitle:@"Report an issue" action:@selector(reportAnIssue) keyEquivalent:@""];
|
||||
githubItem.target = self;
|
||||
[menu addItem:githubItem];
|
||||
|
||||
NSMenuItem *discordItem = [[NSMenuItem alloc] initWithTitle:@"Join the Discord" action:@selector(joinTheDiscord) keyEquivalent:@""];
|
||||
discordItem.target = self;
|
||||
[menu addItem:discordItem];
|
||||
return menu;
|
||||
}
|
||||
|
||||
-(void)reportAnIssue {
|
||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/hrydgard/ppsspp/issues/new/choose"]];
|
||||
}
|
||||
|
||||
-(void)joinTheDiscord {
|
||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://discord.gg/5NJB6dD"]];
|
||||
}
|
||||
|
||||
-(NSMenu *)makeOpenSubmenu {
|
||||
NSMenu *menu = [[NSMenu alloc] initWithTitle:@"File"];
|
||||
NSMenuItem *openWithSystemFolderBrowserItem = [[NSMenuItem alloc] initWithTitle:@"Open..." action:@selector(openSystemFileBrowser) keyEquivalent:@"o"];
|
||||
@ -252,7 +290,7 @@ 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(FullScreen, g_Config.bFullScreen, System_MakeRequest(SystemRequestType::TOGGLE_FULLSCREEN_STATE, 0, g_Config.UseFullScreen() ? "1" : "0", "", 3))
|
||||
TOGGLE_METHOD(VSync, g_Config.bVSync)
|
||||
#undef TOGGLE_METHOD
|
||||
|
||||
@ -331,7 +369,14 @@ TOGGLE_METHOD(VSync, g_Config.bVSync)
|
||||
}
|
||||
|
||||
-(void)openSystemFileBrowser {
|
||||
System_SendMessage("browse_folder", "");
|
||||
int g = 0;
|
||||
DarwinDirectoryPanelCallback callback = [g] (bool succ, Path thePathChosen) {
|
||||
if (succ)
|
||||
NativeMessageReceived("browse_folder", thePathChosen.c_str());
|
||||
};
|
||||
|
||||
DarwinFileSystemServices services;
|
||||
services.presentDirectoryPanel(callback, /* allowFiles = */ true, /* allowDirectorites = */ true);
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
|
@ -877,8 +877,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) {
|
||||
|
@ -115,6 +115,3 @@ void DarwinFileSystemServices::setUserPreferredMemoryStickDirectory(Path path) {
|
||||
g_Config.memStickDirectory = path;
|
||||
}
|
||||
|
||||
void PostDarwinNotification(const char *name, const char *value) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@(name) object: @(value)];
|
||||
}
|
||||
|
@ -620,7 +620,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")));
|
||||
|
||||
PopupSliderChoice *volume = audioSettings->Add(new PopupSliderChoice(&g_Config.iGlobalVolume, VOLUME_OFF, VOLUME_FULL, a->T("Global volume"), screenManager()));
|
||||
volume->SetEnabledPtr(&g_Config.bEnableSound);
|
||||
volume->SetZeroLabel(a->T("Mute"));
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4212eef67ed0ca048cb726a6767185504e7695e5
|
||||
Subproject commit c77b09b57c27837dc2d41aa371ed3d236ce9ce47
|
@ -1 +1 @@
|
||||
Subproject commit 7bd1ec93d4586985ba1ef420b43b5e620f68695e
|
||||
Subproject commit 6719edebaae03330ee5441d9b28280672edf00d5
|
@ -1 +1 @@
|
||||
Subproject commit b34f619e1c85810dcb3c578107d2e48ba4ee2b37
|
||||
Subproject commit 77551c429f86c0e077f26552b7c1c0f12a9f235e
|
Loading…
x
Reference in New Issue
Block a user