summaryrefslogtreecommitdiff
path: root/src/core/loader/3dsx.cpp
diff options
context:
space:
mode:
authorGravatar Emmanuel Gil Peyrot2015-01-06 21:30:40 +0000
committerGravatar Emmanuel Gil Peyrot2015-01-15 21:21:26 +0000
commitb5237e885df72f6c37532fc8af9573966e7b07e5 (patch)
treefdfd4da299cc2779f35fcc30e770b85b9e710166 /src/core/loader/3dsx.cpp
parentLoader: Initialize the default NCCH values in the class declaration, not in t... (diff)
downloadyuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.tar.gz
yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.tar.xz
yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.zip
Loader: Keep a reference to the file and pass it to the correct AppLoader, instead of loading it multiple times.
Diffstat (limited to 'src/core/loader/3dsx.cpp')
-rw-r--r--src/core/loader/3dsx.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp
index 54ee992fc..873ee8b25 100644
--- a/src/core/loader/3dsx.cpp
+++ b/src/core/loader/3dsx.cpp
@@ -199,28 +199,15 @@ static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr)
199 return ERROR_NONE; 199 return ERROR_NONE;
200} 200}
201 201
202/// AppLoader_DSX constructor
203AppLoader_THREEDSX::AppLoader_THREEDSX(const std::string& filename) : filename(filename) {
204}
205
206/// AppLoader_DSX destructor
207AppLoader_THREEDSX::~AppLoader_THREEDSX() {
208}
209
210ResultStatus AppLoader_THREEDSX::Load() { 202ResultStatus AppLoader_THREEDSX::Load() {
211 LOG_INFO(Loader, "Loading 3DSX file %s...", filename.c_str());
212
213 if (is_loaded) 203 if (is_loaded)
214 return ResultStatus::ErrorAlreadyLoaded; 204 return ResultStatus::ErrorAlreadyLoaded;
215 205
216 FileUtil::IOFile file(filename, "rb"); 206 if (!file->IsOpen())
217
218 if (file.IsOpen()) {
219 Load3DSXFile(file, 0x00100000);
220 Kernel::LoadExec(0x00100000);
221 } else {
222 return ResultStatus::Error; 207 return ResultStatus::Error;
223 } 208
209 Load3DSXFile(*file, 0x00100000);
210 Kernel::LoadExec(0x00100000);
224 211
225 is_loaded = true; 212 is_loaded = true;
226 return ResultStatus::Success; 213 return ResultStatus::Success;