Merge branch 'master' of github.com:citra-emu/citra into ips-patches
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <utility>
|
||||
#include "core/core.h"
|
||||
#include "core/file_sys/archive_savedata.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
|
||||
@@ -16,16 +17,19 @@ ArchiveFactory_SaveData::ArchiveFactory_SaveData(
|
||||
: sd_savedata_source(std::move(sd_savedata)) {}
|
||||
|
||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const Path& path) {
|
||||
return sd_savedata_source->Open(Kernel::g_current_process->codeset->program_id);
|
||||
return sd_savedata_source->Open(
|
||||
Core::System::GetInstance().Kernel().GetCurrentProcess()->codeset->program_id);
|
||||
}
|
||||
|
||||
ResultCode ArchiveFactory_SaveData::Format(const Path& path,
|
||||
const FileSys::ArchiveFormatInfo& format_info) {
|
||||
return sd_savedata_source->Format(Kernel::g_current_process->codeset->program_id, format_info);
|
||||
return sd_savedata_source->Format(
|
||||
Core::System::GetInstance().Kernel().GetCurrentProcess()->codeset->program_id, format_info);
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SaveData::GetFormatInfo(const Path& path) const {
|
||||
return sd_savedata_source->GetFormatInfo(Kernel::g_current_process->codeset->program_id);
|
||||
return sd_savedata_source->GetFormatInfo(
|
||||
Core::System::GetInstance().Kernel().GetCurrentProcess()->codeset->program_id);
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/swap.h"
|
||||
#include "core/core.h"
|
||||
#include "core/file_sys/archive_selfncch.h"
|
||||
#include "core/file_sys/errors.h"
|
||||
#include "core/file_sys/ivfc_archive.h"
|
||||
@@ -279,7 +280,7 @@ void ArchiveFactory_SelfNCCH::Register(Loader::AppLoader& app_loader) {
|
||||
|
||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SelfNCCH::Open(const Path& path) {
|
||||
auto archive = std::make_unique<SelfNCCHArchive>(
|
||||
ncch_data[Kernel::g_current_process->codeset->program_id]);
|
||||
ncch_data[Core::System::GetInstance().Kernel().GetCurrentProcess()->codeset->program_id]);
|
||||
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
||||
}
|
||||
|
||||
|
22
src/core/file_sys/delay_generator.cpp
Normal file
22
src/core/file_sys/delay_generator.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include "core/file_sys/delay_generator.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
DelayGenerator::~DelayGenerator() = default;
|
||||
|
||||
u64 DefaultDelayGenerator::GetReadDelayNs(std::size_t length) {
|
||||
// This is the delay measured for a romfs read.
|
||||
// For now we will take that as a default
|
||||
static constexpr u64 slope(94);
|
||||
static constexpr u64 offset(582778);
|
||||
static constexpr u64 minimum(663124);
|
||||
u64 IPCDelayNanoseconds = std::max<u64>(static_cast<u64>(length) * slope + offset, minimum);
|
||||
return IPCDelayNanoseconds;
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
@@ -4,10 +4,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
class DelayGenerator {
|
||||
public:
|
||||
virtual ~DelayGenerator();
|
||||
virtual u64 GetReadDelayNs(std::size_t length) = 0;
|
||||
|
||||
// TODO (B3N30): Add getter for all other file/directory io operations
|
||||
@@ -15,15 +19,7 @@ public:
|
||||
|
||||
class DefaultDelayGenerator : public DelayGenerator {
|
||||
public:
|
||||
u64 GetReadDelayNs(std::size_t length) override {
|
||||
// This is the delay measured for a romfs read.
|
||||
// For now we will take that as a default
|
||||
static constexpr u64 slope(94);
|
||||
static constexpr u64 offset(582778);
|
||||
static constexpr u64 minimum(663124);
|
||||
u64 IPCDelayNanoseconds = std::max<u64>(static_cast<u64>(length) * slope + offset, minimum);
|
||||
return IPCDelayNanoseconds;
|
||||
}
|
||||
u64 GetReadDelayNs(std::size_t length) override;
|
||||
};
|
||||
|
||||
} // namespace FileSys
|
||||
|
@@ -226,7 +226,9 @@ Loader::ResultStatus NCCHContainer::Load() {
|
||||
std::memcpy(input.data(), key_y_primary.data(), key_y_primary.size());
|
||||
std::memcpy(input.data() + key_y_primary.size(), seed.data(), seed.size());
|
||||
CryptoPP::SHA256 sha;
|
||||
sha.CalculateDigest(key_y_secondary.data(), input.data(), input.size());
|
||||
std::array<u8, CryptoPP::SHA256::DIGESTSIZE> hash;
|
||||
sha.CalculateDigest(hash.data(), input.data(), input.size());
|
||||
std::memcpy(key_y_secondary.data(), hash.data(), key_y_secondary.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ bool SeedDB::Load() {
|
||||
LOG_ERROR(Service_FS, "Failed to read seed database count fully");
|
||||
return false;
|
||||
}
|
||||
if (!file.Seek(file.Tell() + SEEDDB_PADDING_BYTES, SEEK_SET)) {
|
||||
if (!file.Seek(SEEDDB_PADDING_BYTES, SEEK_CUR)) {
|
||||
LOG_ERROR(Service_FS, "Failed to skip seed database padding");
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user