Cocoa Port: When dealing with file paths, replace instances of [NSString cStringUsingEncoding:NSUTF8StringEncoding] with [NSString fileSystemRepresentation] and [NSFileManager stringWithFileSystemRepresentation:].
- This commit doesn't actually do anything, but it is the "proper" way for Apple OSes to deal with file paths that interact with lower-level C file functions.
This commit is contained in:
parent
416b08d6f7
commit
ba05516b7d
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2011 Roger Manuel
|
||||
Copyright (C) 2012-2018 DeSmuME team
|
||||
Copyright (C) 2012-2022 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -708,7 +708,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
|
||||
if (fileURL != nil)
|
||||
{
|
||||
listData->init((char *)[[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
listData->init((char *)[CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
list = [[CocoaDSCheatManager cheatListWithListObject:listData] retain];
|
||||
}
|
||||
else
|
||||
|
@ -966,7 +966,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
|
||||
CHEATSEXPORT *exporter = new CHEATSEXPORT();
|
||||
|
||||
BOOL result = exporter->load((char *)[[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
BOOL result = exporter->load((char *)[CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
if (!result)
|
||||
{
|
||||
if (error != nil)
|
||||
|
|
|
@ -724,50 +724,42 @@ volatile bool execute = true;
|
|||
|
||||
- (void) setArm9ImageURL:(NSURL *)fileURL
|
||||
{
|
||||
const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
|
||||
execControl->SetARM9ImagePath(filePath);
|
||||
execControl->SetARM9ImagePath([CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
}
|
||||
|
||||
- (NSURL *) arm9ImageURL
|
||||
{
|
||||
const char *filePath = execControl->GetARM9ImagePath();
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
|
||||
return [CocoaDSUtil fileURLFromCPath:execControl->GetARM9ImagePath()];
|
||||
}
|
||||
|
||||
- (void) setArm7ImageURL:(NSURL *)fileURL
|
||||
{
|
||||
const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
|
||||
execControl->SetARM7ImagePath(filePath);
|
||||
execControl->SetARM7ImagePath([CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
}
|
||||
|
||||
- (NSURL *) arm7ImageURL
|
||||
{
|
||||
const char *filePath = execControl->GetARM7ImagePath();
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
|
||||
return [CocoaDSUtil fileURLFromCPath:execControl->GetARM7ImagePath()];
|
||||
}
|
||||
|
||||
- (void) setFirmwareImageURL:(NSURL *)fileURL
|
||||
{
|
||||
const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
|
||||
execControl->SetFirmwareImagePath(filePath);
|
||||
execControl->SetFirmwareImagePath([CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
}
|
||||
|
||||
- (NSURL *) firmwareImageURL
|
||||
{
|
||||
const char *filePath = execControl->GetFirmwareImagePath();
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
|
||||
return [CocoaDSUtil fileURLFromCPath:execControl->GetFirmwareImagePath()];
|
||||
}
|
||||
|
||||
- (void) setSlot1R4URL:(NSURL *)fileURL
|
||||
{
|
||||
const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
|
||||
execControl->SetSlot1R4Path(filePath);
|
||||
execControl->SetSlot1R4Path([CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
}
|
||||
|
||||
- (NSURL *) slot1R4URL
|
||||
{
|
||||
const char *filePath = execControl->GetSlot1R4Path();
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
|
||||
return [CocoaDSUtil fileURLFromCPath:execControl->GetSlot1R4Path()];
|
||||
}
|
||||
|
||||
- (void) updateFirmwareMACAddressString
|
||||
|
@ -996,8 +988,9 @@ volatile bool execute = true;
|
|||
return NO;
|
||||
}
|
||||
|
||||
std::string sramPath = (sramURL != nil) ? [[sramURL path] cStringUsingEncoding:NSUTF8StringEncoding] : "";
|
||||
const char *fileName = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *cSramPath = [CocoaDSUtil cPathFromFileURL:sramURL];
|
||||
std::string sramPath = (cSramPath != NULL) ? std::string(cSramPath) : "";
|
||||
const char *fileName = [CocoaDSUtil cPathFromFileURL:fileURL];
|
||||
|
||||
NSDateFormatter *df = [[NSDateFormatter alloc] init];
|
||||
[df setDateFormat:@"Y M d H m s SSS"];
|
||||
|
|
|
@ -142,7 +142,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
const char *statePath = [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *statePath = [CocoaDSUtil cPathFromFileURL:saveStateURL];
|
||||
bool cResult = savestate_load(statePath);
|
||||
if(cResult)
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
const char *statePath = [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *statePath = [CocoaDSUtil cPathFromFileURL:saveStateURL];
|
||||
bool cResult = savestate_save(statePath);
|
||||
if(cResult)
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
const char *romPath = [[romURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *romPath = [CocoaDSUtil cPathFromFileURL:romURL];
|
||||
NSInteger resultCode = NDS_LoadROM(romPath, NULL, NULL);
|
||||
if (resultCode > 0)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
const char *replayPath = [[replayURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *replayPath = [CocoaDSUtil cPathFromFileURL:replayURL];
|
||||
const char *resultCode = FCEUI_LoadMovie(replayPath, true, false, -1);
|
||||
if (resultCode == NULL)
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
+ (BOOL) importRomSave:(NSURL *)romSaveURL
|
||||
{
|
||||
BOOL result = NO;
|
||||
const char *romSavePath = [[romSaveURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *romSavePath = [CocoaDSUtil cPathFromFileURL:romSaveURL];
|
||||
|
||||
NSInteger resultCode = MMU_new.backupDevice.importData(romSavePath, 0);
|
||||
if (resultCode == 0)
|
||||
|
@ -243,7 +243,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
#endif
|
||||
case ROMSAVEFORMAT_NOGBA:
|
||||
{
|
||||
const char *destinationPath = [[[destinationURL path] stringByAppendingPathExtension:@FILE_EXT_ROM_SAVE_NOGBA] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *destinationPath = [CocoaDSUtil cPathFromFilePath:[[destinationURL path] stringByAppendingPathExtension:@FILE_EXT_ROM_SAVE_NOGBA]];
|
||||
bool resultCode = MMU_new.backupDevice.exportData(destinationPath);
|
||||
if (resultCode)
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
|
||||
case ROMSAVEFORMAT_RAW:
|
||||
{
|
||||
const char *destinationPath = [[[destinationURL path] stringByAppendingPathExtension:@FILE_EXT_ROM_SAVE_RAW] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *destinationPath = [CocoaDSUtil cPathFromFilePath:[[destinationURL path] stringByAppendingPathExtension:@FILE_EXT_ROM_SAVE_RAW]];
|
||||
bool resultCode = MMU_new.backupDevice.exportData(destinationPath);
|
||||
if (resultCode)
|
||||
{
|
||||
|
@ -358,55 +358,55 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
NSURL *romURL = [CocoaDSFile directoryURLByKind:@"ROM" version:versionString port:portString];
|
||||
if (romURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToRoms, [[romURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToRoms, [CocoaDSUtil cPathFromFileURL:romURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *romSaveURL = [CocoaDSFile directoryURLByKind:@"ROM Save" version:versionString port:portString];
|
||||
if (romSaveURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToBattery, [[romSaveURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToBattery, [CocoaDSUtil cPathFromFileURL:romSaveURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *saveStateURL = [CocoaDSFile directoryURLByKind:@"Save State" version:versionString port:portString];
|
||||
if (saveStateURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToStates, [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToStates, [CocoaDSUtil cPathFromFileURL:saveStateURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *screenshotURL = [CocoaDSFile directoryURLByKind:@"Screenshot" version:versionString port:portString];
|
||||
if (screenshotURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToScreenshots, [[screenshotURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToScreenshots, [CocoaDSUtil cPathFromFileURL:screenshotURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *aviURL = [CocoaDSFile directoryURLByKind:@"Video" version:versionString port:portString];
|
||||
if (aviURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToAviFiles, [[aviURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToAviFiles, [CocoaDSUtil cPathFromFileURL:aviURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *cheatURL = [CocoaDSFile directoryURLByKind:@"Cheat" version:versionString port:portString];
|
||||
if (cheatURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToCheats, [[cheatURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToCheats, [CocoaDSUtil cPathFromFileURL:cheatURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *soundSamplesURL = [CocoaDSFile directoryURLByKind:@"Sound Sample" version:versionString port:portString];
|
||||
if (soundSamplesURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToSounds, [[soundSamplesURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToSounds, [CocoaDSUtil cPathFromFileURL:soundSamplesURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *firmwareURL = [CocoaDSFile directoryURLByKind:@"Firmware Configuration" version:versionString port:portString];
|
||||
if (firmwareURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToFirmware, [[firmwareURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToFirmware, [CocoaDSUtil cPathFromFileURL:firmwareURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *luaURL = [CocoaDSFile directoryURLByKind:@"Lua Script" version:versionString port:portString];
|
||||
if (luaURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToLua, [[luaURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToLua, [CocoaDSUtil cPathFromFileURL:luaURL], MAX_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,55 +438,55 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
NSURL *romURL = (NSURL *)[URLDictionary valueForKey:@"ROM"];
|
||||
if (romURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToRoms, [[romURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToRoms, [CocoaDSUtil cPathFromFileURL:romURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *romSaveURL = (NSURL *)[URLDictionary valueForKey:@"ROM Save"];
|
||||
if (romSaveURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToBattery, [[romSaveURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToBattery, [CocoaDSUtil cPathFromFileURL:romSaveURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *saveStateURL = (NSURL *)[URLDictionary valueForKey:@"Save State"];
|
||||
if (saveStateURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToStates, [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToStates, [CocoaDSUtil cPathFromFileURL:saveStateURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *screenshotURL = (NSURL *)[URLDictionary valueForKey:@"Screenshot"];
|
||||
if (screenshotURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToScreenshots, [[screenshotURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToScreenshots, [CocoaDSUtil cPathFromFileURL:screenshotURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *aviURL = (NSURL *)[URLDictionary valueForKey:@"Video"];
|
||||
if (aviURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToAviFiles, [[aviURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToAviFiles, [CocoaDSUtil cPathFromFileURL:aviURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *cheatURL = (NSURL *)[URLDictionary valueForKey:@"Cheat"];
|
||||
if (cheatURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToCheats, [[cheatURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToCheats, [CocoaDSUtil cPathFromFileURL:cheatURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *soundSamplesURL = (NSURL *)[URLDictionary valueForKey:@"Sound Sample"];
|
||||
if (soundSamplesURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToSounds, [[soundSamplesURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToSounds, [CocoaDSUtil cPathFromFileURL:soundSamplesURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *firmwareURL = (NSURL *)[URLDictionary valueForKey:@"Firmware Configuration"];
|
||||
if (firmwareURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToFirmware, [[firmwareURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToFirmware, [CocoaDSUtil cPathFromFileURL:firmwareURL], MAX_PATH);
|
||||
}
|
||||
|
||||
NSURL *luaURL = (NSURL *)[URLDictionary valueForKey:@"Lua Script"];
|
||||
if (luaURL != nil)
|
||||
{
|
||||
strlcpy(path.pathToLua, [[luaURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
|
||||
strlcpy(path.pathToLua, [CocoaDSUtil cPathFromFileURL:luaURL], MAX_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2014-2018 DeSmuME Team
|
||||
Copyright (C) 2014-2022 DeSmuME Team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -135,18 +135,18 @@
|
|||
return currentDevice;
|
||||
}
|
||||
|
||||
- (void) setMpcfFileSearchURL:(NSURL *)theURL
|
||||
- (void) setMpcfFileSearchURL:(NSURL *)fileURL
|
||||
{
|
||||
if (theURL != nil)
|
||||
if (fileURL != nil)
|
||||
{
|
||||
BOOL isDirectory = NO;
|
||||
NSString *thePath = [theURL path];
|
||||
NSString *filePath = [fileURL path];
|
||||
|
||||
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||
[fileManager fileExistsAtPath:thePath isDirectory:&isDirectory];
|
||||
[fileManager fileExistsAtPath:[fileURL path] isDirectory:&isDirectory];
|
||||
|
||||
CFlash_Mode = (isDirectory) ? ADDON_CFLASH_MODE_Path : ADDON_CFLASH_MODE_File;
|
||||
CFlash_Path = [thePath cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
CFlash_Path = [CocoaDSUtil cPathFromFileURL:fileURL];
|
||||
|
||||
[fileManager release];
|
||||
}
|
||||
|
@ -159,14 +159,14 @@
|
|||
|
||||
- (NSURL *) mpcfFileSearchURL
|
||||
{
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:CFlash_Path.c_str() encoding:NSUTF8StringEncoding]];
|
||||
return [CocoaDSUtil fileURLFromCPath:CFlash_Path.c_str()];
|
||||
}
|
||||
|
||||
- (void) setGbaCartridgeURL:(NSURL *)fileURL
|
||||
{
|
||||
if (fileURL != nil)
|
||||
{
|
||||
GBACartridge_RomPath = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
GBACartridge_RomPath = [CocoaDSUtil cPathFromFileURL:fileURL];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -176,14 +176,14 @@
|
|||
|
||||
- (NSURL *) gbaCartridgeURL
|
||||
{
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:GBACartridge_RomPath.c_str() encoding:NSUTF8StringEncoding]];
|
||||
return [CocoaDSUtil fileURLFromCPath:GBACartridge_RomPath.c_str()];
|
||||
}
|
||||
|
||||
- (void) setGbaSRamURL:(NSURL *)fileURL
|
||||
{
|
||||
if (fileURL != nil)
|
||||
{
|
||||
GBACartridge_SRAMPath = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
GBACartridge_SRAMPath = [CocoaDSUtil cPathFromFileURL:fileURL];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -193,7 +193,7 @@
|
|||
|
||||
- (NSURL *) gbaSRamURL;
|
||||
{
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:GBACartridge_SRAMPath.c_str() encoding:NSUTF8StringEncoding]];
|
||||
return [CocoaDSUtil fileURLFromCPath:GBACartridge_SRAMPath.c_str()];
|
||||
}
|
||||
|
||||
- (BOOL) doesGbaCartridgeSaveExist
|
||||
|
|
|
@ -34,6 +34,11 @@
|
|||
+ (NSColor *) NSColorFromRGBA8888:(uint32_t)theColor;
|
||||
+ (uint32_t) RGBA8888FromNSColor:(NSColor *)theColor;
|
||||
|
||||
+ (NSString *) filePathFromCPath:(const char *)cPath;
|
||||
+ (NSURL *) fileURLFromCPath:(const char *)cPath;
|
||||
+ (const char *) cPathFromFilePath:(NSString *)filePath;
|
||||
+ (const char *) cPathFromFileURL:(NSURL *)fileURL;
|
||||
|
||||
+ (NSInteger) appVersionNumeric;
|
||||
+ (NSString *) appInternalVersionString;
|
||||
+ (NSString *) appInternalNameAndVersionString;
|
||||
|
|
|
@ -136,6 +136,31 @@
|
|||
#endif
|
||||
}
|
||||
|
||||
+ (NSString *) filePathFromCPath:(const char *)cPath
|
||||
{
|
||||
if (cPath == NULL)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cPath length:strlen(cPath)];
|
||||
}
|
||||
|
||||
+ (NSURL *) fileURLFromCPath:(const char *)cPath
|
||||
{
|
||||
return [NSURL fileURLWithPath:[CocoaDSUtil filePathFromCPath:cPath]];
|
||||
}
|
||||
|
||||
+ (const char *) cPathFromFilePath:(NSString *)filePath
|
||||
{
|
||||
return (filePath != nil) ? [filePath fileSystemRepresentation] : NULL;
|
||||
}
|
||||
|
||||
+ (const char *) cPathFromFileURL:(NSURL *)fileURL
|
||||
{
|
||||
return (fileURL != nil) ? [CocoaDSUtil cPathFromFilePath:[fileURL path]] : NULL;
|
||||
}
|
||||
|
||||
+ (NSInteger) appVersionNumeric
|
||||
{
|
||||
return (NSInteger)EMU_DESMUME_VERSION_NUMERIC();
|
||||
|
|
|
@ -371,7 +371,7 @@ volatile bool execute = true;
|
|||
if (_cdp == NULL)
|
||||
{
|
||||
NSString *gameCoreFontPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SourceSansPro-Bold" ofType:@"otf"];
|
||||
const char *hudFontPath = [[NSFileManager defaultManager] fileSystemRepresentationWithPath:gameCoreFontPath];
|
||||
const char *hudFontPath = [CocoaDSUtil cPathFromFilePath:gameCoreFontPath];
|
||||
|
||||
_cdp = new OE_OGLDisplayPresenter(fetchObj);
|
||||
_cdp->Init();
|
||||
|
|
|
@ -1295,7 +1295,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
[newDisplayOutput setClientDisplay3DView:cdv];
|
||||
|
||||
NSString *fontPath = [[NSBundle mainBundle] pathForResource:@"SourceSansPro-Bold" ofType:@"otf"];
|
||||
cdv->Get3DPresenter()->SetHUDFontPath([fontPath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
cdv->Get3DPresenter()->SetHUDFontPath([CocoaDSUtil cPathFromFilePath:fontPath]);
|
||||
cdv->Get3DPresenter()->SetHUDRenderMipmapped(true);
|
||||
|
||||
if (scaleFactor != 1.0f)
|
||||
|
|
|
@ -1802,7 +1802,7 @@ void HandleDeviceRemovalCallback(void *inContext, IOReturn inResult, void *inSen
|
|||
}
|
||||
|
||||
// Check if the audio file is already loaded. If it is, don't load it again.
|
||||
std::string filePathStr = std::string([filePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
std::string filePathStr = std::string([CocoaDSUtil cPathFromFilePath:filePath]);
|
||||
for (AudioFileSampleGeneratorMap::iterator it=audioFileGenerators.begin(); it!=audioFileGenerators.end(); ++it)
|
||||
{
|
||||
if (it->first.find(filePathStr) != std::string::npos)
|
||||
|
@ -1905,7 +1905,7 @@ void HandleDeviceRemovalCallback(void *inContext, IOReturn inResult, void *inSen
|
|||
return NULL;
|
||||
}
|
||||
|
||||
std::string filePathStr = std::string([filePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
std::string filePathStr = std::string([CocoaDSUtil cPathFromFilePath:filePath]);
|
||||
for (AudioFileSampleGeneratorMap::iterator it=audioFileGenerators.begin(); it!=audioFileGenerators.end(); ++it)
|
||||
{
|
||||
if (it->first.find(filePathStr) != std::string::npos)
|
||||
|
|
|
@ -1350,8 +1350,8 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
param.refObject = newCaptureObject;
|
||||
param.fetchObject = currentFetchObj;
|
||||
param.formatID = [self formatID];
|
||||
param.savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param.romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param.savePath = std::string([CocoaDSUtil cPathFromFilePath:savePath]);
|
||||
param.romName = std::string([CocoaDSUtil cPathFromFilePath:romName]);
|
||||
param.useDeposterize = [self useDeposterize] ? true : false;
|
||||
param.outputFilterID = (OutputFilterTypeID)[self outputFilterID];
|
||||
param.pixelScalerID = (VideoFilterTypeID)[self pixelScalerID];
|
||||
|
@ -1383,7 +1383,8 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
NSString *fileNameNSString = [[dateFormatter stringFromDate:[NSDate date]] stringByAppendingString:[NSString stringWithCString:param.romName.c_str() encoding:NSUTF8StringEncoding]];
|
||||
[dateFormatter release];
|
||||
|
||||
std::string fileName = param.savePath + "/" + std::string([fileNameNSString cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
NSString *savePathNSString = [CocoaDSUtil filePathFromCPath:param.savePath.c_str()];
|
||||
std::string fileName = std::string([CocoaDSUtil cPathFromFilePath:[savePathNSString stringByAppendingPathComponent:fileNameNSString]]);
|
||||
|
||||
// Create the output file stream.
|
||||
ClientAVCaptureError error = ClientAVCaptureError_None;
|
||||
|
|
|
@ -75,8 +75,8 @@
|
|||
param->refObject = NULL;
|
||||
param->fetchObject = [self fetchObject];
|
||||
param->formatID = [self formatID];
|
||||
param->savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param->romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param->savePath = std::string([CocoaDSUtil cPathFromFilePath:savePath]);
|
||||
param->romName = std::string([CocoaDSUtil cPathFromFilePath:romName]);
|
||||
param->useDeposterize = [self useDeposterize] ? true : false;
|
||||
param->outputFilterID = (OutputFilterTypeID)[self outputFilterID];
|
||||
param->pixelScalerID = (VideoFilterTypeID)[self pixelScalerID];
|
||||
|
@ -291,7 +291,7 @@ static void* RunFileWriteThread(void *arg)
|
|||
NSString *fileName = [[dateFormatter stringFromDate:[NSDate date]] stringByAppendingString:[NSString stringWithCString:param.romName.c_str() encoding:NSUTF8StringEncoding]];
|
||||
[dateFormatter release];
|
||||
|
||||
NSString *savePath = [NSString stringWithCString:param.savePath.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSString *savePath = [CocoaDSUtil filePathFromCPath:param.savePath.c_str()];
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:[savePath stringByAppendingPathComponent:fileName]];
|
||||
[CocoaDSFile saveScreenshot:fileURL bitmapData:newImageRep fileType:(NSBitmapImageFileType)param.formatID];
|
||||
|
||||
|
|
Loading…
Reference in New Issue