mirror of
https://github.com/OpenEmu/OpenEmuKit.git
synced 2025-11-01 11:08:14 +00:00
fix: Improve OpenEmuXPCHelperApp, as host does not need to subclass
Like OEXPCGameCoreManager, OpenEmuXPCHelperApp determines the service name of the broker by interrogating it's Info.plist
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
0547FDCF24E850EB005C1FFC /* NSXPCListener+HelperApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 0547FDCD24E850EB005C1FFC /* NSXPCListener+HelperApp.m */; };
|
||||
0547FDD224E85783005C1FFC /* OEXPCGameCoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 0547FDD024E85783005C1FFC /* OEXPCGameCoreManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0547FDD324E85783005C1FFC /* OEXPCGameCoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0547FDD124E85783005C1FFC /* OEXPCGameCoreManager.m */; };
|
||||
0547FDDF24E8622B005C1FFC /* OpenEmuXPCHelperAppBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0547FDDD24E8622B005C1FFC /* OpenEmuXPCHelperAppBase.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0547FDE024E8622B005C1FFC /* OpenEmuXPCHelperAppBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0547FDDE24E8622B005C1FFC /* OpenEmuXPCHelperAppBase.m */; };
|
||||
0547FDDF24E8622B005C1FFC /* OpenEmuXPCHelperApp.h in Headers */ = {isa = PBXBuildFile; fileRef = 0547FDDD24E8622B005C1FFC /* OpenEmuXPCHelperApp.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0547FDE024E8622B005C1FFC /* OpenEmuXPCHelperApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 0547FDDE24E8622B005C1FFC /* OpenEmuXPCHelperApp.m */; };
|
||||
054A774925B2399100F2F3D6 /* ShaderParameterGroupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 054A774825B2399100F2F3D6 /* ShaderParameterGroupModel.swift */; };
|
||||
05713219259C33B9001CB13A /* NSFileManager+ExtendedAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 05713217259C33B9001CB13A /* NSFileManager+ExtendedAttributes.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0571321A259C33B9001CB13A /* NSFileManager+ExtendedAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 05713218259C33B9001CB13A /* NSFileManager+ExtendedAttributes.m */; };
|
||||
@@ -108,8 +108,8 @@
|
||||
0547FDCD24E850EB005C1FFC /* NSXPCListener+HelperApp.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSXPCListener+HelperApp.m"; sourceTree = "<group>"; };
|
||||
0547FDD024E85783005C1FFC /* OEXPCGameCoreManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OEXPCGameCoreManager.h; sourceTree = "<group>"; };
|
||||
0547FDD124E85783005C1FFC /* OEXPCGameCoreManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OEXPCGameCoreManager.m; sourceTree = "<group>"; };
|
||||
0547FDDD24E8622B005C1FFC /* OpenEmuXPCHelperAppBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenEmuXPCHelperAppBase.h; sourceTree = "<group>"; };
|
||||
0547FDDE24E8622B005C1FFC /* OpenEmuXPCHelperAppBase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OpenEmuXPCHelperAppBase.m; sourceTree = "<group>"; };
|
||||
0547FDDD24E8622B005C1FFC /* OpenEmuXPCHelperApp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenEmuXPCHelperApp.h; sourceTree = "<group>"; };
|
||||
0547FDDE24E8622B005C1FFC /* OpenEmuXPCHelperApp.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OpenEmuXPCHelperApp.m; sourceTree = "<group>"; };
|
||||
054A774825B2399100F2F3D6 /* ShaderParameterGroupModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShaderParameterGroupModel.swift; sourceTree = "<group>"; };
|
||||
05713217259C33B9001CB13A /* NSFileManager+ExtendedAttributes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSFileManager+ExtendedAttributes.h"; sourceTree = "<group>"; };
|
||||
05713218259C33B9001CB13A /* NSFileManager+ExtendedAttributes.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSFileManager+ExtendedAttributes.m"; sourceTree = "<group>"; };
|
||||
@@ -281,8 +281,8 @@
|
||||
05E6B9FF24CCD47400ACFB35 /* Video */,
|
||||
05E6B9DB24CCD43800ACFB35 /* OpenEmuHelperApp.h */,
|
||||
05E6B9DC24CCD43900ACFB35 /* OpenEmuHelperApp.m */,
|
||||
0547FDDD24E8622B005C1FFC /* OpenEmuXPCHelperAppBase.h */,
|
||||
0547FDDE24E8622B005C1FFC /* OpenEmuXPCHelperAppBase.m */,
|
||||
0547FDDD24E8622B005C1FFC /* OpenEmuXPCHelperApp.h */,
|
||||
0547FDDE24E8622B005C1FFC /* OpenEmuXPCHelperApp.m */,
|
||||
);
|
||||
name = "Helper App (Remote Layer)";
|
||||
sourceTree = "<group>";
|
||||
@@ -458,7 +458,7 @@
|
||||
05E6BA5D24CCDFC700ACFB35 /* OEShaderParamValue.h in Headers */,
|
||||
05E6958424CA5D4200ACFB35 /* OpenEmuKit.h in Headers */,
|
||||
05E6BA0624CCD49600ACFB35 /* OECoreVideoTexture.h in Headers */,
|
||||
0547FDDF24E8622B005C1FFC /* OpenEmuXPCHelperAppBase.h in Headers */,
|
||||
0547FDDF24E8622B005C1FFC /* OpenEmuXPCHelperApp.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -545,7 +545,7 @@
|
||||
files = (
|
||||
0547FDD324E85783005C1FFC /* OEXPCGameCoreManager.m in Sources */,
|
||||
05E6BA5C24CCDFC700ACFB35 /* OEShaderParamValue.m in Sources */,
|
||||
0547FDE024E8622B005C1FFC /* OpenEmuXPCHelperAppBase.m in Sources */,
|
||||
0547FDE024E8622B005C1FFC /* OpenEmuXPCHelperApp.m in Sources */,
|
||||
05E6BA4B24CCD7DB00ACFB35 /* OEGameCoreManager.m in Sources */,
|
||||
0518D6E424F2BA4B0037101D /* OEGameStartupInfo.m in Sources */,
|
||||
05D828D524E9881E00BB975E /* OEXPCMatchMaking.swift in Sources */,
|
||||
|
||||
@@ -38,7 +38,7 @@ FOUNDATION_EXPORT const unsigned char OpenEmuKitVersionString[];
|
||||
#import <OpenEmuKit/OEShaderParamValue.h>
|
||||
#import <OpenEmuKit/OEGameCoreHelper.h>
|
||||
#import <OpenEmuKit/OpenEmuHelperApp.h>
|
||||
#import <OpenEmuKit/OpenEmuXPCHelperAppBase.h>
|
||||
#import <OpenEmuKit/OpenEmuXPCHelperApp.h>
|
||||
#import <OpenEmuKit/OEGameCoreManager.h>
|
||||
#import <OpenEmuKit/OEThreadGameCoreManager.h>
|
||||
#import <OpenEmuKit/OEXPCGameCoreManager.h>
|
||||
|
||||
@@ -32,18 +32,38 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* A protocol that defines the behaviour required to control an emulator core.
|
||||
*
|
||||
* A host application obtains an instance of @c OEGameCoreHelper in order
|
||||
* to communicate with the core, which may be running in another thread or
|
||||
* a remote process.
|
||||
*/
|
||||
@protocol OEGameCoreHelper <NSObject>
|
||||
|
||||
/*!
|
||||
* Adjust the output volume of the core.
|
||||
* @param value The new volume level, from @c [0, 1.0]
|
||||
*/
|
||||
- (void)setVolume:(CGFloat)value;
|
||||
|
||||
/*!
|
||||
* Manage the paused status of the core.
|
||||
*
|
||||
* @param pauseEmulation Specify @c true to pause the core.
|
||||
*/
|
||||
- (void)setPauseEmulation:(BOOL)pauseEmulation;
|
||||
- (void)setAudioOutputDeviceID:(AudioDeviceID)deviceID;
|
||||
- (void)setOutputBounds:(NSRect)rect;
|
||||
- (void)setBackingScaleFactor:(CGFloat)newBackingScaleFactor;
|
||||
|
||||
#pragma mark - Shader management
|
||||
|
||||
- (void)setShaderURL:(NSURL *)url parameters:(NSDictionary<NSString *, NSNumber *> *)parameters completionHandler:(void (^)(BOOL success, NSError * _Nullable error))block;
|
||||
- (void)setShaderParameterValue:(CGFloat)value forKey:(NSString *)key;
|
||||
|
||||
#pragma mark - Emulator control
|
||||
|
||||
- (void)setupEmulationWithCompletionHandler:(void(^)(OEIntSize screenSize, OEIntSize aspectSize))handler;
|
||||
- (void)startEmulationWithCompletionHandler:(void(^)(void))handler;
|
||||
- (void)resetEmulationWithCompletionHandler:(void(^)(void))handler;
|
||||
@@ -65,9 +85,16 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)systemBindingsDidSetEvent:(OEHIDEvent *)event forBinding:(__kindof OEBindingDescription *)bindingDescription playerNumber:(NSUInteger)playerNumber;
|
||||
- (void)systemBindingsDidUnsetEvent:(OEHIDEvent *)event forBinding:(__kindof OEBindingDescription *)bindingDescription playerNumber:(NSUInteger)playerNumber;
|
||||
|
||||
#pragma mark - screenshot support
|
||||
#pragma mark - Screenshot support
|
||||
|
||||
/**
|
||||
* Capture an image of the final core video display buffer, which includes all shader effects.
|
||||
*/
|
||||
- (void)captureOutputImageWithCompletionHandler:(void (^)(NSBitmapImageRep *image))block;
|
||||
|
||||
/**
|
||||
* Capture an image of the raw core video display buffer with no effects.
|
||||
*/
|
||||
- (void)captureSourceImageWithCompletionHandler:(void (^)(NSBitmapImageRep *image))block;
|
||||
|
||||
@end
|
||||
@@ -93,11 +120,20 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)nextDisplayMode;
|
||||
- (void)lastDisplayMode;
|
||||
|
||||
/// Notify the host application the the screen and aspect sizes have changed for the core.
|
||||
///
|
||||
/// @details
|
||||
/// The host application would use this to adjust the size of the display window.
|
||||
/**
|
||||
* Notify the host application that the screen and aspect sizes have changed for the core.
|
||||
*
|
||||
* The host application would use this information to adjust the size of the display window.
|
||||
*
|
||||
* @param newScreenSize The updated screen size
|
||||
* @param newAspectSize The updated aspect size
|
||||
*/
|
||||
- (void)setScreenSize:(OEIntSize)newScreenSize aspectSize:(OEIntSize)newAspectSize;
|
||||
/**
|
||||
* Notify the host application that the disc count has changed
|
||||
*
|
||||
*
|
||||
*/
|
||||
- (void)setDiscCount:(NSUInteger)discCount;
|
||||
- (void)setDisplayModes:(NSArray <NSDictionary <NSString *, id> *> *)displayModes;
|
||||
- (void)setRemoteContextID:(NSUInteger)contextID;
|
||||
|
||||
@@ -63,11 +63,6 @@
|
||||
[_helperThread start];
|
||||
}
|
||||
|
||||
- (void)dummyTimer:(NSTimer *)dummyTimer
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (void)_executionThread:(id)object
|
||||
{
|
||||
@autoreleasepool
|
||||
@@ -80,7 +75,7 @@
|
||||
{
|
||||
if(_errorHandler != nil)
|
||||
{
|
||||
__block typeof(_errorHandler) errorHandler = _errorHandler;
|
||||
__block __auto_type errorHandler = _errorHandler;
|
||||
_errorHandler = nil;
|
||||
dispatch_async(self.queue, ^{
|
||||
errorHandler(error);
|
||||
@@ -94,7 +89,7 @@
|
||||
_completionHandler = nil;
|
||||
}
|
||||
|
||||
_dummyTimer = [NSTimer scheduledTimerWithTimeInterval:1e9 target:self selector:@selector(dummyTimer:) userInfo:nil repeats:YES];
|
||||
_dummyTimer = [NSTimer scheduledTimerWithTimeInterval:1e9 repeats:YES block:^(NSTimer * _Nonnull timer) {}];
|
||||
|
||||
CFRunLoopRun();
|
||||
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface OpenEmuXPCHelperAppBase : OpenEmuHelperApp
|
||||
|
||||
@property (readonly) NSString *serviceName;
|
||||
@interface OpenEmuXPCHelperApp : OpenEmuHelperApp
|
||||
|
||||
@end
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#import "OEXPCGameCoreHelper.h"
|
||||
#import "OpenEmuXPCHelperAppBase.h"
|
||||
#import "OpenEmuXPCHelperApp.h"
|
||||
#import <OpenEmuSystem/OpenEmuSystem.h>
|
||||
#import "OEShaderParamValue.h"
|
||||
#import "NSXPCListener+HelperApp.h"
|
||||
#import "OEGameStartupInfo.h"
|
||||
#import "OELogging.h"
|
||||
|
||||
@interface OpenEmuXPCHelperAppBase () <NSXPCListenerDelegate, OEXPCGameCoreHelper>
|
||||
@interface OpenEmuXPCHelperApp () <NSXPCListenerDelegate, OEXPCGameCoreHelper>
|
||||
{
|
||||
NSXPCListener *_mainListener;
|
||||
NSXPCConnection *_gameCoreConnection;
|
||||
@@ -41,12 +41,19 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation OpenEmuXPCHelperAppBase
|
||||
@implementation OpenEmuXPCHelperApp
|
||||
|
||||
- (NSDictionary<NSString *, NSString *> *)infoDictionary {
|
||||
id obj = [NSBundle.mainBundle objectForInfoDictionaryKey:@"OpenEmuKit"];
|
||||
if ([obj isKindOfClass:NSDictionary.class]) {
|
||||
return obj;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)serviceName
|
||||
{
|
||||
[self doesNotImplementSelector:_cmd];
|
||||
return nil;
|
||||
return [self.infoDictionary objectForKey:@"XPCBrokerServiceName"];
|
||||
}
|
||||
|
||||
- (void)launchApplication
|
||||
@@ -176,11 +183,4 @@
|
||||
completionHandler(error);
|
||||
}
|
||||
|
||||
- (void)stopEmulationWithCompletionHandler:(void(^)(void))handler
|
||||
{
|
||||
[super stopEmulationWithCompletionHandler:^{
|
||||
handler();
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user