mirror of
https://github.com/OpenEmu/OpenEmuKit.git
synced 2025-11-01 11:08:14 +00:00
chore: Logging improvements and some minor cleanup
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#import "NSXPCConnection+HelperApp.h"
|
||||
#import <OpenEmuKit/OpenEmuKit-Swift.h>
|
||||
#import <objc/runtime.h>
|
||||
#import "OELogging.h"
|
||||
|
||||
NSString *kHelperIdentifierArgumentPrefix = @"--org.openemu.broker.id=";
|
||||
int xpc_task_key = 0;
|
||||
@@ -40,7 +41,7 @@ int xpc_task_key = 0;
|
||||
task.executableURL = url;
|
||||
task.arguments = @[[@[kHelperIdentifierArgumentPrefix, identifier] componentsJoinedByString:@""]];
|
||||
[task setTerminationHandler:^(NSTask * _){
|
||||
NSLog(@"Helper task %@ terminated unexpectedly", identifier);
|
||||
os_log_error(OE_LOG_HELPER, "Helper task %{public}@ terminated unexpectedly", identifier);
|
||||
dispatch_semaphore_signal(sem);
|
||||
}];
|
||||
task.standardError = NSFileHandle.fileHandleWithStandardError;
|
||||
@@ -92,7 +93,7 @@ int xpc_task_key = 0;
|
||||
|
||||
__weak __typeof(newCn) weakCn = newCn;
|
||||
[task setTerminationHandler:^(NSTask *task) {
|
||||
NSLog(@"Helper %@ terminating", identifier);
|
||||
os_log_debug(OE_LOG_HELPER, "Helper %{public}@ terminating", identifier);
|
||||
__strong __typeof(weakCn) strongCn = weakCn;
|
||||
[strongCn invalidate];
|
||||
}];
|
||||
|
||||
@@ -147,7 +147,7 @@ static OSStatus audioConverterComplexInputDataProc(AudioConverterRef inAudioConv
|
||||
|
||||
OSStatus status = AudioConverterNew(srcDesc, dstDesc, &_conv);
|
||||
if (status != noErr) {
|
||||
NSLog(@"unable to create audio converter: %d", status);
|
||||
os_log_error(OE_LOG_AUDIO, "Unable to create audio converter: %d", status);
|
||||
return NO;
|
||||
}
|
||||
/* 64 bytes of padding above self.maximumFramesToRender because
|
||||
@@ -157,7 +157,7 @@ static OSStatus audioConverterComplexInputDataProc(AudioConverterRef inAudioConv
|
||||
_convInputBytePerFrame = (UInt32)srcDesc->mBytesPerFrame;
|
||||
UInt32 bufferSize = _convInputFrameCount * _convInputBytePerFrame;
|
||||
_convBuffer = malloc(_convInputFrameCount * _convInputBytePerFrame);
|
||||
os_log_error(OE_LOG_AUDIO, "audio converter buffer size = %{public}u bytes", bufferSize);
|
||||
os_log_info(OE_LOG_AUDIO, "Audio converter buffer size = %{public}u bytes", bufferSize);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,10 @@ 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.
|
||||
- (void)setScreenSize:(OEIntSize)newScreenSize aspectSize:(OEIntSize)newAspectSize;
|
||||
- (void)setDiscCount:(NSUInteger)discCount;
|
||||
- (void)setDisplayModes:(NSArray <NSDictionary <NSString *, id> *> *)displayModes;
|
||||
|
||||
@@ -24,4 +24,12 @@
|
||||
|
||||
#import <os/log.h>
|
||||
|
||||
#define OE_LOG_NAME "org.openemu.OpenEmuKit"
|
||||
|
||||
extern os_log_t OE_LOG_AUDIO;
|
||||
extern os_log_t OE_LOG_DEFAULT;
|
||||
/// Subsystem for logging renderer messages.
|
||||
extern os_log_t OE_LOG_RENDERER;
|
||||
|
||||
/// Subsystem for logging XPC helper messages.
|
||||
extern os_log_t OE_LOG_HELPER;
|
||||
|
||||
+7
-1
@@ -25,9 +25,15 @@
|
||||
#import "OELogging.h"
|
||||
|
||||
os_log_t OE_LOG_AUDIO;
|
||||
os_log_t OE_LOG_DEFAULT;
|
||||
os_log_t OE_LOG_RENDERER;
|
||||
os_log_t OE_LOG_HELPER;
|
||||
|
||||
__attribute__((constructor))
|
||||
static void InitializeLogging() {
|
||||
OE_LOG_AUDIO = os_log_create("org.openemu.OpenEmuKit", "OEGameAudio");
|
||||
OE_LOG_AUDIO = os_log_create(OE_LOG_NAME, "OEGameAudio");
|
||||
OE_LOG_DEFAULT = os_log_create(OE_LOG_NAME, "default");
|
||||
OE_LOG_RENDERER = os_log_create(OE_LOG_NAME, "renderer");
|
||||
OE_LOG_HELPER = os_log_create(OE_LOG_NAME, "helper");
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import <OpenGL/glext.h>
|
||||
#import <stdatomic.h>
|
||||
#import "OECoreVideoTexture.h"
|
||||
#import "OELogging.h"
|
||||
|
||||
@implementation OEOpenGL2GameRenderer
|
||||
{
|
||||
@@ -119,14 +120,14 @@
|
||||
err = CGLChoosePixelFormat(attributes, &_glPixelFormat, &numPixelFormats);
|
||||
if(err != kCGLNoError)
|
||||
{
|
||||
NSLog(@"Error choosing pixel format %s", CGLErrorString(err));
|
||||
os_log_error(OE_LOG_RENDERER, "Error choosing pixel format %{public}s", CGLErrorString(err));
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
|
||||
err = CGLCreateContext(_glPixelFormat, NULL, &_glContext);
|
||||
if(err != kCGLNoError)
|
||||
{
|
||||
NSLog(@"Error creating context %s", CGLErrorString(err));
|
||||
os_log_error(OE_LOG_RENDERER, "Error creating context %{public}s", CGLErrorString(err));
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@
|
||||
status = glGetError();
|
||||
if(status != 0)
|
||||
{
|
||||
NSLog(@"setup: create interop texture FBO 1, OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "Setup failed: create interop texture FBO 1, OpenGL error %04X", status);
|
||||
}
|
||||
|
||||
// Complete the FBO
|
||||
@@ -155,13 +156,13 @@
|
||||
status = glGetError();
|
||||
if(status != 0)
|
||||
{
|
||||
NSLog(@"setup: create ioSurface FBO 2, OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "Setup failed: create ioSurface FBO 2, OpenGL error %04X", status);
|
||||
}
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
if(status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
{
|
||||
NSLog(@"Cannot create FBO, OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "Cannot create FBO, OpenGL error %04X", status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +171,7 @@
|
||||
if(_alternateContext == NULL)
|
||||
CGLCreateContext(_glPixelFormat, _glContext, &_alternateContext);
|
||||
|
||||
DLog(@"Setup GL2.1 3D 'alternate-threaded' rendering");
|
||||
os_log_debug(OE_LOG_DEFAULT, "Setup GL2.1 3D 'alternate-threaded' rendering");
|
||||
}
|
||||
|
||||
- (void)setupDoubleBufferedFBO
|
||||
@@ -193,8 +194,7 @@
|
||||
GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
if(status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
{
|
||||
NSLog(@"Cannot create temp FBO");
|
||||
NSLog(@"OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "Cannot create temp FBO. OpenGL error %04X", status);
|
||||
|
||||
glDeleteFramebuffersEXT(1, &_alternateFBO);
|
||||
}
|
||||
@@ -203,7 +203,7 @@
|
||||
|
||||
_isDoubleBufferFBOMode = YES;
|
||||
|
||||
DLog(@"Setup GL2.1 3D 'double-buffered FBO' rendering");
|
||||
os_log_debug(OE_LOG_DEFAULT, "Setup GL2.1 3D 'double-buffered FBO' rendering");
|
||||
}
|
||||
|
||||
- (void)clearFramebuffer
|
||||
@@ -220,13 +220,13 @@
|
||||
GLenum status = glGetError();
|
||||
if(status)
|
||||
{
|
||||
NSLog(@"draw: bind FBO: OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "bindFBO: OpenGL error %04X", status);
|
||||
}
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
if(status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
{
|
||||
NSLog(@"OpenGL error %04X in draw, check FBO", status);
|
||||
os_log_error(OE_LOG_RENDERER, "OpenGL error %04X in draw, check FBO", status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
GLenum status = glGetError();
|
||||
if(status)
|
||||
{
|
||||
NSLog(@"draw: blit FBO: OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "glBlitFramebufferEXT: OpenGL error %04X", status);
|
||||
}
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _alternateFBO);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import <OpenGL/gl3ext.h>
|
||||
#import <stdatomic.h>
|
||||
#import "OECoreVideoTexture.h"
|
||||
#import "OELogging.h"
|
||||
|
||||
@implementation OEOpenGL3GameRenderer
|
||||
{
|
||||
@@ -88,7 +89,7 @@
|
||||
|
||||
- (void)setupVideo
|
||||
{
|
||||
NSLog(@"Setting up OpenGL3.x Core Profile renderer");
|
||||
os_log_debug(OE_LOG_RENDERER, "Setting up OpenGL3.x Core Profile renderer");
|
||||
|
||||
NSAssert(_gameCore.gameCoreRendering != OEGameCoreRendering2DVideo, @"GL3 renderer doesn't do 2D video");
|
||||
|
||||
@@ -119,14 +120,14 @@
|
||||
err = CGLChoosePixelFormat(attributes, &_glPixelFormat, &numPixelFormats);
|
||||
if(err != kCGLNoError)
|
||||
{
|
||||
NSLog(@"Error choosing pixel format %s", CGLErrorString(err));
|
||||
os_log_error(OE_LOG_RENDERER, "Error choosing pixel format %{public}s", CGLErrorString(err));
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
|
||||
err = CGLCreateContext(_glPixelFormat, NULL, &_glContext);
|
||||
if(err != kCGLNoError)
|
||||
{
|
||||
NSLog(@"Error creating context %s", CGLErrorString(err));
|
||||
os_log_error(OE_LOG_RENDERER, "Error creating context %{public}s", CGLErrorString(err));
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
CGLEnable(_glContext, kCGLCECrashOnRemovedFunctions);
|
||||
@@ -145,7 +146,7 @@
|
||||
status = glGetError();
|
||||
if(status != 0)
|
||||
{
|
||||
NSLog(@"setup: create interop texture FBO 1, OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "Setup failed: Create interop texture FBO 1, OpenGL error %04X", status);
|
||||
}
|
||||
|
||||
// Complete the FBO
|
||||
@@ -156,13 +157,13 @@
|
||||
status = glGetError();
|
||||
if(status != 0)
|
||||
{
|
||||
NSLog(@"setup: create ioSurface FBO 2, OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "Setup failed: Create ioSurface FBO 2, OpenGL error %04X", status);
|
||||
}
|
||||
|
||||
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if(status != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
NSLog(@"Cannot create FBO, OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "Setup failed: Cannot create FBO, OpenGL error %04X", status);
|
||||
}
|
||||
|
||||
glViewport(0, 0, _texture.size.width, _texture.size.height);
|
||||
@@ -192,8 +193,7 @@
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if(status != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
NSLog(@"Cannot create temp FBO");
|
||||
NSLog(@"OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "Cannot create temp FBO. OpenGL error %04X", status);
|
||||
|
||||
glDeleteFramebuffers(1, &_alternateFBO);
|
||||
}
|
||||
@@ -234,13 +234,13 @@
|
||||
GLenum status = glGetError();
|
||||
if(status)
|
||||
{
|
||||
NSLog(@"draw: bind FBO: OpenGL error %04X", status);
|
||||
os_log_error(OE_LOG_RENDERER, "glBindFramebuffer: OpenGL error %04X", status);
|
||||
}
|
||||
|
||||
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if(status != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
NSLog(@"OpenGL error %04X in draw, check FBO", status);
|
||||
os_log_error(OE_LOG_RENDERER, "glCheckFramebufferStatus: OpenGL error %04X in draw, check FBO", status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -26,6 +26,7 @@
|
||||
|
||||
#import "OEPlugin.h"
|
||||
#import <objc/runtime.h>
|
||||
#import "OELogging.h"
|
||||
|
||||
@implementation NSObject (OEPlugin)
|
||||
+ (BOOL)isPluginClass
|
||||
@@ -194,11 +195,12 @@ static NSMutableDictionary *_pluginsForNamesByTypes = nil;
|
||||
[self OE_setupWithBundleAtPath:aPath];
|
||||
if (self.outOfSupport) {
|
||||
/* plugin must be removed */
|
||||
NSLog(@"Removing out-of-support plugin %@", _path);
|
||||
os_log(OE_LOG_DEFAULT, "Removing out-of-support plugin %{public}@", _path);
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSError *error;
|
||||
if (![fm removeItemAtPath:_path error:&error])
|
||||
NSLog(@"Error when removing out-of-support plugin: %@", error);
|
||||
if (![fm removeItemAtPath:_path error:&error]) {
|
||||
os_log_error(OE_LOG_DEFAULT, "Error when removing out-of-support plugin: %{public}@", error);
|
||||
}
|
||||
if (outError) *outError = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCorePluginOutOfSupportError userInfo:nil];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class OEShadersModel : NSObject {
|
||||
|
||||
@objc
|
||||
public static var shared : OEShadersModel = {
|
||||
return OEShadersModel()
|
||||
OEShadersModel()
|
||||
}()
|
||||
|
||||
private var systemShaders: [OEShaderModel]
|
||||
@@ -66,7 +66,7 @@ public class OEShadersModel : NSObject {
|
||||
customShaders = OEShadersModel.loadCustomShaders()
|
||||
_allShaderNames = nil
|
||||
_customShaderNames = nil
|
||||
NotificationCenter.default.post(name: OEShadersModel.shaderModelCustomShadersDidChange, object: nil)
|
||||
NotificationCenter.default.post(name: Self.shaderModelCustomShadersDidChange, object: nil)
|
||||
}
|
||||
|
||||
private var _systemShaderNames: [String]?
|
||||
@@ -102,7 +102,7 @@ public class OEShadersModel : NSObject {
|
||||
@objc
|
||||
public var defaultShader: OEShaderModel {
|
||||
get {
|
||||
if let name = UserDefaults.oe_application.string(forKey: Preferences.global.key),
|
||||
if let name = UserDefaults.standard.string(forKey: Preferences.global.key),
|
||||
let shader = self[name] {
|
||||
return shader
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class OEShadersModel : NSObject {
|
||||
|
||||
@objc
|
||||
public func shader(forSystem identifier: String) -> OEShaderModel? {
|
||||
guard let name = UserDefaults.oe_application.string(forKey: Preferences.system(identifier).key) else {
|
||||
guard let name = UserDefaults.standard.string(forKey: Preferences.system(identifier).key) else {
|
||||
return defaultShader
|
||||
}
|
||||
return self[name]
|
||||
@@ -227,7 +227,7 @@ public class OEShadersModel : NSObject {
|
||||
|
||||
@objc
|
||||
public func parameters(forIdentifier identifier: String) -> [String: Double]? {
|
||||
if let state = UserDefaults.oe_application.string(forKey: Params.system(self.name, identifier).key) {
|
||||
if let state = UserDefaults.standard.string(forKey: Params.system(self.name, identifier).key) {
|
||||
var res = [String:Double]()
|
||||
for param in state.split(separator: ";") {
|
||||
let vals = param.split(separator: "=")
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#import "OEThreadProxy.h"
|
||||
#import "OELogging.h"
|
||||
|
||||
@implementation OEProxy
|
||||
{
|
||||
@@ -72,7 +73,7 @@
|
||||
{
|
||||
if(_cachedMethodSignatures == NULL)
|
||||
{
|
||||
NSLog(@"Attempting to use _cachedMethodSignatures after deallocation with selector: %@", NSStringFromSelector(sel));
|
||||
os_log_fault(OE_LOG_DEFAULT, "Attempting to use _cachedMethodSignatures after deallocation with selector: %{public}@", NSStringFromSelector(sel));
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@
|
||||
|
||||
- (id)forwardingTargetForSelector:(SEL)aSelector
|
||||
{
|
||||
DLog(@"Calling %@ on %@", NSStringFromSelector(aSelector), _target);
|
||||
os_log_debug(OE_LOG_DEFAULT, "Calling %{public}@ on %{public}@", NSStringFromSelector(aSelector), _target);
|
||||
return _target;
|
||||
}
|
||||
|
||||
@@ -276,7 +277,7 @@
|
||||
|
||||
+ (void)OE_cleanUpThreadProxyTarget:(id)target
|
||||
{
|
||||
DLog(@"Clean up target: %@", target);
|
||||
os_log_debug(OE_LOG_DEFAULT, "Clean up target: %{public}@", target);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#import "OEShaderParamValue.h"
|
||||
#import "NSXPCConnection+HelperApp.h"
|
||||
#import "OEGameStartupInfo.h"
|
||||
#import "OELogging.h"
|
||||
|
||||
@interface OEXPCGameCoreManagerBase ()
|
||||
{
|
||||
@@ -61,7 +62,8 @@
|
||||
_helperConnection = [NSXPCConnection connectionWithServiceName:self.serviceName executableURL:self.executableURL error:nil];
|
||||
if(_helperConnection == nil)
|
||||
{
|
||||
NSLog(@"No listener endpoint for identifier: %@", self.executableURL);
|
||||
os_log_error(OE_LOG_HELPER, "No listener endpoint for identifier: %@", self.executableURL);
|
||||
|
||||
NSError *error = [NSError errorWithDomain:OEGameCoreErrorDomain
|
||||
code:OEGameCoreCouldNotLoadROMError
|
||||
userInfo:nil];
|
||||
@@ -107,12 +109,14 @@
|
||||
[_helperConnection remoteObjectProxyWithErrorHandler:
|
||||
^(NSError *error)
|
||||
{
|
||||
NSLog(@"Helper Connection (%p) failed with error: %@", gameCoreHelperPointer, error);
|
||||
dispatch_async(self.queue, ^{
|
||||
errorHandler(error);
|
||||
[self stop];
|
||||
});
|
||||
}];
|
||||
os_log_error(OE_LOG_HELPER, "Helper Connection (%p) failed with error: %@",
|
||||
gameCoreHelperPointer, error);
|
||||
|
||||
dispatch_async(self.queue, ^{
|
||||
errorHandler(error);
|
||||
[self stop];
|
||||
});
|
||||
}];
|
||||
|
||||
gameCoreHelperPointer = (__bridge void *)gameCoreHelper;
|
||||
|
||||
|
||||
+50
-15
@@ -42,6 +42,7 @@
|
||||
#import "OEShaderParamValue.h"
|
||||
#import "OEGameStartupInfo.h"
|
||||
#import <OpenEmuKit/OpenEmuKit-Swift.h>
|
||||
#import "OELogging.h"
|
||||
|
||||
#import "OpenEmuKitPrivate/OpenEmuKitPrivate.h"
|
||||
|
||||
@@ -92,6 +93,18 @@
|
||||
BOOL _hasStartedAudio;
|
||||
}
|
||||
|
||||
/// Log messages related to display.
|
||||
static os_log_t LOG_DISPLAY;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != OpenEmuHelperApp.class) return;
|
||||
|
||||
os_log_debug(OE_LOG_DEFAULT, "Initializing %{public}@ loggers", NSStringFromClass(self));
|
||||
|
||||
LOG_DISPLAY = os_log_create(OE_LOG_NAME, "display");
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
@@ -197,15 +210,23 @@
|
||||
|
||||
if (_gameCore.gameCoreRendering != OEGameCoreRendering2DVideo) {
|
||||
_surface.size = size;
|
||||
DLog(@"Updated surface size to %@", NSStringFromOEIntSize(surfaceSize));
|
||||
os_log_debug(LOG_DISPLAY, "Updated GL render surface size to %{public}@", NSStringFromOEIntSize(surfaceSize));
|
||||
_filterChain.sourceTexture = _surface.metalTexture;
|
||||
_filterChain.sourceTextureIsFlipped = _surface.metalTextureIsFlipped;
|
||||
}
|
||||
else
|
||||
{
|
||||
os_log_debug(LOG_DISPLAY, "Set 2D buffer size to %{public}@", NSStringFromOEIntSize(surfaceSize));
|
||||
}
|
||||
|
||||
[_gameRenderer updateRenderer];
|
||||
OEIntRect rect = _gameCore.screenRect;
|
||||
CGRect sourceRect = {.origin = {.x = rect.origin.x, .y = rect.origin.y}, .size = {.width = rect.size.width, .height = rect.size.height}};
|
||||
CGSize aspectSize = {.width = _gameCore.aspectSize.width, .height = _gameCore.aspectSize.height};
|
||||
|
||||
os_log_debug(LOG_DISPLAY, "Set FilterChain sourceRect to %{public}@, aspectSize to %{public}@",
|
||||
NSStringFromRect(sourceRect),
|
||||
NSStringFromSize(aspectSize));
|
||||
[_filterChain setSourceRect:sourceRect aspect:aspectSize];
|
||||
}
|
||||
|
||||
@@ -228,7 +249,7 @@
|
||||
|
||||
- (void)setOutputBounds:(NSRect)rect
|
||||
{
|
||||
DLog(@"Output bounds changed to: %@", NSStringFromRect(rect));
|
||||
os_log_debug(LOG_DISPLAY, "Output bounds changed to %{public}@", NSStringFromRect(rect));
|
||||
|
||||
if (_videoLayer && !NSEqualRects(_videoLayer.bounds, rect)) {
|
||||
[CATransaction begin];
|
||||
@@ -303,7 +324,7 @@
|
||||
|
||||
NSString *aPath = [info.romPath stringByStandardizingPath];
|
||||
|
||||
DLog(@"New ROM path is: %@", aPath);
|
||||
os_log_info(OE_LOG_HELPER, "Load ROM at path %{public}@", aPath);
|
||||
self.loadedRom = NO;
|
||||
|
||||
_shader = info.shader;
|
||||
@@ -345,11 +366,12 @@
|
||||
[strongSelf->_systemResponder handleHIDEvent:event];
|
||||
}];
|
||||
|
||||
DLog(@"Loaded bundle. About to load rom...");
|
||||
os_log_debug(OE_LOG_HELPER, "Loaded bundle.");
|
||||
|
||||
if([_gameCore loadFileAtPath:aPath error:error])
|
||||
{
|
||||
DLog(@"Loaded new Rom: %@", aPath);
|
||||
os_log_debug(OE_LOG_HELPER, "Loaded new ROM: %{public}@", aPath);
|
||||
|
||||
[_gameCoreOwner setDiscCount:[_gameCore discCount]];
|
||||
[_gameCoreOwner setDisplayModes:[_gameCore displayModes]];
|
||||
|
||||
@@ -359,12 +381,15 @@
|
||||
}
|
||||
|
||||
if (error && !*error) {
|
||||
*error = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadROMError userInfo:@{
|
||||
NSLocalizedDescriptionKey: NSLocalizedString(@"The emulator could not load ROM.", @"Error when loading a ROM."),
|
||||
}];
|
||||
*error = [NSError errorWithDomain:OEGameCoreErrorDomain
|
||||
code:OEGameCoreCouldNotLoadROMError
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey: NSLocalizedString(@"The emulator could not load ROM.", @"Error when loading a ROM."),
|
||||
}];
|
||||
}
|
||||
|
||||
NSLog(@"ROM did not load.");
|
||||
os_log_error(OE_LOG_HELPER, "Failed to load ROM.");
|
||||
|
||||
_gameCore = nil;
|
||||
|
||||
return NO;
|
||||
@@ -399,7 +424,8 @@
|
||||
|
||||
- (void)setAudioOutputDeviceID:(AudioDeviceID)deviceID
|
||||
{
|
||||
DLog(@"Audio output device: %lu", (unsigned long)deviceID);
|
||||
os_log_debug(OE_LOG_HELPER, "Set audio output to device number %lu", (unsigned long)deviceID);
|
||||
|
||||
[_gameCore performBlock:^{
|
||||
[self->_gameAudio setOutputDeviceID:deviceID];
|
||||
}];
|
||||
@@ -563,6 +589,9 @@
|
||||
|
||||
- (void)updateScreenSize:(OEIntSize)newScreenSize aspectSize:(OEIntSize)newAspectSize
|
||||
{
|
||||
os_log_debug(LOG_DISPLAY, "Notify OEGameCoreOwner of display size update: screenSize = %{public}@, aspectSize = %{public}@",
|
||||
NSStringFromOEIntSize(newScreenSize), NSStringFromOEIntSize(newAspectSize));
|
||||
|
||||
[_gameCoreOwner setScreenSize:newScreenSize aspectSize:newAspectSize];
|
||||
}
|
||||
|
||||
@@ -575,7 +604,7 @@
|
||||
|
||||
- (void)gameCoreDidFinishFrameRefreshThread:(OEGameCore *)gameCore
|
||||
{
|
||||
DLog(@"Finishing separate thread, stopping");
|
||||
os_log_debug(OE_LOG_HELPER, "Finishing separate thread, stopping");
|
||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
||||
}
|
||||
|
||||
@@ -607,7 +636,9 @@
|
||||
[CATransaction setDisableActions:YES];
|
||||
|
||||
if (!OEIntSizeEqualToSize(previousBufferSize, bufferSize)) {
|
||||
DLog(@"Recreating IOSurface because of game size change to %@", NSStringFromOEIntSize(bufferSize));
|
||||
os_log_debug(LOG_DISPLAY, "Game core buffer size change: %{public}@ → %{public}@",
|
||||
NSStringFromOEIntSize(previousBufferSize),
|
||||
NSStringFromOEIntSize(bufferSize));
|
||||
NSAssert(_gameRenderer.canChangeBufferSize == YES, @"Game tried changing IOSurface in a state we don't support");
|
||||
|
||||
[self setupCVBuffer];
|
||||
@@ -617,18 +648,22 @@
|
||||
NSAssert((screenRect.origin.x + screenRect.size.width) <= bufferSize.width, @"screen rect must not be larger than buffer size");
|
||||
NSAssert((screenRect.origin.y + screenRect.size.height) <= bufferSize.height, @"screen rect must not be larger than buffer size");
|
||||
|
||||
DLog(@"Sending did change screen rect to %@", NSStringFromOEIntRect(screenRect));
|
||||
[self updateScreenSize];
|
||||
os_log_debug(LOG_DISPLAY, "Game core screen rect change: %{public}@ → %{public}@",
|
||||
NSStringFromOEIntRect(previousScreenRect),
|
||||
NSStringFromOEIntRect(screenRect));
|
||||
mustUpdate = YES;
|
||||
}
|
||||
|
||||
if(!OEIntSizeEqualToSize(aspectSize, previousAspectSize))
|
||||
{
|
||||
DLog(@"Sending did change aspect to %@", NSStringFromOEIntSize(aspectSize));
|
||||
os_log_debug(LOG_DISPLAY, "Game core aspect size change: %{public}@ → %{public}@",
|
||||
NSStringFromOEIntSize(previousAspectSize),
|
||||
NSStringFromOEIntSize(aspectSize));
|
||||
mustUpdate = YES;
|
||||
}
|
||||
|
||||
if (mustUpdate) {
|
||||
[self updateScreenSize];
|
||||
[self updateScreenSize:_previousScreenRect.size aspectSize:_previousAspectSize];
|
||||
[self setupCVBuffer];
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#import "OEShaderParamValue.h"
|
||||
#import "NSXPCListener+HelperApp.h"
|
||||
#import "OEGameStartupInfo.h"
|
||||
#import "OELogging.h"
|
||||
|
||||
@interface OpenEmuXPCHelperAppBase () <NSXPCListenerDelegate, OEXPCGameCoreHelper>
|
||||
{
|
||||
@@ -56,7 +57,7 @@
|
||||
{
|
||||
if (err != nil)
|
||||
{
|
||||
NSLog(@"Unable to retrieve helperListener: %@", err);
|
||||
os_log_error(OE_LOG_HELPER, "Unable to retrieve helperListener: %@", err);
|
||||
}
|
||||
_Exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -76,7 +77,7 @@
|
||||
[_parentApplication addObserver:self forKeyPath:@"terminated" options:NSKeyValueObservingOptionNew context:nil];
|
||||
if(_parentApplication != nil)
|
||||
{
|
||||
NSLog(@"Parent application is: %@", [_parentApplication localizedName]);
|
||||
os_log_debug(OE_LOG_HELPER, "Parent application is: %@", [_parentApplication localizedName]);
|
||||
[self setupProcessPollingTimer];
|
||||
}
|
||||
|
||||
@@ -86,7 +87,7 @@
|
||||
if (dm.accessType != OEDeviceAccessTypeGranted)
|
||||
{
|
||||
[dm requestAccess];
|
||||
NSLog(@"Input Monitoring: Access Denied");
|
||||
os_log(OE_LOG_HELPER, "Input monitoring failed: Access Denied");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +120,7 @@
|
||||
|
||||
- (void)terminate
|
||||
{
|
||||
NSLog(@"Terminating helper");
|
||||
os_log_debug(OE_LOG_HELPER, "Terminating helper");
|
||||
|
||||
[_pollingTimer invalidate];
|
||||
CFRunLoopStop(CFRunLoopGetMain());
|
||||
|
||||
Reference in New Issue
Block a user