diff --git a/stratosphere/ncm/source/debug.cpp b/stratosphere/ncm/source/debug.cpp deleted file mode 100644 index 872802928..000000000 --- a/stratosphere/ncm/source/debug.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include - -#include "impl/ncm_content_manager.hpp" -#include "debug.hpp" -#include "ncm_fs.hpp" - -namespace sts::debug { - - #define IRAM_BASE 0x40000000ull - #define IRAM_SIZE 0x40000 - - #define IRAM_PAYLOAD_MAX_SIZE 0x2F000 - #define IRAM_PAYLOAD_BASE 0x40010000ull - - #define IRAM_SAFE_START 0x40038000ull - #define IRAM_SAFE_END 0x4003D000ull - #define IRAM_SAFE_SIZE IRAM_SAFE_END - IRAM_SAFE_START - - namespace { - - HosMutex g_log_mutex; - - } - - 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]; - - void clear_iram(void) { - /* Fill with null*/ - memset(g_work_page, 0, sizeof(g_work_page)); - - /* Overwrite all of our log's IRAM with 0s. */ - for (size_t ofs = 0; ofs < IRAM_SAFE_SIZE; ofs += sizeof(g_work_page)) { - CopyToIram(IRAM_SAFE_START + ofs, g_work_page, sizeof(g_work_page)); - } - } - - void clear_log(void) { - std::scoped_lock lk(g_log_mutex); - - clear_iram(); - } - - Result Initialize() { - clear_log(); - return ResultSuccess; - } - - void DebugLog(const char* format, ...) { - std::scoped_lock lk(g_log_mutex); - memset(g_work_page, 0, sizeof(g_work_page)); - - /* Format a string with our arguments. */ - va_list args; - va_start(args, format); - vsnprintf(g_work_page, 0x1000, format, args); - va_end(args); - - size_t msg_len = strnlen(g_work_page, 0x1000); - - /* Nothing to log. */ - if (msg_len == 0) { - return; - } - - /* Attempt to put some of our new string in the previous 4 bytes. */ - if (g_curr_log_offset >= 4) { - char __attribute__ ((aligned (0x4))) prev_4[4] = {0}; - CopyFromIram(prev_4, IRAM_SAFE_START+g_curr_log_offset-4, 4); - size_t prev_4_size = strnlen(prev_4, 4); - - /* Do we have room to put some of our new string in the old one? */ - if (prev_4_size < 4) { - size_t spare_4_space = 4 - prev_4_size; - memcpy(prev_4 + prev_4_size, g_work_page, spare_4_space); - - /* Copy the previous 4 bytes back. */ - CopyToIram(IRAM_SAFE_START+g_curr_log_offset-4, prev_4, 4); - memmove(g_work_page, g_work_page + spare_4_space, 0x1000-spare_4_space); - /* Update our size again. */ - msg_len = strnlen(g_work_page, 0x1000); - } - } - - size_t msg_len_aligned = (msg_len + 3) & ~3; - - if (g_curr_log_offset + msg_len_aligned > IRAM_SAFE_SIZE) { - if (g_log_skip == 0) { - /* Log is full. Reboot to RCM to read it. */ - RebootToRcm(); - return; - } - - g_log_skip--; - 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. */ - if (msg_len_aligned > msg_len) { - memset(g_work_page + msg_len, '\0', msg_len_aligned - msg_len); - } - - uintptr_t iram_out_start = IRAM_SAFE_START+g_curr_log_offset; - uintptr_t iram_next_page = (iram_out_start + 0x1000-1) & ~(0x1000-1); - - /* We are copying across two pages */ - if (iram_out_start + msg_len_aligned > iram_next_page) { - size_t first_page_size = iram_next_page - iram_out_start; - CopyToIram(iram_out_start, g_work_page, first_page_size); - CopyToIram(iram_next_page, g_work_page+first_page_size, msg_len_aligned-first_page_size); - } else { - CopyToIram(iram_out_start, g_work_page, msg_len_aligned); - } - - g_curr_log_offset += msg_len_aligned; - } - - void LogBytes(const void* buf, size_t len) { - if (buf == NULL || len == 0) { - return; - } - - const u8* bytes = static_cast(buf); - int count = 0; - DebugLog("\n\n00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n"); - DebugLog("-----------------------------------------------\n"); - - for (size_t i = 0; i < len; i++) { - DebugLog("%02x ", bytes[i]); - count++; - if ((count % 16) == 0) { - DebugLog("\n"); - } - } - - DebugLog("\n"); - } -} - diff --git a/stratosphere/ncm/source/debug.hpp b/stratosphere/ncm/source/debug.hpp deleted file mode 100644 index 0eca28d9a..000000000 --- a/stratosphere/ncm/source/debug.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019 Adubbz - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once -#include -#include -#include - -namespace sts::debug { - #define STR_(X) #X - #define STR(X) STR_(X) - - #define D_LOG(format, ...) \ - debug::DebugLog("%s:" STR(__LINE__) " " format, __FUNCTION__, ##__VA_ARGS__); - #define R_DEBUG_START \ - Result rc = [&]() -> Result { - #define R_DEBUG_END \ - }(); \ - D_LOG(" -> 0x%08" PRIX32 "\n", rc); \ - return rc; - - Result Initialize(); - void DebugLog(const char* format, ...); - void LogBytes(const void* buf, size_t len); - -} \ No newline at end of file diff --git a/stratosphere/ncm/source/impl/ncm_content_manager.cpp b/stratosphere/ncm/source/impl/ncm_content_manager.cpp index 6d3d6af74..7d403fb82 100644 --- a/stratosphere/ncm/source/impl/ncm_content_manager.cpp +++ b/stratosphere/ncm/source/impl/ncm_content_manager.cpp @@ -19,7 +19,6 @@ #include #include -#include "../debug.hpp" #include "../ncm_contentmetadatabase.hpp" #include "../ncm_contentstorage.hpp" #include "../ncm_fs.hpp" @@ -150,9 +149,6 @@ namespace sts::ncm::impl { if (g_initialized) { return ResultSuccess; } - - R_ASSERT(debug::Initialize()); - debug::DebugLog("ContentManager::InitializeContentManager\n"); size_t cur_storage_index = g_num_content_storage_entries; @@ -257,8 +253,6 @@ namespace sts::ncm::impl { } void FinalizeContentManager() { - debug::DebugLog("Finalizing content manager...\n"); - { std::scoped_lock lk(g_mutex); diff --git a/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp b/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp index f209052fc..9fe14696e 100644 --- a/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp +++ b/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp @@ -20,8 +20,6 @@ #include "../ncm_make_path.hpp" #include "../ncm_path_utils.hpp" -#include "../debug.hpp" - namespace sts::ncm::impl { unsigned int PlaceHolderAccessor::GetDirectoryDepth() { @@ -66,7 +64,6 @@ namespace sts::ncm::impl { this->EnsureRecursively(placeholder_id); this->GetPlaceHolderPathUncached(placeholder_path, placeholder_id); - debug::DebugLog("Creating %s\n", placeholder_path); R_TRY_CATCH(fsdevCreateFile(placeholder_path, size, FS_CREATE_BIG_FILE)) { R_CATCH(ResultFsPathAlreadyExists) { return ResultNcmPlaceHolderAlreadyExists; @@ -81,7 +78,6 @@ namespace sts::ncm::impl { this->GetPlaceHolderPathUncached(placeholder_path, placeholder_id); - debug::DebugLog("Deleting %s\n", placeholder_path); if (std::remove(placeholder_path) != 0) { R_TRY_CATCH(fsdevGetLastResult()) { R_CATCH(ResultFsPathNotFound) { diff --git a/stratosphere/ncm/source/lr_addoncontentlocationresolver.cpp b/stratosphere/ncm/source/lr_addoncontentlocationresolver.cpp index 4d4d5e1ef..a6051bdc9 100644 --- a/stratosphere/ncm/source/lr_addoncontentlocationresolver.cpp +++ b/stratosphere/ncm/source/lr_addoncontentlocationresolver.cpp @@ -17,8 +17,6 @@ #include "impl/ncm_content_manager.hpp" #include "lr_addoncontentlocationresolver.hpp" -#include "debug.hpp" - namespace sts::lr { AddOnContentLocationResolverInterface::AddOnContentLocationResolverInterface() { @@ -26,7 +24,6 @@ namespace sts::lr { } Result AddOnContentLocationResolverInterface::ResolveAddOnContentPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; ncm::StorageId storage_id = ncm::StorageId::None; @@ -45,21 +42,16 @@ namespace sts::lr { *out.pointer = path; return ResultSuccess; - R_DEBUG_END } Result AddOnContentLocationResolverInterface::RegisterAddOnContentStorage(ncm::StorageId storage_id, ncm::TitleId tid) { - R_DEBUG_START R_TRY(this->redirector.SetRedirection(tid, storage_id)); return ResultSuccess; - R_DEBUG_END } Result AddOnContentLocationResolverInterface::UnregisterAllAddOnContentPath() { - R_DEBUG_START this->redirector.ClearRedirections(); return ResultSuccess; - R_DEBUG_END } } \ No newline at end of file diff --git a/stratosphere/ncm/source/lr_contentlocationresolver.cpp b/stratosphere/ncm/source/lr_contentlocationresolver.cpp index 8dd735cef..95680e8bd 100644 --- a/stratosphere/ncm/source/lr_contentlocationresolver.cpp +++ b/stratosphere/ncm/source/lr_contentlocationresolver.cpp @@ -17,8 +17,6 @@ #include "impl/ncm_content_manager.hpp" #include "lr_contentlocationresolver.hpp" -#include "debug.hpp" - namespace sts::lr { ContentLocationResolverInterface::~ContentLocationResolverInterface() { @@ -30,7 +28,6 @@ namespace sts::lr { } Result ContentLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->program_redirector.FindRedirection(&path, tid)) { @@ -48,21 +45,15 @@ namespace sts::lr { R_ASSERT(this->content_storage->GetPath(&path, program_content_id)); *out.pointer = path; - D_LOG("path: %s\n", path.path); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::RedirectProgramPath(InPointer 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 } Result ContentLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->app_control_redirector.FindRedirection(&path, tid)) { @@ -71,11 +62,9 @@ namespace sts::lr { } return ResultLrControlNotFound; - R_DEBUG_END } Result ContentLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->html_docs_redirector.FindRedirection(&path, tid)) { @@ -84,39 +73,29 @@ namespace sts::lr { } return ResultLrHtmlDocumentNotFound; - R_DEBUG_END } Result ContentLocationResolverInterface::ResolveDataPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; ncm::ContentId data_content_id; 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 } Result ContentLocationResolverInterface::RedirectApplicationControlPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->app_control_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::RedirectApplicationHtmlDocumentPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->html_docs_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); - D_LOG("path: %s\n", (*path.pointer).path); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->legal_info_redirector.FindRedirection(&path, tid)) { @@ -125,18 +104,14 @@ namespace sts::lr { } return ResultLrLegalInformationNotFound; - R_DEBUG_END } Result ContentLocationResolverInterface::RedirectApplicationLegalInformationPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->legal_info_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::Refresh() { - R_DEBUG_START std::shared_ptr content_meta_database; std::shared_ptr content_storage; R_TRY(ncm::impl::OpenContentMetaDatabase(&content_meta_database, this->storage_id)); @@ -151,57 +126,43 @@ namespace sts::lr { this->legal_info_redirector.ClearRedirections(); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::RedirectApplicationProgramPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->program_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::ClearApplicationRedirection() { - R_DEBUG_START this->program_redirector.ClearRedirections(impl::RedirectionFlags_Application); this->debug_program_redirector.ClearRedirections(impl::RedirectionFlags_Application); this->app_control_redirector.ClearRedirections(impl::RedirectionFlags_Application); this->html_docs_redirector.ClearRedirections(impl::RedirectionFlags_Application); this->legal_info_redirector.ClearRedirections(impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::EraseProgramRedirection(ncm::TitleId tid) { - R_DEBUG_START this->program_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::EraseApplicationControlRedirection(ncm::TitleId tid) { - R_DEBUG_START this->app_control_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::EraseApplicationHtmlDocumentRedirection(ncm::TitleId tid) { - R_DEBUG_START this->html_docs_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::EraseApplicationLegalInformationRedirection(ncm::TitleId tid) { - R_DEBUG_START this->legal_info_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->debug_program_redirector.FindRedirection(&path, tid)) { @@ -217,28 +178,21 @@ namespace sts::lr { *out.pointer = path; return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::RedirectProgramPathForDebug(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->debug_program_redirector.SetRedirection(tid, *path.pointer); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::RedirectApplicationProgramPathForDebug(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->debug_program_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result ContentLocationResolverInterface::EraseProgramRedirectionForDebug(ncm::TitleId tid) { - R_DEBUG_START this->debug_program_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } } \ No newline at end of file diff --git a/stratosphere/ncm/source/lr_manager_service.cpp b/stratosphere/ncm/source/lr_manager_service.cpp index 82b11f7ec..6958cb11e 100644 --- a/stratosphere/ncm/source/lr_manager_service.cpp +++ b/stratosphere/ncm/source/lr_manager_service.cpp @@ -17,33 +17,23 @@ #include "impl/lr_manager.hpp" #include "lr_manager_service.hpp" -#include "debug.hpp" namespace sts::lr { Result LocationResolverManagerService::OpenLocationResolver(Out> out, ncm::StorageId storage_id) { - R_DEBUG_START return impl::OpenLocationResolver(out, storage_id); - R_DEBUG_END } Result LocationResolverManagerService::OpenRegisteredLocationResolver(Out> out) { - R_DEBUG_START return impl::OpenRegisteredLocationResolver(out); - R_DEBUG_END } Result LocationResolverManagerService::RefreshLocationResolver(ncm::StorageId storage_id) { - R_DEBUG_START - D_LOG("storage_id: 0x%x\n", static_cast(storage_id)); return impl::RefreshLocationResolver(storage_id); - R_DEBUG_END } Result LocationResolverManagerService::OpenAddOnContentLocationResolver(Out> out) { - R_DEBUG_START return impl::OpenAddOnContentLocationResolver(out); - R_DEBUG_END } } \ No newline at end of file diff --git a/stratosphere/ncm/source/lr_redirectonlylocationresolver.cpp b/stratosphere/ncm/source/lr_redirectonlylocationresolver.cpp index 0c6ca239d..b140e69b1 100644 --- a/stratosphere/ncm/source/lr_redirectonlylocationresolver.cpp +++ b/stratosphere/ncm/source/lr_redirectonlylocationresolver.cpp @@ -17,8 +17,6 @@ #include "impl/ncm_content_manager.hpp" #include "lr_redirectonlylocationresolver.hpp" -#include "debug.hpp" - namespace sts::lr { RedirectOnlyLocationResolverInterface::~RedirectOnlyLocationResolverInterface() { @@ -30,7 +28,6 @@ namespace sts::lr { } Result RedirectOnlyLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->program_redirector.FindRedirection(&path, tid)) { @@ -39,18 +36,14 @@ namespace sts::lr { } return ResultLrProgramNotFound; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::RedirectProgramPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->program_redirector.SetRedirection(tid, *path.pointer); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->app_control_redirector.FindRedirection(&path, tid)) { @@ -59,11 +52,9 @@ namespace sts::lr { } return ResultLrControlNotFound; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->html_docs_redirector.FindRedirection(&path, tid)) { @@ -72,31 +63,23 @@ namespace sts::lr { } return ResultLrHtmlDocumentNotFound; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::ResolveDataPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START return ResultLrDataNotFound; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::RedirectApplicationControlPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->app_control_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::RedirectApplicationHtmlDocumentPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->html_docs_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->legal_info_redirector.FindRedirection(&path, tid)) { @@ -105,75 +88,57 @@ namespace sts::lr { } return ResultLrLegalInformationNotFound; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::RedirectApplicationLegalInformationPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->legal_info_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::Refresh() { - R_DEBUG_START this->program_redirector.ClearRedirections(); this->debug_program_redirector.ClearRedirections(); this->app_control_redirector.ClearRedirections(); this->html_docs_redirector.ClearRedirections(); this->legal_info_redirector.ClearRedirections(); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::RedirectApplicationProgramPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->program_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::ClearApplicationRedirection() { - R_DEBUG_START this->program_redirector.ClearRedirections(impl::RedirectionFlags_Application); this->debug_program_redirector.ClearRedirections(impl::RedirectionFlags_Application); this->app_control_redirector.ClearRedirections(impl::RedirectionFlags_Application); this->html_docs_redirector.ClearRedirections(impl::RedirectionFlags_Application); this->legal_info_redirector.ClearRedirections(impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::EraseProgramRedirection(ncm::TitleId tid) { - R_DEBUG_START this->program_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::EraseApplicationControlRedirection(ncm::TitleId tid) { - R_DEBUG_START this->app_control_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::EraseApplicationHtmlDocumentRedirection(ncm::TitleId tid) { - R_DEBUG_START this->html_docs_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::EraseApplicationLegalInformationRedirection(ncm::TitleId tid) { - R_DEBUG_START this->legal_info_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (this->debug_program_redirector.FindRedirection(&path, tid)) { @@ -189,28 +154,21 @@ namespace sts::lr { *out.pointer = path; return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::RedirectProgramPathForDebug(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->debug_program_redirector.SetRedirection(tid, *path.pointer); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::RedirectApplicationProgramPathForDebug(InPointer path, ncm::TitleId tid) { - R_DEBUG_START this->debug_program_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application); return ResultSuccess; - R_DEBUG_END } Result RedirectOnlyLocationResolverInterface::EraseProgramRedirectionForDebug(ncm::TitleId tid) { - R_DEBUG_START this->debug_program_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } } \ No newline at end of file diff --git a/stratosphere/ncm/source/lr_registeredlocationresolver.cpp b/stratosphere/ncm/source/lr_registeredlocationresolver.cpp index 1b5197fe8..a21c41120 100644 --- a/stratosphere/ncm/source/lr_registeredlocationresolver.cpp +++ b/stratosphere/ncm/source/lr_registeredlocationresolver.cpp @@ -16,8 +16,6 @@ #include "lr_registeredlocationresolver.hpp" -#include "debug.hpp" - namespace sts::lr { RegisteredLocationResolverInterface::RegisteredLocationResolverInterface() { @@ -32,7 +30,6 @@ namespace sts::lr { } Result RegisteredLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (!this->program_redirector.FindRedirection(&path, tid)) { @@ -43,11 +40,9 @@ namespace sts::lr { *out.pointer = path; return ResultSuccess; - R_DEBUG_END } Result RegisteredLocationResolverInterface::RegisterProgramPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START Path tmp_path = *path.pointer; if (!this->registered_program_redirector.SetRedirection(tid, tmp_path)) { @@ -56,26 +51,20 @@ namespace sts::lr { } return ResultSuccess; - R_DEBUG_END } Result RegisteredLocationResolverInterface::UnregisterProgramPath(ncm::TitleId tid) { - R_DEBUG_START this->registered_program_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result RegisteredLocationResolverInterface::RedirectProgramPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START Path tmp_path = *path.pointer; this->program_redirector.SetRedirection(tid, tmp_path); return ResultSuccess; - R_DEBUG_END } Result RegisteredLocationResolverInterface::ResolveHtmlDocumentPath(OutPointerWithServerSize out, ncm::TitleId tid) { - R_DEBUG_START Path path; if (!this->html_docs_redirector.FindRedirection(&path, tid)) { @@ -86,11 +75,9 @@ namespace sts::lr { *out.pointer = path; return ResultLrHtmlDocumentNotFound; - R_DEBUG_END } Result RegisteredLocationResolverInterface::RegisterHtmlDocumentPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START Path tmp_path = *path.pointer; if (!this->registered_html_docs_redirector.SetRedirection(tid, tmp_path)) { @@ -99,30 +86,23 @@ namespace sts::lr { } return ResultSuccess; - R_DEBUG_END } Result RegisteredLocationResolverInterface::UnregisterHtmlDocumentPath(ncm::TitleId tid) { - R_DEBUG_START this->registered_html_docs_redirector.EraseRedirection(tid); return ResultSuccess; - R_DEBUG_END } Result RegisteredLocationResolverInterface::RedirectHtmlDocumentPath(InPointer path, ncm::TitleId tid) { - R_DEBUG_START Path tmp_path = *path.pointer; this->html_docs_redirector.SetRedirection(tid, tmp_path); return ResultSuccess; - R_DEBUG_END } Result RegisteredLocationResolverInterface::Refresh() { - R_DEBUG_START this->registered_program_redirector.ClearRedirections(); this->registered_html_docs_redirector.ClearRedirections(); return ResultSuccess; - R_DEBUG_END } } \ No newline at end of file diff --git a/stratosphere/ncm/source/ncm_content_manager_service.cpp b/stratosphere/ncm/source/ncm_content_manager_service.cpp index b7c5acb11..cd95b9191 100644 --- a/stratosphere/ncm/source/ncm_content_manager_service.cpp +++ b/stratosphere/ncm/source/ncm_content_manager_service.cpp @@ -17,94 +17,64 @@ #include "impl/ncm_content_manager.hpp" #include "ncm_content_manager_service.hpp" -#include "debug.hpp" - namespace sts::ncm { Result ContentManagerService::CreateContentStorage(StorageId storage_id) { - R_DEBUG_START return impl::CreateContentStorage(storage_id); - R_DEBUG_END } Result ContentManagerService::CreateContentMetaDatabase(StorageId storage_id) { - R_DEBUG_START return impl::CreateContentMetaDatabase(storage_id); - R_DEBUG_END } Result ContentManagerService::VerifyContentStorage(StorageId storage_id) { - R_DEBUG_START return impl::VerifyContentStorage(storage_id); - R_DEBUG_END } Result ContentManagerService::VerifyContentMetaDatabase(StorageId storage_id) { - R_DEBUG_START return impl::VerifyContentMetaDatabase(storage_id); - R_DEBUG_END } Result ContentManagerService::OpenContentStorage(Out> out, StorageId storage_id) { - R_DEBUG_START - D_LOG("storage id: 0x%x\n", storage_id); std::shared_ptr content_storage; R_TRY(impl::OpenContentStorage(&content_storage, storage_id)); out.SetValue(std::move(content_storage)); return ResultSuccess; - R_DEBUG_END } Result ContentManagerService::OpenContentMetaDatabase(Out> out, StorageId storage_id) { - R_DEBUG_START - D_LOG("storage id: 0x%x\n", storage_id); std::shared_ptr content_meta_database; R_TRY(impl::OpenContentMetaDatabase(&content_meta_database, storage_id)); out.SetValue(std::move(content_meta_database)); return ResultSuccess; - R_DEBUG_END } Result ContentManagerService::CloseContentStorageForcibly(StorageId storage_id) { - R_DEBUG_START return impl::CloseContentStorageForcibly(storage_id); - R_DEBUG_END } Result ContentManagerService::CloseContentMetaDatabaseForcibly(StorageId storage_id) { - R_DEBUG_START return impl::CloseContentMetaDatabaseForcibly(storage_id); - R_DEBUG_END } Result ContentManagerService::CleanupContentMetaDatabase(StorageId storage_id) { - R_DEBUG_START return impl::CleanupContentMetaDatabase(storage_id); - R_DEBUG_END } Result ContentManagerService::ActivateContentStorage(StorageId storage_id) { - R_DEBUG_START return impl::ActivateContentStorage(storage_id); - R_DEBUG_END } Result ContentManagerService::InactivateContentStorage(StorageId storage_id) { - R_DEBUG_START return impl::InactivateContentStorage(storage_id); - R_DEBUG_END } Result ContentManagerService::ActivateContentMetaDatabase(StorageId storage_id) { - R_DEBUG_START return impl::ActivateContentMetaDatabase(storage_id); - R_DEBUG_END } Result ContentManagerService::InactivateContentMetaDatabase(StorageId storage_id) { - R_DEBUG_START return impl::InactivateContentMetaDatabase(storage_id); - R_DEBUG_END } } \ No newline at end of file diff --git a/stratosphere/ncm/source/ncm_contentmetadatabase.cpp b/stratosphere/ncm/source/ncm_contentmetadatabase.cpp index f84076939..976728b34 100644 --- a/stratosphere/ncm/source/ncm_contentmetadatabase.cpp +++ b/stratosphere/ncm/source/ncm_contentmetadatabase.cpp @@ -17,8 +17,6 @@ #include "ncm_contentmetadatabase.hpp" #include "ncm_utils.hpp" -#include "debug.hpp" - namespace sts::ncm { namespace { @@ -95,11 +93,6 @@ namespace sts::ncm { Result ContentMetaDatabaseInterface::GetContentIdByTypeImpl(ContentId* out, const ContentMetaKey& key, ContentType type, std::optional id_offset) { R_TRY(this->EnsureEnabled()); - 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) { return ResultNcmContentMetaNotFound; @@ -146,9 +139,6 @@ 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; } @@ -189,50 +179,36 @@ namespace sts::ncm { Result ContentMetaDatabaseInterface::Set(ContentMetaKey key, InBuffer value) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); - - D_LOG(" set title_id: 0x%lx\n", key.id); - D_LOG(" set version: 0x%x\n", key.version); - R_TRY(this->kvs->Set(key, value.buffer, value.num_elements)); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::Get(Out out_size, ContentMetaKey key, OutBuffer out_value) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); R_TRY(this->kvs->Get(out_size.GetPointer(), out_value.buffer, out_value.num_elements, key)); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::Remove(ContentMetaKey key) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); R_TRY(this->kvs->Remove(key)); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetContentIdByType(Out out_content_id, ContentMetaKey key, ContentType type) { - R_DEBUG_START ContentId content_id; R_TRY(this->GetContentIdByTypeImpl(&content_id, key, type, std::nullopt)); out_content_id.SetValue(content_id); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::ListContentInfo(Out out_count, OutBuffer out_info, ContentMetaKey key, u32 offset) { - R_DEBUG_START if (offset >> 0x1f != 0) { return ResultNcmInvalidOffset; } R_TRY(this->EnsureEnabled()); - const void *value = nullptr; size_t value_size = 0; R_TRY(GetContentMetaValuePointer(&value, &value_size, key, this->kvs)); @@ -246,22 +222,14 @@ namespace sts::ncm { out_count.SetValue(count); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::List(Out out_entries_total, Out out_entries_written, OutBuffer out_info, ContentMetaType type, TitleId application_title_id, TitleId title_id_min, TitleId title_id_max, ContentInstallType install_type) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); 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); @@ -313,21 +281,17 @@ namespace sts::ncm { out_entries_total.SetValue(entries_total); out_entries_written.SetValue(entries_written); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetLatestContentMetaKey(Out out_key, TitleId title_id) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); ContentMetaKey key; R_TRY(this->GetLatestContentMetaKeyImpl(&key, title_id)); out_key.SetValue(key); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::ListApplication(Out out_entries_total, Out out_entries_written, OutBuffer out_keys, ContentMetaType type) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); size_t entries_total = 0; @@ -378,11 +342,9 @@ namespace sts::ncm { out_entries_total.SetValue(entries_total); out_entries_written.SetValue(entries_written); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::Has(Out out, ContentMetaKey key) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); if (this->kvs->GetCount() == 0) { @@ -396,16 +358,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; - R_DEBUG_END } Result ContentMetaDatabaseInterface::HasAll(Out out, InBuffer keys) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); bool has = true; @@ -415,11 +372,9 @@ namespace sts::ncm { out.SetValue(has); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetSize(Out out_size, ContentMetaKey key) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); if (this->kvs->GetCount() == 0) { @@ -433,11 +388,9 @@ namespace sts::ncm { out_size.SetValue(it->GetValueSize()); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetRequiredSystemVersion(Out out_version, ContentMetaKey key) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); if (key.type != ContentMetaType::Application && key.type != ContentMetaType::Patch) { @@ -453,40 +406,30 @@ namespace sts::ncm { const auto ext_header = GetValueExtendedHeader(value); out_version.SetValue(ext_header->required_system_version); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetPatchId(Out out_patch_id, ContentMetaKey key) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); if (key.type != ContentMetaType::Application) { return ResultNcmInvalidContentMetaKey; } - D_LOG(" key title_id: 0x%lx\n", key.id); - D_LOG(" key version: 0x%x\n", key.version); - const void* value = nullptr; size_t value_size = 0; R_TRY(GetContentMetaValuePointer(&value, &value_size, key, this->kvs)); const auto ext_header = GetValueExtendedHeader(value); out_patch_id.SetValue(ext_header->patch_id); - D_LOG(" patch title_id: 0x%lx\n", *out_patch_id); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::DisableForcibly() { - R_DEBUG_START this->disabled = true; return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::LookupOrphanContent(OutBuffer out_orphaned, InBuffer content_ids) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); if (out_orphaned.num_elements < content_ids.num_elements) { @@ -531,28 +474,17 @@ 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 } Result ContentMetaDatabaseInterface::Commit() { - R_DEBUG_START R_TRY(this->EnsureEnabled()); R_TRY(this->kvs->Save()); R_TRY(fsdevCommitDevice(this->mount_name)); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::HasContent(Out out, ContentMetaKey key, ContentId content_id) { - R_DEBUG_START const void* value = nullptr; size_t value_size = 0; R_TRY(GetContentMetaValuePointer(&value, &value_size, key, this->kvs)); @@ -572,11 +504,9 @@ namespace sts::ncm { out.SetValue(false); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::ListContentMetaInfo(Out out_entries_written, OutBuffer out_meta_info, ContentMetaKey key, u32 start_index) { - R_DEBUG_START if (start_index >> 0x1f != 0) { return ResultNcmInvalidOffset; } @@ -607,11 +537,9 @@ namespace sts::ncm { out_entries_written.SetValue(entries_written); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetAttributes(Out out_attributes, ContentMetaKey key) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); const void* value = nullptr; @@ -620,11 +548,9 @@ namespace sts::ncm { const auto header = GetValueHeader(value); out_attributes.SetValue(header->attributes); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetRequiredApplicationVersion(Out out_version, ContentMetaKey key) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); if (key.type != ContentMetaType::AddOnContent) { @@ -637,16 +563,13 @@ namespace sts::ncm { const auto ext_header = GetValueExtendedHeader(value); out_version.SetValue(ext_header->required_application_version); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetContentIdByTypeAndIdOffset(Out out_content_id, ContentMetaKey key, ContentType type, u8 id_offset) { - R_DEBUG_START ContentId content_id; R_TRY(this->GetContentIdByTypeImpl(&content_id, key, type, std::optional(id_offset))); out_content_id.SetValue(content_id); return ResultSuccess; - R_DEBUG_END } Result ContentMetaDatabaseInterface::GetLatestProgram(ContentId* out_content_id, TitleId title_id) { @@ -666,7 +589,6 @@ namespace sts::ncm { } Result OnMemoryContentMetaDatabaseInterface::GetLatestContentMetaKey(Out out_key, TitleId title_id) { - R_DEBUG_START R_TRY(this->EnsureEnabled()); const ContentMetaKey key = ContentMetaKey::Make(title_id, 0, ContentMetaType::Unknown); @@ -686,20 +608,15 @@ namespace sts::ncm { *out_key = *found_key; return ResultSuccess; - R_DEBUG_END } Result OnMemoryContentMetaDatabaseInterface::LookupOrphanContent(OutBuffer out_orphaned, InBuffer content_ids) { - R_DEBUG_START return ResultNcmInvalidContentMetaDatabase; - R_DEBUG_END } Result OnMemoryContentMetaDatabaseInterface::Commit() { - R_DEBUG_START R_TRY(this->EnsureEnabled()); return ResultSuccess; - R_DEBUG_END } } \ No newline at end of file diff --git a/stratosphere/ncm/source/ncm_contentstorage.cpp b/stratosphere/ncm/source/ncm_contentstorage.cpp index 56941af67..0697f9df4 100644 --- a/stratosphere/ncm/source/ncm_contentstorage.cpp +++ b/stratosphere/ncm/source/ncm_contentstorage.cpp @@ -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 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 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 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 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 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 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 out_count, OutBuffer out_buf) { - R_DEBUG_START if (this->disabled) { return ResultNcmInvalidContentStorage; } @@ -335,11 +309,9 @@ namespace sts::ncm { out_count.SetValue(static_cast(entry_count)); return ResultSuccess; - R_DEBUG_END } Result ContentStorageInterface::GetContentCount(Out 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 out_count, OutBuffer 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(entry_count)); return ResultSuccess; - R_DEBUG_END } Result ContentStorageInterface::GetSizeFromContentId(Out 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 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 out_rights_id, Out 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(key_generation)); return ResultSuccess; - R_DEBUG_END } Result ContentStorageInterface::GetRightsIdFromContentId(Out out_rights_id, Out 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 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 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 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 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 out_rights_id, Out 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 } } \ No newline at end of file diff --git a/stratosphere/ncm/source/ncm_main.cpp b/stratosphere/ncm/source/ncm_main.cpp index 2904a833c..14ccc2617 100644 --- a/stratosphere/ncm/source/ncm_main.cpp +++ b/stratosphere/ncm/source/ncm_main.cpp @@ -22,8 +22,6 @@ #include "lr_manager_service.hpp" #include "ncm_content_manager_service.hpp" -#include "debug.hpp" - extern "C" { extern u32 __start__; diff --git a/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp b/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp index ef4c26452..b02cefc93 100644 --- a/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp +++ b/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp @@ -18,12 +18,9 @@ #include "ncm_path_utils.hpp" #include "ncm_readonlycontentstorage.hpp" -#include "debug.hpp" - namespace sts::ncm { Result ReadOnlyContentStorageInterface::Initialize(const char* root_path, MakeContentPathFunc content_path_func) { - R_DEBUG_START if (this->disabled) { return ResultNcmInvalidContentStorage; } @@ -37,53 +34,37 @@ namespace sts::ncm { strncpy(this->root_path, root_path, FS_MAX_PATH-2); this->make_content_path_func = *content_path_func; return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GeneratePlaceHolderId(Out out) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, u64 size) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::DeletePlaceHolder(PlaceHolderId placeholder_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::HasPlaceHolder(Out out, PlaceHolderId placeholder_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::WritePlaceHolder(PlaceHolderId placeholder_id, u64 offset, InBuffer data) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::Register(PlaceHolderId placeholder_id, ContentId content_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::Delete(ContentId content_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::Has(Out out, ContentId content_id) { - R_DEBUG_START if (this->disabled) { return ResultNcmInvalidContentStorage; } @@ -101,11 +82,9 @@ namespace sts::ncm { out.SetValue(has); return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetPath(OutPointerWithServerSize out, ContentId content_id) { - R_DEBUG_START if (this->disabled) { return ResultNcmInvalidContentStorage; } @@ -125,41 +104,29 @@ namespace sts::ncm { *out.pointer = common_path; return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetPlaceHolderPath(OutPointerWithServerSize out, PlaceHolderId placeholder_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::CleanupAllPlaceHolder() { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::ListPlaceHolder(Out out_count, OutBuffer out_buf) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetContentCount(Out out_count) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::ListContentId(Out out_count, OutBuffer out_buf, u32 start_offset) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetSizeFromContentId(Out out_size, ContentId content_id) { - R_DEBUG_START if (this->disabled) { return ResultNcmInvalidContentStorage; } @@ -181,30 +148,22 @@ namespace sts::ncm { out_size.SetValue(st.st_size); return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::DisableForcibly() { - R_DEBUG_START this->disabled = true; return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::SetPlaceHolderSize(PlaceHolderId placeholder_id, u64 size) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::ReadContentIdFile(OutBuffer buf, ContentId content_id, u64 offset) { - R_DEBUG_START /* Offset is too large */ if (offset >> 0x3f != 0) { return ResultNcmInvalidOffset; @@ -240,17 +199,13 @@ namespace sts::ncm { } return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetRightsIdFromPlaceHolderId(Out out_rights_id, Out out_key_generation, PlaceHolderId placeholder_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetRightsIdFromContentId(Out out_rights_id, Out out_key_generation, ContentId content_id) { - R_DEBUG_START if (this->disabled) { return ResultNcmInvalidContentStorage; } @@ -276,51 +231,36 @@ namespace sts::ncm { out_key_generation.SetValue(static_cast(key_generation)); return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::WriteContentForDebug(ContentId content_id, u64 offset, InBuffer data) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetFreeSpaceSize(Out out_size) { - R_DEBUG_START out_size.SetValue(0); return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetTotalSpaceSize(Out out_size) { - R_DEBUG_START out_size.SetValue(0); return ResultSuccess; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::FlushPlaceHolder() { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetSizeFromPlaceHolderId(Out out, PlaceHolderId placeholder_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::RepairInvalidFileAttribute() { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } Result ReadOnlyContentStorageInterface::GetRightsIdFromPlaceHolderIdWithCache(Out out_rights_id, Out out_key_generation, PlaceHolderId placeholder_id, ContentId cache_content_id) { - R_DEBUG_START return ResultNcmInvalidContentStorageOperation; - R_DEBUG_END } } \ No newline at end of file