Chore: Enable warnings as errors on MSVC (#6456)
* tests: add Sanity test for SplitFilename83 fix test fix test * disable `C4715:not all control paths return a value` for nihstro includes nihstro: no warn * Chore: Enable warnings as errors on msvc + fix warnings fixes some more warnings clang-format * more fixes * Externals: Add target_compile_options `/W0` nihstro-headers and ... Revert "disable `C4715:not all control paths return a value` for nihstro includes" This reverts commit 606d79b55d3044b744fb835025b8eb0f4ea5b757. * src\citra\config.cpp: ReadSetting: simplify type casting * settings.cpp: Get*Name: remove superflous logs
This commit is contained in:
parent
055a58f01e
commit
41f13456c0
71 changed files with 397 additions and 294 deletions
|
@ -28,8 +28,9 @@ constexpr u32 DepositBits(u32 val) {
|
|||
u32 mask = mask_;
|
||||
u32 res = 0;
|
||||
for (u32 bb = 1; mask; bb += bb) {
|
||||
u32 neg_mask = 0 - mask;
|
||||
if (val & bb)
|
||||
res |= mask & -mask;
|
||||
res |= mask & neg_mask;
|
||||
mask &= mask - 1;
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -242,10 +242,6 @@ public:
|
|||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
MoveEvents();
|
||||
// NOTE: ts_queue should be empty now
|
||||
// TODO(SaveState): Remove the next two lines when we break compatibility
|
||||
s64 x;
|
||||
ar& x; // to keep compatibility with old save states that stored global_timer
|
||||
ar& event_queue;
|
||||
ar& event_fifo_id;
|
||||
ar& slice_length;
|
||||
|
|
|
@ -383,7 +383,7 @@ void FFmpegAudioStream::ProcessFrame(const VariableAudioFrame& channel0,
|
|||
LOG_ERROR(Render, "Audio frame dropped: Could not resample data");
|
||||
return;
|
||||
}
|
||||
if (static_cast<u64>(resampled_count) < frame_size) {
|
||||
if (resampled_count < frame_size) {
|
||||
offset = resampled_count;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -118,14 +118,14 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
u64 frame_size{};
|
||||
int frame_size{};
|
||||
u64 frame_count{};
|
||||
|
||||
std::unique_ptr<AVFrame, AVFrameDeleter> audio_frame{};
|
||||
std::unique_ptr<SwrContext, SwrContextDeleter> swr_context{};
|
||||
|
||||
u8** resampled_data{};
|
||||
u64 offset{}; // Number of output samples that are currently in resampled_data.
|
||||
int offset{}; // Number of output samples that are currently in resampled_data.
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,6 +85,7 @@ std::u16string Path::AsU16Str() const {
|
|||
return {};
|
||||
case LowPathType::Invalid:
|
||||
case LowPathType::Binary:
|
||||
default:
|
||||
// TODO(yuriks): Add assert
|
||||
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
|
||||
return {};
|
||||
|
|
|
@ -144,45 +144,45 @@ void LayeredFS::LoadRelocations() {
|
|||
return;
|
||||
}
|
||||
|
||||
const FileUtil::DirectoryEntryCallable callback = [this,
|
||||
&callback](u64* /*num_entries_out*/,
|
||||
const std::string& directory,
|
||||
const std::string& virtual_name) {
|
||||
auto* parent = directory_path_map.at(directory.substr(patch_path.size() - 1));
|
||||
const FileUtil::DirectoryEntryCallable callback =
|
||||
[this, &callback]([[maybe_unused]] u64* num_entries_out, const std::string& directory,
|
||||
const std::string& virtual_name) {
|
||||
auto* parent = directory_path_map.at(directory.substr(patch_path.size() - 1));
|
||||
|
||||
if (FileUtil::IsDirectory(directory + virtual_name + DIR_SEP)) {
|
||||
const auto path = (directory + virtual_name + DIR_SEP).substr(patch_path.size() - 1);
|
||||
if (!directory_path_map.count(path)) { // Add this directory
|
||||
auto directory = std::make_unique<Directory>();
|
||||
directory->name = virtual_name;
|
||||
directory->path = path;
|
||||
directory->parent = parent;
|
||||
directory_path_map.emplace(path, directory.get());
|
||||
parent->directories.emplace_back(std::move(directory));
|
||||
LOG_INFO(Service_FS, "LayeredFS created directory {}", path);
|
||||
if (FileUtil::IsDirectory(directory + virtual_name + DIR_SEP)) {
|
||||
const auto path =
|
||||
(directory + virtual_name + DIR_SEP).substr(patch_path.size() - 1);
|
||||
if (!directory_path_map.count(path)) { // Add this directory
|
||||
auto child_dir = std::make_unique<Directory>();
|
||||
child_dir->name = virtual_name;
|
||||
child_dir->path = path;
|
||||
child_dir->parent = parent;
|
||||
directory_path_map.emplace(path, child_dir.get());
|
||||
parent->directories.emplace_back(std::move(child_dir));
|
||||
LOG_INFO(Service_FS, "LayeredFS created directory {}", path);
|
||||
}
|
||||
return FileUtil::ForeachDirectoryEntry(nullptr, directory + virtual_name + DIR_SEP,
|
||||
callback);
|
||||
}
|
||||
return FileUtil::ForeachDirectoryEntry(nullptr, directory + virtual_name + DIR_SEP,
|
||||
callback);
|
||||
}
|
||||
|
||||
const auto path = (directory + virtual_name).substr(patch_path.size() - 1);
|
||||
if (!file_path_map.count(path)) { // Newly created file
|
||||
auto file = std::make_unique<File>();
|
||||
file->name = virtual_name;
|
||||
file->path = path;
|
||||
file->parent = parent;
|
||||
file_path_map.emplace(path, file.get());
|
||||
parent->files.emplace_back(std::move(file));
|
||||
LOG_INFO(Service_FS, "LayeredFS created file {}", path);
|
||||
}
|
||||
const auto path = (directory + virtual_name).substr(patch_path.size() - 1);
|
||||
if (!file_path_map.count(path)) { // Newly created file
|
||||
auto file = std::make_unique<File>();
|
||||
file->name = virtual_name;
|
||||
file->path = path;
|
||||
file->parent = parent;
|
||||
file_path_map.emplace(path, file.get());
|
||||
parent->files.emplace_back(std::move(file));
|
||||
LOG_INFO(Service_FS, "LayeredFS created file {}", path);
|
||||
}
|
||||
|
||||
auto* file = file_path_map.at(path);
|
||||
file->relocation.type = 1;
|
||||
file->relocation.replace_file_path = directory + virtual_name;
|
||||
file->relocation.size = FileUtil::GetSize(directory + virtual_name);
|
||||
LOG_INFO(Service_FS, "LayeredFS replacement file in use for {}", path);
|
||||
return true;
|
||||
};
|
||||
auto* file = file_path_map.at(path);
|
||||
file->relocation.type = 1;
|
||||
file->relocation.replace_file_path = directory + virtual_name;
|
||||
file->relocation.size = FileUtil::GetSize(directory + virtual_name);
|
||||
LOG_INFO(Service_FS, "LayeredFS replacement file in use for {}", path);
|
||||
return true;
|
||||
};
|
||||
|
||||
FileUtil::ForeachDirectoryEntry(nullptr, patch_path, callback);
|
||||
}
|
||||
|
|
|
@ -119,12 +119,12 @@ NCCHContainer::NCCHContainer(const std::string& filepath, u32 ncch_offset, u32 p
|
|||
file = FileUtil::IOFile(filepath, "rb");
|
||||
}
|
||||
|
||||
Loader::ResultStatus NCCHContainer::OpenFile(const std::string& filepath, u32 ncch_offset,
|
||||
u32 partition) {
|
||||
this->filepath = filepath;
|
||||
this->ncch_offset = ncch_offset;
|
||||
this->partition = partition;
|
||||
file = FileUtil::IOFile(filepath, "rb");
|
||||
Loader::ResultStatus NCCHContainer::OpenFile(const std::string& filepath_, u32 ncch_offset_,
|
||||
u32 partition_) {
|
||||
filepath = filepath_;
|
||||
ncch_offset = ncch_offset_;
|
||||
partition = partition_;
|
||||
file = FileUtil::IOFile(filepath_, "rb");
|
||||
|
||||
if (!file.IsOpen()) {
|
||||
LOG_WARNING(Service_FS, "Failed to open {}", filepath);
|
||||
|
@ -597,12 +597,12 @@ Loader::ResultStatus NCCHContainer::ApplyCodePatch(std::vector<u8>& code) const
|
|||
}};
|
||||
|
||||
for (const PatchLocation& info : patch_paths) {
|
||||
FileUtil::IOFile file{info.path, "rb"};
|
||||
if (!file)
|
||||
FileUtil::IOFile patch_file{info.path, "rb"};
|
||||
if (!patch_file)
|
||||
continue;
|
||||
|
||||
std::vector<u8> patch(file.GetSize());
|
||||
if (file.ReadBytes(patch.data(), patch.size()) != patch.size())
|
||||
std::vector<u8> patch(patch_file.GetSize());
|
||||
if (patch_file.ReadBytes(patch.data(), patch.size()) != patch.size())
|
||||
return Loader::ResultStatus::Error;
|
||||
|
||||
LOG_INFO(Service_FS, "File {} patching code.bin", info.path);
|
||||
|
|
|
@ -40,7 +40,7 @@ std::vector<HLE::Applets::MiiData> LoadMiis() {
|
|||
std::array<u8, sizeof(mii)> mii_raw;
|
||||
file->Read(saved_miis_offset, sizeof(mii), mii_raw.data());
|
||||
std::memcpy(&mii, mii_raw.data(), sizeof(mii));
|
||||
if (mii.mii_id != 0) {
|
||||
if (mii.mii_id != 0u) {
|
||||
miis.push_back(mii);
|
||||
}
|
||||
saved_miis_offset += sizeof(mii);
|
||||
|
|
|
@ -31,8 +31,8 @@ struct MiiSelectorData {
|
|||
class MiiSelector {
|
||||
public:
|
||||
virtual ~MiiSelector() = default;
|
||||
virtual void Setup(const MiiSelectorConfig& config) {
|
||||
this->config = MiiSelectorConfig(config);
|
||||
virtual void Setup(const MiiSelectorConfig& config_) {
|
||||
config = MiiSelectorConfig(config_);
|
||||
}
|
||||
|
||||
const MiiSelectorData& ReceiveData() const {
|
||||
|
|
|
@ -144,8 +144,8 @@ const KeyboardData& SoftwareKeyboard::ReceiveData() {
|
|||
return data;
|
||||
}
|
||||
|
||||
void DefaultKeyboard::Execute(const Frontend::KeyboardConfig& config) {
|
||||
SoftwareKeyboard::Execute(config);
|
||||
void DefaultKeyboard::Execute(const Frontend::KeyboardConfig& config_) {
|
||||
SoftwareKeyboard::Execute(config_);
|
||||
|
||||
auto cfg = Service::CFG::GetModule(Core::System::GetInstance());
|
||||
ASSERT_MSG(cfg, "CFG Module missing!");
|
||||
|
|
|
@ -85,8 +85,8 @@ public:
|
|||
/**
|
||||
* Executes the software keyboard, configured with the given parameters.
|
||||
*/
|
||||
virtual void Execute(const KeyboardConfig& config) {
|
||||
this->config = config;
|
||||
virtual void Execute(const KeyboardConfig& config_) {
|
||||
config = config_;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -173,9 +173,13 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
|
|||
void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height,
|
||||
bool is_portrait_mode) {
|
||||
Layout::FramebufferLayout layout;
|
||||
const auto layout_option = Settings::values.layout_option;
|
||||
const auto min_size = Layout::GetMinimumSizeFromLayout(
|
||||
layout_option.GetValue(), Settings::values.upright_screen.GetValue());
|
||||
|
||||
// If in portrait mode, only the MobilePortrait option really makes sense
|
||||
const Settings::LayoutOption layout_option = is_portrait_mode
|
||||
? Settings::LayoutOption::MobilePortrait
|
||||
: Settings::values.layout_option.GetValue();
|
||||
const auto min_size =
|
||||
Layout::GetMinimumSizeFromLayout(layout_option, Settings::values.upright_screen.GetValue());
|
||||
|
||||
if (Settings::values.custom_layout.GetValue() == true) {
|
||||
layout = Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue());
|
||||
|
@ -183,11 +187,6 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height,
|
|||
width = std::max(width, min_size.first);
|
||||
height = std::max(height, min_size.second);
|
||||
|
||||
// If in portrait mode, only the MobilePortrait option really makes sense
|
||||
const Settings::LayoutOption layout_option =
|
||||
is_portrait_mode ? Settings::LayoutOption::MobilePortrait
|
||||
: Settings::values.layout_option.GetValue();
|
||||
|
||||
switch (layout_option) {
|
||||
case Settings::LayoutOption::SingleScreen:
|
||||
layout =
|
||||
|
|
|
@ -281,7 +281,8 @@ private:
|
|||
* For the request to be honored, EmuWindow implementations will usually reimplement this
|
||||
* function.
|
||||
*/
|
||||
virtual void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) {
|
||||
virtual void OnMinimalClientAreaChangeRequest(
|
||||
[[maybe_unused]] std::pair<u32, u32> minimal_size) {
|
||||
// By default, ignore this request and do nothing.
|
||||
}
|
||||
|
||||
|
|
|
@ -421,28 +421,32 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar
|
|||
if (Settings::values.upright_screen.GetValue()) {
|
||||
if (Settings::values.swap_screen.GetValue()) {
|
||||
width = Core::kScreenBottomHeight * res_scale;
|
||||
height = (Core::kScreenBottomWidth +
|
||||
Core::kScreenTopWidth /
|
||||
Settings::values.large_screen_proportion.GetValue()) *
|
||||
res_scale;
|
||||
height =
|
||||
(Core::kScreenBottomWidth +
|
||||
static_cast<int>(Core::kScreenTopWidth /
|
||||
Settings::values.large_screen_proportion.GetValue())) *
|
||||
res_scale;
|
||||
} else {
|
||||
width = Core::kScreenTopHeight * res_scale;
|
||||
height = (Core::kScreenTopWidth +
|
||||
Core::kScreenBottomWidth /
|
||||
Settings::values.large_screen_proportion.GetValue()) *
|
||||
res_scale;
|
||||
height =
|
||||
(Core::kScreenTopWidth +
|
||||
static_cast<int>(Core::kScreenBottomWidth /
|
||||
Settings::values.large_screen_proportion.GetValue())) *
|
||||
res_scale;
|
||||
}
|
||||
} else {
|
||||
if (Settings::values.swap_screen.GetValue()) {
|
||||
width = (Core::kScreenBottomWidth +
|
||||
Core::kScreenTopWidth /
|
||||
Settings::values.large_screen_proportion.GetValue()) *
|
||||
static_cast<int>(
|
||||
Settings::values.large_screen_proportion.GetValue())) *
|
||||
res_scale;
|
||||
height = Core::kScreenBottomHeight * res_scale;
|
||||
} else {
|
||||
width = (Core::kScreenTopWidth +
|
||||
Core::kScreenBottomWidth /
|
||||
Settings::values.large_screen_proportion.GetValue()) *
|
||||
static_cast<int>(
|
||||
Settings::values.large_screen_proportion.GetValue())) *
|
||||
res_scale;
|
||||
height = Core::kScreenTopHeight * res_scale;
|
||||
}
|
||||
|
@ -470,10 +474,14 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar
|
|||
break;
|
||||
case Settings::LayoutOption::MobileLandscape:
|
||||
if (Settings::values.swap_screen.GetValue()) {
|
||||
width = (Core::kScreenBottomWidth + Core::kScreenTopWidth / 2.25f) * res_scale;
|
||||
width =
|
||||
(Core::kScreenBottomWidth + static_cast<int>(Core::kScreenTopWidth / 2.25f)) *
|
||||
res_scale;
|
||||
height = Core::kScreenBottomHeight * res_scale;
|
||||
} else {
|
||||
width = (Core::kScreenTopWidth + Core::kScreenBottomWidth / 2.25f) * res_scale;
|
||||
width =
|
||||
(Core::kScreenTopWidth + static_cast<int>(Core::kScreenBottomWidth / 2.25f)) *
|
||||
res_scale;
|
||||
height = Core::kScreenTopHeight * res_scale;
|
||||
}
|
||||
layout = MobileLandscapeFrameLayout(
|
||||
|
@ -586,7 +594,7 @@ FramebufferLayout GetCardboardSettings(const FramebufferLayout& layout) {
|
|||
|
||||
std::pair<unsigned, unsigned> GetMinimumSizeFromLayout(Settings::LayoutOption layout,
|
||||
bool upright_screen) {
|
||||
unsigned min_width, min_height;
|
||||
u32 min_width, min_height;
|
||||
|
||||
switch (layout) {
|
||||
case Settings::LayoutOption::SingleScreen:
|
||||
|
@ -597,12 +605,12 @@ std::pair<unsigned, unsigned> GetMinimumSizeFromLayout(Settings::LayoutOption la
|
|||
min_height = Core::kScreenBottomHeight;
|
||||
break;
|
||||
case Settings::LayoutOption::LargeScreen:
|
||||
min_width =
|
||||
min_width = static_cast<u32>(
|
||||
Settings::values.swap_screen
|
||||
? Core::kScreenTopWidth / Settings::values.large_screen_proportion.GetValue() +
|
||||
Core::kScreenBottomWidth
|
||||
: Core::kScreenTopWidth + Core::kScreenBottomWidth /
|
||||
Settings::values.large_screen_proportion.GetValue();
|
||||
Settings::values.large_screen_proportion.GetValue());
|
||||
min_height = Core::kScreenBottomHeight;
|
||||
break;
|
||||
case Settings::LayoutOption::SideScreen:
|
||||
|
|
|
@ -24,8 +24,8 @@ public:
|
|||
std::string GetName() const override {
|
||||
return name;
|
||||
}
|
||||
void SetName(const std::string& name) {
|
||||
this->name = name;
|
||||
void SetName(const std::string& name_) {
|
||||
name = name_;
|
||||
}
|
||||
|
||||
static constexpr HandleType HANDLE_TYPE = HandleType::Event;
|
||||
|
|
|
@ -238,13 +238,14 @@ ResultVal<VAddr> Process::HeapAllocate(VAddr target, u32 size, VMAPermission per
|
|||
return ERR_INVALID_ADDRESS;
|
||||
}
|
||||
}
|
||||
|
||||
auto vma = vm_manager.FindVMA(target);
|
||||
if (vma->second.type != VMAType::Free || vma->second.base + vma->second.size < target + size) {
|
||||
LOG_ERROR(Kernel, "Trying to allocate already allocated memory");
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
{
|
||||
auto vma = vm_manager.FindVMA(target);
|
||||
if (vma->second.type != VMAType::Free ||
|
||||
vma->second.base + vma->second.size < target + size) {
|
||||
LOG_ERROR(Kernel, "Trying to allocate already allocated memory");
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
}
|
||||
}
|
||||
|
||||
auto allocated_fcram = memory_region->HeapAllocate(size);
|
||||
if (allocated_fcram.empty()) {
|
||||
LOG_ERROR(Kernel, "Not enough space");
|
||||
|
|
|
@ -157,14 +157,16 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
|
|||
// APT:GetSharedFont for detail.
|
||||
target_address = linear_heap_phys_offset + Memory::LINEAR_HEAP_VADDR;
|
||||
}
|
||||
|
||||
auto vma = target_process.vm_manager.FindVMA(target_address);
|
||||
if (vma->second.type != VMAType::Free ||
|
||||
vma->second.base + vma->second.size < target_address + size) {
|
||||
LOG_ERROR(Kernel,
|
||||
"cannot map id={}, address=0x{:08X} name={}, mapping to already allocated memory",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
{
|
||||
auto vma = target_process.vm_manager.FindVMA(target_address);
|
||||
if (vma->second.type != VMAType::Free ||
|
||||
vma->second.base + vma->second.size < target_address + size) {
|
||||
LOG_ERROR(
|
||||
Kernel,
|
||||
"cannot map id={}, address=0x{:08X} name={}, mapping to already allocated memory",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
}
|
||||
}
|
||||
|
||||
// Map the memory block into the target process
|
||||
|
|
|
@ -28,8 +28,8 @@ public:
|
|||
std::string GetName() const override {
|
||||
return name;
|
||||
}
|
||||
void SetName(std::string name) {
|
||||
this->name = std::move(name);
|
||||
void SetName(std::string name_) {
|
||||
name = std::move(name_);
|
||||
}
|
||||
|
||||
static constexpr HandleType HANDLE_TYPE = HandleType::SharedMemory;
|
||||
|
|
|
@ -1962,7 +1962,7 @@ ResultCode SVC::GetProcessList(s32* process_count, VAddr out_process_array,
|
|||
}
|
||||
|
||||
s32 written = 0;
|
||||
for (const auto process : kernel.GetProcessList()) {
|
||||
for (const auto& process : kernel.GetProcessList()) {
|
||||
if (written >= out_process_array_count) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -115,8 +115,8 @@ public:
|
|||
*/
|
||||
const std::vector<std::shared_ptr<Thread>>& GetThreadList();
|
||||
|
||||
void SetCPU(ARM_Interface& cpu) {
|
||||
this->cpu = &cpu;
|
||||
void SetCPU(ARM_Interface& cpu_) {
|
||||
cpu = &cpu_;
|
||||
}
|
||||
|
||||
std::unique_ptr<ARM_Interface::ThreadContext> NewContext() {
|
||||
|
|
|
@ -1197,8 +1197,8 @@ static void CaptureFrameBuffer(Core::System& system, u32 capture_offset, VAddr s
|
|||
auto dst_vaddr = screen_capture_base_vaddr + capture_offset;
|
||||
auto dst_ptr = system.Memory().GetPointer(dst_vaddr);
|
||||
const auto src_ptr = system.Memory().GetPointer(src);
|
||||
for (auto y = 0; y < height; y++) {
|
||||
for (auto x = 0; x < screen_width; x++) {
|
||||
for (u32 y = 0; y < height; y++) {
|
||||
for (u32 x = 0; x < screen_width; x++) {
|
||||
auto dst_offset =
|
||||
VideoCore::GetMortonOffset(x, y, bpp) + (y & ~7) * screen_width_pow2 * bpp;
|
||||
auto src_offset = bpp * (screen_width * y + x);
|
||||
|
|
|
@ -929,7 +929,7 @@ void Module::APTInterface::StoreSysMenuArg(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x40, 1, 2); // 0x00400042
|
||||
const auto size = rp.Pop<u32>();
|
||||
[[maybe_unused]] const auto size = rp.Pop<u32>();
|
||||
const auto buffer = rp.PopStaticBuffer();
|
||||
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
|
|
@ -855,7 +855,7 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromGameCard(u64 title_id, Special
|
|||
case SpecialContentType::DLPChild:
|
||||
return MakeResult(static_cast<u16>(NCSDContentIndex::DLP));
|
||||
default:
|
||||
ASSERT(false);
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1424,8 +1424,8 @@ void NWM_UDS::DecryptBeaconData(Kernel::HLERequestContext& ctx, u16 command_id)
|
|||
auto& node = nodes.emplace_back();
|
||||
node.friend_code_seed = info.friend_code_seed;
|
||||
node.network_node_id = info.network_node_id;
|
||||
for (std::size_t i = 0; i < info.username.size(); ++i) {
|
||||
node.username[i] = info.username[i];
|
||||
for (std::size_t j = 0; j < info.username.size(); ++j) {
|
||||
node.username[j] = info.username[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ static std::array<u8, CryptoPP::Weak::MD5::DIGESTSIZE> GetDataCryptoCTR(
|
|||
* Generates the key used for encrypting the 802.11 data frames generated by UDS.
|
||||
* @returns The key used for data frames crypto.
|
||||
*/
|
||||
static std::array<u8, CryptoPP::AES::BLOCKSIZE> GenerateDataCCMPKey(
|
||||
[[maybe_unused]] static std::array<u8, CryptoPP::AES::BLOCKSIZE> GenerateDataCCMPKey(
|
||||
const std::vector<u8>& passphrase, const NetworkInfo& network_info) {
|
||||
// Calculate the MD5 hash of the input passphrase.
|
||||
std::array<u8, CryptoPP::Weak::MD5::DIGESTSIZE> passphrase_hash;
|
||||
|
@ -157,11 +157,10 @@ static std::vector<u8> GenerateCCMPAAD(const MacAddress& sender, const MacAddres
|
|||
* Decrypts the payload of an encrypted 802.11 data frame using the specified key.
|
||||
* @returns The decrypted payload.
|
||||
*/
|
||||
static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload,
|
||||
const std::array<u8, CryptoPP::AES::BLOCKSIZE>& ccmp_key,
|
||||
const MacAddress& sender, const MacAddress& receiver,
|
||||
const MacAddress& bssid, u16 sequence_number,
|
||||
u16 frame_control) {
|
||||
[[maybe_unused]] static std::vector<u8> DecryptDataFrame(
|
||||
const std::vector<u8>& encrypted_payload,
|
||||
const std::array<u8, CryptoPP::AES::BLOCKSIZE>& ccmp_key, const MacAddress& sender,
|
||||
const MacAddress& receiver, const MacAddress& bssid, u16 sequence_number, u16 frame_control) {
|
||||
|
||||
// Reference: IEEE 802.11-2007
|
||||
|
||||
|
@ -218,11 +217,10 @@ static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload
|
|||
* Encrypts the payload of an 802.11 data frame using the specified key.
|
||||
* @returns The encrypted payload.
|
||||
*/
|
||||
static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
|
||||
const std::array<u8, CryptoPP::AES::BLOCKSIZE>& ccmp_key,
|
||||
const MacAddress& sender, const MacAddress& receiver,
|
||||
const MacAddress& bssid, u16 sequence_number,
|
||||
u16 frame_control) {
|
||||
[[maybe_unused]] static std::vector<u8> EncryptDataFrame(
|
||||
const std::vector<u8>& payload, const std::array<u8, CryptoPP::AES::BLOCKSIZE>& ccmp_key,
|
||||
const MacAddress& sender, const MacAddress& receiver, const MacAddress& bssid,
|
||||
u16 sequence_number, u16 frame_control) {
|
||||
// Reference: IEEE 802.11-2007
|
||||
|
||||
std::vector<u8> aad = GenerateCCMPAAD(sender, receiver, bssid, frame_control);
|
||||
|
|
|
@ -99,7 +99,7 @@ void PLG_LDR::OnProcessRun(Kernel::Process& process, Kernel::KernelSystem& kerne
|
|||
plugin_root + fmt::format("{:016X}", process.codeset->program_id);
|
||||
FileUtil::FSTEntry entry;
|
||||
FileUtil::ScanDirectoryTree(plugin_tid, entry);
|
||||
for (const auto child : entry.children) {
|
||||
for (const auto& child : entry.children) {
|
||||
if (!child.isDirectory && child.physicalName.ends_with(".3gx")) {
|
||||
plgldr_context.is_default_path = false;
|
||||
plgldr_context.plugin_path = child.physicalName;
|
||||
|
|
|
@ -794,8 +794,6 @@ void SOC_U::Poll(Kernel::HLERequestContext& ctx) {
|
|||
ret = TranslateError(GET_ERRNO);
|
||||
}
|
||||
|
||||
size_t test = platform_pollfd.size();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ret);
|
||||
|
|
|
@ -298,13 +298,13 @@ void LoadSafeModeNativeFirmKeysOld3DS() {
|
|||
std::vector<u8> firm_buffer(size);
|
||||
firm->Read(0, firm_buffer.size(), firm_buffer.data());
|
||||
firm->Close();
|
||||
|
||||
AESKey key;
|
||||
constexpr std::size_t SLOT_0x31_KEY_Y_OFFSET = 817672;
|
||||
std::memcpy(key.data(), firm_buffer.data() + SLOT_0x31_KEY_Y_OFFSET, sizeof(key));
|
||||
key_slots.at(0x31).SetKeyY(key);
|
||||
LOG_DEBUG(HW_AES, "Loaded Slot0x31 KeyY: {}", KeyToString(key));
|
||||
|
||||
{
|
||||
AESKey key;
|
||||
constexpr std::size_t SLOT_0x31_KEY_Y_OFFSET = 817672;
|
||||
std::memcpy(key.data(), firm_buffer.data() + SLOT_0x31_KEY_Y_OFFSET, sizeof(key));
|
||||
key_slots.at(0x31).SetKeyY(key);
|
||||
LOG_DEBUG(HW_AES, "Loaded Slot0x31 KeyY: {}", KeyToString(key));
|
||||
}
|
||||
auto LoadCommonKey = [&firm_buffer](std::size_t key_slot) -> AESKey {
|
||||
constexpr std::size_t START_OFFSET = 836533;
|
||||
constexpr std::size_t OFFSET = 0x14; // 0x10 bytes for key + 4 bytes between keys
|
||||
|
@ -417,13 +417,13 @@ void LoadNativeFirmKeysNew3DS() {
|
|||
d2.SetKeyWithIV(normal_key_slot0x15->data(), normal_key_slot0x15->size(),
|
||||
arm9_header.CTR.data(), arm9_header.CTR.size());
|
||||
d2.ProcessData(arm9_binary.data(), enc_arm9_binary.data(), enc_arm9_binary.size());
|
||||
|
||||
AESKey key;
|
||||
constexpr std::size_t SLOT_0x31_KEY_Y_OFFSET = 517368;
|
||||
std::memcpy(key.data(), arm9_binary.data() + SLOT_0x31_KEY_Y_OFFSET, sizeof(key));
|
||||
key_slots.at(0x31).SetKeyY(key);
|
||||
LOG_DEBUG(HW_AES, "Loaded Slot0x31 KeyY: {}", KeyToString(key));
|
||||
|
||||
{
|
||||
AESKey key;
|
||||
constexpr std::size_t SLOT_0x31_KEY_Y_OFFSET = 517368;
|
||||
std::memcpy(key.data(), arm9_binary.data() + SLOT_0x31_KEY_Y_OFFSET, sizeof(key));
|
||||
key_slots.at(0x31).SetKeyY(key);
|
||||
LOG_DEBUG(HW_AES, "Loaded Slot0x31 KeyY: {}", KeyToString(key));
|
||||
}
|
||||
auto LoadCommonKey = [&arm9_binary](std::size_t key_slot) -> AESKey {
|
||||
constexpr std::size_t START_OFFSET = 541065;
|
||||
constexpr std::size_t OFFSET = 0x14; // 0x10 bytes for key + 4 bytes between keys
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
* @returns A pair with the optional N3ds mode, and the status.
|
||||
*/
|
||||
virtual std::pair<std::optional<u8>, ResultStatus> LoadKernelN3dsMode() {
|
||||
return std::make_pair(0, ResultStatus::Success);
|
||||
return std::make_pair(u8(0), ResultStatus::Success);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,7 +136,7 @@ public:
|
|||
* @param buffer Reference to buffer to store data
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadCode(std::vector<u8>& buffer) {
|
||||
virtual ResultStatus ReadCode([[maybe_unused]] std::vector<u8>& buffer) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
* @param buffer Reference to buffer to store data
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadIcon(std::vector<u8>& buffer) {
|
||||
virtual ResultStatus ReadIcon([[maybe_unused]] std::vector<u8>& buffer) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
* @param buffer Reference to buffer to store data
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadBanner(std::vector<u8>& buffer) {
|
||||
virtual ResultStatus ReadBanner([[maybe_unused]] std::vector<u8>& buffer) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
* @param buffer Reference to buffer to store data
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadLogo(std::vector<u8>& buffer) {
|
||||
virtual ResultStatus ReadLogo([[maybe_unused]] std::vector<u8>& buffer) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
* @param out_program_id Reference to store program id into
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadProgramId(u64& out_program_id) {
|
||||
virtual ResultStatus ReadProgramId([[maybe_unused]] u64& out_program_id) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ public:
|
|||
* @param out_extdata_id Reference to store extdata id into
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadExtdataId(u64& out_extdata_id) {
|
||||
virtual ResultStatus ReadExtdataId([[maybe_unused]] u64& out_extdata_id) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,8 @@ public:
|
|||
* @param romfs_file The file containing the RomFS
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadRomFS(std::shared_ptr<FileSys::RomFSReader>& romfs_file) {
|
||||
virtual ResultStatus ReadRomFS(
|
||||
[[maybe_unused]] std::shared_ptr<FileSys::RomFSReader>& romfs_file) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -200,7 +201,7 @@ public:
|
|||
* @param target_path The target path to dump to
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus DumpRomFS(const std::string& target_path) {
|
||||
virtual ResultStatus DumpRomFS([[maybe_unused]] const std::string& target_path) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -210,7 +211,8 @@ public:
|
|||
* @param romfs_file The file containing the RomFS
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadUpdateRomFS(std::shared_ptr<FileSys::RomFSReader>& romfs_file) {
|
||||
virtual ResultStatus ReadUpdateRomFS(
|
||||
[[maybe_unused]] std::shared_ptr<FileSys::RomFSReader>& romfs_file) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -219,7 +221,7 @@ public:
|
|||
* @param target_path The target path to dump to
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus DumpUpdateRomFS(const std::string& target_path) {
|
||||
virtual ResultStatus DumpUpdateRomFS([[maybe_unused]] const std::string& target_path) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
@ -228,7 +230,7 @@ public:
|
|||
* @param title Reference to store the application title into
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadTitle(std::string& title) {
|
||||
virtual ResultStatus ReadTitle([[maybe_unused]] std::string& title) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ std::pair<std::optional<u32>, ResultStatus> AppLoader_NCCH::LoadKernelSystemMode
|
|||
if (!is_loaded) {
|
||||
ResultStatus res = base_ncch.Load();
|
||||
if (res != ResultStatus::Success) {
|
||||
return std::make_pair(std::optional<u32>{}, res);
|
||||
return std::make_pair(std::nullopt, res);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ std::pair<std::optional<u8>, ResultStatus> AppLoader_NCCH::LoadKernelN3dsMode()
|
|||
if (!is_loaded) {
|
||||
ResultStatus res = base_ncch.Load();
|
||||
if (res != ResultStatus::Success) {
|
||||
return std::make_pair(std::optional<u8>{}, res);
|
||||
return std::make_pair(std::nullopt, res);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue