Add the basics of the Emulation menu to the Mac build
This commit is contained in:
parent
de10c1c1c6
commit
e1d4a19ce1
3 changed files with 112 additions and 49 deletions
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Core.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "Common/File/Path.h"
|
||||
#include "Common/System/System.h"
|
||||
|
@ -22,9 +24,6 @@
|
|||
#include "Common/StringUtils.h"
|
||||
|
||||
void TakeScreenshot();
|
||||
/* including "Core/Core.h" results in a compilation error soo */
|
||||
bool Core_IsStepping();
|
||||
void Core_EnableStepping(bool step, const char *reason = nullptr, u32 relatedAddress = 0);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -84,20 +83,25 @@ void OSXOpenURL(const char *url) {
|
|||
fileMenuItem.submenu = [self makeFileSubmenu];
|
||||
fileMenuItem.submenu.delegate = self;
|
||||
|
||||
NSMenuItem *graphicsMenuItem = [[NSMenuItem alloc] init];
|
||||
graphicsMenuItem.submenu = [self makeGraphicsMenu];
|
||||
graphicsMenuItem.submenu.delegate = self;
|
||||
|
||||
NSMenuItem *emulationMenuItem = [[NSMenuItem alloc] init];
|
||||
emulationMenuItem.submenu = [self makeEmulationMenu];
|
||||
emulationMenuItem.submenu.delegate = self;
|
||||
|
||||
NSMenuItem *debugMenuItem = [[NSMenuItem alloc] init];
|
||||
debugMenuItem.submenu = [self makeDebugMenu];
|
||||
debugMenuItem.submenu.delegate = self;
|
||||
|
||||
NSMenuItem *graphicsMenuItem = [[NSMenuItem alloc] init];
|
||||
graphicsMenuItem.submenu = [self makeGraphicsMenu];
|
||||
graphicsMenuItem.submenu.delegate = self;
|
||||
|
||||
NSMenuItem *helpMenuItem = [[NSMenuItem alloc] init];
|
||||
helpMenuItem.submenu = [self makeHelpMenu];
|
||||
|
||||
[NSApplication.sharedApplication.menu addItem:fileMenuItem];
|
||||
[NSApplication.sharedApplication.menu addItem:graphicsMenuItem];
|
||||
[NSApplication.sharedApplication.menu addItem:emulationMenuItem];
|
||||
[NSApplication.sharedApplication.menu addItem:debugMenuItem];
|
||||
[NSApplication.sharedApplication.menu addItem:graphicsMenuItem];
|
||||
[NSApplication.sharedApplication.menu addItem:helpMenuItem];
|
||||
|
||||
NSString *windowMenuItemTitle = @"Window"; // Don't translate, we lookup this.
|
||||
|
@ -153,7 +157,27 @@ void OSXOpenURL(const char *url) {
|
|||
}
|
||||
|
||||
- (void)menuNeedsUpdate:(NSMenu *)menu {
|
||||
if ([menu.title isEqualToString: [self localizedMenuString:"Graphics"]]) {
|
||||
if ([menu.title isEqualToString: [self localizedMenuString:"Emulation"]]) {
|
||||
menu.autoenablesItems = NO;
|
||||
printf("ASD\n");
|
||||
// Enable/disable the various items.
|
||||
for (NSMenuItem *item in menu.itemArray) {
|
||||
switch (item.tag) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
GlobalUIState state = GetUIState();
|
||||
item.enabled = state == UISTATE_INGAME ? YES : NO;
|
||||
printf("Setting enabled state to %d\n", (int)item.enabled);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("Unknown tag %d\n", (int)(long)item.tag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ([menu.title isEqualToString: [self localizedMenuString:"Graphics"]]) {
|
||||
for (NSMenuItem *item in menu.itemArray) {
|
||||
switch (item.tag) {
|
||||
case 1:
|
||||
|
@ -248,9 +272,9 @@ void OSXOpenURL(const char *url) {
|
|||
NSMenu *backendsMenu = [[NSMenu alloc] init];
|
||||
#define GRAPHICS_LOCALIZED(key) @(graphicsLocalization->T(key))
|
||||
#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str())
|
||||
|
||||
|
||||
NSMenuItem *gpuBackendItem = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Backend") action:nil keyEquivalent:@""];
|
||||
|
||||
|
||||
std::vector<GPUBackend> 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: @""];
|
||||
|
@ -259,15 +283,15 @@ void OSXOpenURL(const char *url) {
|
|||
backendMenuItem.state = [self controlStateForBool: g_Config.iGPUBackend == (int)allowed[i]];
|
||||
[backendsMenu addItem:backendMenuItem];
|
||||
}
|
||||
|
||||
|
||||
gpuBackendItem.submenu = backendsMenu;
|
||||
[parent addItem:gpuBackendItem];
|
||||
|
||||
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
||||
MENU_ITEM(softwareRendering, GRAPHICS_LOCALIZED("Software Rendering"), @selector(toggleSoftwareRendering:), g_Config.bSoftwareRendering, 1)
|
||||
[parent addItem:softwareRendering];
|
||||
|
||||
|
||||
/*
|
||||
MENU_ITEM(vsyncItem, GRAPHICS_LOCALIZED("VSync"), @selector(toggleVSync:), g_Config.bVSync, 2)
|
||||
[parent addItem:vsyncItem];
|
||||
|
@ -275,23 +299,23 @@ void OSXOpenURL(const char *url) {
|
|||
|
||||
MENU_ITEM(fullScreenItem, DESKTOPUI_LOCALIZED("Fullscreen"), @selector(toggleFullScreen:), g_Config.bFullScreen, 3)
|
||||
[parent addItem:fullScreenItem];
|
||||
|
||||
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
||||
MENU_ITEM(autoFrameSkip, GRAPHICS_LOCALIZED("Auto FrameSkip"), @selector(toggleAutoFrameSkip:), g_Config.bAutoFrameSkip, 4)
|
||||
[parent addItem:autoFrameSkip];
|
||||
|
||||
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
||||
MENU_ITEM(fpsCounterItem, DESKTOPUI_LOCALIZED("Show FPS Counter"), @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER, 5)
|
||||
fpsCounterItem.tag = (int)ShowStatusFlags::FPS_COUNTER + 100;
|
||||
|
||||
|
||||
MENU_ITEM(speedCounterItem, GRAPHICS_LOCALIZED("Show Speed"), @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::SPEED_COUNTER, 6)
|
||||
speedCounterItem.tag = (int)ShowStatusFlags::SPEED_COUNTER + 100; // because of menuNeedsUpdate:
|
||||
|
||||
|
||||
MENU_ITEM(batteryPercentItem, GRAPHICS_LOCALIZED("Show battery %"), @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::BATTERY_PERCENT, 7)
|
||||
batteryPercentItem.tag = (int)ShowStatusFlags::BATTERY_PERCENT + 100;
|
||||
|
||||
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
[parent addItem:fpsCounterItem];
|
||||
[parent addItem:speedCounterItem];
|
||||
|
@ -301,80 +325,118 @@ void OSXOpenURL(const char *url) {
|
|||
return parent;
|
||||
}
|
||||
|
||||
-(NSMenu *)makeEmulationMenu {
|
||||
std::shared_ptr<I18NCategory> desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI);
|
||||
#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str())
|
||||
|
||||
NSMenu *parent = [[NSMenu alloc] initWithTitle:DESKTOPUI_LOCALIZED("Emulation")];
|
||||
|
||||
NSMenuItem *pauseAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Pause") action:@selector(pauseAction:) keyEquivalent:@""];
|
||||
pauseAction.target = self;
|
||||
pauseAction.tag = 1;
|
||||
NSMenuItem *resetAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Reset") action:@selector(resetAction:) keyEquivalent:@""];
|
||||
resetAction.target = self;
|
||||
resetAction.tag = 2;
|
||||
|
||||
[parent addItem:pauseAction];
|
||||
[parent addItem:resetAction];
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
-(NSMenu *)makeDebugMenu {
|
||||
std::shared_ptr<I18NCategory> sysInfoLocalization = GetI18NCategory(I18NCat::SYSINFO);
|
||||
std::shared_ptr<I18NCategory> desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI);
|
||||
#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str())
|
||||
|
||||
NSMenu *parent = [[NSMenu alloc] initWithTitle:DESKTOPUI_LOCALIZED("Debugging")];
|
||||
|
||||
|
||||
NSMenuItem *breakAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Break") action:@selector(breakAction:) keyEquivalent:@""];
|
||||
breakAction.tag = 1;
|
||||
breakAction.target = self;
|
||||
|
||||
|
||||
MENU_ITEM(breakOnLoadAction, DESKTOPUI_LOCALIZED("Break on Load"), @selector(toggleBreakOnLoad:), g_Config.bAutoRun, 2)
|
||||
MENU_ITEM(ignoreIllegalRWAction, DESKTOPUI_LOCALIZED("Ignore Illegal Reads/Writes"), @selector(toggleIgnoreIllegalRWs:), g_Config.bIgnoreBadMemAccess, 3)
|
||||
|
||||
|
||||
[parent addItem:breakAction];
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
||||
[parent addItem:breakOnLoadAction];
|
||||
[parent addItem:ignoreIllegalRWAction];
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
||||
NSMenuItem *loadSymbolMapAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Load Map File...") action:@selector(loadMapFile) keyEquivalent:@""];
|
||||
loadSymbolMapAction.target = self;
|
||||
|
||||
|
||||
NSMenuItem *saveMapFileAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Save Map file...") action:@selector(saveMapFile) keyEquivalent:@""];
|
||||
saveMapFileAction.target = self;
|
||||
|
||||
|
||||
NSMenuItem *loadSymFileAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Load .sym File...") action:@selector(loadSymbolsFile) keyEquivalent:@""];
|
||||
loadSymFileAction.target = self;
|
||||
|
||||
|
||||
NSMenuItem *saveSymFileAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Save .sym File...") action:@selector(saveSymbolsfile) keyEquivalent:@""];
|
||||
saveSymFileAction.target = self;
|
||||
|
||||
|
||||
NSMenuItem *resetSymbolTableAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Reset Symbol Table") action:@selector(resetSymbolTable) keyEquivalent:@""];
|
||||
resetSymbolTableAction.target = self;
|
||||
|
||||
|
||||
NSMenuItem *takeScreenshotAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Take Screenshot") action:@selector(takeScreenshot) keyEquivalent:@""];
|
||||
takeScreenshotAction.target = self;
|
||||
|
||||
|
||||
NSMenuItem *dumpNextFrameToLogAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Dump Next Frame to Log") action:@selector(dumpNextFrameToLog) keyEquivalent:@""];
|
||||
dumpNextFrameToLogAction.target = self;
|
||||
|
||||
|
||||
NSMenuItem *copyBaseAddr = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Copy PSP memory base address") action:@selector(copyAddr) keyEquivalent:@""];
|
||||
copyBaseAddr.target = self;
|
||||
|
||||
|
||||
MENU_ITEM(showDebugStatsAction, DESKTOPUI_LOCALIZED("Show Debug Statistics"), @selector(toggleShowDebugStats:), g_Config.bShowDebugStats, 2)
|
||||
|
||||
|
||||
[parent addItem:loadSymbolMapAction];
|
||||
[parent addItem:saveMapFileAction];
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
||||
[parent addItem:loadSymFileAction];
|
||||
[parent addItem:saveSymFileAction];
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
||||
[parent addItem:resetSymbolTableAction];
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
|
||||
[parent addItem:takeScreenshotAction];
|
||||
[parent addItem:dumpNextFrameToLogAction];
|
||||
[parent addItem:showDebugStatsAction];
|
||||
|
||||
|
||||
[parent addItem:[NSMenuItem separatorItem]];
|
||||
[parent addItem:copyBaseAddr];
|
||||
return parent;
|
||||
}
|
||||
|
||||
-(void)breakAction: (NSMenuItem *)item {
|
||||
std::shared_ptr<I18NCategory> desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI);
|
||||
#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str())
|
||||
std::shared_ptr<I18NCategory> developerUILocalization = GetI18NCategory(I18NCat::DEVELOPER);
|
||||
#define DEVELOPERUI_LOCALIZED(key) @(developerUILocalization->T(key))
|
||||
if (Core_IsStepping()) {
|
||||
Core_EnableStepping(false, "ui.break");
|
||||
item.title = @"Break";
|
||||
item.title = DESKTOPUI_LOCALIZED("Break");
|
||||
} else {
|
||||
Core_EnableStepping(true, "ui.break");
|
||||
item.title = @"Resume";
|
||||
item.title = DEVELOPERUI_LOCALIZED("Resume");
|
||||
}
|
||||
}
|
||||
|
||||
-(void)pauseAction: (NSMenuItem *)item {
|
||||
NativeMessageReceived("pause", "");
|
||||
}
|
||||
|
||||
-(void)resetAction: (NSMenuItem *)item {
|
||||
NativeMessageReceived("reset", "");
|
||||
Core_EnableStepping(false);
|
||||
}
|
||||
|
||||
-(void)chatAction: (NSMenuItem *)item {
|
||||
if (GetUIState() == UISTATE_INGAME) {
|
||||
NativeMessageReceived("chat screen", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,12 +451,10 @@ void OSXOpenURL(const char *url) {
|
|||
openPanel.allowedFileTypes = allowedFileTypes;
|
||||
if ([openPanel runModal] == NSModalResponseOK) {
|
||||
NSURL *urlWeWant = openPanel.URLs.firstObject;
|
||||
|
||||
if (urlWeWant) {
|
||||
return urlWeWant;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -404,7 +464,6 @@ void OSXOpenURL(const char *url) {
|
|||
if ([savePanel runModal] == NSModalResponseOK && savePanel.URL) {
|
||||
return savePanel.URL;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -481,10 +540,10 @@ TOGGLE_METHOD(ShowDebugStats, g_Config.bShowDebugStats, NativeMessageReceived("c
|
|||
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) {
|
||||
|
@ -515,8 +574,11 @@ TOGGLE_METHOD(ShowDebugStats, g_Config.bShowDebugStats, NativeMessageReceived("c
|
|||
}
|
||||
|
||||
-(void)addOpenRecentlyItem {
|
||||
std::shared_ptr<I18NCategory> mainmenuLocalization = GetI18NCategory(I18NCat::MAINMENU);
|
||||
#define MAINMENU_LOCALIZED(key) @(mainmenuLocalization->T(key))
|
||||
|
||||
std::vector<std::string> recentIsos = g_Config.RecentIsos();
|
||||
NSMenuItem *openRecent = [[NSMenuItem alloc] initWithTitle:@"Recent" action:nil keyEquivalent:@""];
|
||||
NSMenuItem *openRecent = [[NSMenuItem alloc] initWithTitle:MAINMENU_LOCALIZED("Recent") action:nil keyEquivalent:@""];
|
||||
NSMenu *recentsMenu = [[NSMenu alloc] init];
|
||||
if (recentIsos.empty())
|
||||
openRecent.enabled = NO;
|
||||
|
|
|
@ -509,6 +509,7 @@ namespace MainWindow {
|
|||
g_Config.bEnableCheats = !g_Config.bEnableCheats;
|
||||
osm.ShowOnOff(gr->T("Cheats"), g_Config.bEnableCheats);
|
||||
break;
|
||||
|
||||
case ID_EMULATION_CHAT:
|
||||
if (GetUIState() == UISTATE_INGAME) {
|
||||
NativeMessageReceived("chat screen", "");
|
||||
|
|
|
@ -250,7 +250,7 @@ Reset = Återställ
|
|||
Reset limited logging = Reset limited logging
|
||||
RestoreDefaultSettings = Restore these settings back to their defaults?\nYou can't undo this.\nPlease restart PPSSPP after restoring settings.
|
||||
RestoreGameDefaultSettings = Are you sure you want to restore the game-specific settings\nback to the PPSSPP defaults?
|
||||
Resume = Resume
|
||||
Resume = Fortsätt
|
||||
Run CPU Tests = Kör CPU-tester
|
||||
Save new textures = Spara nya texturer
|
||||
Shader Viewer = Shader-visare
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue