diff options
Diffstat (limited to 'src/core/loader/3dsx.cpp')
| -rw-r--r-- | src/core/loader/3dsx.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp index 5fb3b9e2b..48a11ef81 100644 --- a/src/core/loader/3dsx.cpp +++ b/src/core/loader/3dsx.cpp | |||
| @@ -303,4 +303,31 @@ ResultStatus AppLoader_THREEDSX::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& ro | |||
| 303 | return ResultStatus::ErrorNotUsed; | 303 | return ResultStatus::ErrorNotUsed; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | ResultStatus AppLoader_THREEDSX::ReadIcon(std::vector<u8>& buffer) { | ||
| 307 | if (!file.IsOpen()) | ||
| 308 | return ResultStatus::Error; | ||
| 309 | |||
| 310 | // Reset read pointer in case this file has been read before. | ||
| 311 | file.Seek(0, SEEK_SET); | ||
| 312 | |||
| 313 | THREEDSX_Header hdr; | ||
| 314 | if (file.ReadBytes(&hdr, sizeof(THREEDSX_Header)) != sizeof(THREEDSX_Header)) | ||
| 315 | return ResultStatus::Error; | ||
| 316 | |||
| 317 | if (hdr.header_size != sizeof(THREEDSX_Header)) | ||
| 318 | return ResultStatus::Error; | ||
| 319 | |||
| 320 | // Check if the 3DSX has a SMDH... | ||
| 321 | if (hdr.smdh_offset != 0) { | ||
| 322 | file.Seek(hdr.smdh_offset, SEEK_SET); | ||
| 323 | buffer.resize(hdr.smdh_size); | ||
| 324 | |||
| 325 | if (file.ReadBytes(&buffer[0], hdr.smdh_size) != hdr.smdh_size) | ||
| 326 | return ResultStatus::Error; | ||
| 327 | |||
| 328 | return ResultStatus::Success; | ||
| 329 | } | ||
| 330 | return ResultStatus::ErrorNotUsed; | ||
| 331 | } | ||
| 332 | |||
| 306 | } // namespace Loader | 333 | } // namespace Loader |