tvOS: Add Settings.app option to reset retroarch.cfg (#17143)
Some checks are pending
CI 3DS / build (push) Waiting to run
CI Android / build (push) Waiting to run
CI DOS/DJGPP / build (push) Waiting to run
CI Emscripten / build (push) Waiting to run
CI GameCube / build (push) Waiting to run
CI Linux (i686) / build (push) Waiting to run
CI Windows (MSVC) / msvc (Debug, x64, 2019) (push) Waiting to run
CI Windows (MSVC) / msvc (Debug, x64, 2022) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, 2019) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, 2022) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, UWP) (push) Waiting to run
CI Windows (MSVC) / msvc (ReleaseAngle, x64, UWP) (push) Waiting to run
CI macOS / build (push) Waiting to run
CI Miyoo ARM32 / build (push) Waiting to run
CI PS2 / build (push) Waiting to run
CI PS4/ORBIS / build (push) Waiting to run
CI PSP / build (push) Waiting to run
CI PSVita / build (push) Waiting to run
CI RS90 Odbeta MIPS32 / build (push) Waiting to run
CI RetroFW MIPS32 / build (push) Waiting to run
CI Switch/libnx / build (push) Waiting to run
CI Wii / build (push) Waiting to run
CI WiiU / build (push) Waiting to run
CI Windows i686 (MXE) / build (push) Waiting to run
CI Windows x64 (MXE) / build (push) Waiting to run
RetroArch CI / linux-c89 (push) Waiting to run
CI webOS / build (push) Waiting to run

This commit is contained in:
Eric Warmenhoven 2024-10-31 00:49:55 -04:00 committed by GitHub
parent 89ca8495e1
commit f175d0e091
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 57 additions and 0 deletions

View File

@ -23,6 +23,7 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
07019B932CD24FF200D6C3FD /* GCDWebDAVServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 07C5C63E2CD167470030FBEC /* GCDWebDAVServer.m */; }; 07019B932CD24FF200D6C3FD /* GCDWebDAVServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 07C5C63E2CD167470030FBEC /* GCDWebDAVServer.m */; };
070A88432A4E7AA9003161C0 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 070A88422A4E7AA9003161C0 /* OpenAL.framework */; }; 070A88432A4E7AA9003161C0 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 070A88422A4E7AA9003161C0 /* OpenAL.framework */; };
071212C82C6FD65B00F1B4B0 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 071212C72C6FD65B00F1B4B0 /* Settings.bundle */; };
0712A7722B807AE400C9765F /* TVServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0712A7712B807AE400C9765F /* TVServices.framework */; }; 0712A7722B807AE400C9765F /* TVServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0712A7712B807AE400C9765F /* TVServices.framework */; };
0712A7762B807AE400C9765F /* ContentProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 0712A7752B807AE400C9765F /* ContentProvider.m */; }; 0712A7762B807AE400C9765F /* ContentProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 0712A7752B807AE400C9765F /* ContentProvider.m */; };
0712A77A2B807AE400C9765F /* RetroArchTopShelfExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 0712A7702B807AE400C9765F /* RetroArchTopShelfExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 0712A77A2B807AE400C9765F /* RetroArchTopShelfExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 0712A7702B807AE400C9765F /* RetroArchTopShelfExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
@ -172,6 +173,7 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
070A88422A4E7AA9003161C0 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; 070A88422A4E7AA9003161C0 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
071212C72C6FD65B00F1B4B0 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
0712A7702B807AE400C9765F /* RetroArchTopShelfExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = RetroArchTopShelfExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 0712A7702B807AE400C9765F /* RetroArchTopShelfExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = RetroArchTopShelfExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
0712A7712B807AE400C9765F /* TVServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TVServices.framework; path = Library/Frameworks/TVServices.framework; sourceTree = DEVELOPER_DIR; }; 0712A7712B807AE400C9765F /* TVServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TVServices.framework; path = Library/Frameworks/TVServices.framework; sourceTree = DEVELOPER_DIR; };
0712A7742B807AE400C9765F /* ContentProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentProvider.h; sourceTree = "<group>"; }; 0712A7742B807AE400C9765F /* ContentProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentProvider.h; sourceTree = "<group>"; };
@ -569,6 +571,7 @@
926C77E221FD1E6700103EDE /* Assets.xcassets */, 926C77E221FD1E6700103EDE /* Assets.xcassets */,
926C77E421FD1E6700103EDE /* Info.plist */, 926C77E421FD1E6700103EDE /* Info.plist */,
073DB2892B8706490001BA32 /* RetroArchTV.entitlements */, 073DB2892B8706490001BA32 /* RetroArchTV.entitlements */,
071212C72C6FD65B00F1B4B0 /* Settings.bundle */,
); );
path = tvOS; path = tvOS;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1448,6 +1451,7 @@
07B7872D29E8FE8F0088B74F /* filters in Resources */, 07B7872D29E8FE8F0088B74F /* filters in Resources */,
92CC05BD21FE3C1700FF79F0 /* GCDWebUploader.bundle in Resources */, 92CC05BD21FE3C1700FF79F0 /* GCDWebUploader.bundle in Resources */,
0753AD1A2C86144200874A42 /* BaseConfig.xcconfig in Resources */, 0753AD1A2C86144200874A42 /* BaseConfig.xcconfig in Resources */,
071212C82C6FD65B00F1B4B0 /* Settings.bundle in Resources */,
9222F2002314BA7C0097C0FD /* assets.zip in Resources */, 9222F2002314BA7C0097C0FD /* assets.zip in Resources */,
926C77E321FD1E6700103EDE /* Assets.xcassets in Resources */, 926C77E321FD1E6700103EDE /* Assets.xcassets in Resources */,
); );

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>StringsTable</key>
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Restore Default Config</string>
<key>Key</key>
<string>restore_default_config</string>
<key>DefaultValue</key>
<false/>
</dict>
</array>
</dict>
</plist>

Binary file not shown.

View File

@ -672,6 +672,38 @@ enum
int argc = 1; int argc = 1;
apple_platform = self; apple_platform = self;
if ([NSUserDefaults.standardUserDefaults boolForKey:@"restore_default_config"])
{
[NSUserDefaults.standardUserDefaults setBool:NO forKey:@"restore_default_config"];
[NSUserDefaults.standardUserDefaults setObject:@"" forKey:@FILE_PATH_MAIN_CONFIG];
// Get the Caches directory path
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesDirectory = [paths firstObject];
// Define the original and new file paths
NSString *originalPath = [cachesDirectory stringByAppendingPathComponent:@"RetroArch/config/retroarch.cfg"];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"HHmm-yyMMdd"];
NSString *timestamp = [dateFormatter stringFromDate:[NSDate date]];
NSString *newPath = [cachesDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"RetroArch/config/RetroArch-%@.cfg", timestamp]];
// File manager instance
NSFileManager *fileManager = [NSFileManager defaultManager];
// Check if the file exists and rename it
if ([fileManager fileExistsAtPath:originalPath]) {
NSError *error = nil;
if ([fileManager moveItemAtPath:originalPath toPath:newPath error:&error]) {
NSLog(@"File renamed to %@", newPath);
} else {
NSLog(@"Error renaming file: %@", error.localizedDescription);
}
} else {
NSLog(@"File does not exist at path %@", originalPath);
}
}
[self setDelegate:self]; [self setDelegate:self];
/* Setup window */ /* Setup window */