NCM client implementation (#858)

* ncm: Implement InstallTaskDataBase and FileInstallTaskData

* ncm: minor bugfixes

* ncm: Implemented MemoryInstallTaskData

* ncm: more std

* ncm: begin implementing install task base

* ncm: move protected funcs

* ncm: fix recursive include

* ncm: more install task progress

* ncm install task: implement IncrementProgress and update UpdateThroughputMeasurement

* ncm: more work

* ncm client: more progress

* ncm client: more progress

* ncm client: finish implementing GetContentMetaInfoList

* ncm client: more progress

* ncm client: finished InstallTaskBase

* ncm client: implement PackageInstallTaskBase

* ncm client: fixes

* ncm: improve accuracy

* ncm client: implement PackageInstallTask

* ncm client: implement PackageSystemUpdateTask

* ncm client: minor name tweaks

* ncm client: implement SubmissionPackageInstallTask

* ncm client: add missing this to SubmissionPackageInstallTask

* ncm client: add missing nullptr check to SubmissionPackageInstallTask destructor

* ncm client: SubmissionPackageInstallTask fixes

* ncm: fix forward declarations

* ncm client: added simplified funcs

* ncm: cleanup client code

* ncm: fix bug introduced by cleanup

* ncm: fix typo

* ncm: implement correct ReadVariationContentMetaInfoList behavior

* ncm: correct InstallContentMetaWriter ctor

* ncm: correct conversion of content meta header types

Co-authored-by: Michael Scire <SciresM@gmail.com>
This commit is contained in:
Adubbz
2020-04-04 16:40:46 +11:00
committed by GitHub
parent 76d72fa946
commit a50d6a2696
48 changed files with 4163 additions and 56 deletions

View File

@@ -27,7 +27,7 @@ namespace ams::lr {
Path path;
u32 flags;
public:
Redirection(ncm::ProgramId program_id, ncm::ProgramId owner_id, const Path& path, u32 flags) :
Redirection(ncm::ProgramId program_id, ncm::ProgramId owner_id, const Path &path, u32 flags) :
program_id(program_id), owner_id(owner_id), path(path), flags(flags) { /* ... */ }
ncm::ProgramId GetProgramId() const {

View File

@@ -47,7 +47,7 @@ namespace ams::lr {
inline void RegisterImpl(size_t i, const Key &key, const Value &value, const ncm::ProgramId owner_id) {
/* Populate entry. */
Entry& entry = this->entries[i];
Entry &entry = this->entries[i];
entry.key = key;
entry.value = value;
entry.owner_id = owner_id;
@@ -61,7 +61,7 @@ namespace ams::lr {
bool Register(const Key &key, const Value &value, const ncm::ProgramId owner_id) {
/* Try to find an existing value. */
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
Entry &entry = this->entries[i];
if (entry.is_valid && entry.key == key) {
this->RegisterImpl(i, key, value, owner_id);
return true;
@@ -70,7 +70,7 @@ namespace ams::lr {
/* We didn't find an existing entry, so try to create a new one. */
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
Entry &entry = this->entries[i];
if (!entry.is_valid) {
this->RegisterImpl(i, key, value, owner_id);
return true;
@@ -83,7 +83,7 @@ namespace ams::lr {
void Unregister(const Key &key) {
/* Invalidate entries with a matching key. */
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
Entry &entry = this->entries[i];
if (entry.is_valid && entry.key == key) {
entry.is_valid = false;
}
@@ -93,7 +93,7 @@ namespace ams::lr {
void UnregisterOwnerProgram(ncm::ProgramId owner_id) {
/* Invalidate entries with a matching owner id. */
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
Entry &entry = this->entries[i];
if (entry.owner_id == owner_id) {
entry.is_valid = false;
}
@@ -103,7 +103,7 @@ namespace ams::lr {
bool Find(Value *out, const Key &key) const {
/* Locate a matching entry. */
for (size_t i = 0; i < this->GetCapacity(); i++) {
const Entry& entry = this->entries[i];
const Entry &entry = this->entries[i];
if (entry.is_valid && entry.key == key) {
*out = entry.value;
return true;
@@ -123,7 +123,7 @@ namespace ams::lr {
void ClearExcluding(const ncm::ProgramId *ids, size_t num_ids) {
/* Invalidate all entries unless excluded. */
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
Entry &entry = this->entries[i];
if (!this->IsExcluded(entry.owner_id, ids, num_ids)) {
entry.is_valid = false;