mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-06 17:42:14 +02:00
lr: Imrpoved path handling and adjust ResolveAddOnContentPath order
This commit is contained in:
parent
75ee69c0b5
commit
d0da24920b
@ -28,12 +28,13 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ncm::IContentMetaDatabase> content_meta_database;
|
std::shared_ptr<ncm::IContentMetaDatabase> content_meta_database;
|
||||||
std::shared_ptr<ncm::IContentStorage> content_storage;
|
|
||||||
R_TRY(ncm::impl::OpenContentMetaDatabase(&content_meta_database, storage_id));
|
|
||||||
R_TRY(ncm::impl::OpenContentStorage(&content_storage, storage_id));
|
|
||||||
|
|
||||||
ncm::ContentId data_content_id;
|
ncm::ContentId data_content_id;
|
||||||
|
R_TRY(ncm::impl::OpenContentMetaDatabase(&content_meta_database, storage_id));
|
||||||
R_TRY(content_meta_database->GetLatestData(&data_content_id, tid));
|
R_TRY(content_meta_database->GetLatestData(&data_content_id, tid));
|
||||||
|
|
||||||
|
std::shared_ptr<ncm::IContentStorage> content_storage;
|
||||||
|
R_TRY(ncm::impl::OpenContentStorage(&content_storage, storage_id));
|
||||||
R_ASSERT(content_storage->GetPath(&path, data_content_id));
|
R_ASSERT(content_storage->GetPath(&path, data_content_id));
|
||||||
*out.pointer = path;
|
*out.pointer = path;
|
||||||
|
|
||||||
|
@ -30,22 +30,19 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path(const char* path) {
|
Path(const char* path) {
|
||||||
strlcpy(this->path, path, MaxPathLen);
|
strncpy(this->path, path, MaxPathLen-1);
|
||||||
|
this->EnsureNullTerminated();
|
||||||
}
|
}
|
||||||
|
|
||||||
Path& operator=(const Path& other) {
|
Path& operator=(const Path& other) {
|
||||||
/* N appears to always memcpy paths, so we will too. */
|
/* N appears to always memcpy paths, so we will too. */
|
||||||
memcpy(this->path, other.path, MaxPathLen);
|
std::memcpy(this->path, other.path, MaxPathLen);
|
||||||
this->EnsureNullTerminated();
|
this->EnsureNullTerminated();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnsureNullTerminated() {
|
void EnsureNullTerminated() {
|
||||||
const size_t len = strnlen(this->path, MaxPathLen);
|
path[MaxPathLen-1] = '\0';
|
||||||
|
|
||||||
if (len == MaxPathLen) {
|
|
||||||
path[MaxPathLen-1] = '\0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user