Skip to content

Commit 5854125

Browse files
committed
Use NSURLErrorKey for NSError user infos.
1 parent 8f9b725 commit 5854125

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

Classes/PCSX2GameCore.mm

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@
7474
alignas(16) static SysMtgsThread s_mtgs_thread;
7575
PCSX2GameCore *_current;
7676

77-
@interface PCSX2GameCore ()
78-
79-
@end
80-
8177
@implementation PCSX2GameCore {
8278
@package
8379
bool hasInitialized;
@@ -151,7 +147,7 @@ - (BOOL)loadFileAtURL:(NSURL *)url error:(NSError **)error
151147

152148
if (_allCueSheetFiles.count <= 0) {
153149
if (error) {
154-
*error = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadROMError userInfo:@{NSFilePathErrorKey: url.path}];
150+
*error = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadROMError userInfo:@{NSURLErrorKey: url}];
155151
}
156152

157153
return false;
@@ -312,21 +308,22 @@ - (void)startEmulation
312308
wi.surface_height = screenRect.size.height ;
313309
g_host_display->CreateDevice(wi, VsyncMode::Adaptive);
314310

315-
VMManager::Internal::InitializeGlobals() ;
311+
VMManager::Internal::InitializeGlobals();
316312

317313

318-
if(VMManager::Initialize(params)){
314+
if (VMManager::Initialize(params)) {
319315
hasInitialized = true;
320316
VMManager::SetState(VMState::Running);
321-
if ([stateToLoad.path length] > 0)
317+
if ([stateToLoad.path length] > 0) {
322318
VMManager::LoadState(stateToLoad.fileSystemRepresentation);
319+
}
323320

324-
[NSThread detachNewThreadSelector:@selector(runVMThread) toTarget:self withObject:nil];
321+
[NSThread detachNewThreadSelector:@selector(runVMThread:) toTarget:self withObject:nil];
325322
}
326323
}
327324
}
328325

329-
- (void)runVMThread
326+
- (void)runVMThread:(id)unused
330327
{
331328
OESetThreadRealtime(1. / 50, .007, .03); // guessed from bsnes
332329

@@ -377,6 +374,7 @@ - (void)executeFrame
377374
#pragma mark Video
378375
- (OEIntSize)aspectSize
379376
{
377+
//TODO: change based off of app/user availability.
380378
return (OEIntSize){ 4, 3 };
381379
}
382380

@@ -478,7 +476,7 @@ - (void)loadStateFromFileAtURL:(NSURL *)fileURL completionHandler:(void (^)(BOOL
478476
bool success = VMManager::LoadState(fileURL.fileSystemRepresentation);
479477
WaitRequested = false;
480478

481-
block(success, success ? nil : [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadStateError userInfo:@{NSLocalizedDescriptionKey: @"PCSX2 Could not load the current state.", NSFilePathErrorKey: fileURL.path}]);
479+
block(success, success ? nil : [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadStateError userInfo:@{NSLocalizedDescriptionKey: @"PCSX2 Could not load the current state.", NSURLErrorKey: fileURL}]);
482480
}
483481

484482
- (void)saveStateToFileAtURL:(NSURL *)fileURL completionHandler:(void (^)(BOOL, NSError *))block
@@ -487,7 +485,7 @@ - (void)saveStateToFileAtURL:(NSURL *)fileURL completionHandler:(void (^)(BOOL,
487485
return;
488486
bool success = VMManager::SaveState(fileURL.fileSystemRepresentation, false, false);
489487

490-
block(success, success ? nil : [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotSaveStateError userInfo:@{NSLocalizedDescriptionKey: @"PCSX2 Could not save the current state.", NSFilePathErrorKey: fileURL.path}]);
488+
block(success, success ? nil : [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotSaveStateError userInfo:@{NSLocalizedDescriptionKey: @"PCSX2 Could not save the current state.", NSURLErrorKey: fileURL}]);
491489

492490
}
493491

@@ -801,7 +799,7 @@ - (void)changeDisplayWithMode:(NSString *)displayMode
801799
void Host::ReleaseHostDisplay(bool clear_state)
802800
{
803801
GET_CURRENT_OR_RETURN();
804-
if(g_host_display.get()){
802+
if (g_host_display.get()) {
805803
g_host_display.reset();
806804
}
807805
}

0 commit comments

Comments
 (0)