| 89 | } |
| 90 | |
| 91 | int checkMemoryCardFreeSpace(const char *path, uint64_t size) { |
| 92 | char device[8]; |
| 93 | uint64_t free_size = 0, max_size = 0, extra_space = 0; |
| 94 | |
| 95 | char *p = strchr(path, ':'); |
| 96 | if (p) { |
| 97 | strncpy(device, path, p - path + 1); |
| 98 | device[p - path + 1] = '\0'; |
| 99 | } |
| 100 | |
| 101 | if (strcmp(device, "ux0:") == 0) { |
| 102 | extra_space = 40 * 1024 * 1024; |
| 103 | } |
| 104 | |
| 105 | if (is_safe_mode) { |
| 106 | sceAppMgrGetDevInfo(device, &max_size, &free_size); |
| 107 | } else { |
| 108 | SceIoDevInfo info; |
| 109 | memset(&info, 0, sizeof(SceIoDevInfo)); |
| 110 | sceIoDevctl(device, 0x3001, NULL, 0, &info, sizeof(SceIoDevInfo)); |
| 111 | free_size = info.free_size; |
| 112 | max_size = info.max_size; |
| 113 | } |
| 114 | |
| 115 | if (size >= (free_size + extra_space)) { |
| 116 | closeWaitDialog(); |
| 117 | |
| 118 | char size_string[16]; |
| 119 | getSizeString(size_string, size - (free_size + extra_space)); |
| 120 | infoDialog(language_container[NO_SPACE_ERROR], size_string); |
| 121 | |
| 122 | return 1; |
| 123 | } |
| 124 | |
| 125 | return 0; |
| 126 | } |
| 127 | |
| 128 | static int power_tick_thread(SceSize args, void *argp) { |
| 129 | while (1) { |
no test coverage detected