diff options
Diffstat (limited to 'src/core/loader')
| -rw-r--r-- | src/core/loader/3dsx.cpp | 12 | ||||
| -rw-r--r-- | src/core/loader/3dsx.h | 8 | ||||
| -rw-r--r-- | src/core/loader/elf.cpp | 14 | ||||
| -rw-r--r-- | src/core/loader/elf.h | 8 | ||||
| -rw-r--r-- | src/core/loader/loader.cpp | 39 | ||||
| -rw-r--r-- | src/core/loader/loader.h | 8 | ||||
| -rw-r--r-- | src/core/loader/ncch.cpp | 24 | ||||
| -rw-r--r-- | src/core/loader/ncch.h | 36 |
8 files changed, 100 insertions, 49 deletions
diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp index 5d806c5d0..15527c5a6 100644 --- a/src/core/loader/3dsx.cpp +++ b/src/core/loader/3dsx.cpp | |||
| @@ -8,9 +8,10 @@ | |||
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | 9 | ||
| 10 | #include "core/file_sys/archive_romfs.h" | 10 | #include "core/file_sys/archive_romfs.h" |
| 11 | #include "core/hle/kernel/process.h" | ||
| 12 | #include "core/hle/service/fs/archive.h" | ||
| 11 | #include "core/loader/elf.h" | 13 | #include "core/loader/elf.h" |
| 12 | #include "core/loader/ncch.h" | 14 | #include "core/loader/ncch.h" |
| 13 | #include "core/hle/service/fs/archive.h" | ||
| 14 | #include "core/mem_map.h" | 15 | #include "core/mem_map.h" |
| 15 | 16 | ||
| 16 | #include "3dsx.h" | 17 | #include "3dsx.h" |
| @@ -229,8 +230,13 @@ ResultStatus AppLoader_THREEDSX::Load() { | |||
| 229 | if (!file->IsOpen()) | 230 | if (!file->IsOpen()) |
| 230 | return ResultStatus::Error; | 231 | return ResultStatus::Error; |
| 231 | 232 | ||
| 232 | Load3DSXFile(*file, 0x00100000); | 233 | Kernel::g_current_process = Kernel::Process::Create(filename, 0); |
| 233 | Kernel::LoadExec(0x00100000); | 234 | Kernel::g_current_process->svc_access_mask.set(); |
| 235 | Kernel::g_current_process->address_mappings = default_address_mappings; | ||
| 236 | |||
| 237 | Load3DSXFile(*file, Memory::EXEFS_CODE_VADDR); | ||
| 238 | |||
| 239 | Kernel::g_current_process->Run(Memory::EXEFS_CODE_VADDR, 48, Kernel::DEFAULT_STACK_SIZE); | ||
| 234 | 240 | ||
| 235 | is_loaded = true; | 241 | is_loaded = true; |
| 236 | return ResultStatus::Success; | 242 | return ResultStatus::Success; |
diff --git a/src/core/loader/3dsx.h b/src/core/loader/3dsx.h index a11667400..096b3ec20 100644 --- a/src/core/loader/3dsx.h +++ b/src/core/loader/3dsx.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <string> | ||
| 8 | |||
| 7 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 8 | #include "core/loader/loader.h" | 10 | #include "core/loader/loader.h" |
| 9 | 11 | ||
| @@ -15,7 +17,8 @@ namespace Loader { | |||
| 15 | /// Loads an 3DSX file | 17 | /// Loads an 3DSX file |
| 16 | class AppLoader_THREEDSX final : public AppLoader { | 18 | class AppLoader_THREEDSX final : public AppLoader { |
| 17 | public: | 19 | public: |
| 18 | AppLoader_THREEDSX(std::unique_ptr<FileUtil::IOFile>&& file) : AppLoader(std::move(file)) { } | 20 | AppLoader_THREEDSX(std::unique_ptr<FileUtil::IOFile>&& file, std::string filename) |
| 21 | : AppLoader(std::move(file)), filename(std::move(filename)) {} | ||
| 19 | 22 | ||
| 20 | /** | 23 | /** |
| 21 | * Returns the type of the file | 24 | * Returns the type of the file |
| @@ -29,6 +32,9 @@ public: | |||
| 29 | * @return ResultStatus result of function | 32 | * @return ResultStatus result of function |
| 30 | */ | 33 | */ |
| 31 | ResultStatus Load() override; | 34 | ResultStatus Load() override; |
| 35 | |||
| 36 | private: | ||
| 37 | std::string filename; | ||
| 32 | }; | 38 | }; |
| 33 | 39 | ||
| 34 | } // namespace Loader | 40 | } // namespace Loader |
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 467e91924..f86a98b8c 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp | |||
| @@ -10,9 +10,9 @@ | |||
| 10 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 11 | #include "common/symbols.h" | 11 | #include "common/symbols.h" |
| 12 | 12 | ||
| 13 | #include "core/mem_map.h" | ||
| 14 | #include "core/loader/elf.h" | ||
| 15 | #include "core/hle/kernel/kernel.h" | 13 | #include "core/hle/kernel/kernel.h" |
| 14 | #include "core/loader/elf.h" | ||
| 15 | #include "core/mem_map.h" | ||
| 16 | 16 | ||
| 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 18 | // ELF Header Constants | 18 | // ELF Header Constants |
| @@ -350,9 +350,15 @@ ResultStatus AppLoader_ELF::Load() { | |||
| 350 | if (file->ReadBytes(&buffer[0], size) != size) | 350 | if (file->ReadBytes(&buffer[0], size) != size) |
| 351 | return ResultStatus::Error; | 351 | return ResultStatus::Error; |
| 352 | 352 | ||
| 353 | Kernel::g_current_process = Kernel::Process::Create(filename, 0); | ||
| 354 | Kernel::g_current_process->svc_access_mask.set(); | ||
| 355 | Kernel::g_current_process->address_mappings = default_address_mappings; | ||
| 356 | |||
| 353 | ElfReader elf_reader(&buffer[0]); | 357 | ElfReader elf_reader(&buffer[0]); |
| 354 | elf_reader.LoadInto(0x00100000); | 358 | elf_reader.LoadInto(Memory::EXEFS_CODE_VADDR); |
| 355 | Kernel::LoadExec(elf_reader.GetEntryPoint()); | 359 | // TODO: Fill application title |
| 360 | |||
| 361 | Kernel::g_current_process->Run(elf_reader.GetEntryPoint(), 48, Kernel::DEFAULT_STACK_SIZE); | ||
| 356 | 362 | ||
| 357 | is_loaded = true; | 363 | is_loaded = true; |
| 358 | return ResultStatus::Success; | 364 | return ResultStatus::Success; |
diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h index b6e6651f5..32841606a 100644 --- a/src/core/loader/elf.h +++ b/src/core/loader/elf.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <string> | ||
| 8 | |||
| 7 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 8 | #include "core/loader/loader.h" | 10 | #include "core/loader/loader.h" |
| 9 | 11 | ||
| @@ -15,7 +17,8 @@ namespace Loader { | |||
| 15 | /// Loads an ELF/AXF file | 17 | /// Loads an ELF/AXF file |
| 16 | class AppLoader_ELF final : public AppLoader { | 18 | class AppLoader_ELF final : public AppLoader { |
| 17 | public: | 19 | public: |
| 18 | AppLoader_ELF(std::unique_ptr<FileUtil::IOFile>&& file) : AppLoader(std::move(file)) { } | 20 | AppLoader_ELF(std::unique_ptr<FileUtil::IOFile>&& file, std::string filename) |
| 21 | : AppLoader(std::move(file)), filename(std::move(filename)) { } | ||
| 19 | 22 | ||
| 20 | /** | 23 | /** |
| 21 | * Returns the type of the file | 24 | * Returns the type of the file |
| @@ -29,6 +32,9 @@ public: | |||
| 29 | * @return ResultStatus result of function | 32 | * @return ResultStatus result of function |
| 30 | */ | 33 | */ |
| 31 | ResultStatus Load() override; | 34 | ResultStatus Load() override; |
| 35 | |||
| 36 | private: | ||
| 37 | std::string filename; | ||
| 32 | }; | 38 | }; |
| 33 | 39 | ||
| 34 | } // namespace Loader | 40 | } // namespace Loader |
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index de0ab540a..505e2d280 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -8,16 +8,23 @@ | |||
| 8 | #include "common/make_unique.h" | 8 | #include "common/make_unique.h" |
| 9 | 9 | ||
| 10 | #include "core/file_sys/archive_romfs.h" | 10 | #include "core/file_sys/archive_romfs.h" |
| 11 | #include "core/hle/kernel/process.h" | ||
| 12 | #include "core/hle/service/fs/archive.h" | ||
| 11 | #include "core/loader/3dsx.h" | 13 | #include "core/loader/3dsx.h" |
| 12 | #include "core/loader/elf.h" | 14 | #include "core/loader/elf.h" |
| 13 | #include "core/loader/ncch.h" | 15 | #include "core/loader/ncch.h" |
| 14 | #include "core/hle/service/fs/archive.h" | ||
| 15 | #include "core/mem_map.h" | 16 | #include "core/mem_map.h" |
| 16 | 17 | ||
| 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 18 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 18 | 19 | ||
| 19 | namespace Loader { | 20 | namespace Loader { |
| 20 | 21 | ||
| 22 | const std::initializer_list<Kernel::AddressMapping> default_address_mappings = { | ||
| 23 | { 0x1FF50000, 0x8000, true }, // part of DSP RAM | ||
| 24 | { 0x1FF70000, 0x8000, true }, // part of DSP RAM | ||
| 25 | { 0x1F000000, 0x600000, false }, // entire VRAM | ||
| 26 | }; | ||
| 27 | |||
| 21 | /** | 28 | /** |
| 22 | * Identifies the type of a bootable file | 29 | * Identifies the type of a bootable file |
| 23 | * @param file open file | 30 | * @param file open file |
| @@ -42,19 +49,11 @@ static FileType IdentifyFile(FileUtil::IOFile& file) { | |||
| 42 | 49 | ||
| 43 | /** | 50 | /** |
| 44 | * Guess the type of a bootable file from its extension | 51 | * Guess the type of a bootable file from its extension |
| 45 | * @param filename String filename of bootable file | 52 | * @param extension String extension of bootable file |
| 46 | * @return FileType of file | 53 | * @return FileType of file |
| 47 | */ | 54 | */ |
| 48 | static FileType GuessFromFilename(const std::string& filename) { | 55 | static FileType GuessFromExtension(const std::string& extension_) { |
| 49 | if (filename.size() == 0) { | 56 | std::string extension = Common::ToLower(extension_); |
| 50 | LOG_ERROR(Loader, "invalid filename %s", filename.c_str()); | ||
| 51 | return FileType::Error; | ||
| 52 | } | ||
| 53 | |||
| 54 | size_t extension_loc = filename.find_last_of('.'); | ||
| 55 | if (extension_loc == std::string::npos) | ||
| 56 | return FileType::Unknown; | ||
| 57 | std::string extension = Common::ToLower(filename.substr(extension_loc)); | ||
| 58 | 57 | ||
| 59 | if (extension == ".elf") | 58 | if (extension == ".elf") |
| 60 | return FileType::ELF; | 59 | return FileType::ELF; |
| @@ -100,8 +99,11 @@ ResultStatus LoadFile(const std::string& filename) { | |||
| 100 | return ResultStatus::Error; | 99 | return ResultStatus::Error; |
| 101 | } | 100 | } |
| 102 | 101 | ||
| 102 | std::string filename_filename, filename_extension; | ||
| 103 | Common::SplitPath(filename, nullptr, &filename_filename, &filename_extension); | ||
| 104 | |||
| 103 | FileType type = IdentifyFile(*file); | 105 | FileType type = IdentifyFile(*file); |
| 104 | FileType filename_type = GuessFromFilename(filename); | 106 | FileType filename_type = GuessFromExtension(filename_extension); |
| 105 | 107 | ||
| 106 | if (type != filename_type) { | 108 | if (type != filename_type) { |
| 107 | LOG_WARNING(Loader, "File %s has a different type than its extension.", filename.c_str()); | 109 | LOG_WARNING(Loader, "File %s has a different type than its extension.", filename.c_str()); |
| @@ -115,11 +117,11 @@ ResultStatus LoadFile(const std::string& filename) { | |||
| 115 | 117 | ||
| 116 | //3DSX file format... | 118 | //3DSX file format... |
| 117 | case FileType::THREEDSX: | 119 | case FileType::THREEDSX: |
| 118 | return AppLoader_THREEDSX(std::move(file)).Load(); | 120 | return AppLoader_THREEDSX(std::move(file), filename_filename).Load(); |
| 119 | 121 | ||
| 120 | // Standard ELF file format... | 122 | // Standard ELF file format... |
| 121 | case FileType::ELF: | 123 | case FileType::ELF: |
| 122 | return AppLoader_ELF(std::move(file)).Load(); | 124 | return AppLoader_ELF(std::move(file), filename_filename).Load(); |
| 123 | 125 | ||
| 124 | // NCCH/NCSD container formats... | 126 | // NCCH/NCSD container formats... |
| 125 | case FileType::CXI: | 127 | case FileType::CXI: |
| @@ -129,7 +131,6 @@ ResultStatus LoadFile(const std::string& filename) { | |||
| 129 | 131 | ||
| 130 | // Load application and RomFS | 132 | // Load application and RomFS |
| 131 | if (ResultStatus::Success == app_loader.Load()) { | 133 | if (ResultStatus::Success == app_loader.Load()) { |
| 132 | Kernel::g_program_id = app_loader.GetProgramId(); | ||
| 133 | Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS); | 134 | Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS); |
| 134 | return ResultStatus::Success; | 135 | return ResultStatus::Success; |
| 135 | } | 136 | } |
| @@ -139,11 +140,15 @@ ResultStatus LoadFile(const std::string& filename) { | |||
| 139 | // Raw BIN file format... | 140 | // Raw BIN file format... |
| 140 | case FileType::BIN: | 141 | case FileType::BIN: |
| 141 | { | 142 | { |
| 143 | Kernel::g_current_process = Kernel::Process::Create(filename_filename, 0); | ||
| 144 | Kernel::g_current_process->svc_access_mask.set(); | ||
| 145 | Kernel::g_current_process->address_mappings = default_address_mappings; | ||
| 146 | |||
| 142 | size_t size = (size_t)file->GetSize(); | 147 | size_t size = (size_t)file->GetSize(); |
| 143 | if (file->ReadBytes(Memory::GetPointer(Memory::EXEFS_CODE_VADDR), size) != size) | 148 | if (file->ReadBytes(Memory::GetPointer(Memory::EXEFS_CODE_VADDR), size) != size) |
| 144 | return ResultStatus::Error; | 149 | return ResultStatus::Error; |
| 145 | 150 | ||
| 146 | Kernel::LoadExec(Memory::EXEFS_CODE_VADDR); | 151 | Kernel::g_current_process->Run(Memory::EXEFS_CODE_VADDR, 0x30, Kernel::DEFAULT_STACK_SIZE); |
| 147 | return ResultStatus::Success; | 152 | return ResultStatus::Success; |
| 148 | } | 153 | } |
| 149 | 154 | ||
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 2b87239cf..a56f67205 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/file_util.h" | 10 | #include "common/file_util.h" |
| 11 | 11 | ||
| 12 | #include "core/hle/kernel/process.h" | ||
| 13 | |||
| 12 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 14 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 13 | // Loader namespace | 15 | // Loader namespace |
| 14 | 16 | ||
| @@ -105,6 +107,12 @@ protected: | |||
| 105 | }; | 107 | }; |
| 106 | 108 | ||
| 107 | /** | 109 | /** |
| 110 | * Common address mappings found in most games, used for binary formats that don't have this | ||
| 111 | * information. | ||
| 112 | */ | ||
| 113 | extern const std::initializer_list<Kernel::AddressMapping> default_address_mappings; | ||
| 114 | |||
| 115 | /** | ||
| 108 | * Identifies and loads a bootable file | 116 | * Identifies and loads a bootable file |
| 109 | * @param filename String filename of bootable file | 117 | * @param filename String filename of bootable file |
| 110 | * @return ResultStatus result of function | 118 | * @return ResultStatus result of function |
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 9bce2b79d..0e2db2fbb 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp | |||
| @@ -5,9 +5,12 @@ | |||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | 6 | ||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "common/make_unique.h" | ||
| 9 | #include "common/string_util.h" | ||
| 10 | #include "common/swap.h" | ||
| 8 | 11 | ||
| 9 | #include "core/loader/ncch.h" | ||
| 10 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/kernel.h" |
| 13 | #include "core/loader/ncch.h" | ||
| 11 | #include "core/mem_map.h" | 14 | #include "core/mem_map.h" |
| 12 | 15 | ||
| 13 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 16 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -117,8 +120,21 @@ ResultStatus AppLoader_NCCH::LoadExec() const { | |||
| 117 | 120 | ||
| 118 | std::vector<u8> code; | 121 | std::vector<u8> code; |
| 119 | if (ResultStatus::Success == ReadCode(code)) { | 122 | if (ResultStatus::Success == ReadCode(code)) { |
| 123 | std::string process_name = Common::StringFromFixedZeroTerminatedBuffer( | ||
| 124 | (const char*)exheader_header.codeset_info.name, 8); | ||
| 125 | u64 program_id = *reinterpret_cast<u64_le const*>(&ncch_header.program_id[0]); | ||
| 126 | Kernel::g_current_process = Kernel::Process::Create(process_name, program_id); | ||
| 127 | |||
| 128 | // Copy data while converting endianess | ||
| 129 | std::array<u32, ARRAY_SIZE(exheader_header.arm11_kernel_caps.descriptors)> kernel_caps; | ||
| 130 | std::copy_n(exheader_header.arm11_kernel_caps.descriptors, kernel_caps.size(), begin(kernel_caps)); | ||
| 131 | Kernel::g_current_process->ParseKernelCaps(kernel_caps.data(), kernel_caps.size()); | ||
| 132 | |||
| 120 | Memory::WriteBlock(entry_point, &code[0], code.size()); | 133 | Memory::WriteBlock(entry_point, &code[0], code.size()); |
| 121 | Kernel::LoadExec(entry_point); | 134 | |
| 135 | s32 priority = exheader_header.arm11_system_local_caps.priority; | ||
| 136 | u32 stack_size = exheader_header.codeset_info.stack_size; | ||
| 137 | Kernel::g_current_process->Run(entry_point, priority, stack_size); | ||
| 122 | return ResultStatus::Success; | 138 | return ResultStatus::Success; |
| 123 | } | 139 | } |
| 124 | return ResultStatus::Error; | 140 | return ResultStatus::Error; |
| @@ -277,8 +293,4 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector<u8>& buffer) const { | |||
| 277 | return ResultStatus::ErrorNotUsed; | 293 | return ResultStatus::ErrorNotUsed; |
| 278 | } | 294 | } |
| 279 | 295 | ||
| 280 | u64 AppLoader_NCCH::GetProgramId() const { | ||
| 281 | return *reinterpret_cast<u64 const*>(&ncch_header.program_id[0]); | ||
| 282 | } | ||
| 283 | |||
| 284 | } // namespace Loader | 296 | } // namespace Loader |
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 44c72a4e2..29e39d2c0 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h | |||
| @@ -6,7 +6,9 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | 8 | ||
| 9 | #include "common/bit_field.h" | ||
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/swap.h" | ||
| 10 | 12 | ||
| 11 | #include "core/loader/loader.h" | 13 | #include "core/loader/loader.h" |
| 12 | 14 | ||
| @@ -65,13 +67,13 @@ struct ExeFs_Header { | |||
| 65 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 67 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 66 | // ExHeader (executable file system header) headers | 68 | // ExHeader (executable file system header) headers |
| 67 | 69 | ||
| 68 | struct ExHeader_SystemInfoFlags{ | 70 | struct ExHeader_SystemInfoFlags { |
| 69 | u8 reserved[5]; | 71 | u8 reserved[5]; |
| 70 | u8 flag; | 72 | u8 flag; |
| 71 | u8 remaster_version[2]; | 73 | u8 remaster_version[2]; |
| 72 | }; | 74 | }; |
| 73 | 75 | ||
| 74 | struct ExHeader_CodeSegmentInfo{ | 76 | struct ExHeader_CodeSegmentInfo { |
| 75 | u32 address; | 77 | u32 address; |
| 76 | u32 num_max_pages; | 78 | u32 num_max_pages; |
| 77 | u32 code_size; | 79 | u32 code_size; |
| @@ -88,17 +90,17 @@ struct ExHeader_CodeSetInfo { | |||
| 88 | u32 bss_size; | 90 | u32 bss_size; |
| 89 | }; | 91 | }; |
| 90 | 92 | ||
| 91 | struct ExHeader_DependencyList{ | 93 | struct ExHeader_DependencyList { |
| 92 | u8 program_id[0x30][8]; | 94 | u8 program_id[0x30][8]; |
| 93 | }; | 95 | }; |
| 94 | 96 | ||
| 95 | struct ExHeader_SystemInfo{ | 97 | struct ExHeader_SystemInfo { |
| 96 | u64 save_data_size; | 98 | u64 save_data_size; |
| 97 | u8 jump_id[8]; | 99 | u8 jump_id[8]; |
| 98 | u8 reserved_2[0x30]; | 100 | u8 reserved_2[0x30]; |
| 99 | }; | 101 | }; |
| 100 | 102 | ||
| 101 | struct ExHeader_StorageInfo{ | 103 | struct ExHeader_StorageInfo { |
| 102 | u8 ext_save_data_id[8]; | 104 | u8 ext_save_data_id[8]; |
| 103 | u8 system_save_data_id[8]; | 105 | u8 system_save_data_id[8]; |
| 104 | u8 reserved[8]; | 106 | u8 reserved[8]; |
| @@ -106,10 +108,16 @@ struct ExHeader_StorageInfo{ | |||
| 106 | u8 other_attributes; | 108 | u8 other_attributes; |
| 107 | }; | 109 | }; |
| 108 | 110 | ||
| 109 | struct ExHeader_ARM11_SystemLocalCaps{ | 111 | struct ExHeader_ARM11_SystemLocalCaps { |
| 110 | u8 program_id[8]; | 112 | u8 program_id[8]; |
| 111 | u32 core_version; | 113 | u32 core_version; |
| 112 | u8 flags[3]; | 114 | u8 reserved_flags[2]; |
| 115 | union { | ||
| 116 | u8 flags0; | ||
| 117 | BitField<0, 2, u8> ideal_processor; | ||
| 118 | BitField<2, 2, u8> affinity_mask; | ||
| 119 | BitField<4, 4, u8> system_mode; | ||
| 120 | }; | ||
| 113 | u8 priority; | 121 | u8 priority; |
| 114 | u8 resource_limit_descriptor[0x10][2]; | 122 | u8 resource_limit_descriptor[0x10][2]; |
| 115 | ExHeader_StorageInfo storage_info; | 123 | ExHeader_StorageInfo storage_info; |
| @@ -119,17 +127,17 @@ struct ExHeader_ARM11_SystemLocalCaps{ | |||
| 119 | u8 resource_limit_category; | 127 | u8 resource_limit_category; |
| 120 | }; | 128 | }; |
| 121 | 129 | ||
| 122 | struct ExHeader_ARM11_KernelCaps{ | 130 | struct ExHeader_ARM11_KernelCaps { |
| 123 | u8 descriptors[28][4]; | 131 | u32_le descriptors[28]; |
| 124 | u8 reserved[0x10]; | 132 | u8 reserved[0x10]; |
| 125 | }; | 133 | }; |
| 126 | 134 | ||
| 127 | struct ExHeader_ARM9_AccessControl{ | 135 | struct ExHeader_ARM9_AccessControl { |
| 128 | u8 descriptors[15]; | 136 | u8 descriptors[15]; |
| 129 | u8 descversion; | 137 | u8 descversion; |
| 130 | }; | 138 | }; |
| 131 | 139 | ||
| 132 | struct ExHeader_Header{ | 140 | struct ExHeader_Header { |
| 133 | ExHeader_CodeSetInfo codeset_info; | 141 | ExHeader_CodeSetInfo codeset_info; |
| 134 | ExHeader_DependencyList dependency_list; | 142 | ExHeader_DependencyList dependency_list; |
| 135 | ExHeader_SystemInfo system_info; | 143 | ExHeader_SystemInfo system_info; |
| @@ -205,12 +213,6 @@ public: | |||
| 205 | */ | 213 | */ |
| 206 | ResultStatus ReadRomFS(std::vector<u8>& buffer) const override; | 214 | ResultStatus ReadRomFS(std::vector<u8>& buffer) const override; |
| 207 | 215 | ||
| 208 | /* | ||
| 209 | * Gets the program id from the NCCH header | ||
| 210 | * @return u64 Program id | ||
| 211 | */ | ||
| 212 | u64 GetProgramId() const; | ||
| 213 | |||
| 214 | private: | 216 | private: |
| 215 | 217 | ||
| 216 | /** | 218 | /** |