summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar MerryMage2016-12-15 09:54:25 +0000
committerGravatar MerryMage2016-12-15 18:42:38 +0000
commit351b5d23f4b332a36e4b5c7668809deae4de4af1 (patch)
treee0f327f749e3caf50a122caff856789d87ce67ff /src/core
parentarchive_source_sd_savedata: Add static method to get a specific save data path (diff)
downloadyuzu-351b5d23f4b332a36e4b5c7668809deae4de4af1.tar.gz
yuzu-351b5d23f4b332a36e4b5c7668809deae4de4af1.tar.xz
yuzu-351b5d23f4b332a36e4b5c7668809deae4de4af1.zip
loader: Implement ReadProgramId
Diffstat (limited to 'src/core')
-rw-r--r--src/core/loader/loader.h9
-rw-r--r--src/core/loader/ncch.cpp12
-rw-r--r--src/core/loader/ncch.h7
3 files changed, 28 insertions, 0 deletions
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 5e3d46638..a6c2a745f 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -144,6 +144,15 @@ public:
144 } 144 }
145 145
146 /** 146 /**
147 * Get the program id of the application
148 * @param out_program_id Reference to store program id into
149 * @return ResultStatus result of function
150 */
151 virtual ResultStatus ReadProgramId(u64& out_program_id) {
152 return ResultStatus::ErrorNotImplemented;
153 }
154
155 /**
147 * Get the RomFS of the application 156 * Get the RomFS of the application
148 * Since the RomFS can be huge, we return a file reference instead of copying to a buffer 157 * Since the RomFS can be huge, we return a file reference instead of copying to a buffer
149 * @param romfs_file The file containing the RomFS 158 * @param romfs_file The file containing the RomFS
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index d4be61e0e..6f2164428 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -344,6 +344,18 @@ ResultStatus AppLoader_NCCH::ReadLogo(std::vector<u8>& buffer) {
344 return LoadSectionExeFS("logo", buffer); 344 return LoadSectionExeFS("logo", buffer);
345} 345}
346 346
347ResultStatus AppLoader_NCCH::ReadProgramId(u64& out_program_id) {
348 if (!file.IsOpen())
349 return ResultStatus::Error;
350
351 ResultStatus result = LoadExeFS();
352 if (result != ResultStatus::Success)
353 return result;
354
355 out_program_id = ncch_header.program_id;
356 return ResultStatus::Success;
357}
358
347ResultStatus AppLoader_NCCH::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, 359ResultStatus AppLoader_NCCH::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset,
348 u64& size) { 360 u64& size) {
349 if (!file.IsOpen()) 361 if (!file.IsOpen())
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index bcf3ae6e3..6c93d46d8 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -220,6 +220,13 @@ public:
220 ResultStatus ReadLogo(std::vector<u8>& buffer) override; 220 ResultStatus ReadLogo(std::vector<u8>& buffer) override;
221 221
222 /** 222 /**
223 * Get the program id of the application
224 * @param out_program_id Reference to store program id into
225 * @return ResultStatus result of function
226 */
227 ResultStatus ReadProgramId(u64& out_program_id) override;
228
229 /**
223 * Get the RomFS of the application 230 * Get the RomFS of the application
224 * @param romfs_file Reference to buffer to store data 231 * @param romfs_file Reference to buffer to store data
225 * @param offset Offset in the file to the RomFS 232 * @param offset Offset in the file to the RomFS