summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/kernel_executable.cpp2
-rw-r--r--src/core/file_sys/program_metadata.cpp6
-rw-r--r--src/core/file_sys/program_metadata.h4
-rw-r--r--src/core/file_sys/romfs_factory.cpp4
-rw-r--r--src/core/file_sys/savedata_factory.cpp4
-rw-r--r--src/core/file_sys/vfs_libzip.cpp2
-rw-r--r--src/core/file_sys/xts_archive.cpp12
7 files changed, 16 insertions, 18 deletions
diff --git a/src/core/file_sys/kernel_executable.cpp b/src/core/file_sys/kernel_executable.cpp
index 371300684..76313679d 100644
--- a/src/core/file_sys/kernel_executable.cpp
+++ b/src/core/file_sys/kernel_executable.cpp
@@ -147,7 +147,7 @@ std::vector<u32> KIP::GetKernelCapabilities() const {
147} 147}
148 148
149s32 KIP::GetMainThreadPriority() const { 149s32 KIP::GetMainThreadPriority() const {
150 return header.main_thread_priority; 150 return static_cast<s32>(header.main_thread_priority);
151} 151}
152 152
153u32 KIP::GetMainThreadStackSize() const { 153u32 KIP::GetMainThreadStackSize() const {
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp
index 7310b3602..1d6c30962 100644
--- a/src/core/file_sys/program_metadata.cpp
+++ b/src/core/file_sys/program_metadata.cpp
@@ -52,14 +52,14 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) {
52} 52}
53 53
54void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space, 54void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space,
55 u8 main_thread_prio, u8 main_thread_core, 55 s32 main_thread_prio, u32 main_thread_core,
56 u32 main_thread_stack_size, u64 title_id, 56 u32 main_thread_stack_size, u64 title_id,
57 u64 filesystem_permissions, 57 u64 filesystem_permissions,
58 KernelCapabilityDescriptors capabilities) { 58 KernelCapabilityDescriptors capabilities) {
59 npdm_header.has_64_bit_instructions.Assign(is_64_bit); 59 npdm_header.has_64_bit_instructions.Assign(is_64_bit);
60 npdm_header.address_space_type.Assign(address_space); 60 npdm_header.address_space_type.Assign(address_space);
61 npdm_header.main_thread_priority = main_thread_prio; 61 npdm_header.main_thread_priority = static_cast<u8>(main_thread_prio);
62 npdm_header.main_thread_cpu = main_thread_core; 62 npdm_header.main_thread_cpu = static_cast<u8>(main_thread_core);
63 npdm_header.main_stack_size = main_thread_stack_size; 63 npdm_header.main_stack_size = main_thread_stack_size;
64 aci_header.title_id = title_id; 64 aci_header.title_id = title_id;
65 aci_file_access.permissions = filesystem_permissions; 65 aci_file_access.permissions = filesystem_permissions;
diff --git a/src/core/file_sys/program_metadata.h b/src/core/file_sys/program_metadata.h
index 88ec97d85..f8759a396 100644
--- a/src/core/file_sys/program_metadata.h
+++ b/src/core/file_sys/program_metadata.h
@@ -47,8 +47,8 @@ public:
47 Loader::ResultStatus Load(VirtualFile file); 47 Loader::ResultStatus Load(VirtualFile file);
48 48
49 // Load from parameters instead of NPDM file, used for KIP 49 // Load from parameters instead of NPDM file, used for KIP
50 void LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space, u8 main_thread_prio, 50 void LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space, s32 main_thread_prio,
51 u8 main_thread_core, u32 main_thread_stack_size, u64 title_id, 51 u32 main_thread_core, u32 main_thread_stack_size, u64 title_id,
52 u64 filesystem_permissions, KernelCapabilityDescriptors capabilities); 52 u64 filesystem_permissions, KernelCapabilityDescriptors capabilities);
53 53
54 bool Is64BitProgram() const; 54 bool Is64BitProgram() const;
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
index 4bd2e6183..418a39a7e 100644
--- a/src/core/file_sys/romfs_factory.cpp
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -71,12 +71,12 @@ ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage,
71 71
72 if (res == nullptr) { 72 if (res == nullptr) {
73 // TODO(DarkLordZach): Find the right error code to use here 73 // TODO(DarkLordZach): Find the right error code to use here
74 return ResultCode(-1); 74 return RESULT_UNKNOWN;
75 } 75 }
76 const auto romfs = res->GetRomFS(); 76 const auto romfs = res->GetRomFS();
77 if (romfs == nullptr) { 77 if (romfs == nullptr) {
78 // TODO(DarkLordZach): Find the right error code to use here 78 // TODO(DarkLordZach): Find the right error code to use here
79 return ResultCode(-1); 79 return RESULT_UNKNOWN;
80 } 80 }
81 return MakeResult<VirtualFile>(romfs); 81 return MakeResult<VirtualFile>(romfs);
82} 82}
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp
index e2a7eaf7b..f3def93ab 100644
--- a/src/core/file_sys/savedata_factory.cpp
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -90,7 +90,7 @@ ResultVal<VirtualDir> SaveDataFactory::Create(SaveDataSpaceId space,
90 // Return an error if the save data doesn't actually exist. 90 // Return an error if the save data doesn't actually exist.
91 if (out == nullptr) { 91 if (out == nullptr) {
92 // TODO(DarkLordZach): Find out correct error code. 92 // TODO(DarkLordZach): Find out correct error code.
93 return ResultCode(-1); 93 return RESULT_UNKNOWN;
94 } 94 }
95 95
96 return MakeResult<VirtualDir>(std::move(out)); 96 return MakeResult<VirtualDir>(std::move(out));
@@ -111,7 +111,7 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space,
111 // Return an error if the save data doesn't actually exist. 111 // Return an error if the save data doesn't actually exist.
112 if (out == nullptr) { 112 if (out == nullptr) {
113 // TODO(Subv): Find out correct error code. 113 // TODO(Subv): Find out correct error code.
114 return ResultCode(-1); 114 return RESULT_UNKNOWN;
115 } 115 }
116 116
117 return MakeResult<VirtualDir>(std::move(out)); 117 return MakeResult<VirtualDir>(std::move(out));
diff --git a/src/core/file_sys/vfs_libzip.cpp b/src/core/file_sys/vfs_libzip.cpp
index 8bdaa7e4a..11d1978ea 100644
--- a/src/core/file_sys/vfs_libzip.cpp
+++ b/src/core/file_sys/vfs_libzip.cpp
@@ -27,7 +27,7 @@ VirtualDir ExtractZIP(VirtualFile file) {
27 27
28 std::shared_ptr<VectorVfsDirectory> out = std::make_shared<VectorVfsDirectory>(); 28 std::shared_ptr<VectorVfsDirectory> out = std::make_shared<VectorVfsDirectory>();
29 29
30 const auto num_entries = zip_get_num_entries(zip.get(), 0); 30 const auto num_entries = static_cast<std::size_t>(zip_get_num_entries(zip.get(), 0));
31 31
32 zip_stat_t stat{}; 32 zip_stat_t stat{};
33 zip_stat_init(&stat); 33 zip_stat_init(&stat);
diff --git a/src/core/file_sys/xts_archive.cpp b/src/core/file_sys/xts_archive.cpp
index 7ca375791..86e06ccb9 100644
--- a/src/core/file_sys/xts_archive.cpp
+++ b/src/core/file_sys/xts_archive.cpp
@@ -7,12 +7,13 @@
7#include <cstring> 7#include <cstring>
8#include <regex> 8#include <regex>
9#include <string> 9#include <string>
10
10#include <mbedtls/md.h> 11#include <mbedtls/md.h>
11#include <mbedtls/sha256.h> 12#include <mbedtls/sha256.h>
12#include "common/assert.h" 13
13#include "common/file_util.h" 14#include "common/file_util.h"
14#include "common/hex_util.h" 15#include "common/hex_util.h"
15#include "common/logging/log.h" 16#include "common/string_util.h"
16#include "core/crypto/aes_util.h" 17#include "core/crypto/aes_util.h"
17#include "core/crypto/xts_encryption_layer.h" 18#include "core/crypto/xts_encryption_layer.h"
18#include "core/file_sys/partition_filesystem.h" 19#include "core/file_sys/partition_filesystem.h"
@@ -53,11 +54,8 @@ NAX::NAX(VirtualFile file_) : header(std::make_unique<NAXHeader>()), file(std::m
53 return; 54 return;
54 } 55 }
55 56
56 std::string two_dir = match[1]; 57 const std::string two_dir = Common::ToUpper(match[1]);
57 std::string nca_id = match[2]; 58 const std::string nca_id = Common::ToLower(match[2]);
58 std::transform(two_dir.begin(), two_dir.end(), two_dir.begin(), ::toupper);
59 std::transform(nca_id.begin(), nca_id.end(), nca_id.begin(), ::tolower);
60
61 status = Parse(fmt::format("/registered/{}/{}.nca", two_dir, nca_id)); 59 status = Parse(fmt::format("/registered/{}/{}.nca", two_dir, nca_id));
62} 60}
63 61