Feat: add switch to toggle Metal perf HUD
This commit is contained in:
1 parent
2752cf5042
commit
60e04dcb86
4 files changed
+24
-2
No files matched your search
@@ -183,6 +183,14 @@
|
||||
return whenNotInGame() && (UIScreen.mainScreen.maximumFramesPerSecond > 60);
|
||||
}
|
||||
},
|
||||
@{@"key": @"performance_hud",
|
||||
@"hasDetail": @YES,
|
||||
@"icon": @"waveform.path.ecg",
|
||||
@"type": self.typeSwitch,
|
||||
@"enableCondition": ^BOOL(){
|
||||
return [CAMetalLayer instancesRespondToSelector:@selector(developerHUDProperties)];
|
||||
}
|
||||
},
|
||||
@{@"key": @"fullscreen_airplay",
|
||||
@"hasDetail": @YES,
|
||||
@"icon": @"airplayvideo",
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
@"renderer": @"auto",
|
||||
@"resolution": @(100),
|
||||
@"max_framerate": @YES,
|
||||
@"performance_hud": @NO,
|
||||
@"fullscreen_airplay": @YES,
|
||||
@"silence_other_audio": @NO,
|
||||
@"silence_with_switch": @NO
|
||||
|
||||
@@ -19,12 +19,13 @@
|
||||
#import "SurfaceViewController.h"
|
||||
#import "TrackedTextField.h"
|
||||
#import "UIKit+hook.h"
|
||||
|
||||
#import "ios_uikit_bridge.h"
|
||||
|
||||
#include "glfw_keycodes.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
int memorystatus_control(uint32_t command, int32_t pid, uint32_t flags, void *buffer, size_t buffersize);
|
||||
#define MEMORYSTATUS_CMD_SET_JETSAM_TASK_LIMIT 6
|
||||
|
||||
@@ -73,7 +74,9 @@ static GameSurfaceView* pojavWindow;
|
||||
[super viewDidLoad];
|
||||
isControlModifiable = NO;
|
||||
self.isMacCatalystApp = NSProcessInfo.processInfo.isMacCatalystApp;
|
||||
|
||||
// Load MetalHUD library
|
||||
dlopen("/usr/lib/libMTLHud.dylib", 0);
|
||||
|
||||
self.lightHaptic = [[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleLight)];
|
||||
self.mediumHaptic = [[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleMedium)];
|
||||
|
||||
@@ -357,6 +360,13 @@ static GameSurfaceView* pojavWindow;
|
||||
[self updateAudioSettings];
|
||||
// Update resolution
|
||||
[self updateSavedResolution];
|
||||
// Update performance HUD visibility
|
||||
if (@available(iOS 16, tvOS 16, *)) {
|
||||
if ([self.surfaceView.layer isKindOfClass:CAMetalLayer.class]) {
|
||||
BOOL perfHUDEnabled = getPrefBool(@"video.performance_hud");
|
||||
((CAMetalLayer *)self.surfaceView.layer).developerHUDProperties = perfHUDEnabled ? @{@"mode": @"default"} : nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateSavedResolution {
|
||||
|
||||
@@ -189,6 +189,9 @@
|
||||
"preference.title.max_framerate" = "Maximum framerate";
|
||||
"preference.detail.max_framerate" = "Allows you to limit the game framerate to 60FPS on ProMotion displays.";
|
||||
|
||||
"preference.title.performance_hud" = "Show Performance HUD";
|
||||
"preference.detail.performance_hud" = "When available, show the performance monitoring overlay.";
|
||||
|
||||
"preference.title.fullscreen_airplay" = "Fullscreen AirPlay";
|
||||
"preference.detail.fullscreen_airplay" = "Allows presenting fullscreen game window on the external display rather than mirroring everything on screen.";
|
||||
"preference.title.silence_other_audio" = "Pause audio when game opens";
|
||||
|
||||
Reference in new issue
Block a user