Overview
Comment: | Add support for files on Nintendo Switch |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | nintendo-switch |
Files: | files | file ages | folders |
SHA3-256: |
3228d624fe4699aa2cf6c00a14606254 |
User & Date: | js on 2022-07-17 22:49:37 |
Other Links: | branch diff | manifest | tags |
Context
2022-07-31
| ||
13:55 | Add initial socket code for Nintendo Switch check-in: a30a0ab261 user: js tags: nintendo-switch | |
2022-07-17
| ||
22:49 | Add support for files on Nintendo Switch check-in: 3228d624fe user: js tags: nintendo-switch | |
20:05 | tests: Init and use console on Switch check-in: 986e12aa9c user: js tags: nintendo-switch | |
Changes
Modified src/OFFile.m from [0786a18c44] to [732a34cd87].
︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | + + + + + - - - + + + + | #import "OFReadFailedException.h" #import "OFSeekFailedException.h" #import "OFWriteFailedException.h" #ifdef OF_WINDOWS # include <windows.h> #endif #ifdef OF_AMIGAOS # include <proto/exec.h> # include <proto/dos.h> #endif #ifdef OF_WII # include <fat.h> #endif #ifdef OF_NINTENDO_DS # include <stdbool.h> # include <filesystem.h> #endif |
︙ | |||
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | + + + + + + + + + + + + + + + + + + + | *append = true; return MODE_READWRITE; } return -1; } #endif #ifdef OF_NINTENDO_SWITCH static bool initialized = false; OF_DESTRUCTOR() { if (initialized) romfsExit(); } #endif @implementation OFFile + (void)initialize { if (self != [OFFile class]) return; #ifdef OF_WII if (!fatInitDefault()) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif #ifdef OF_NINTENDO_DS if (!nitroFSInit(NULL)) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif #ifdef OF_NINTENDO_SWITCH if (R_SUCCEEDED(romfsInit())) /* * Errors are intentionally ignored, as it's possible we just * have no romfs. */ initialized = true; #endif } + (instancetype)fileWithPath: (OFString *)path mode: (OFString *)mode { return [[[self alloc] initWithPath: path mode: mode] autorelease]; } |
︙ |
Modified src/OFString+PathAdditions.m from [422d7384b5] to [dfeb40c068].
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + + | #include "platform.h" #if defined(OF_WINDOWS) || defined(OF_MSDOS) || defined(OF_MINT) # import "platform/Windows/OFString+PathAdditions.m" #elif defined(OF_AMIGAOS) # import "platform/AmigaOS/OFString+PathAdditions.m" |
Modified src/OFSystemInfo.m from [2ea5196f61] to [ae514f74f6].
︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | + + + + + + | #endif #if defined(OF_AMIGAOS4) # include <exec/exectags.h> #elif defined(OF_MORPHOS) # include <exec/system.h> #endif #ifdef OF_NINTENDO_SWITCH # define id nx_id # import <switch.h> # undef nx_id #endif #import "OFSystemInfo.h" #import "OFApplication.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFLocale.h" #import "OFOnce.h" |
︙ | |||
231 232 233 234 235 236 237 238 239 240 241 242 243 244 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | + + + + + + + + + + + | return; operatingSystemVersion = [[OFString alloc] initWithCString: utsname.release encoding: [OFLocale encoding]]; #endif } #ifdef OF_NINTENDO_SWITCH static OFString *tmpFSPath = nil; static void mountTmpFS(void) { if (R_SUCCEEDED(fsdevMountTemporaryStorage("tmpfs"))) tmpFSPath = @"tmpfs:/"; } #endif #if defined(OF_X86_64) || defined(OF_X86) static OF_INLINE struct X86Regs OF_CONST_FUNC x86CPUID(uint32_t eax, uint32_t ecx) { struct X86Regs regs; |
︙ | |||
564 565 566 567 568 569 570 571 572 573 574 575 576 577 | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | + + + + + | return [OFString stringWithUTF8String: pathC]; # elif defined(OF_AMIGAOS) return @"T:"; # elif defined(OF_MSDOS) return [[OFApplication environment] objectForKey: @"TEMP"]; # elif defined(OF_MINT) return @"u:\\tmp"; # elif defined(OF_NINTENDO_SWITCH) static OFOnceControl onceControl = OFOnceControlInitValue; OFOnce(&onceControl, mountTmpFS); return tmpFSPath; # else OFString *path = [[OFApplication environment] objectForKey: @"XDG_RUNTIME_DIR"]; if (path != nil) return path; |
︙ |
Modified tests/Makefile from [7da1ae39be] to [7c3cce2239].
︙ | |||
198 199 200 201 202 203 204 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | - + + - + - - + + + + + + + + + | ${PROG_NOINST}.3dsx: ${PROG_NOINST} 3dsxtool $< $@ ${PROG_NOINST}.arm9: ${PROG_NOINST} arm-none-eabi-objcopy -O binary $< $@ |
Modified tests/OFStringTests.m from [7a4f20e376] to [9b77bee5fe].
︙ | |||
560 561 562 563 564 565 566 | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | - + + | TEST(@"-[isAbsolutePath]", C(@"C:\\foo").absolutePath && C(@"a:/foo").absolutePath && !C(@"foo").absolutePath && !C(@"b:foo").absolutePath) # elif defined(OF_AMIGAOS) TEST(@"-[isAbsolutePath]", C(@"dh0:foo").absolutePath && C(@"dh0:a/b").absolutePath && !C(@"foo/bar").absolutePath && !C(@"foo").absolutePath) |
︙ | |||
726 727 728 729 730 731 732 | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | - + + | [[stringClass pathWithComponents: [OFArray arrayWithObjects: @"foo", @"bar", @"baz", nil]] isEqual: @"foo/bar/baz"] && [[stringClass pathWithComponents: [OFArray arrayWithObjects: @"foo/", @"bar", @"", @"baz", @"/", nil]] isEqual: @"foo//bar/baz//"] && [[stringClass pathWithComponents: [OFArray arrayWithObjects: @"foo", nil]] isEqual: @"foo"]) |
︙ | |||
850 851 852 853 854 855 856 | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | - + + | [[array objectAtIndex: 1] isEqual: @"bar"] && [[array objectAtIndex: 2] isEqual: @"baz"] && /* foo// */ (array = C(@"foo//").pathComponents) && array.count == 2 && [[array objectAtIndex: 0] isEqual: @"foo"] && [[array objectAtIndex: 1] isEqual: @"/"] && C(@"").pathComponents.count == 0) |
︙ | |||
931 932 933 934 935 936 937 | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | - + + | [C(@"dh0:tmp").lastPathComponent isEqual: @"tmp"] && [C(@"dh0:tmp/").lastPathComponent isEqual: @"tmp"] && [C(@"dh0:/").lastPathComponent isEqual: @"/"] && [C(@"dh0:").lastPathComponent isEqual: @"dh0:"] && [C(@"foo").lastPathComponent isEqual: @"foo"] && [C(@"foo/bar").lastPathComponent isEqual: @"bar"] && [C(@"foo/bar/baz/").lastPathComponent isEqual: @"baz"]) |
︙ | |||
997 998 999 1000 1001 1002 1003 | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 | - + + | [C(@"dh0:tmp/").stringByDeletingLastPathComponent isEqual: @"dh0:"] && [C(@"dh0:/").stringByDeletingLastPathComponent isEqual: @"dh0:"] && [C(@"dh0:tmp/foo/").stringByDeletingLastPathComponent isEqual: @"dh0:tmp"] && [C(@"foo/bar").stringByDeletingLastPathComponent isEqual: @"foo"] && [C(@"foo").stringByDeletingLastPathComponent isEqual: @""]) |
︙ | |||
1044 1045 1046 1047 1048 1049 1050 | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | - + + | [C(@"dh0:foo./bar.baz").stringByDeletingPathExtension isEqual: @"dh0:foo./bar"] && [C(@"foo.bar/").stringByDeletingPathExtension isEqual: @"foo"] && [C(@".foo").stringByDeletingPathExtension isEqual: @".foo"] && [C(@".foo\\bar").stringByDeletingPathExtension isEqual: @".foo\\bar"] && [C(@".foo.bar").stringByDeletingPathExtension isEqual: @".foo"]) |
︙ |
Modified tests/TestsAppDelegate.m from [a391d406bc] to [a6eba3166b].
︙ | |||
156 157 158 159 160 161 162 163 164 165 166 167 168 169 | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | + + + + | consoleInit(GFX_TOP, NULL); #endif #ifdef OF_NINTENDO_SWITCH consoleInit(NULL); padConfigureInput(1, HidNpadStyleSet_NpadStandard); updateConsole(true); # ifdef OF_HAVE_FILES [[OFFileManager defaultManager] changeCurrentDirectoryPath: @"romfs:/"]; # endif #endif #if defined(OF_WII) || defined(OF_PSP) || defined(OF_NINTENDO_DS) || \ defined(OF_NINTENDO_3DS) || defined(OF_NINTENDO_SWITCH) @try { return OFApplicationMain(&argc, &argv, [[TestsAppDelegate alloc] init]); |
︙ |