Delegate shouldn't keep the specific ViewController type

This commit is contained in:
Henrik Rydgård 2024-05-21 14:57:30 +02:00
parent b1a435840c
commit 947f0a876e
5 changed files with 11 additions and 5 deletions

View File

@ -2,13 +2,13 @@
#import <UIKit/UIKit.h>
@class PPSSPPViewControllerGL;
@protocol PPSSPPViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIScreen *screen;
@property (strong, nonatomic) PPSSPPViewControllerGL *viewController;
@property (strong, nonatomic) id<PPSSPPViewController> viewController;
@end

View File

@ -91,14 +91,15 @@
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
PPSSPPViewControllerGL *vc = [[PPSSPPViewControllerGL alloc] init];
// Here we can switch viewcontroller depending on backend.
self.viewController = [[PPSSPPViewControllerGL alloc] init];
self.viewController = vc;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioSessionInterruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMediaServicesWereReset:) name:AVAudioSessionMediaServicesWereResetNotification object:nil];
self.window.rootViewController = self.viewController;
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
return YES;

View File

@ -166,7 +166,7 @@
g_display.pixel_in_dps_x = (float)g_display.pixel_xres / (float)g_display.dp_xres;
g_display.pixel_in_dps_y = (float)g_display.pixel_yres / (float)g_display.dp_yres;
[[sharedViewController view] setContentScaleFactor:scale];
[[sharedViewController getView] setContentScaleFactor:scale];
// PSP native resize
PSP_CoreParameter().pixelWidth = g_display.pixel_xres;

View File

@ -16,6 +16,7 @@
- (void)shareText:(NSString *)text;
- (void)shutdown;
- (void)bindDefaultFBO;
- (UIView *)getView;
@end
@interface PPSSPPViewControllerGL : GLKViewController <

View File

@ -599,6 +599,10 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) {
return UIRectEdgeAll;
}
- (UIView *)getView {
return [self view];
}
- (void)setupController:(GCController *)controller
{
self.gameController = controller;