mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-02 07:39:49 -04:00
Removed debug code
This commit is contained in:
parent
4e75776112
commit
d6ff261fcc
14 changed files with 0 additions and 562 deletions
|
@ -20,8 +20,6 @@
|
|||
#include "ncm_make_path.hpp"
|
||||
#include "ncm_utils.hpp"
|
||||
|
||||
#include "debug.hpp"
|
||||
|
||||
namespace sts::ncm {
|
||||
|
||||
ContentStorageInterface::~ContentStorageInterface() {
|
||||
|
@ -94,18 +92,15 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
Result ContentStorageInterface::GeneratePlaceHolderId(Out<PlaceHolderId> out) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
||||
sts::rnd::GenerateRandomBytes(out.GetPointer(), sizeof(NcmNcaId));
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, u64 size) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -117,21 +112,17 @@ namespace sts::ncm {
|
|||
R_TRY(this->placeholder_accessor.Create(placeholder_id, size));
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::DeletePlaceHolder(PlaceHolderId placeholder_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
||||
return this->placeholder_accessor.Delete(placeholder_id);
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::HasPlaceHolder(Out<bool> out, PlaceHolderId placeholder_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -144,11 +135,9 @@ namespace sts::ncm {
|
|||
out.SetValue(has);
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::WritePlaceHolder(PlaceHolderId placeholder_id, u64 offset, InBuffer<u8> data) {
|
||||
R_DEBUG_START
|
||||
/* Offset is too large */
|
||||
if (offset >> 0x3f != 0) {
|
||||
return ResultNcmInvalidOffset;
|
||||
|
@ -181,11 +170,9 @@ namespace sts::ncm {
|
|||
this->placeholder_accessor.StoreToCache(f, placeholder_id);
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::Register(PlaceHolderId placeholder_id, ContentId content_id) {
|
||||
R_DEBUG_START
|
||||
this->ClearContentCache();
|
||||
|
||||
if (this->disabled) {
|
||||
|
@ -210,11 +197,9 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::Delete(ContentId content_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -232,11 +217,9 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::Has(Out<bool> out, ContentId content_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -249,11 +232,9 @@ namespace sts::ncm {
|
|||
out.SetValue(has);
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetPath(OutPointerWithServerSize<lr::Path, 0x1> out, ContentId content_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -263,13 +244,10 @@ 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
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetPlaceHolderPath(OutPointerWithServerSize<lr::Path, 0x1> out, PlaceHolderId placeholder_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -280,11 +258,9 @@ namespace sts::ncm {
|
|||
R_TRY(ConvertToFsCommonPath(common_path, FS_MAX_PATH-1, placeholder_path));
|
||||
*out.pointer = common_path;
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::CleanupAllPlaceHolder() {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -302,11 +278,9 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::ListPlaceHolder(Out<u32> out_count, OutBuffer<PlaceHolderId> out_buf) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -335,11 +309,9 @@ namespace sts::ncm {
|
|||
|
||||
out_count.SetValue(static_cast<u32>(entry_count));
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetContentCount(Out<u32> out_count) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -362,11 +334,9 @@ namespace sts::ncm {
|
|||
|
||||
out_count.SetValue(content_count);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::ListContentId(Out<u32> out_count, OutBuffer<ContentId> out_buf, u32 start_offset) {
|
||||
R_DEBUG_START
|
||||
if (start_offset >> 0x1f != 0) {
|
||||
return ResultNcmInvalidOffset;
|
||||
}
|
||||
|
@ -411,19 +381,11 @@ 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
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetSizeFromContentId(Out<u64> out_size, ContentId content_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -438,20 +400,16 @@ namespace sts::ncm {
|
|||
|
||||
out_size.SetValue(st.st_size);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::DisableForcibly() {
|
||||
R_DEBUG_START
|
||||
this->disabled = true;
|
||||
this->ClearContentCache();
|
||||
this->placeholder_accessor.ClearAllCaches();
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -480,22 +438,18 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::SetPlaceHolderSize(PlaceHolderId placeholder_id, u64 size) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
||||
R_TRY(this->placeholder_accessor.SetSize(placeholder_id, size));
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::ReadContentIdFile(OutBuffer<u8> buf, ContentId content_id, u64 offset) {
|
||||
R_DEBUG_START
|
||||
/* Offset is too large */
|
||||
if (offset >> 0x3f != 0) {
|
||||
return ResultNcmInvalidOffset;
|
||||
|
@ -518,11 +472,9 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetRightsIdFromPlaceHolderId(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, PlaceHolderId placeholder_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -540,11 +492,9 @@ namespace sts::ncm {
|
|||
out_key_generation.SetValue(static_cast<u64>(key_generation));
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetRightsIdFromContentId(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, ContentId content_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -603,11 +553,9 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::WriteContentForDebug(ContentId content_id, u64 offset, InBuffer<u8> data) {
|
||||
R_DEBUG_START
|
||||
/* Offset is too large */
|
||||
if (offset >> 0x3f != 0) {
|
||||
return ResultNcmInvalidOffset;
|
||||
|
@ -646,44 +594,34 @@ namespace sts::ncm {
|
|||
fflush(f);
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetFreeSpaceSize(Out<u64> out_size) {
|
||||
R_DEBUG_START
|
||||
struct statvfs st = {0};
|
||||
if (statvfs(this->root_path, &st) == -1) {
|
||||
return fsdevGetLastResult();
|
||||
}
|
||||
|
||||
D_LOG("free space: 0x%x\n", st.f_bfree);
|
||||
out_size.SetValue(st.f_bfree);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetTotalSpaceSize(Out<u64> out_size) {
|
||||
R_DEBUG_START
|
||||
struct statvfs st = {0};
|
||||
if (statvfs(this->root_path, &st) == -1) {
|
||||
return fsdevGetLastResult();
|
||||
}
|
||||
|
||||
D_LOG("total space: 0x%x\n", st.f_blocks);
|
||||
out_size.SetValue(st.f_blocks);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::FlushPlaceHolder() {
|
||||
R_DEBUG_START
|
||||
this->placeholder_accessor.ClearAllCaches();
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetSizeFromPlaceHolderId(Out<u64> out_size, PlaceHolderId placeholder_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -708,11 +646,9 @@ namespace sts::ncm {
|
|||
|
||||
out_size.SetValue(st.st_size);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::RepairInvalidFileAttribute() {
|
||||
R_DEBUG_START
|
||||
char content_root_path[FS_MAX_PATH] = {0};
|
||||
this->GetContentRootPath(content_root_path);
|
||||
unsigned int dir_depth = this->GetContentDirectoryDepth();
|
||||
|
@ -741,11 +677,9 @@ namespace sts::ncm {
|
|||
R_TRY(TraverseDirectory(placeholder_root_path, dir_depth, fix_file_attributes));
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result ContentStorageInterface::GetRightsIdFromPlaceHolderIdWithCache(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
R_DEBUG_START
|
||||
if (this->disabled) {
|
||||
return ResultNcmInvalidContentStorage;
|
||||
}
|
||||
|
@ -804,7 +738,6 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue