summaryrefslogtreecommitdiff
path: root/src/core/loader/3dsx.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2016-05-05 18:35:24 -0400
committerGravatar bunnei2016-05-05 18:35:24 -0400
commit55946cdc119c53656c79667b9a81172563b443ad (patch)
tree1fc81259c565ed89e17029a859c06ec8231728aa /src/core/loader/3dsx.cpp
parentMerge pull request #1706 from mailwl/mii-selector (diff)
parentadd missing header (diff)
downloadyuzu-55946cdc119c53656c79667b9a81172563b443ad.tar.gz
yuzu-55946cdc119c53656c79667b9a81172563b443ad.tar.xz
yuzu-55946cdc119c53656c79667b9a81172563b443ad.zip
Merge pull request #1700 from wwylele/gamelist-icon
Qt: display game icon and title in the game list
Diffstat (limited to 'src/core/loader/3dsx.cpp')
-rw-r--r--src/core/loader/3dsx.cpp27
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
306ResultStatus 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