mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-22 20:06:40 +00:00
Fixed List implementation. Also lots of debug logging.
This commit is contained in:
parent
6e5c0bde51
commit
4e75776112
5 changed files with 43 additions and 6 deletions
|
@ -24,6 +24,7 @@ namespace sts::debug {
|
|||
|
||||
size_t g_curr_log_offset = 0;
|
||||
size_t g_log_skip = 1000;
|
||||
u32 g_page_num = 0;
|
||||
|
||||
char __attribute__ ((aligned (0x1000))) g_work_page[0x1000];
|
||||
|
||||
|
@ -94,8 +95,10 @@ namespace sts::debug {
|
|||
}
|
||||
|
||||
g_log_skip--;
|
||||
clear_iram();
|
||||
g_curr_log_offset = 0;
|
||||
g_page_num++;
|
||||
clear_iram();
|
||||
CopyToIram(IRAM_SAFE_END-sizeof(u32), &g_page_num, sizeof(u32));
|
||||
}
|
||||
|
||||
/* Fill remainder with 0s. */
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace sts::lr {
|
|||
|
||||
R_ASSERT(this->content_storage->GetPath(&path, program_content_id));
|
||||
*out.pointer = path;
|
||||
debug::DebugLog("Resolved program path to %s\n", path.path);
|
||||
D_LOG("path: %s\n", path.path);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ namespace sts::lr {
|
|||
Result ContentLocationResolverInterface::RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
|
||||
R_DEBUG_START
|
||||
this->program_redirector.SetRedirection(tid, *path.pointer);
|
||||
D_LOG("path: %s\n", (*path.pointer).path);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
@ -94,6 +95,7 @@ namespace sts::lr {
|
|||
R_TRY(this->content_meta_database->GetLatestData(&data_content_id, tid));
|
||||
R_ASSERT(this->content_storage->GetPath(&path, data_content_id));
|
||||
*out.pointer = path;
|
||||
D_LOG("path: %s\n", path.path);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
@ -108,7 +110,7 @@ namespace sts::lr {
|
|||
Result ContentLocationResolverInterface::RedirectApplicationHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) {
|
||||
R_DEBUG_START
|
||||
this->html_docs_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
|
||||
debug::DebugLog("Redirected application html document path to %s\n", (*path.pointer).path);
|
||||
D_LOG("path: %s\n", (*path.pointer).path);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace sts::ncm {
|
|||
|
||||
Result ContentManagerService::OpenContentStorage(Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id) {
|
||||
R_DEBUG_START
|
||||
D_LOG("storage id: 0x%x\n", storage_id);
|
||||
std::shared_ptr<IContentStorage> content_storage;
|
||||
R_TRY(impl::OpenContentStorage(&content_storage, storage_id));
|
||||
out.SetValue(std::move(content_storage));
|
||||
|
@ -56,6 +57,7 @@ namespace sts::ncm {
|
|||
|
||||
Result ContentManagerService::OpenContentMetaDatabase(Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id) {
|
||||
R_DEBUG_START
|
||||
D_LOG("storage id: 0x%x\n", storage_id);
|
||||
std::shared_ptr<IContentMetaDatabase> content_meta_database;
|
||||
R_TRY(impl::OpenContentMetaDatabase(&content_meta_database, storage_id));
|
||||
out.SetValue(std::move(content_meta_database));
|
||||
|
|
|
@ -95,7 +95,10 @@ namespace sts::ncm {
|
|||
Result ContentMetaDatabaseInterface::GetContentIdByTypeImpl(ContentId* out, const ContentMetaKey& key, ContentType type, std::optional<u8> id_offset) {
|
||||
R_TRY(this->EnsureEnabled());
|
||||
|
||||
D_LOG("key: 0x%lx\n", key.id);
|
||||
D_LOG("key id: 0x%lx\n", key.id);
|
||||
D_LOG("key version: 0x%x\n", key.version)
|
||||
D_LOG("type: 0x%x\n", type);
|
||||
D_LOG("id_offset: 0x%x\n", id_offset);
|
||||
|
||||
const auto it = this->kvs->lower_bound(key);
|
||||
if (it == this->kvs->end() || it->GetKey().id != key.id) {
|
||||
|
@ -143,6 +146,9 @@ namespace sts::ncm {
|
|||
return ResultNcmContentNotFound;
|
||||
}
|
||||
|
||||
char content_name[sizeof(ContentId)*2+1] = {0};
|
||||
GetStringFromContentId(content_name, found_content_info->content_id);
|
||||
D_LOG("content id: %s.nca\n", content_name);
|
||||
*out = found_content_info->content_id;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
@ -250,6 +256,12 @@ namespace sts::ncm {
|
|||
size_t entries_total = 0;
|
||||
size_t entries_written = 0;
|
||||
|
||||
D_LOG("app tid: 0x%x\n", application_title_id);
|
||||
D_LOG("meta type: 0x%x\n", type);
|
||||
D_LOG("install type: 0x%x\n", install_type);
|
||||
D_LOG("tid min: 0x%lx\n", title_id_min);
|
||||
D_LOG("tid max: 0x%lx\n", title_id_max);
|
||||
|
||||
/* If there are no entries then we've already successfully listed them all. */
|
||||
if (this->kvs->GetCount() == 0) {
|
||||
out_entries_total.SetValue(entries_total);
|
||||
|
@ -261,7 +273,7 @@ namespace sts::ncm {
|
|||
ContentMetaKey key = entry->GetKey();
|
||||
|
||||
/* Check if this entry matches the given filters. */
|
||||
if (!((static_cast<u8>(type) == 0 || key.type == type) && (title_id_min <= key.id && key.id <= title_id_max) && (key.install_type == ContentInstallType::Full || key.install_type == install_type))) {
|
||||
if (!((static_cast<u8>(type) == 0 || key.type == type) && (title_id_min <= key.id && key.id <= title_id_max) && (key.install_type == ContentInstallType::Unknown || key.install_type == install_type))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -384,9 +396,11 @@ namespace sts::ncm {
|
|||
has = it->GetKey() == key;
|
||||
}
|
||||
|
||||
D_LOG("key id: 0x%lx\n", key.id);
|
||||
D_LOG("key version: 0x%x\n", key.version);
|
||||
D_LOG("has: %d\n", has);
|
||||
out.SetValue(has);
|
||||
return ResultSuccess;
|
||||
debug::DebugLog("Has 0x%lx\n", key.id);
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
|
@ -517,6 +531,13 @@ namespace sts::ncm {
|
|||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < content_ids.num_elements; i++) {
|
||||
char content_name[sizeof(ContentId)*2+1] = {0};
|
||||
GetStringFromContentId(content_name, content_ids[i]);
|
||||
D_LOG("content id: %s.nca\n", content_name);
|
||||
D_LOG("orphaned: %d\n", out_orphaned[i]);
|
||||
}
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
|
|
@ -263,6 +263,7 @@ namespace sts::ncm {
|
|||
this->GetContentPath(content_path, content_id);
|
||||
R_TRY(ConvertToFsCommonPath(common_path, FS_MAX_PATH-1, content_path));
|
||||
*out.pointer = common_path;
|
||||
D_LOG("path: %s\n", common_path);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
@ -410,6 +411,12 @@ namespace sts::ncm {
|
|||
return ResultSuccess;
|
||||
}));
|
||||
|
||||
for (size_t i = 0; i < entry_count; i++) {
|
||||
char content_name[sizeof(ContentId)*2+1] = {0};
|
||||
GetStringFromContentId(content_name, out_buf[i]);
|
||||
D_LOG("content id: %s.nca\n", content_name);
|
||||
}
|
||||
|
||||
out_count.SetValue(static_cast<u32>(entry_count));
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
|
@ -649,6 +656,7 @@ namespace sts::ncm {
|
|||
return fsdevGetLastResult();
|
||||
}
|
||||
|
||||
D_LOG("free space: 0x%x\n", st.f_bfree);
|
||||
out_size.SetValue(st.f_bfree);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
|
@ -661,6 +669,7 @@ namespace sts::ncm {
|
|||
return fsdevGetLastResult();
|
||||
}
|
||||
|
||||
D_LOG("total space: 0x%x\n", st.f_blocks);
|
||||
out_size.SetValue(st.f_blocks);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
|
|
Loading…
Reference in a new issue