diff options
| author | 2014-12-12 23:20:01 -0500 | |
|---|---|---|
| committer | 2014-12-12 23:20:01 -0500 | |
| commit | af1cd769e7b407af71496e788e218add31f8b2b0 (patch) | |
| tree | 1e3fd71256c04a15970b09abd3f7280f8b1ff678 /src/core/loader/ncch.cpp | |
| parent | Merge pull request #267 from bunnei/apt-shared-font (diff) | |
| parent | Remove old logging system (diff) | |
| download | yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.gz yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.xz yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.zip | |
Merge pull request #258 from yuriks/log-ng
New logging system
Diffstat (limited to 'src/core/loader/ncch.cpp')
| -rw-r--r-- | src/core/loader/ncch.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 343bb7523..ba9ba00c0 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp | |||
| @@ -140,13 +140,13 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>& | |||
| 140 | // Iterate through the ExeFs archive until we find the .code file... | 140 | // Iterate through the ExeFs archive until we find the .code file... |
| 141 | FileUtil::IOFile file(filename, "rb"); | 141 | FileUtil::IOFile file(filename, "rb"); |
| 142 | if (file.IsOpen()) { | 142 | if (file.IsOpen()) { |
| 143 | LOG_DEBUG(Loader, "%d sections:", kMaxSections); | ||
| 143 | for (int i = 0; i < kMaxSections; i++) { | 144 | for (int i = 0; i < kMaxSections; i++) { |
| 144 | // Load the specified section... | 145 | // Load the specified section... |
| 145 | if (strcmp((const char*)exefs_header.section[i].name, name) == 0) { | 146 | if (strcmp((const char*)exefs_header.section[i].name, name) == 0) { |
| 146 | INFO_LOG(LOADER, "ExeFS section %d:", i); | 147 | LOG_DEBUG(Loader, "%d - offset: 0x%08X, size: 0x%08X, name: %s", i, |
| 147 | INFO_LOG(LOADER, " name: %s", exefs_header.section[i].name); | 148 | exefs_header.section[i].offset, exefs_header.section[i].size, |
| 148 | INFO_LOG(LOADER, " offset: 0x%08X", exefs_header.section[i].offset); | 149 | exefs_header.section[i].name); |
| 149 | INFO_LOG(LOADER, " size: 0x%08X", exefs_header.section[i].size); | ||
| 150 | 150 | ||
| 151 | s64 section_offset = (exefs_header.section[i].offset + exefs_offset + | 151 | s64 section_offset = (exefs_header.section[i].offset + exefs_offset + |
| 152 | sizeof(ExeFs_Header)+ncch_offset); | 152 | sizeof(ExeFs_Header)+ncch_offset); |
| @@ -181,7 +181,7 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>& | |||
| 181 | } | 181 | } |
| 182 | } | 182 | } |
| 183 | } else { | 183 | } else { |
| 184 | ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); | 184 | LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str()); |
| 185 | return ResultStatus::Error; | 185 | return ResultStatus::Error; |
| 186 | } | 186 | } |
| 187 | return ResultStatus::ErrorNotUsed; | 187 | return ResultStatus::ErrorNotUsed; |
| @@ -194,7 +194,7 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>& | |||
| 194 | * @return True on success, otherwise false | 194 | * @return True on success, otherwise false |
| 195 | */ | 195 | */ |
| 196 | ResultStatus AppLoader_NCCH::Load() { | 196 | ResultStatus AppLoader_NCCH::Load() { |
| 197 | INFO_LOG(LOADER, "Loading NCCH file %s...", filename.c_str()); | 197 | LOG_INFO(Loader, "Loading NCCH file %s...", filename.c_str()); |
| 198 | 198 | ||
| 199 | if (is_loaded) | 199 | if (is_loaded) |
| 200 | return ResultStatus::ErrorAlreadyLoaded; | 200 | return ResultStatus::ErrorAlreadyLoaded; |
| @@ -205,7 +205,7 @@ ResultStatus AppLoader_NCCH::Load() { | |||
| 205 | 205 | ||
| 206 | // Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)... | 206 | // Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)... |
| 207 | if (0 == memcmp(&ncch_header.magic, "NCSD", 4)) { | 207 | if (0 == memcmp(&ncch_header.magic, "NCSD", 4)) { |
| 208 | WARN_LOG(LOADER, "Only loading the first (bootable) NCCH within the NCSD file!"); | 208 | LOG_WARNING(Loader, "Only loading the first (bootable) NCCH within the NCSD file!"); |
| 209 | ncch_offset = 0x4000; | 209 | ncch_offset = 0x4000; |
| 210 | file.Seek(ncch_offset, 0); | 210 | file.Seek(ncch_offset, 0); |
| 211 | file.ReadBytes(&ncch_header, sizeof(NCCH_Header)); | 211 | file.ReadBytes(&ncch_header, sizeof(NCCH_Header)); |
| @@ -222,17 +222,17 @@ ResultStatus AppLoader_NCCH::Load() { | |||
| 222 | is_compressed = (exheader_header.codeset_info.flags.flag & 1) == 1; | 222 | is_compressed = (exheader_header.codeset_info.flags.flag & 1) == 1; |
| 223 | entry_point = exheader_header.codeset_info.text.address; | 223 | entry_point = exheader_header.codeset_info.text.address; |
| 224 | 224 | ||
| 225 | INFO_LOG(LOADER, "Name: %s", exheader_header.codeset_info.name); | 225 | LOG_INFO(Loader, "Name: %s", exheader_header.codeset_info.name); |
| 226 | INFO_LOG(LOADER, "Code compressed: %s", is_compressed ? "yes" : "no"); | 226 | LOG_DEBUG(Loader, "Code compressed: %s", is_compressed ? "yes" : "no"); |
| 227 | INFO_LOG(LOADER, "Entry point: 0x%08X", entry_point); | 227 | LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point); |
| 228 | 228 | ||
| 229 | // Read ExeFS... | 229 | // Read ExeFS... |
| 230 | 230 | ||
| 231 | exefs_offset = ncch_header.exefs_offset * kBlockSize; | 231 | exefs_offset = ncch_header.exefs_offset * kBlockSize; |
| 232 | u32 exefs_size = ncch_header.exefs_size * kBlockSize; | 232 | u32 exefs_size = ncch_header.exefs_size * kBlockSize; |
| 233 | 233 | ||
| 234 | INFO_LOG(LOADER, "ExeFS offset: 0x%08X", exefs_offset); | 234 | LOG_DEBUG(Loader, "ExeFS offset: 0x%08X", exefs_offset); |
| 235 | INFO_LOG(LOADER, "ExeFS size: 0x%08X", exefs_size); | 235 | LOG_DEBUG(Loader, "ExeFS size: 0x%08X", exefs_size); |
| 236 | 236 | ||
| 237 | file.Seek(exefs_offset + ncch_offset, 0); | 237 | file.Seek(exefs_offset + ncch_offset, 0); |
| 238 | file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)); | 238 | file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)); |
| @@ -243,7 +243,7 @@ ResultStatus AppLoader_NCCH::Load() { | |||
| 243 | 243 | ||
| 244 | return ResultStatus::Success; | 244 | return ResultStatus::Success; |
| 245 | } else { | 245 | } else { |
| 246 | ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); | 246 | LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str()); |
| 247 | } | 247 | } |
| 248 | return ResultStatus::Error; | 248 | return ResultStatus::Error; |
| 249 | } | 249 | } |
| @@ -297,8 +297,8 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector<u8>& buffer) const { | |||
| 297 | u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000; | 297 | u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000; |
| 298 | u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000; | 298 | u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000; |
| 299 | 299 | ||
| 300 | INFO_LOG(LOADER, "RomFS offset: 0x%08X", romfs_offset); | 300 | LOG_DEBUG(Loader, "RomFS offset: 0x%08X", romfs_offset); |
| 301 | INFO_LOG(LOADER, "RomFS size: 0x%08X", romfs_size); | 301 | LOG_DEBUG(Loader, "RomFS size: 0x%08X", romfs_size); |
| 302 | 302 | ||
| 303 | buffer.resize(romfs_size); | 303 | buffer.resize(romfs_size); |
| 304 | 304 | ||
| @@ -307,10 +307,10 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector<u8>& buffer) const { | |||
| 307 | 307 | ||
| 308 | return ResultStatus::Success; | 308 | return ResultStatus::Success; |
| 309 | } | 309 | } |
| 310 | NOTICE_LOG(LOADER, "RomFS unused"); | 310 | LOG_DEBUG(Loader, "NCCH has no RomFS"); |
| 311 | return ResultStatus::ErrorNotUsed; | 311 | return ResultStatus::ErrorNotUsed; |
| 312 | } else { | 312 | } else { |
| 313 | ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); | 313 | LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str()); |
| 314 | } | 314 | } |
| 315 | return ResultStatus::Error; | 315 | return ResultStatus::Error; |
| 316 | } | 316 | } |