| 112 | } |
| 113 | |
| 114 | int savOpen(int titleIdx, int kind) override |
| 115 | { |
| 116 | if (kind != 0 || titleIdx < 0 || titleIdx >= titleCount()) { |
| 117 | return -1; // no extdata on Switch |
| 118 | } |
| 119 | const int slot = freeSlot(); |
| 120 | if (slot < 0) { |
| 121 | return -2; |
| 122 | } |
| 123 | |
| 124 | Title title; |
| 125 | TitleCatalog::get().getTitle(title, g_currentUId, (size_t)titleIdx); |
| 126 | |
| 127 | // Mount the save on the slot's own device name (the SaveDataSource::mount |
| 128 | // path hardcodes "save:", which belongs to the backup/restore worker). |
| 129 | FsFileSystem fileSystem; |
| 130 | Result res = 0; |
| 131 | switch (title.saveDataType()) { |
| 132 | case FsSaveDataType_Bcat: |
| 133 | res = FileSystem::mountBcatSave(&fileSystem, title.id()); |
| 134 | break; |
| 135 | case FsSaveDataType_Device: |
| 136 | res = FileSystem::mountDeviceSave(&fileSystem, title.id()); |
| 137 | break; |
| 138 | case FsSaveDataType_System: |
| 139 | res = FileSystem::mountSystemSave(&fileSystem, title.id(), title.saveDataSpaceId()); |
| 140 | break; |
| 141 | default: |
| 142 | res = FileSystem::mountSave(&fileSystem, title.id(), title.userId()); |
| 143 | break; |
| 144 | } |
| 145 | if (R_FAILED(res)) { |
| 146 | return (int)res; |
| 147 | } |
| 148 | |
| 149 | snprintf(mSlots[slot].dev, sizeof(mSlots[slot].dev), "scr%d", slot); |
| 150 | if (fsdevMountDevice(mSlots[slot].dev, fileSystem) == -1) { |
| 151 | fsFsClose(&fileSystem); |
| 152 | return -1; |
| 153 | } |
| 154 | |
| 155 | mSlots[slot].live = true; |
| 156 | return slot; |
| 157 | } |
| 158 | |
| 159 | // Shared extdata is a 3DS concept (e.g. the Home Menu Play Coin |
| 160 | // archive); the Switch has no console-wide extdata, so this is always |
nothing calls this directly
no test coverage detected