Merge pull request #6296 from lioncash/shadow-error
core: Make variable shadowing a compile-time error
This commit is contained in:
commit
ad6e20cfde
|
@ -651,20 +651,17 @@ endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options(core PRIVATE
|
target_compile_options(core PRIVATE
|
||||||
# 'expression' : signed/unsigned mismatch
|
/we4018 # 'expression' : signed/unsigned mismatch
|
||||||
/we4018
|
/we4244 # 'argument' : conversion from 'type1' to 'type2', possible loss of data (floating-point)
|
||||||
# 'argument' : conversion from 'type1' to 'type2', possible loss of data (floating-point)
|
/we4245 # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||||
/we4244
|
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||||
# 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
|
/we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||||
/we4245
|
/we4305 # 'context' : truncation from 'type1' to 'type2'
|
||||||
# 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
/we4456 # Declaration of 'identifier' hides previous local declaration
|
||||||
/we4254
|
/we4457 # Declaration of 'identifier' hides function parameter
|
||||||
# 'var' : conversion from 'size_t' to 'type', possible loss of data
|
/we4458 # Declaration of 'identifier' hides class member
|
||||||
/we4267
|
/we4459 # Declaration of 'identifier' hides global declaration
|
||||||
# 'context' : truncation from 'type1' to 'type2'
|
/we4715 # 'function' : not all control paths return a value
|
||||||
/we4305
|
|
||||||
# 'function' : not all control paths return a value
|
|
||||||
/we4715
|
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
target_compile_options(core PRIVATE
|
target_compile_options(core PRIVATE
|
||||||
|
@ -672,6 +669,7 @@ else()
|
||||||
-Werror=ignored-qualifiers
|
-Werror=ignored-qualifiers
|
||||||
-Werror=implicit-fallthrough
|
-Werror=implicit-fallthrough
|
||||||
-Werror=sign-compare
|
-Werror=sign-compare
|
||||||
|
-Werror=shadow
|
||||||
|
|
||||||
$<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess>
|
$<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess>
|
||||||
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
|
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Core {
|
||||||
|
|
||||||
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
|
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent) : parent(parent) {}
|
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_) : parent{parent_} {}
|
||||||
|
|
||||||
u8 MemoryRead8(u32 vaddr) override {
|
u8 MemoryRead8(u32 vaddr) override {
|
||||||
return parent.system.Memory().Read8(vaddr);
|
return parent.system.Memory().Read8(vaddr);
|
||||||
|
|
|
@ -27,7 +27,7 @@ using Vector = Dynarmic::A64::Vector;
|
||||||
|
|
||||||
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
|
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
explicit DynarmicCallbacks64(ARM_Dynarmic_64& parent) : parent(parent) {}
|
explicit DynarmicCallbacks64(ARM_Dynarmic_64& parent_) : parent{parent_} {}
|
||||||
|
|
||||||
u8 MemoryRead8(u64 vaddr) override {
|
u8 MemoryRead8(u64 vaddr) override {
|
||||||
return parent.system.Memory().Read8(vaddr);
|
return parent.system.Memory().Read8(vaddr);
|
||||||
|
|
|
@ -18,7 +18,7 @@ class DynarmicCP15 final : public Dynarmic::A32::Coprocessor {
|
||||||
public:
|
public:
|
||||||
using CoprocReg = Dynarmic::A32::CoprocReg;
|
using CoprocReg = Dynarmic::A32::CoprocReg;
|
||||||
|
|
||||||
explicit DynarmicCP15(ARM_Dynarmic_32& parent) : parent(parent) {}
|
explicit DynarmicCP15(ARM_Dynarmic_32& parent_) : parent{parent_} {}
|
||||||
|
|
||||||
std::optional<Callback> CompileInternalOperation(bool two, unsigned opc1, CoprocReg CRd,
|
std::optional<Callback> CompileInternalOperation(bool two, unsigned opc1, CoprocReg CRd,
|
||||||
CoprocReg CRn, CoprocReg CRm,
|
CoprocReg CRn, CoprocReg CRm,
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
DynarmicExclusiveMonitor::DynarmicExclusiveMonitor(Memory::Memory& memory, std::size_t core_count)
|
DynarmicExclusiveMonitor::DynarmicExclusiveMonitor(Memory::Memory& memory_, std::size_t core_count_)
|
||||||
: monitor(core_count), memory{memory} {}
|
: monitor{core_count_}, memory{memory_} {}
|
||||||
|
|
||||||
DynarmicExclusiveMonitor::~DynarmicExclusiveMonitor() = default;
|
DynarmicExclusiveMonitor::~DynarmicExclusiveMonitor() = default;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Core {
|
||||||
|
|
||||||
class DynarmicExclusiveMonitor final : public ExclusiveMonitor {
|
class DynarmicExclusiveMonitor final : public ExclusiveMonitor {
|
||||||
public:
|
public:
|
||||||
explicit DynarmicExclusiveMonitor(Memory::Memory& memory, std::size_t core_count);
|
explicit DynarmicExclusiveMonitor(Memory::Memory& memory_, std::size_t core_count_);
|
||||||
~DynarmicExclusiveMonitor() override;
|
~DynarmicExclusiveMonitor() override;
|
||||||
|
|
||||||
u8 ExclusiveRead8(std::size_t core_index, VAddr addr) override;
|
u8 ExclusiveRead8(std::size_t core_index, VAddr addr) override;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
CpuManager::CpuManager(System& system) : system{system} {}
|
CpuManager::CpuManager(System& system_) : system{system_} {}
|
||||||
CpuManager::~CpuManager() = default;
|
CpuManager::~CpuManager() = default;
|
||||||
|
|
||||||
void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) {
|
void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ class System;
|
||||||
|
|
||||||
class CpuManager {
|
class CpuManager {
|
||||||
public:
|
public:
|
||||||
explicit CpuManager(System& system);
|
explicit CpuManager(System& system_);
|
||||||
CpuManager(const CpuManager&) = delete;
|
CpuManager(const CpuManager&) = delete;
|
||||||
CpuManager(CpuManager&&) = delete;
|
CpuManager(CpuManager&&) = delete;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
namespace Core::Crypto {
|
namespace Core::Crypto {
|
||||||
|
|
||||||
CTREncryptionLayer::CTREncryptionLayer(FileSys::VirtualFile base_, Key128 key_,
|
CTREncryptionLayer::CTREncryptionLayer(FileSys::VirtualFile base_, Key128 key_,
|
||||||
std::size_t base_offset)
|
std::size_t base_offset_)
|
||||||
: EncryptionLayer(std::move(base_)), base_offset(base_offset), cipher(key_, Mode::CTR) {}
|
: EncryptionLayer(std::move(base_)), base_offset(base_offset_), cipher(key_, Mode::CTR) {}
|
||||||
|
|
||||||
std::size_t CTREncryptionLayer::Read(u8* data, std::size_t length, std::size_t offset) const {
|
std::size_t CTREncryptionLayer::Read(u8* data, std::size_t length, std::size_t offset) const {
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class CTREncryptionLayer : public EncryptionLayer {
|
||||||
public:
|
public:
|
||||||
using IVData = std::array<u8, 16>;
|
using IVData = std::array<u8, 16>;
|
||||||
|
|
||||||
CTREncryptionLayer(FileSys::VirtualFile base, Key128 key, std::size_t base_offset);
|
CTREncryptionLayer(FileSys::VirtualFile base_, Key128 key_, std::size_t base_offset_);
|
||||||
|
|
||||||
std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
|
std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
|
||||||
|
|
||||||
|
|
|
@ -458,7 +458,7 @@ static std::array<u8, size> operator^(const std::array<u8, size>& lhs,
|
||||||
const std::array<u8, size>& rhs) {
|
const std::array<u8, size>& rhs) {
|
||||||
std::array<u8, size> out;
|
std::array<u8, size> out;
|
||||||
std::transform(lhs.begin(), lhs.end(), rhs.begin(), out.begin(),
|
std::transform(lhs.begin(), lhs.end(), rhs.begin(), out.begin(),
|
||||||
[](u8 lhs, u8 rhs) { return u8(lhs ^ rhs); });
|
[](u8 lhs_elem, u8 rhs_elem) { return u8(lhs_elem ^ rhs_elem); });
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,10 @@ CNMT::CNMT(VirtualFile file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CNMT::CNMT(CNMTHeader header, OptionalHeader opt_header, std::vector<ContentRecord> content_records,
|
CNMT::CNMT(CNMTHeader header_, OptionalHeader opt_header_,
|
||||||
std::vector<MetaRecord> meta_records)
|
std::vector<ContentRecord> content_records_, std::vector<MetaRecord> meta_records_)
|
||||||
: header(std::move(header)), opt_header(std::move(opt_header)),
|
: header(std::move(header_)), opt_header(std::move(opt_header_)),
|
||||||
content_records(std::move(content_records)), meta_records(std::move(meta_records)) {}
|
content_records(std::move(content_records_)), meta_records(std::move(meta_records_)) {}
|
||||||
|
|
||||||
CNMT::~CNMT() = default;
|
CNMT::~CNMT() = default;
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,8 @@ static_assert(sizeof(CNMTHeader) == 0x20, "CNMTHeader has incorrect size.");
|
||||||
class CNMT {
|
class CNMT {
|
||||||
public:
|
public:
|
||||||
explicit CNMT(VirtualFile file);
|
explicit CNMT(VirtualFile file);
|
||||||
CNMT(CNMTHeader header, OptionalHeader opt_header, std::vector<ContentRecord> content_records,
|
CNMT(CNMTHeader header_, OptionalHeader opt_header_,
|
||||||
std::vector<MetaRecord> meta_records);
|
std::vector<ContentRecord> content_records_, std::vector<MetaRecord> meta_records_);
|
||||||
~CNMT();
|
~CNMT();
|
||||||
|
|
||||||
u64 GetTitleID() const;
|
u64 GetTitleID() const;
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
NSP::NSP(VirtualFile file_, std::size_t program_index)
|
NSP::NSP(VirtualFile file_, std::size_t program_index_)
|
||||||
: file(std::move(file_)), program_index(program_index), status{Loader::ResultStatus::Success},
|
: file(std::move(file_)), program_index(program_index_), status{Loader::ResultStatus::Success},
|
||||||
pfs(std::make_shared<PartitionFilesystem>(file)), keys{Core::Crypto::KeyManager::Instance()} {
|
pfs(std::make_shared<PartitionFilesystem>(file)), keys{Core::Crypto::KeyManager::Instance()} {
|
||||||
if (pfs->GetStatus() != Loader::ResultStatus::Success) {
|
if (pfs->GetStatus() != Loader::ResultStatus::Success) {
|
||||||
status = pfs->GetStatus();
|
status = pfs->GetStatus();
|
||||||
|
|
|
@ -27,7 +27,7 @@ enum class ContentRecordType : u8;
|
||||||
|
|
||||||
class NSP : public ReadOnlyVfsDirectory {
|
class NSP : public ReadOnlyVfsDirectory {
|
||||||
public:
|
public:
|
||||||
explicit NSP(VirtualFile file, std::size_t program_index = 0);
|
explicit NSP(VirtualFile file_, std::size_t program_index_ = 0);
|
||||||
~NSP() override;
|
~NSP() override;
|
||||||
|
|
||||||
Loader::ResultStatus GetStatus() const;
|
Loader::ResultStatus GetStatus() const;
|
||||||
|
|
|
@ -23,8 +23,8 @@ static bool VerifyConcatenationMapContinuity(const std::multimap<u64, VirtualFil
|
||||||
return map.begin()->first == 0;
|
return map.begin()->first == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConcatenatedVfsFile::ConcatenatedVfsFile(std::vector<VirtualFile> files_, std::string name)
|
ConcatenatedVfsFile::ConcatenatedVfsFile(std::vector<VirtualFile> files_, std::string name_)
|
||||||
: name(std::move(name)) {
|
: name(std::move(name_)) {
|
||||||
std::size_t next_offset = 0;
|
std::size_t next_offset = 0;
|
||||||
for (const auto& file : files_) {
|
for (const auto& file : files_) {
|
||||||
files.emplace(next_offset, file);
|
files.emplace(next_offset, file);
|
||||||
|
@ -32,8 +32,8 @@ ConcatenatedVfsFile::ConcatenatedVfsFile(std::vector<VirtualFile> files_, std::s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConcatenatedVfsFile::ConcatenatedVfsFile(std::multimap<u64, VirtualFile> files_, std::string name)
|
ConcatenatedVfsFile::ConcatenatedVfsFile(std::multimap<u64, VirtualFile> files_, std::string name_)
|
||||||
: files(std::move(files_)), name(std::move(name)) {
|
: files(std::move(files_)), name(std::move(name_)) {
|
||||||
ASSERT(VerifyConcatenationMapContinuity(files));
|
ASSERT(VerifyConcatenationMapContinuity(files));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ namespace FileSys {
|
||||||
// Class that wraps multiple vfs files and concatenates them, making reads seamless. Currently
|
// Class that wraps multiple vfs files and concatenates them, making reads seamless. Currently
|
||||||
// read-only.
|
// read-only.
|
||||||
class ConcatenatedVfsFile : public VfsFile {
|
class ConcatenatedVfsFile : public VfsFile {
|
||||||
ConcatenatedVfsFile(std::vector<VirtualFile> files, std::string name);
|
explicit ConcatenatedVfsFile(std::vector<VirtualFile> files, std::string name_);
|
||||||
ConcatenatedVfsFile(std::multimap<u64, VirtualFile> files, std::string name);
|
explicit ConcatenatedVfsFile(std::multimap<u64, VirtualFile> files, std::string name_);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~ConcatenatedVfsFile() override;
|
~ConcatenatedVfsFile() override;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
LayeredVfsDirectory::LayeredVfsDirectory(std::vector<VirtualDir> dirs, std::string name)
|
LayeredVfsDirectory::LayeredVfsDirectory(std::vector<VirtualDir> dirs_, std::string name_)
|
||||||
: dirs(std::move(dirs)), name(std::move(name)) {}
|
: dirs(std::move(dirs_)), name(std::move(name_)) {}
|
||||||
|
|
||||||
LayeredVfsDirectory::~LayeredVfsDirectory() = default;
|
LayeredVfsDirectory::~LayeredVfsDirectory() = default;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace FileSys {
|
||||||
// one and falling back to the one after. The highest priority directory (overwrites all others)
|
// one and falling back to the one after. The highest priority directory (overwrites all others)
|
||||||
// should be element 0 in the dirs vector.
|
// should be element 0 in the dirs vector.
|
||||||
class LayeredVfsDirectory : public VfsDirectory {
|
class LayeredVfsDirectory : public VfsDirectory {
|
||||||
LayeredVfsDirectory(std::vector<VirtualDir> dirs, std::string name);
|
explicit LayeredVfsDirectory(std::vector<VirtualDir> dirs_, std::string name_);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~LayeredVfsDirectory() override;
|
~LayeredVfsDirectory() override;
|
||||||
|
|
|
@ -3,7 +3,16 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
|
#endif
|
||||||
#include <zip.h>
|
#include <zip.h>
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "core/file_sys/vfs.h"
|
#include "core/file_sys/vfs.h"
|
||||||
#include "core/file_sys/vfs_libzip.h"
|
#include "core/file_sys/vfs_libzip.h"
|
||||||
|
|
|
@ -14,9 +14,9 @@ namespace FileSys {
|
||||||
|
|
||||||
class StaticVfsFile : public VfsFile {
|
class StaticVfsFile : public VfsFile {
|
||||||
public:
|
public:
|
||||||
explicit StaticVfsFile(u8 value, std::size_t size = 0, std::string name = "",
|
explicit StaticVfsFile(u8 value_, std::size_t size_ = 0, std::string name_ = "",
|
||||||
VirtualDir parent = nullptr)
|
VirtualDir parent_ = nullptr)
|
||||||
: value{value}, size{size}, name{std::move(name)}, parent{std::move(parent)} {}
|
: value{value_}, size{size_}, name{std::move(name_)}, parent{std::move(parent_)} {}
|
||||||
|
|
||||||
std::string GetName() const override {
|
std::string GetName() const override {
|
||||||
return name;
|
return name;
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "core/file_sys/vfs_vector.h"
|
#include "core/file_sys/vfs_vector.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
VectorVfsFile::VectorVfsFile(std::vector<u8> initial_data, std::string name, VirtualDir parent)
|
VectorVfsFile::VectorVfsFile(std::vector<u8> initial_data, std::string name_, VirtualDir parent_)
|
||||||
: data(std::move(initial_data)), parent(std::move(parent)), name(std::move(name)) {}
|
: data(std::move(initial_data)), parent(std::move(parent_)), name(std::move(name_)) {}
|
||||||
|
|
||||||
VectorVfsFile::~VectorVfsFile() = default;
|
VectorVfsFile::~VectorVfsFile() = default;
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@ std::shared_ptr<ArrayVfsFile<Size>> MakeArrayFile(const std::array<u8, Size>& da
|
||||||
// An implementation of VfsFile that is backed by a vector optionally supplied upon construction
|
// An implementation of VfsFile that is backed by a vector optionally supplied upon construction
|
||||||
class VectorVfsFile : public VfsFile {
|
class VectorVfsFile : public VfsFile {
|
||||||
public:
|
public:
|
||||||
explicit VectorVfsFile(std::vector<u8> initial_data = {}, std::string name = "",
|
explicit VectorVfsFile(std::vector<u8> initial_data = {}, std::string name_ = "",
|
||||||
VirtualDir parent = nullptr);
|
VirtualDir parent_ = nullptr);
|
||||||
~VectorVfsFile() override;
|
~VectorVfsFile() override;
|
||||||
|
|
||||||
std::string GetName() const override;
|
std::string GetName() const override;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
private:
|
private:
|
||||||
class Device : public Input::TouchDevice {
|
class Device : public Input::TouchDevice {
|
||||||
public:
|
public:
|
||||||
explicit Device(std::weak_ptr<TouchState>&& touch_state) : touch_state(touch_state) {}
|
explicit Device(std::weak_ptr<TouchState>&& touch_state_) : touch_state(touch_state_) {}
|
||||||
Input::TouchStatus GetStatus() const override {
|
Input::TouchStatus GetStatus() const override {
|
||||||
if (auto state = touch_state.lock()) {
|
if (auto state = touch_state.lock()) {
|
||||||
std::lock_guard guard{state->mutex};
|
std::lock_guard guard{state->mutex};
|
||||||
|
|
|
@ -33,8 +33,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {}
|
explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {}
|
||||||
|
|
||||||
explicit RequestHelperBase(Kernel::HLERequestContext& context)
|
explicit RequestHelperBase(Kernel::HLERequestContext& ctx)
|
||||||
: context(&context), cmdbuf(context.CommandBuffer()) {}
|
: context(&ctx), cmdbuf(ctx.CommandBuffer()) {}
|
||||||
|
|
||||||
void Skip(u32 size_in_words, bool set_to_null) {
|
void Skip(u32 size_in_words, bool set_to_null) {
|
||||||
if (set_to_null) {
|
if (set_to_null) {
|
||||||
|
@ -71,12 +71,12 @@ public:
|
||||||
AlwaysMoveHandles = 1,
|
AlwaysMoveHandles = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit ResponseBuilder(Kernel::HLERequestContext& ctx, u32 normal_params_size,
|
explicit ResponseBuilder(Kernel::HLERequestContext& ctx, u32 normal_params_size_,
|
||||||
u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0,
|
u32 num_handles_to_copy_ = 0, u32 num_objects_to_move_ = 0,
|
||||||
Flags flags = Flags::None)
|
Flags flags = Flags::None)
|
||||||
: RequestHelperBase(ctx), normal_params_size(normal_params_size),
|
: RequestHelperBase(ctx), normal_params_size(normal_params_size_),
|
||||||
num_handles_to_copy(num_handles_to_copy),
|
num_handles_to_copy(num_handles_to_copy_),
|
||||||
num_objects_to_move(num_objects_to_move), kernel{ctx.kernel} {
|
num_objects_to_move(num_objects_to_move_), kernel{ctx.kernel} {
|
||||||
|
|
||||||
memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH);
|
memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH);
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ public:
|
||||||
|
|
||||||
ctx.data_size = static_cast<u32>(raw_data_size);
|
ctx.data_size = static_cast<u32>(raw_data_size);
|
||||||
header.data_size.Assign(static_cast<u32>(raw_data_size));
|
header.data_size.Assign(static_cast<u32>(raw_data_size));
|
||||||
if (num_handles_to_copy || num_handles_to_move) {
|
if (num_handles_to_copy != 0 || num_handles_to_move != 0) {
|
||||||
header.enable_handle_descriptor.Assign(1);
|
header.enable_handle_descriptor.Assign(1);
|
||||||
}
|
}
|
||||||
PushRaw(header);
|
PushRaw(header);
|
||||||
|
|
||||||
if (header.enable_handle_descriptor) {
|
if (header.enable_handle_descriptor) {
|
||||||
IPC::HandleDescriptorHeader handle_descriptor_header{};
|
IPC::HandleDescriptorHeader handle_descriptor_header{};
|
||||||
handle_descriptor_header.num_handles_to_copy.Assign(num_handles_to_copy);
|
handle_descriptor_header.num_handles_to_copy.Assign(num_handles_to_copy_);
|
||||||
handle_descriptor_header.num_handles_to_move.Assign(num_handles_to_move);
|
handle_descriptor_header.num_handles_to_move.Assign(num_handles_to_move);
|
||||||
PushRaw(handle_descriptor_header);
|
PushRaw(handle_descriptor_header);
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
GlobalSchedulerContext::GlobalSchedulerContext(KernelCore& kernel)
|
GlobalSchedulerContext::GlobalSchedulerContext(KernelCore& kernel_)
|
||||||
: kernel{kernel}, scheduler_lock{kernel} {}
|
: kernel{kernel_}, scheduler_lock{kernel_} {}
|
||||||
|
|
||||||
GlobalSchedulerContext::~GlobalSchedulerContext() = default;
|
GlobalSchedulerContext::~GlobalSchedulerContext() = default;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class GlobalSchedulerContext final {
|
||||||
public:
|
public:
|
||||||
using LockType = KAbstractSchedulerLock<KScheduler>;
|
using LockType = KAbstractSchedulerLock<KScheduler>;
|
||||||
|
|
||||||
explicit GlobalSchedulerContext(KernelCore& kernel);
|
explicit GlobalSchedulerContext(KernelCore& kernel_);
|
||||||
~GlobalSchedulerContext();
|
~GlobalSchedulerContext();
|
||||||
|
|
||||||
/// Adds a new thread to the scheduler
|
/// Adds a new thread to the scheduler
|
||||||
|
|
|
@ -18,7 +18,8 @@ class KernelCore;
|
||||||
|
|
||||||
class KLightConditionVariable {
|
class KLightConditionVariable {
|
||||||
public:
|
public:
|
||||||
explicit KLightConditionVariable(KernelCore& kernel) : thread_queue(kernel), kernel(kernel) {}
|
explicit KLightConditionVariable(KernelCore& kernel_)
|
||||||
|
: thread_queue(kernel_), kernel(kernel_) {}
|
||||||
|
|
||||||
void Wait(KLightLock* lock, s64 timeout = -1) {
|
void Wait(KLightLock* lock, s64 timeout = -1) {
|
||||||
WaitImpl(lock, timeout);
|
WaitImpl(lock, timeout);
|
||||||
|
|
|
@ -201,10 +201,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator insert(const_iterator pos, reference ref) {
|
iterator insert(const_iterator pos, reference ref) {
|
||||||
KLinkedListNode* node = KLinkedListNode::Allocate(kernel);
|
KLinkedListNode* new_node = KLinkedListNode::Allocate(kernel);
|
||||||
ASSERT(node != nullptr);
|
ASSERT(new_node != nullptr);
|
||||||
node->Initialize(std::addressof(ref));
|
new_node->Initialize(std::addressof(ref));
|
||||||
return iterator(BaseList::insert(pos.m_base_it, *node));
|
return iterator(BaseList::insert(pos.m_base_it, *new_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_back(reference ref) {
|
void push_back(reference ref) {
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
KMemoryBlockManager::KMemoryBlockManager(VAddr start_addr, VAddr end_addr)
|
KMemoryBlockManager::KMemoryBlockManager(VAddr start_addr_, VAddr end_addr_)
|
||||||
: start_addr{start_addr}, end_addr{end_addr} {
|
: start_addr{start_addr_}, end_addr{end_addr_} {
|
||||||
const u64 num_pages{(end_addr - start_addr) / PageSize};
|
const u64 num_pages{(end_addr - start_addr) / PageSize};
|
||||||
memory_block_tree.emplace_back(start_addr, num_pages, KMemoryState::Free,
|
memory_block_tree.emplace_back(start_addr, num_pages, KMemoryState::Free,
|
||||||
KMemoryPermission::None, KMemoryAttribute::None);
|
KMemoryPermission::None, KMemoryAttribute::None);
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
using const_iterator = MemoryBlockTree::const_iterator;
|
using const_iterator = MemoryBlockTree::const_iterator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KMemoryBlockManager(VAddr start_addr, VAddr end_addr);
|
KMemoryBlockManager(VAddr start_addr_, VAddr end_addr_);
|
||||||
|
|
||||||
iterator end() {
|
iterator end() {
|
||||||
return memory_block_tree.end();
|
return memory_block_tree.end();
|
||||||
|
|
|
@ -17,7 +17,7 @@ class KPageLinkedList final {
|
||||||
public:
|
public:
|
||||||
class Node final {
|
class Node final {
|
||||||
public:
|
public:
|
||||||
constexpr Node(u64 addr, std::size_t num_pages) : addr{addr}, num_pages{num_pages} {}
|
constexpr Node(u64 addr_, std::size_t num_pages_) : addr{addr_}, num_pages{num_pages_} {}
|
||||||
|
|
||||||
constexpr u64 GetAddress() const {
|
constexpr u64 GetAddress() const {
|
||||||
return addr;
|
return addr;
|
||||||
|
|
|
@ -58,7 +58,7 @@ constexpr std::size_t GetSizeInRange(const KMemoryInfo& info, VAddr start, VAddr
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
KPageTable::KPageTable(Core::System& system) : system{system} {}
|
KPageTable::KPageTable(Core::System& system_) : system{system_} {}
|
||||||
|
|
||||||
ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type,
|
ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type,
|
||||||
bool enable_aslr, VAddr code_addr,
|
bool enable_aslr, VAddr code_addr,
|
||||||
|
@ -906,8 +906,8 @@ ResultCode KPageTable::LockForDeviceAddressSpace(VAddr addr, std::size_t size) {
|
||||||
|
|
||||||
block_manager->UpdateLock(
|
block_manager->UpdateLock(
|
||||||
addr, size / PageSize,
|
addr, size / PageSize,
|
||||||
[](KMemoryBlockManager::iterator block, KMemoryPermission perm) {
|
[](KMemoryBlockManager::iterator block, KMemoryPermission permission) {
|
||||||
block->ShareToDevice(perm);
|
block->ShareToDevice(permission);
|
||||||
},
|
},
|
||||||
perm);
|
perm);
|
||||||
|
|
||||||
|
@ -929,8 +929,8 @@ ResultCode KPageTable::UnlockForDeviceAddressSpace(VAddr addr, std::size_t size)
|
||||||
|
|
||||||
block_manager->UpdateLock(
|
block_manager->UpdateLock(
|
||||||
addr, size / PageSize,
|
addr, size / PageSize,
|
||||||
[](KMemoryBlockManager::iterator block, KMemoryPermission perm) {
|
[](KMemoryBlockManager::iterator block, KMemoryPermission permission) {
|
||||||
block->UnshareToDevice(perm);
|
block->UnshareToDevice(permission);
|
||||||
},
|
},
|
||||||
perm);
|
perm);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class KMemoryBlockManager;
|
||||||
|
|
||||||
class KPageTable final : NonCopyable {
|
class KPageTable final : NonCopyable {
|
||||||
public:
|
public:
|
||||||
explicit KPageTable(Core::System& system);
|
explicit KPageTable(Core::System& system_);
|
||||||
|
|
||||||
ResultCode InitializeForProcess(FileSys::ProgramAddressSpaceType as_type, bool enable_aslr,
|
ResultCode InitializeForProcess(FileSys::ProgramAddressSpaceType as_type, bool enable_aslr,
|
||||||
VAddr code_addr, std::size_t code_size,
|
VAddr code_addr, std::size_t code_size,
|
||||||
|
|
|
@ -607,7 +607,7 @@ void KScheduler::YieldToAnyThread(KernelCore& kernel) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KScheduler::KScheduler(Core::System& system, s32 core_id) : system(system), core_id(core_id) {
|
KScheduler::KScheduler(Core::System& system_, s32 core_id_) : system{system_}, core_id{core_id_} {
|
||||||
switch_fiber = std::make_shared<Common::Fiber>(OnSwitch, this);
|
switch_fiber = std::make_shared<Common::Fiber>(OnSwitch, this);
|
||||||
state.needs_scheduling.store(true);
|
state.needs_scheduling.store(true);
|
||||||
state.interrupt_task_thread_runnable = false;
|
state.interrupt_task_thread_runnable = false;
|
||||||
|
|
|
@ -30,7 +30,7 @@ class KThread;
|
||||||
|
|
||||||
class KScheduler final {
|
class KScheduler final {
|
||||||
public:
|
public:
|
||||||
explicit KScheduler(Core::System& system, s32 core_id);
|
explicit KScheduler(Core::System& system_, s32 core_id_);
|
||||||
~KScheduler();
|
~KScheduler();
|
||||||
|
|
||||||
/// Reschedules to the next available thread (call after current thread is suspended)
|
/// Reschedules to the next available thread (call after current thread is suspended)
|
||||||
|
|
|
@ -17,8 +17,8 @@ namespace Kernel {
|
||||||
|
|
||||||
class [[nodiscard]] KScopedSchedulerLockAndSleep {
|
class [[nodiscard]] KScopedSchedulerLockAndSleep {
|
||||||
public:
|
public:
|
||||||
explicit KScopedSchedulerLockAndSleep(KernelCore & kernel, KThread * t, s64 timeout)
|
explicit KScopedSchedulerLockAndSleep(KernelCore & kernel_, KThread * t, s64 timeout)
|
||||||
: kernel(kernel), thread(t), timeout_tick(timeout) {
|
: kernel(kernel_), thread(t), timeout_tick(timeout) {
|
||||||
// Lock the scheduler.
|
// Lock the scheduler.
|
||||||
kernel.GlobalSchedulerContext().scheduler_lock.Lock();
|
kernel.GlobalSchedulerContext().scheduler_lock.Lock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Kernel {
|
||||||
|
|
||||||
class KThreadQueue {
|
class KThreadQueue {
|
||||||
public:
|
public:
|
||||||
explicit KThreadQueue(KernelCore& kernel) : kernel{kernel} {}
|
explicit KThreadQueue(KernelCore& kernel_) : kernel{kernel_} {}
|
||||||
|
|
||||||
bool IsEmpty() const {
|
bool IsEmpty() const {
|
||||||
return wait_list.empty();
|
return wait_list.empty();
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
PhysicalCore::PhysicalCore(std::size_t core_index, Core::System& system,
|
PhysicalCore::PhysicalCore(std::size_t core_index_, Core::System& system_, KScheduler& scheduler_,
|
||||||
Kernel::KScheduler& scheduler, Core::CPUInterrupts& interrupts)
|
Core::CPUInterrupts& interrupts_)
|
||||||
: core_index{core_index}, system{system}, scheduler{scheduler},
|
: core_index{core_index_}, system{system_}, scheduler{scheduler_},
|
||||||
interrupts{interrupts}, guard{std::make_unique<Common::SpinLock>()} {}
|
interrupts{interrupts_}, guard{std::make_unique<Common::SpinLock>()} {}
|
||||||
|
|
||||||
PhysicalCore::~PhysicalCore() = default;
|
PhysicalCore::~PhysicalCore() = default;
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ namespace Kernel {
|
||||||
|
|
||||||
class PhysicalCore {
|
class PhysicalCore {
|
||||||
public:
|
public:
|
||||||
PhysicalCore(std::size_t core_index, Core::System& system, Kernel::KScheduler& scheduler,
|
PhysicalCore(std::size_t core_index_, Core::System& system_, KScheduler& scheduler_,
|
||||||
Core::CPUInterrupts& interrupts);
|
Core::CPUInterrupts& interrupts_);
|
||||||
~PhysicalCore();
|
~PhysicalCore();
|
||||||
|
|
||||||
PhysicalCore(const PhysicalCore&) = delete;
|
PhysicalCore(const PhysicalCore&) = delete;
|
||||||
|
|
|
@ -819,10 +819,10 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle handle{};
|
Handle resource_handle{};
|
||||||
R_TRY(handle_table.Add(&handle, resource_limit));
|
R_TRY(handle_table.Add(&resource_handle, resource_limit));
|
||||||
|
|
||||||
*result = handle;
|
*result = resource_handle;
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ enum class ErrorModule : u32 {
|
||||||
PCIe = 120,
|
PCIe = 120,
|
||||||
Friends = 121,
|
Friends = 121,
|
||||||
BCAT = 122,
|
BCAT = 122,
|
||||||
SSL = 123,
|
SSLSrv = 123,
|
||||||
Account = 124,
|
Account = 124,
|
||||||
News = 125,
|
News = 125,
|
||||||
Mii = 126,
|
Mii = 126,
|
||||||
|
|
|
@ -833,7 +833,7 @@ IStorageImpl::~IStorageImpl() = default;
|
||||||
|
|
||||||
class StorageDataImpl final : public IStorageImpl {
|
class StorageDataImpl final : public IStorageImpl {
|
||||||
public:
|
public:
|
||||||
explicit StorageDataImpl(std::vector<u8>&& buffer) : buffer{std::move(buffer)} {}
|
explicit StorageDataImpl(std::vector<u8>&& buffer_) : buffer{std::move(buffer_)} {}
|
||||||
|
|
||||||
std::vector<u8>& GetData() override {
|
std::vector<u8>& GetData() override {
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -1513,9 +1513,9 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
|
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
|
||||||
system.GetContentProvider()};
|
system.GetContentProvider()};
|
||||||
auto res = pm.GetControlMetadata();
|
auto metadata = pm.GetControlMetadata();
|
||||||
if (res.first != nullptr) {
|
if (metadata.first != nullptr) {
|
||||||
return res;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id),
|
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id),
|
||||||
|
@ -1550,9 +1550,9 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
|
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
|
||||||
system.GetContentProvider()};
|
system.GetContentProvider()};
|
||||||
auto res = pm.GetControlMetadata();
|
auto metadata = pm.GetControlMetadata();
|
||||||
if (res.first != nullptr) {
|
if (metadata.first != nullptr) {
|
||||||
return res;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id),
|
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id),
|
||||||
|
|
|
@ -15,11 +15,11 @@ namespace Service::APM {
|
||||||
|
|
||||||
constexpr auto DEFAULT_PERFORMANCE_CONFIGURATION = PerformanceConfiguration::Config7;
|
constexpr auto DEFAULT_PERFORMANCE_CONFIGURATION = PerformanceConfiguration::Config7;
|
||||||
|
|
||||||
Controller::Controller(Core::Timing::CoreTiming& core_timing)
|
Controller::Controller(Core::Timing::CoreTiming& core_timing_)
|
||||||
: core_timing{core_timing}, configs{
|
: core_timing{core_timing_}, configs{
|
||||||
{PerformanceMode::Handheld, DEFAULT_PERFORMANCE_CONFIGURATION},
|
{PerformanceMode::Handheld, DEFAULT_PERFORMANCE_CONFIGURATION},
|
||||||
{PerformanceMode::Docked, DEFAULT_PERFORMANCE_CONFIGURATION},
|
{PerformanceMode::Docked, DEFAULT_PERFORMANCE_CONFIGURATION},
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
Controller::~Controller() = default;
|
Controller::~Controller() = default;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ enum class PerformanceMode : u8 {
|
||||||
// system during times of high load -- this simply maps to different PerformanceConfigs to use.
|
// system during times of high load -- this simply maps to different PerformanceConfigs to use.
|
||||||
class Controller {
|
class Controller {
|
||||||
public:
|
public:
|
||||||
explicit Controller(Core::Timing::CoreTiming& core_timing);
|
explicit Controller(Core::Timing::CoreTiming& core_timing_);
|
||||||
~Controller();
|
~Controller();
|
||||||
|
|
||||||
void SetPerformanceConfiguration(PerformanceMode mode, PerformanceConfiguration config);
|
void SetPerformanceConfiguration(PerformanceMode mode, PerformanceConfiguration config);
|
||||||
|
|
|
@ -362,7 +362,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
|
||||||
static constexpr u64 max_perf_detail_entries = 100;
|
static constexpr u64 max_perf_detail_entries = 100;
|
||||||
|
|
||||||
// Size of the data structure representing the bulk of the voice-related state.
|
// Size of the data structure representing the bulk of the voice-related state.
|
||||||
static constexpr u64 voice_state_size = 0x100;
|
static constexpr u64 voice_state_size_bytes = 0x100;
|
||||||
|
|
||||||
// Size of the upsampler manager data structure
|
// Size of the upsampler manager data structure
|
||||||
constexpr u64 upsampler_manager_size = 0x48;
|
constexpr u64 upsampler_manager_size = 0x48;
|
||||||
|
@ -449,7 +449,8 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
|
||||||
size += Common::AlignUp(voice_info_size * params.voice_count, info_field_alignment_size);
|
size += Common::AlignUp(voice_info_size * params.voice_count, info_field_alignment_size);
|
||||||
size +=
|
size +=
|
||||||
Common::AlignUp(voice_resource_size * params.voice_count, info_field_alignment_size);
|
Common::AlignUp(voice_resource_size * params.voice_count, info_field_alignment_size);
|
||||||
size += Common::AlignUp(voice_state_size * params.voice_count, info_field_alignment_size);
|
size +=
|
||||||
|
Common::AlignUp(voice_state_size_bytes * params.voice_count, info_field_alignment_size);
|
||||||
return size;
|
return size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ public:
|
||||||
Enabled,
|
Enabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit OpusDecoderState(OpusDecoderPtr decoder, u32 sample_rate, u32 channel_count)
|
explicit OpusDecoderState(OpusDecoderPtr decoder_, u32 sample_rate_, u32 channel_count_)
|
||||||
: decoder{std::move(decoder)}, sample_rate{sample_rate}, channel_count{channel_count} {}
|
: decoder{std::move(decoder_)}, sample_rate{sample_rate_}, channel_count{channel_count_} {}
|
||||||
|
|
||||||
// Decodes interleaved Opus packets. Optionally allows reporting time taken to
|
// Decodes interleaved Opus packets. Optionally allows reporting time taken to
|
||||||
// perform the decoding, as well as any relevant extra behavior.
|
// perform the decoding, as well as any relevant extra behavior.
|
||||||
|
@ -160,9 +160,9 @@ private:
|
||||||
|
|
||||||
class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> {
|
class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> {
|
||||||
public:
|
public:
|
||||||
explicit IHardwareOpusDecoderManager(Core::System& system_, OpusDecoderState decoder_state)
|
explicit IHardwareOpusDecoderManager(Core::System& system_, OpusDecoderState decoder_state_)
|
||||||
: ServiceFramework{system_, "IHardwareOpusDecoderManager"}, decoder_state{
|
: ServiceFramework{system_, "IHardwareOpusDecoderManager"}, decoder_state{
|
||||||
std::move(decoder_state)} {
|
std::move(decoder_state_)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IHardwareOpusDecoderManager::DecodeInterleavedOld, "DecodeInterleavedOld"},
|
{0, &IHardwareOpusDecoderManager::DecodeInterleavedOld, "DecodeInterleavedOld"},
|
||||||
|
|
|
@ -3,9 +3,18 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <fmt/ostream.h>
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
|
#endif
|
||||||
#include <httplib.h>
|
#include <httplib.h>
|
||||||
#include <mbedtls/sha256.h>
|
#include <mbedtls/sha256.h>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "common/hex_util.h"
|
#include "common/hex_util.h"
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
@ -178,8 +187,8 @@ bool VfsRawCopyDProgress(FileSys::VirtualDir src, FileSys::VirtualDir dest,
|
||||||
|
|
||||||
class Boxcat::Client {
|
class Boxcat::Client {
|
||||||
public:
|
public:
|
||||||
Client(std::string path, u64 title_id, u64 build_id)
|
Client(std::string path_, u64 title_id_, u64 build_id_)
|
||||||
: path(std::move(path)), title_id(title_id), build_id(build_id) {}
|
: path(std::move(path_)), title_id(title_id_), build_id(build_id_) {}
|
||||||
|
|
||||||
DownloadResult DownloadDataZip() {
|
DownloadResult DownloadDataZip() {
|
||||||
return DownloadInternal(fmt::format(BOXCAT_PATHNAME_DATA, title_id), TIMEOUT_SECONDS,
|
return DownloadInternal(fmt::format(BOXCAT_PATHNAME_DATA, title_id), TIMEOUT_SECONDS,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
ControllerBase::ControllerBase(Core::System& system) : system(system) {}
|
ControllerBase::ControllerBase(Core::System& system_) : system(system_) {}
|
||||||
ControllerBase::~ControllerBase() = default;
|
ControllerBase::~ControllerBase() = default;
|
||||||
|
|
||||||
void ControllerBase::ActivateController() {
|
void ControllerBase::ActivateController() {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class System;
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
class ControllerBase {
|
class ControllerBase {
|
||||||
public:
|
public:
|
||||||
explicit ControllerBase(Core::System& system);
|
explicit ControllerBase(Core::System& system_);
|
||||||
virtual ~ControllerBase();
|
virtual ~ControllerBase();
|
||||||
|
|
||||||
// Called when the controller is initialized
|
// Called when the controller is initialized
|
||||||
|
|
|
@ -23,7 +23,7 @@ constexpr f32 Square(s32 num) {
|
||||||
return static_cast<f32>(num * num);
|
return static_cast<f32>(num * num);
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller_Gesture::Controller_Gesture(Core::System& system) : ControllerBase(system) {}
|
Controller_Gesture::Controller_Gesture(Core::System& system_) : ControllerBase(system_) {}
|
||||||
Controller_Gesture::~Controller_Gesture() = default;
|
Controller_Gesture::~Controller_Gesture() = default;
|
||||||
|
|
||||||
void Controller_Gesture::OnInit() {
|
void Controller_Gesture::OnInit() {
|
||||||
|
@ -211,15 +211,16 @@ void Controller_Gesture::UpdateExistingGesture(GestureProperties& gesture, Touch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_Gesture::EndGesture(GestureProperties& gesture, GestureProperties& last_gesture,
|
void Controller_Gesture::EndGesture(GestureProperties& gesture,
|
||||||
TouchType& type, Attribute& attributes, f32 time_difference) {
|
GestureProperties& last_gesture_props, TouchType& type,
|
||||||
|
Attribute& attributes, f32 time_difference) {
|
||||||
const auto& last_entry =
|
const auto& last_entry =
|
||||||
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
|
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
|
||||||
if (last_gesture.active_points != 0) {
|
if (last_gesture_props.active_points != 0) {
|
||||||
switch (last_entry.type) {
|
switch (last_entry.type) {
|
||||||
case TouchType::Touch:
|
case TouchType::Touch:
|
||||||
if (enable_press_and_tap) {
|
if (enable_press_and_tap) {
|
||||||
SetTapEvent(gesture, last_gesture, type, attributes);
|
SetTapEvent(gesture, last_gesture_props, type, attributes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
type = TouchType::Cancel;
|
type = TouchType::Cancel;
|
||||||
|
@ -234,7 +235,7 @@ void Controller_Gesture::EndGesture(GestureProperties& gesture, GesturePropertie
|
||||||
force_update = true;
|
force_update = true;
|
||||||
break;
|
break;
|
||||||
case TouchType::Pan:
|
case TouchType::Pan:
|
||||||
EndPanEvent(gesture, last_gesture, type, time_difference);
|
EndPanEvent(gesture, last_gesture_props, type, time_difference);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -246,10 +247,11 @@ void Controller_Gesture::EndGesture(GestureProperties& gesture, GesturePropertie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_Gesture::SetTapEvent(GestureProperties& gesture, GestureProperties& last_gesture,
|
void Controller_Gesture::SetTapEvent(GestureProperties& gesture,
|
||||||
TouchType& type, Attribute& attributes) {
|
GestureProperties& last_gesture_props, TouchType& type,
|
||||||
|
Attribute& attributes) {
|
||||||
type = TouchType::Tap;
|
type = TouchType::Tap;
|
||||||
gesture = last_gesture;
|
gesture = last_gesture_props;
|
||||||
force_update = true;
|
force_update = true;
|
||||||
f32 tap_time_difference =
|
f32 tap_time_difference =
|
||||||
static_cast<f32>(last_update_timestamp - last_tap_timestamp) / (1000 * 1000 * 1000);
|
static_cast<f32>(last_update_timestamp - last_tap_timestamp) / (1000 * 1000 * 1000);
|
||||||
|
@ -259,8 +261,9 @@ void Controller_Gesture::SetTapEvent(GestureProperties& gesture, GestureProperti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_Gesture::UpdatePanEvent(GestureProperties& gesture, GestureProperties& last_gesture,
|
void Controller_Gesture::UpdatePanEvent(GestureProperties& gesture,
|
||||||
TouchType& type, f32 time_difference) {
|
GestureProperties& last_gesture_props, TouchType& type,
|
||||||
|
f32 time_difference) {
|
||||||
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
|
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
|
||||||
const auto& last_entry =
|
const auto& last_entry =
|
||||||
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
|
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
|
||||||
|
@ -272,13 +275,14 @@ void Controller_Gesture::UpdatePanEvent(GestureProperties& gesture, GesturePrope
|
||||||
last_pan_time_difference = time_difference;
|
last_pan_time_difference = time_difference;
|
||||||
|
|
||||||
// Promote to pinch type
|
// Promote to pinch type
|
||||||
if (std::abs(gesture.average_distance - last_gesture.average_distance) > pinch_threshold) {
|
if (std::abs(gesture.average_distance - last_gesture_props.average_distance) >
|
||||||
|
pinch_threshold) {
|
||||||
type = TouchType::Pinch;
|
type = TouchType::Pinch;
|
||||||
cur_entry.scale = gesture.average_distance / last_gesture.average_distance;
|
cur_entry.scale = gesture.average_distance / last_gesture_props.average_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
const f32 angle_between_two_lines = std::atan((gesture.angle - last_gesture.angle) /
|
const f32 angle_between_two_lines = std::atan((gesture.angle - last_gesture_props.angle) /
|
||||||
(1 + (gesture.angle * last_gesture.angle)));
|
(1 + (gesture.angle * last_gesture_props.angle)));
|
||||||
// Promote to rotate type
|
// Promote to rotate type
|
||||||
if (std::abs(angle_between_two_lines) > angle_threshold) {
|
if (std::abs(angle_between_two_lines) > angle_threshold) {
|
||||||
type = TouchType::Rotate;
|
type = TouchType::Rotate;
|
||||||
|
@ -287,8 +291,9 @@ void Controller_Gesture::UpdatePanEvent(GestureProperties& gesture, GesturePrope
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_Gesture::EndPanEvent(GestureProperties& gesture, GestureProperties& last_gesture,
|
void Controller_Gesture::EndPanEvent(GestureProperties& gesture,
|
||||||
TouchType& type, f32 time_difference) {
|
GestureProperties& last_gesture_props, TouchType& type,
|
||||||
|
f32 time_difference) {
|
||||||
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
|
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
|
||||||
const auto& last_entry =
|
const auto& last_entry =
|
||||||
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
|
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
|
||||||
|
@ -301,7 +306,7 @@ void Controller_Gesture::EndPanEvent(GestureProperties& gesture, GestureProperti
|
||||||
|
|
||||||
// Set swipe event with parameters
|
// Set swipe event with parameters
|
||||||
if (curr_vel > swipe_threshold) {
|
if (curr_vel > swipe_threshold) {
|
||||||
SetSwipeEvent(gesture, last_gesture, type);
|
SetSwipeEvent(gesture, last_gesture_props, type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,13 +317,13 @@ void Controller_Gesture::EndPanEvent(GestureProperties& gesture, GestureProperti
|
||||||
force_update = true;
|
force_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_Gesture::SetSwipeEvent(GestureProperties& gesture, GestureProperties& last_gesture,
|
void Controller_Gesture::SetSwipeEvent(GestureProperties& gesture,
|
||||||
TouchType& type) {
|
GestureProperties& last_gesture_props, TouchType& type) {
|
||||||
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
|
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
|
||||||
const auto& last_entry =
|
const auto& last_entry =
|
||||||
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
|
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
|
||||||
type = TouchType::Swipe;
|
type = TouchType::Swipe;
|
||||||
gesture = last_gesture;
|
gesture = last_gesture_props;
|
||||||
force_update = true;
|
force_update = true;
|
||||||
cur_entry.delta_x = last_entry.delta_x;
|
cur_entry.delta_x = last_entry.delta_x;
|
||||||
cur_entry.delta_y = last_entry.delta_y;
|
cur_entry.delta_y = last_entry.delta_y;
|
||||||
|
|
|
@ -128,32 +128,34 @@ private:
|
||||||
void UpdateExistingGesture(GestureProperties& gesture, TouchType& type, f32 time_difference);
|
void UpdateExistingGesture(GestureProperties& gesture, TouchType& type, f32 time_difference);
|
||||||
|
|
||||||
// Terminates exiting gesture
|
// Terminates exiting gesture
|
||||||
void EndGesture(GestureProperties& gesture, GestureProperties& last_gesture, TouchType& type,
|
void EndGesture(GestureProperties& gesture, GestureProperties& last_gesture_props,
|
||||||
Attribute& attributes, f32 time_difference);
|
TouchType& type, Attribute& attributes, f32 time_difference);
|
||||||
|
|
||||||
// Set current event to a tap event
|
// Set current event to a tap event
|
||||||
void SetTapEvent(GestureProperties& gesture, GestureProperties& last_gesture, TouchType& type,
|
void SetTapEvent(GestureProperties& gesture, GestureProperties& last_gesture_props,
|
||||||
Attribute& attributes);
|
TouchType& type, Attribute& attributes);
|
||||||
|
|
||||||
// Calculates and set the extra parameters related to a pan event
|
// Calculates and set the extra parameters related to a pan event
|
||||||
void UpdatePanEvent(GestureProperties& gesture, GestureProperties& last_gesture,
|
void UpdatePanEvent(GestureProperties& gesture, GestureProperties& last_gesture_props,
|
||||||
TouchType& type, f32 time_difference);
|
TouchType& type, f32 time_difference);
|
||||||
|
|
||||||
// Terminates the pan event
|
// Terminates the pan event
|
||||||
void EndPanEvent(GestureProperties& gesture, GestureProperties& last_gesture, TouchType& type,
|
void EndPanEvent(GestureProperties& gesture, GestureProperties& last_gesture_props,
|
||||||
f32 time_difference);
|
TouchType& type, f32 time_difference);
|
||||||
|
|
||||||
// Set current event to a swipe event
|
// Set current event to a swipe event
|
||||||
void SetSwipeEvent(GestureProperties& gesture, GestureProperties& last_gesture,
|
void SetSwipeEvent(GestureProperties& gesture, GestureProperties& last_gesture_props,
|
||||||
TouchType& type);
|
TouchType& type);
|
||||||
|
|
||||||
// Returns an unused finger id, if there is no fingers avaliable MAX_FINGERS will be returned
|
// Returns an unused finger id, if there is no fingers available std::nullopt is returned.
|
||||||
std::optional<size_t> GetUnusedFingerID() const;
|
std::optional<size_t> GetUnusedFingerID() const;
|
||||||
|
|
||||||
/** If the touch is new it tries to assing a new finger id, if there is no fingers avaliable no
|
/**
|
||||||
|
* If the touch is new it tries to assign a new finger id, if there is no fingers available no
|
||||||
* changes will be made. Updates the coordinates if the finger id it's already set. If the touch
|
* changes will be made. Updates the coordinates if the finger id it's already set. If the touch
|
||||||
* ends delays the output by one frame to set the end_touch flag before finally freeing the
|
* ends delays the output by one frame to set the end_touch flag before finally freeing the
|
||||||
* finger id */
|
* finger id
|
||||||
|
*/
|
||||||
size_t UpdateTouchInputEvent(const std::tuple<float, float, bool>& touch_input,
|
size_t UpdateTouchInputEvent(const std::tuple<float, float, bool>& touch_input,
|
||||||
size_t finger_id);
|
size_t finger_id);
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ static_assert(std::has_unique_object_representations_v<MiiInfo>,
|
||||||
#pragma pack(push, 4)
|
#pragma pack(push, 4)
|
||||||
|
|
||||||
struct MiiInfoElement {
|
struct MiiInfoElement {
|
||||||
MiiInfoElement(const MiiInfo& info, Source source) : info{info}, source{source} {}
|
MiiInfoElement(const MiiInfo& info_, Source source_) : info{info_}, source{source_} {}
|
||||||
|
|
||||||
MiiInfo info{};
|
MiiInfo info{};
|
||||||
Source source{};
|
Source source{};
|
||||||
|
|
|
@ -253,8 +253,8 @@ private:
|
||||||
|
|
||||||
class MiiDBModule final : public ServiceFramework<MiiDBModule> {
|
class MiiDBModule final : public ServiceFramework<MiiDBModule> {
|
||||||
public:
|
public:
|
||||||
explicit MiiDBModule(Core::System& system_, const char* name)
|
explicit MiiDBModule(Core::System& system_, const char* name_)
|
||||||
: ServiceFramework{system_, name} {
|
: ServiceFramework{system_, name_} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &MiiDBModule::GetDatabaseService, "GetDatabaseService"},
|
{0, &MiiDBModule::GetDatabaseService, "GetDatabaseService"},
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Service::Nvidia::Devices {
|
||||||
/// implement the ioctl interface.
|
/// implement the ioctl interface.
|
||||||
class nvdevice {
|
class nvdevice {
|
||||||
public:
|
public:
|
||||||
explicit nvdevice(Core::System& system) : system{system} {}
|
explicit nvdevice(Core::System& system_) : system{system_} {}
|
||||||
virtual ~nvdevice() = default;
|
virtual ~nvdevice() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,13 +48,13 @@ private:
|
||||||
public:
|
public:
|
||||||
constexpr BufferMap() = default;
|
constexpr BufferMap() = default;
|
||||||
|
|
||||||
constexpr BufferMap(GPUVAddr start_addr, std::size_t size)
|
constexpr BufferMap(GPUVAddr start_addr_, std::size_t size_)
|
||||||
: start_addr{start_addr}, end_addr{start_addr + size} {}
|
: start_addr{start_addr_}, end_addr{start_addr_ + size_} {}
|
||||||
|
|
||||||
constexpr BufferMap(GPUVAddr start_addr, std::size_t size, VAddr cpu_addr,
|
constexpr BufferMap(GPUVAddr start_addr_, std::size_t size_, VAddr cpu_addr_,
|
||||||
bool is_allocated)
|
bool is_allocated_)
|
||||||
: start_addr{start_addr}, end_addr{start_addr + size}, cpu_addr{cpu_addr},
|
: start_addr{start_addr_}, end_addr{start_addr_ + size_}, cpu_addr{cpu_addr_},
|
||||||
is_allocated{is_allocated} {}
|
is_allocated{is_allocated_} {}
|
||||||
|
|
||||||
constexpr VAddr StartAddr() const {
|
constexpr VAddr StartAddr() const {
|
||||||
return start_addr;
|
return start_addr;
|
||||||
|
|
|
@ -27,13 +27,13 @@ protected:
|
||||||
public:
|
public:
|
||||||
constexpr BufferMap() = default;
|
constexpr BufferMap() = default;
|
||||||
|
|
||||||
constexpr BufferMap(GPUVAddr start_addr, std::size_t size)
|
constexpr BufferMap(GPUVAddr start_addr_, std::size_t size_)
|
||||||
: start_addr{start_addr}, end_addr{start_addr + size} {}
|
: start_addr{start_addr_}, end_addr{start_addr_ + size_} {}
|
||||||
|
|
||||||
constexpr BufferMap(GPUVAddr start_addr, std::size_t size, VAddr cpu_addr,
|
constexpr BufferMap(GPUVAddr start_addr_, std::size_t size_, VAddr cpu_addr_,
|
||||||
bool is_allocated)
|
bool is_allocated_)
|
||||||
: start_addr{start_addr}, end_addr{start_addr + size}, cpu_addr{cpu_addr},
|
: start_addr{start_addr_}, end_addr{start_addr_ + size_}, cpu_addr{cpu_addr_},
|
||||||
is_allocated{is_allocated} {}
|
is_allocated{is_allocated_} {}
|
||||||
|
|
||||||
constexpr VAddr StartAddr() const {
|
constexpr VAddr StartAddr() const {
|
||||||
return start_addr;
|
return start_addr;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
namespace Service::Nvidia {
|
namespace Service::Nvidia {
|
||||||
|
|
||||||
SyncpointManager::SyncpointManager(Tegra::GPU& gpu) : gpu{gpu} {}
|
SyncpointManager::SyncpointManager(Tegra::GPU& gpu_) : gpu{gpu_} {}
|
||||||
|
|
||||||
SyncpointManager::~SyncpointManager() = default;
|
SyncpointManager::~SyncpointManager() = default;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Service::Nvidia {
|
||||||
|
|
||||||
class SyncpointManager final {
|
class SyncpointManager final {
|
||||||
public:
|
public:
|
||||||
explicit SyncpointManager(Tegra::GPU& gpu);
|
explicit SyncpointManager(Tegra::GPU& gpu_);
|
||||||
~SyncpointManager();
|
~SyncpointManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
namespace Service::NVFlinger {
|
namespace Service::NVFlinger {
|
||||||
|
|
||||||
BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id)
|
BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_)
|
||||||
: id(id), layer_id(layer_id), buffer_wait_event{kernel} {
|
: id(id_), layer_id(layer_id_), buffer_wait_event{kernel} {
|
||||||
Kernel::KAutoObject::Create(std::addressof(buffer_wait_event));
|
Kernel::KAutoObject::Create(std::addressof(buffer_wait_event));
|
||||||
buffer_wait_event.Initialize("BufferQueue:WaitEvent");
|
buffer_wait_event.Initialize("BufferQueue:WaitEvent");
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
NativeWindowFormat = 2,
|
NativeWindowFormat = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id);
|
explicit BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_);
|
||||||
~BufferQueue();
|
~BufferQueue();
|
||||||
|
|
||||||
enum class BufferTransformFlags : u32 {
|
enum class BufferTransformFlags : u32 {
|
||||||
|
|
|
@ -61,7 +61,7 @@ void NVFlinger::SplitVSync() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NVFlinger::NVFlinger(Core::System& system) : system(system) {
|
NVFlinger::NVFlinger(Core::System& system_) : system(system_) {
|
||||||
displays.emplace_back(0, "Default", system);
|
displays.emplace_back(0, "Default", system);
|
||||||
displays.emplace_back(1, "External", system);
|
displays.emplace_back(1, "External", system);
|
||||||
displays.emplace_back(2, "Edid", system);
|
displays.emplace_back(2, "Edid", system);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class BufferQueue;
|
||||||
|
|
||||||
class NVFlinger final {
|
class NVFlinger final {
|
||||||
public:
|
public:
|
||||||
explicit NVFlinger(Core::System& system);
|
explicit NVFlinger(Core::System& system_);
|
||||||
~NVFlinger();
|
~NVFlinger();
|
||||||
|
|
||||||
/// Sets the NVDrv module instance to use to send buffers to the GPU.
|
/// Sets the NVDrv module instance to use to send buffers to the GPU.
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
namespace Service::PCTL {
|
namespace Service::PCTL {
|
||||||
|
|
||||||
PCTL::PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name,
|
PCTL::PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name,
|
||||||
Capability capability)
|
Capability capability_)
|
||||||
: Interface{system_, std::move(module_), name, capability} {
|
: Interface{system_, std::move(module_), name, capability_} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &PCTL::CreateService, "CreateService"},
|
{0, &PCTL::CreateService, "CreateService"},
|
||||||
{1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},
|
{1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Service::PCTL {
|
||||||
class PCTL final : public Module::Interface {
|
class PCTL final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name,
|
explicit PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name,
|
||||||
Capability capability);
|
Capability capability_);
|
||||||
~PCTL() override;
|
~PCTL() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ std::optional<Kernel::KProcess*> SearchProcessList(
|
||||||
|
|
||||||
void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx,
|
void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx,
|
||||||
const std::vector<Kernel::KProcess*>& process_list) {
|
const std::vector<Kernel::KProcess*>& process_list) {
|
||||||
const auto process = SearchProcessList(process_list, [](const auto& process) {
|
const auto process = SearchProcessList(process_list, [](const auto& proc) {
|
||||||
return process->GetProcessID() == Kernel::KProcess::ProcessIDMin;
|
return proc->GetProcessID() == Kernel::KProcess::ProcessIDMin;
|
||||||
});
|
});
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
@ -100,8 +100,8 @@ private:
|
||||||
LOG_DEBUG(Service_PM, "called, title_id={:016X}", title_id);
|
LOG_DEBUG(Service_PM, "called, title_id={:016X}", title_id);
|
||||||
|
|
||||||
const auto process =
|
const auto process =
|
||||||
SearchProcessList(kernel.GetProcessList(), [title_id](const auto& process) {
|
SearchProcessList(kernel.GetProcessList(), [title_id](const auto& proc) {
|
||||||
return process->GetTitleID() == title_id;
|
return proc->GetTitleID() == title_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!process.has_value()) {
|
if (!process.has_value()) {
|
||||||
|
@ -140,8 +140,8 @@ private:
|
||||||
|
|
||||||
LOG_DEBUG(Service_PM, "called, process_id={:016X}", process_id);
|
LOG_DEBUG(Service_PM, "called, process_id={:016X}", process_id);
|
||||||
|
|
||||||
const auto process = SearchProcessList(process_list, [process_id](const auto& process) {
|
const auto process = SearchProcessList(process_list, [process_id](const auto& proc) {
|
||||||
return process->GetProcessID() == process_id;
|
return proc->GetProcessID() == process_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!process.has_value()) {
|
if (!process.has_value()) {
|
||||||
|
|
|
@ -155,17 +155,17 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Constructs a FunctionInfo for a function.
|
* Constructs a FunctionInfo for a function.
|
||||||
*
|
*
|
||||||
* @param expected_header request header in the command buffer which will trigger dispatch
|
* @param expected_header_ request header in the command buffer which will trigger dispatch
|
||||||
* to this handler
|
* to this handler
|
||||||
* @param handler_callback member function in this service which will be called to handle
|
* @param handler_callback_ member function in this service which will be called to handle
|
||||||
* the request
|
* the request
|
||||||
* @param name human-friendly name for the request. Used mostly for logging purposes.
|
* @param name_ human-friendly name for the request. Used mostly for logging purposes.
|
||||||
*/
|
*/
|
||||||
FunctionInfo(u32 expected_header, HandlerFnP<Self> handler_callback, const char* name)
|
FunctionInfo(u32 expected_header_, HandlerFnP<Self> handler_callback_, const char* name_)
|
||||||
: FunctionInfoBase{
|
: FunctionInfoBase{
|
||||||
expected_header,
|
expected_header_,
|
||||||
// Type-erase member function pointer by casting it down to the base class.
|
// Type-erase member function pointer by casting it down to the base class.
|
||||||
static_cast<HandlerFnP<ServiceFrameworkBase>>(handler_callback), name} {}
|
static_cast<HandlerFnP<ServiceFrameworkBase>>(handler_callback_), name_} {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace Service::Time::Clock {
|
||||||
|
|
||||||
class EphemeralNetworkSystemClockCore final : public SystemClockCore {
|
class EphemeralNetworkSystemClockCore final : public SystemClockCore {
|
||||||
public:
|
public:
|
||||||
explicit EphemeralNetworkSystemClockCore(SteadyClockCore& steady_clock_core)
|
explicit EphemeralNetworkSystemClockCore(SteadyClockCore& steady_clock_core_)
|
||||||
: SystemClockCore{steady_clock_core} {}
|
: SystemClockCore{steady_clock_core_} {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Time::Clock
|
} // namespace Service::Time::Clock
|
||||||
|
|
|
@ -12,8 +12,8 @@ namespace Service::Time::Clock {
|
||||||
|
|
||||||
class LocalSystemClockContextWriter final : public SystemClockContextUpdateCallback {
|
class LocalSystemClockContextWriter final : public SystemClockContextUpdateCallback {
|
||||||
public:
|
public:
|
||||||
explicit LocalSystemClockContextWriter(SharedMemory& shared_memory)
|
explicit LocalSystemClockContextWriter(SharedMemory& shared_memory_)
|
||||||
: SystemClockContextUpdateCallback{}, shared_memory{shared_memory} {}
|
: SystemClockContextUpdateCallback{}, shared_memory{shared_memory_} {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ResultCode Update() override {
|
ResultCode Update() override {
|
||||||
|
|
|
@ -12,8 +12,8 @@ namespace Service::Time::Clock {
|
||||||
|
|
||||||
class NetworkSystemClockContextWriter final : public SystemClockContextUpdateCallback {
|
class NetworkSystemClockContextWriter final : public SystemClockContextUpdateCallback {
|
||||||
public:
|
public:
|
||||||
explicit NetworkSystemClockContextWriter(SharedMemory& shared_memory)
|
explicit NetworkSystemClockContextWriter(SharedMemory& shared_memory_)
|
||||||
: SystemClockContextUpdateCallback{}, shared_memory{shared_memory} {}
|
: SystemClockContextUpdateCallback{}, shared_memory{shared_memory_} {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ResultCode Update() override {
|
ResultCode Update() override {
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace Service::Time::Clock {
|
||||||
|
|
||||||
class StandardLocalSystemClockCore final : public SystemClockCore {
|
class StandardLocalSystemClockCore final : public SystemClockCore {
|
||||||
public:
|
public:
|
||||||
explicit StandardLocalSystemClockCore(SteadyClockCore& steady_clock_core)
|
explicit StandardLocalSystemClockCore(SteadyClockCore& steady_clock_core_)
|
||||||
: SystemClockCore{steady_clock_core} {}
|
: SystemClockCore{steady_clock_core_} {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Time::Clock
|
} // namespace Service::Time::Clock
|
||||||
|
|
|
@ -16,21 +16,21 @@ namespace Service::Time::Clock {
|
||||||
|
|
||||||
class StandardNetworkSystemClockCore final : public SystemClockCore {
|
class StandardNetworkSystemClockCore final : public SystemClockCore {
|
||||||
public:
|
public:
|
||||||
explicit StandardNetworkSystemClockCore(SteadyClockCore& steady_clock_core)
|
explicit StandardNetworkSystemClockCore(SteadyClockCore& steady_clock_core_)
|
||||||
: SystemClockCore{steady_clock_core} {}
|
: SystemClockCore{steady_clock_core_} {}
|
||||||
|
|
||||||
void SetStandardNetworkClockSufficientAccuracy(TimeSpanType value) {
|
void SetStandardNetworkClockSufficientAccuracy(TimeSpanType value) {
|
||||||
standard_network_clock_sufficient_accuracy = value;
|
standard_network_clock_sufficient_accuracy = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) const {
|
bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) const {
|
||||||
SystemClockContext context{};
|
SystemClockContext clock_ctx{};
|
||||||
if (GetClockContext(system, context) != RESULT_SUCCESS) {
|
if (GetClockContext(system, clock_ctx) != RESULT_SUCCESS) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
s64 span{};
|
s64 span{};
|
||||||
if (context.steady_time_point.GetSpanBetween(
|
if (clock_ctx.steady_time_point.GetSpanBetween(
|
||||||
GetSteadyClockCore().GetCurrentTimePoint(system), span) != RESULT_SUCCESS) {
|
GetSteadyClockCore().GetCurrentTimePoint(system), span) != RESULT_SUCCESS) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
namespace Service::Time::Clock {
|
namespace Service::Time::Clock {
|
||||||
|
|
||||||
StandardUserSystemClockCore::StandardUserSystemClockCore(
|
StandardUserSystemClockCore::StandardUserSystemClockCore(
|
||||||
StandardLocalSystemClockCore& local_system_clock_core,
|
StandardLocalSystemClockCore& local_system_clock_core_,
|
||||||
StandardNetworkSystemClockCore& network_system_clock_core, Core::System& system)
|
StandardNetworkSystemClockCore& network_system_clock_core_, Core::System& system_)
|
||||||
: SystemClockCore(local_system_clock_core.GetSteadyClockCore()),
|
: SystemClockCore(local_system_clock_core_.GetSteadyClockCore()),
|
||||||
local_system_clock_core{local_system_clock_core},
|
local_system_clock_core{local_system_clock_core_},
|
||||||
network_system_clock_core{network_system_clock_core}, auto_correction_enabled{},
|
network_system_clock_core{network_system_clock_core_},
|
||||||
auto_correction_time{SteadyClockTimePoint::GetRandom()}, auto_correction_event{
|
auto_correction_time{SteadyClockTimePoint::GetRandom()}, auto_correction_event{
|
||||||
system.Kernel()} {
|
system_.Kernel()} {
|
||||||
Kernel::KAutoObject::Create(std::addressof(auto_correction_event));
|
Kernel::KAutoObject::Create(std::addressof(auto_correction_event));
|
||||||
auto_correction_event.Initialize("StandardUserSystemClockCore:AutoCorrectionEvent");
|
auto_correction_event.Initialize("StandardUserSystemClockCore:AutoCorrectionEvent");
|
||||||
}
|
}
|
||||||
|
@ -35,13 +35,13 @@ ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::Syst
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode StandardUserSystemClockCore::GetClockContext(Core::System& system,
|
ResultCode StandardUserSystemClockCore::GetClockContext(Core::System& system,
|
||||||
SystemClockContext& context) const {
|
SystemClockContext& ctx) const {
|
||||||
if (const ResultCode result{ApplyAutomaticCorrection(system, false)};
|
if (const ResultCode result{ApplyAutomaticCorrection(system, false)};
|
||||||
result != RESULT_SUCCESS) {
|
result != RESULT_SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return local_system_clock_core.GetClockContext(system, context);
|
return local_system_clock_core.GetClockContext(system, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext&) {
|
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext&) {
|
||||||
|
@ -64,13 +64,13 @@ ResultCode StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& s
|
||||||
return ERROR_UNINITIALIZED_CLOCK;
|
return ERROR_UNINITIALIZED_CLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemClockContext context{};
|
SystemClockContext ctx{};
|
||||||
if (const ResultCode result{network_system_clock_core.GetClockContext(system, context)};
|
if (const ResultCode result{network_system_clock_core.GetClockContext(system, ctx)};
|
||||||
result != RESULT_SUCCESS) {
|
result != RESULT_SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
local_system_clock_core.SetClockContext(context);
|
local_system_clock_core.SetClockContext(ctx);
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,13 @@ class StandardNetworkSystemClockCore;
|
||||||
|
|
||||||
class StandardUserSystemClockCore final : public SystemClockCore {
|
class StandardUserSystemClockCore final : public SystemClockCore {
|
||||||
public:
|
public:
|
||||||
StandardUserSystemClockCore(StandardLocalSystemClockCore& local_system_clock_core,
|
StandardUserSystemClockCore(StandardLocalSystemClockCore& local_system_clock_core_,
|
||||||
StandardNetworkSystemClockCore& network_system_clock_core,
|
StandardNetworkSystemClockCore& network_system_clock_core_,
|
||||||
Core::System& system);
|
Core::System& system_);
|
||||||
|
|
||||||
ResultCode SetAutomaticCorrectionEnabled(Core::System& system, bool value);
|
ResultCode SetAutomaticCorrectionEnabled(Core::System& system, bool value);
|
||||||
|
|
||||||
ResultCode GetClockContext(Core::System& system, SystemClockContext& context) const override;
|
ResultCode GetClockContext(Core::System& system, SystemClockContext& ctx) const override;
|
||||||
|
|
||||||
bool IsAutomaticCorrectionEnabled() const {
|
bool IsAutomaticCorrectionEnabled() const {
|
||||||
return auto_correction_enabled;
|
return auto_correction_enabled;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
namespace Service::Time::Clock {
|
namespace Service::Time::Clock {
|
||||||
|
|
||||||
SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core)
|
SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core_)
|
||||||
: steady_clock_core{steady_clock_core} {
|
: steady_clock_core{steady_clock_core_} {
|
||||||
context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId();
|
context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SystemClockContextUpdateCallback;
|
||||||
|
|
||||||
class SystemClockCore {
|
class SystemClockCore {
|
||||||
public:
|
public:
|
||||||
explicit SystemClockCore(SteadyClockCore& steady_clock_core);
|
explicit SystemClockCore(SteadyClockCore& steady_clock_core_);
|
||||||
virtual ~SystemClockCore();
|
virtual ~SystemClockCore();
|
||||||
|
|
||||||
SteadyClockCore& GetSteadyClockCore() const {
|
SteadyClockCore& GetSteadyClockCore() const {
|
||||||
|
|
|
@ -223,7 +223,7 @@ struct TimeManager::Impl final {
|
||||||
TimeZone::TimeZoneContentManager time_zone_content_manager;
|
TimeZone::TimeZoneContentManager time_zone_content_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
TimeManager::TimeManager(Core::System& system) : system{system} {}
|
TimeManager::TimeManager(Core::System& system_) : system{system_} {}
|
||||||
|
|
||||||
TimeManager::~TimeManager() = default;
|
TimeManager::~TimeManager() = default;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class NetworkSystemClockContextWriter;
|
||||||
|
|
||||||
class TimeManager final {
|
class TimeManager final {
|
||||||
public:
|
public:
|
||||||
explicit TimeManager(Core::System& system);
|
explicit TimeManager(Core::System& system_);
|
||||||
~TimeManager();
|
~TimeManager();
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Service::Time {
|
||||||
|
|
||||||
static constexpr std::size_t SHARED_MEMORY_SIZE{0x1000};
|
static constexpr std::size_t SHARED_MEMORY_SIZE{0x1000};
|
||||||
|
|
||||||
SharedMemory::SharedMemory(Core::System& system) : system(system) {
|
SharedMemory::SharedMemory(Core::System& system_) : system(system_) {
|
||||||
std::memset(system.Kernel().GetTimeSharedMem().GetPointer(), 0, SHARED_MEMORY_SIZE);
|
std::memset(system.Kernel().GetTimeSharedMem().GetPointer(), 0, SHARED_MEMORY_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Service::Time {
|
||||||
|
|
||||||
class SharedMemory final {
|
class SharedMemory final {
|
||||||
public:
|
public:
|
||||||
explicit SharedMemory(Core::System& system);
|
explicit SharedMemory(Core::System& system_);
|
||||||
~SharedMemory();
|
~SharedMemory();
|
||||||
|
|
||||||
// TODO(ogniK): We have to properly simulate memory barriers, how are we going to do this?
|
// TODO(ogniK): We have to properly simulate memory barriers, how are we going to do this?
|
||||||
|
|
|
@ -68,8 +68,8 @@ static std::vector<std::string> BuildLocationNameCache(Core::System& system) {
|
||||||
return location_name_cache;
|
return location_name_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeZoneContentManager::TimeZoneContentManager(Core::System& system)
|
TimeZoneContentManager::TimeZoneContentManager(Core::System& system_)
|
||||||
: system{system}, location_name_cache{BuildLocationNameCache(system)} {}
|
: system{system_}, location_name_cache{BuildLocationNameCache(system)} {}
|
||||||
|
|
||||||
void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
|
void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
|
||||||
std::string location_name;
|
std::string location_name;
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Service::Time::TimeZone {
|
||||||
|
|
||||||
class TimeZoneContentManager final {
|
class TimeZoneContentManager final {
|
||||||
public:
|
public:
|
||||||
explicit TimeZoneContentManager(Core::System& system);
|
explicit TimeZoneContentManager(Core::System& system_);
|
||||||
|
|
||||||
void Initialize(TimeManager& time_manager);
|
void Initialize(TimeManager& time_manager);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
Display::Display(u64 id, std::string name, Core::System& system)
|
Display::Display(u64 id, std::string name_, Core::System& system)
|
||||||
: id{id}, name{std::move(name)}, vsync_event{system.Kernel()} {
|
: display_id{id}, name{std::move(name_)}, vsync_event{system.Kernel()} {
|
||||||
Kernel::KAutoObject::Create(std::addressof(vsync_event));
|
Kernel::KAutoObject::Create(std::addressof(vsync_event));
|
||||||
vsync_event.Initialize(fmt::format("Display VSync Event {}", id));
|
vsync_event.Initialize(fmt::format("Display VSync Event {}", id));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,14 +32,14 @@ public:
|
||||||
/// Constructs a display with a given unique ID and name.
|
/// Constructs a display with a given unique ID and name.
|
||||||
///
|
///
|
||||||
/// @param id The unique ID for this display.
|
/// @param id The unique ID for this display.
|
||||||
/// @param name The name for this display.
|
/// @param name_ The name for this display.
|
||||||
///
|
///
|
||||||
Display(u64 id, std::string name, Core::System& system);
|
Display(u64 id, std::string name_, Core::System& system);
|
||||||
~Display();
|
~Display();
|
||||||
|
|
||||||
/// Gets the unique ID assigned to this display.
|
/// Gets the unique ID assigned to this display.
|
||||||
u64 GetID() const {
|
u64 GetID() const {
|
||||||
return id;
|
return display_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the name of this display
|
/// Gets the name of this display
|
||||||
|
@ -96,7 +96,7 @@ public:
|
||||||
const Layer* FindLayer(u64 layer_id) const;
|
const Layer* FindLayer(u64 layer_id) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u64 id;
|
u64 display_id;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Layer>> layers;
|
std::vector<std::shared_ptr<Layer>> layers;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
Layer::Layer(u64 id, NVFlinger::BufferQueue& queue) : id{id}, buffer_queue{queue} {}
|
Layer::Layer(u64 id, NVFlinger::BufferQueue& queue) : layer_id{id}, buffer_queue{queue} {}
|
||||||
|
|
||||||
Layer::~Layer() = default;
|
Layer::~Layer() = default;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
|
|
||||||
/// Gets the ID for this layer.
|
/// Gets the ID for this layer.
|
||||||
u64 GetID() const {
|
u64 GetID() const {
|
||||||
return id;
|
return layer_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a reference to the buffer queue this layer is using.
|
/// Gets a reference to the buffer queue this layer is using.
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u64 id;
|
u64 layer_id;
|
||||||
NVFlinger::BufferQueue& buffer_queue;
|
NVFlinger::BufferQueue& buffer_queue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ private:
|
||||||
|
|
||||||
class IGBPConnectRequestParcel : public Parcel {
|
class IGBPConnectRequestParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPConnectRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
|
explicit IGBPConnectRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
|
||||||
Deserialize();
|
Deserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,8 +274,8 @@ private:
|
||||||
|
|
||||||
class IGBPSetPreallocatedBufferRequestParcel : public Parcel {
|
class IGBPSetPreallocatedBufferRequestParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPSetPreallocatedBufferRequestParcel(std::vector<u8> buffer)
|
explicit IGBPSetPreallocatedBufferRequestParcel(std::vector<u8> buffer_)
|
||||||
: Parcel(std::move(buffer)) {
|
: Parcel(std::move(buffer_)) {
|
||||||
Deserialize();
|
Deserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ protected:
|
||||||
|
|
||||||
class IGBPCancelBufferRequestParcel : public Parcel {
|
class IGBPCancelBufferRequestParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPCancelBufferRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
|
explicit IGBPCancelBufferRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
|
||||||
Deserialize();
|
Deserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ protected:
|
||||||
|
|
||||||
class IGBPDequeueBufferRequestParcel : public Parcel {
|
class IGBPDequeueBufferRequestParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPDequeueBufferRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
|
explicit IGBPDequeueBufferRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
|
||||||
Deserialize();
|
Deserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,8 +360,8 @@ public:
|
||||||
|
|
||||||
class IGBPDequeueBufferResponseParcel : public Parcel {
|
class IGBPDequeueBufferResponseParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPDequeueBufferResponseParcel(u32 slot, Service::Nvidia::MultiFence& multi_fence)
|
explicit IGBPDequeueBufferResponseParcel(u32 slot_, Nvidia::MultiFence& multi_fence_)
|
||||||
: slot(slot), multi_fence(multi_fence) {}
|
: slot(slot_), multi_fence(multi_fence_) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SerializeData() override {
|
void SerializeData() override {
|
||||||
|
@ -377,7 +377,7 @@ protected:
|
||||||
|
|
||||||
class IGBPRequestBufferRequestParcel : public Parcel {
|
class IGBPRequestBufferRequestParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPRequestBufferRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
|
explicit IGBPRequestBufferRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
|
||||||
Deserialize();
|
Deserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ public:
|
||||||
|
|
||||||
class IGBPRequestBufferResponseParcel : public Parcel {
|
class IGBPRequestBufferResponseParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPRequestBufferResponseParcel(NVFlinger::IGBPBuffer buffer) : buffer(buffer) {}
|
explicit IGBPRequestBufferResponseParcel(NVFlinger::IGBPBuffer buffer_) : buffer(buffer_) {}
|
||||||
~IGBPRequestBufferResponseParcel() override = default;
|
~IGBPRequestBufferResponseParcel() override = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -408,7 +408,7 @@ protected:
|
||||||
|
|
||||||
class IGBPQueueBufferRequestParcel : public Parcel {
|
class IGBPQueueBufferRequestParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPQueueBufferRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
|
explicit IGBPQueueBufferRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
|
||||||
Deserialize();
|
Deserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ private:
|
||||||
|
|
||||||
class IGBPQueryRequestParcel : public Parcel {
|
class IGBPQueryRequestParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPQueryRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
|
explicit IGBPQueryRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
|
||||||
Deserialize();
|
Deserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ public:
|
||||||
|
|
||||||
class IGBPQueryResponseParcel : public Parcel {
|
class IGBPQueryResponseParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPQueryResponseParcel(u32 value) : value(value) {}
|
explicit IGBPQueryResponseParcel(u32 value_) : value{value_} {}
|
||||||
~IGBPQueryResponseParcel() override = default;
|
~IGBPQueryResponseParcel() override = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
namespace Loader {
|
namespace Loader {
|
||||||
|
|
||||||
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_,
|
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_,
|
||||||
bool override_update)
|
bool override_update_)
|
||||||
: AppLoader(std::move(file_)), override_update(override_update) {
|
: AppLoader(std::move(file_)), override_update(override_update_) {
|
||||||
const auto file_dir = file->GetContainingDirectory();
|
const auto file_dir = file->GetContainingDirectory();
|
||||||
|
|
||||||
// Title ID
|
// Title ID
|
||||||
|
@ -48,9 +48,9 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
|
||||||
// Any png, jpeg, or bmp file
|
// Any png, jpeg, or bmp file
|
||||||
const auto& files = file_dir->GetFiles();
|
const auto& files = file_dir->GetFiles();
|
||||||
const auto icon_iter =
|
const auto icon_iter =
|
||||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& f) {
|
||||||
return file->GetExtension() == "png" || file->GetExtension() == "jpg" ||
|
return f->GetExtension() == "png" || f->GetExtension() == "jpg" ||
|
||||||
file->GetExtension() == "bmp" || file->GetExtension() == "jpeg";
|
f->GetExtension() == "bmp" || f->GetExtension() == "jpeg";
|
||||||
});
|
});
|
||||||
if (icon_iter != files.end())
|
if (icon_iter != files.end())
|
||||||
icon_data = (*icon_iter)->ReadAllBytes();
|
icon_data = (*icon_iter)->ReadAllBytes();
|
||||||
|
@ -61,9 +61,8 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
|
||||||
if (nacp_file == nullptr) {
|
if (nacp_file == nullptr) {
|
||||||
const auto& files = file_dir->GetFiles();
|
const auto& files = file_dir->GetFiles();
|
||||||
const auto nacp_iter =
|
const auto nacp_iter =
|
||||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
std::find_if(files.begin(), files.end(),
|
||||||
return file->GetExtension() == "nacp";
|
[](const FileSys::VirtualFile& f) { return f->GetExtension() == "nacp"; });
|
||||||
});
|
|
||||||
if (nacp_iter != files.end())
|
if (nacp_iter != files.end())
|
||||||
nacp_file = *nacp_iter;
|
nacp_file = *nacp_iter;
|
||||||
}
|
}
|
||||||
|
@ -75,9 +74,9 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(
|
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(
|
||||||
FileSys::VirtualDir directory, bool override_update)
|
FileSys::VirtualDir directory, bool override_update_)
|
||||||
: AppLoader(directory->GetFile("main")), dir(std::move(directory)),
|
: AppLoader(directory->GetFile("main")), dir(std::move(directory)),
|
||||||
override_update(override_update) {}
|
override_update(override_update_) {}
|
||||||
|
|
||||||
FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::VirtualFile& dir_file) {
|
FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::VirtualFile& dir_file) {
|
||||||
if (FileSys::IsDirectoryExeFS(dir_file->GetContainingDirectory())) {
|
if (FileSys::IsDirectoryExeFS(dir_file->GetContainingDirectory())) {
|
||||||
|
@ -184,8 +183,8 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
||||||
// Find the RomFS by searching for a ".romfs" file in this directory
|
// Find the RomFS by searching for a ".romfs" file in this directory
|
||||||
const auto& files = dir->GetFiles();
|
const auto& files = dir->GetFiles();
|
||||||
const auto romfs_iter =
|
const auto romfs_iter =
|
||||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& f) {
|
||||||
return file->GetName().find(".romfs") != std::string::npos;
|
return f->GetName().find(".romfs") != std::string::npos;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Register the RomFS if a ".romfs" file was found
|
// Register the RomFS if a ".romfs" file was found
|
||||||
|
|
|
@ -24,11 +24,11 @@ namespace Loader {
|
||||||
class AppLoader_DeconstructedRomDirectory final : public AppLoader {
|
class AppLoader_DeconstructedRomDirectory final : public AppLoader {
|
||||||
public:
|
public:
|
||||||
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile main_file,
|
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile main_file,
|
||||||
bool override_update = false);
|
bool override_update_ = false);
|
||||||
|
|
||||||
// Overload to accept exefs directory. Must contain 'main' and 'main.npdm'
|
// Overload to accept exefs directory. Must contain 'main' and 'main.npdm'
|
||||||
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualDir directory,
|
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualDir directory,
|
||||||
bool override_update = false);
|
bool override_update_ = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies whether or not the given file is a deconstructed ROM directory.
|
* Identifies whether or not the given file is a deconstructed ROM directory.
|
||||||
|
|
|
@ -194,7 +194,7 @@ std::ostream& operator<<(std::ostream& os, ResultStatus status) {
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLoader::AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {}
|
AppLoader::AppLoader(FileSys::VirtualFile file_) : file(std::move(file_)) {}
|
||||||
AppLoader::~AppLoader() = default;
|
AppLoader::~AppLoader() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -147,7 +147,7 @@ public:
|
||||||
};
|
};
|
||||||
using LoadResult = std::pair<ResultStatus, std::optional<LoadParameters>>;
|
using LoadResult = std::pair<ResultStatus, std::optional<LoadParameters>>;
|
||||||
|
|
||||||
explicit AppLoader(FileSys::VirtualFile file);
|
explicit AppLoader(FileSys::VirtualFile file_);
|
||||||
virtual ~AppLoader();
|
virtual ~AppLoader();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,8 +37,8 @@ std::string_view ExtractName(std::string_view data, std::size_t start_index, cha
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
StandardVmCallbacks::StandardVmCallbacks(Core::System& system, const CheatProcessMetadata& metadata)
|
StandardVmCallbacks::StandardVmCallbacks(System& system_, const CheatProcessMetadata& metadata_)
|
||||||
: metadata(metadata), system(system) {}
|
: metadata{metadata_}, system{system_} {}
|
||||||
|
|
||||||
StandardVmCallbacks::~StandardVmCallbacks() = default;
|
StandardVmCallbacks::~StandardVmCallbacks() = default;
|
||||||
|
|
||||||
|
@ -174,11 +174,11 @@ std::vector<CheatEntry> TextCheatParser::Parse(std::string_view data) const {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
CheatEngine::CheatEngine(Core::System& system, std::vector<CheatEntry> cheats,
|
CheatEngine::CheatEngine(System& system_, std::vector<CheatEntry> cheats_,
|
||||||
const std::array<u8, 0x20>& build_id)
|
const std::array<u8, 0x20>& build_id_)
|
||||||
: vm{std::make_unique<StandardVmCallbacks>(system, metadata)},
|
: vm{std::make_unique<StandardVmCallbacks>(system_, metadata)},
|
||||||
cheats(std::move(cheats)), core_timing{system.CoreTiming()}, system{system} {
|
cheats(std::move(cheats_)), core_timing{system_.CoreTiming()}, system{system_} {
|
||||||
metadata.main_nso_build_id = build_id;
|
metadata.main_nso_build_id = build_id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
CheatEngine::~CheatEngine() {
|
CheatEngine::~CheatEngine() {
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Core::Memory {
|
||||||
|
|
||||||
class StandardVmCallbacks : public DmntCheatVm::Callbacks {
|
class StandardVmCallbacks : public DmntCheatVm::Callbacks {
|
||||||
public:
|
public:
|
||||||
StandardVmCallbacks(Core::System& system, const CheatProcessMetadata& metadata);
|
StandardVmCallbacks(System& system_, const CheatProcessMetadata& metadata_);
|
||||||
~StandardVmCallbacks() override;
|
~StandardVmCallbacks() override;
|
||||||
|
|
||||||
void MemoryRead(VAddr address, void* data, u64 size) override;
|
void MemoryRead(VAddr address, void* data, u64 size) override;
|
||||||
|
@ -38,7 +38,7 @@ private:
|
||||||
VAddr SanitizeAddress(VAddr address) const;
|
VAddr SanitizeAddress(VAddr address) const;
|
||||||
|
|
||||||
const CheatProcessMetadata& metadata;
|
const CheatProcessMetadata& metadata;
|
||||||
Core::System& system;
|
System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Intermediary class that parses a text file or other disk format for storing cheats into a
|
// Intermediary class that parses a text file or other disk format for storing cheats into a
|
||||||
|
@ -61,8 +61,8 @@ public:
|
||||||
// Class that encapsulates a CheatList and manages its interaction with memory and CoreTiming
|
// Class that encapsulates a CheatList and manages its interaction with memory and CoreTiming
|
||||||
class CheatEngine final {
|
class CheatEngine final {
|
||||||
public:
|
public:
|
||||||
CheatEngine(Core::System& system_, std::vector<CheatEntry> cheats_,
|
CheatEngine(System& system_, std::vector<CheatEntry> cheats_,
|
||||||
const std::array<u8, 0x20>& build_id);
|
const std::array<u8, 0x20>& build_id_);
|
||||||
~CheatEngine();
|
~CheatEngine();
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
|
|
||||||
namespace Core::Memory {
|
namespace Core::Memory {
|
||||||
|
|
||||||
DmntCheatVm::DmntCheatVm(std::unique_ptr<Callbacks> callbacks) : callbacks(std::move(callbacks)) {}
|
DmntCheatVm::DmntCheatVm(std::unique_ptr<Callbacks> callbacks_)
|
||||||
|
: callbacks(std::move(callbacks_)) {}
|
||||||
|
|
||||||
DmntCheatVm::~DmntCheatVm() = default;
|
DmntCheatVm::~DmntCheatVm() = default;
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ public:
|
||||||
static constexpr std::size_t NumStaticRegisters =
|
static constexpr std::size_t NumStaticRegisters =
|
||||||
NumReadableStaticRegisters + NumWritableStaticRegisters;
|
NumReadableStaticRegisters + NumWritableStaticRegisters;
|
||||||
|
|
||||||
explicit DmntCheatVm(std::unique_ptr<Callbacks> callbacks);
|
explicit DmntCheatVm(std::unique_ptr<Callbacks> callbacks_);
|
||||||
~DmntCheatVm();
|
~DmntCheatVm();
|
||||||
|
|
||||||
std::size_t GetProgramSize() const {
|
std::size_t GetProgramSize() const {
|
||||||
|
|
|
@ -27,7 +27,7 @@ constexpr std::size_t IgnoreFrames = 5;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
PerfStats::PerfStats(u64 title_id) : title_id(title_id) {}
|
PerfStats::PerfStats(u64 title_id_) : title_id(title_id_) {}
|
||||||
|
|
||||||
PerfStats::~PerfStats() {
|
PerfStats::~PerfStats() {
|
||||||
if (!Settings::values.record_frame_times || title_id == 0) {
|
if (!Settings::values.record_frame_times || title_id == 0) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct PerfStatsResults {
|
||||||
*/
|
*/
|
||||||
class PerfStats {
|
class PerfStats {
|
||||||
public:
|
public:
|
||||||
explicit PerfStats(u64 title_id);
|
explicit PerfStats(u64 title_id_);
|
||||||
~PerfStats();
|
~PerfStats();
|
||||||
|
|
||||||
using Clock = std::chrono::high_resolution_clock;
|
using Clock = std::chrono::high_resolution_clock;
|
||||||
|
|
|
@ -192,7 +192,7 @@ json GetHLERequestContextData(Kernel::HLERequestContext& ctx, Core::Memory::Memo
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
Reporter::Reporter(System& system) : system(system) {}
|
Reporter::Reporter(System& system_) : system(system_) {}
|
||||||
|
|
||||||
Reporter::~Reporter() = default;
|
Reporter::~Reporter() = default;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class System;
|
||||||
|
|
||||||
class Reporter {
|
class Reporter {
|
||||||
public:
|
public:
|
||||||
explicit Reporter(System& system);
|
explicit Reporter(System& system_);
|
||||||
~Reporter();
|
~Reporter();
|
||||||
|
|
||||||
// Used by fatal services
|
// Used by fatal services
|
||||||
|
|
Loading…
Reference in a new issue