| 145 | } |
| 146 | |
| 147 | Handle launchOpenFile(const char* path) |
| 148 | { |
| 149 | if (strncmp(path, "sdmc:/", 6) == 0) |
| 150 | path += 5; |
| 151 | else if (*path != '/') |
| 152 | return 0; |
| 153 | |
| 154 | // Convert the executable path to UTF-16 |
| 155 | static uint16_t __utf16path[PATH_MAX+1]; |
| 156 | ssize_t units = utf8_to_utf16(__utf16path, (const uint8_t*)path, PATH_MAX); |
| 157 | if (units < 0 || units >= PATH_MAX) return 0; |
| 158 | __utf16path[units] = 0; |
| 159 | |
| 160 | // Open the file directly |
| 161 | FS_Path apath = { PATH_EMPTY, 1, (u8*)"" }; |
| 162 | FS_Path fpath = { PATH_UTF16, (units+1)*2, (u8*)__utf16path }; |
| 163 | Handle file; |
| 164 | Result res = FSUSER_OpenFileDirectly(&file, ARCHIVE_SDMC, apath, fpath, FS_OPEN_READ, 0); |
| 165 | return R_SUCCEEDED(res) ? file : 0; |
| 166 | } |
| 167 | |
| 168 | bool launchHomeMenuEnabled(void) |
| 169 | { |