| 154 | } |
| 155 | |
| 156 | int savOpen(int titleIdx, int kind) override |
| 157 | { |
| 158 | Title title; |
| 159 | if (!catalogTitle(titleIdx, title)) { |
| 160 | return -1; |
| 161 | } |
| 162 | const int slot = freeSlot(); |
| 163 | if (slot < 0) { |
| 164 | return -2; |
| 165 | } |
| 166 | |
| 167 | // Only regular CTR saves and extdata are file-level archives; GBA VC |
| 168 | // (FSPXI raw), DSiWare (TWL FAT) and SPI cart saves are not reachable here. |
| 169 | if (kind == 0) { |
| 170 | const bool spiCart = title.mediaType() == MEDIATYPE_GAME_CARD && title.cardType() != CARD_CTR; |
| 171 | if (!title.accessibleSave() || title.isGBAVC() || title.isDSiWare() || spiCart) { |
| 172 | return -1; |
| 173 | } |
| 174 | } |
| 175 | else if (!title.accessibleExtdata()) { |
| 176 | return -1; |
| 177 | } |
| 178 | |
| 179 | Result res = 0; |
| 180 | ArchiveHandle handle = title.backup(kind == 0 ? BackupKind::Save : BackupKind::Extdata).open(res); |
| 181 | if (!handle) { |
| 182 | return R_FAILED(res) ? (int)res : -1; |
| 183 | } |
| 184 | |
| 185 | mSlots[slot].arch = std::move(handle); |
| 186 | mSlots[slot].commitable = kind == 0; |
| 187 | mSlots[slot].uniqueId = title.uniqueId(); |
| 188 | return slot; |
| 189 | } |
| 190 | |
| 191 | int savOpenShared(uint64_t id) override |
| 192 | { |
no test coverage detected