mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-23 04:41:12 +00:00
Fixed incorrect content manager destruction
This commit is contained in:
parent
9e9987a673
commit
f080f6793b
9 changed files with 38 additions and 7 deletions
|
@ -257,6 +257,8 @@ namespace sts::ncm::impl {
|
|||
}
|
||||
|
||||
void FinalizeContentManager() {
|
||||
debug::DebugLog("Finalizing content manager...\n");
|
||||
|
||||
{
|
||||
std::scoped_lock<HosMutex> lk(g_mutex);
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ 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;
|
||||
|
@ -80,6 +81,7 @@ 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) {
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "impl/ncm_content_manager.hpp"
|
||||
#include "lr_addoncontentlocationresolver.hpp"
|
||||
|
||||
#include "debug.hpp"
|
||||
|
||||
namespace sts::lr {
|
||||
|
||||
AddOnContentLocationResolverInterface::AddOnContentLocationResolverInterface() {
|
||||
|
@ -24,6 +26,7 @@ namespace sts::lr {
|
|||
}
|
||||
|
||||
Result AddOnContentLocationResolverInterface::ResolveAddOnContentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||
R_DEBUG_START
|
||||
Path path;
|
||||
ncm::StorageId storage_id = ncm::StorageId::None;
|
||||
|
||||
|
@ -42,16 +45,21 @@ 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
|
||||
}
|
||||
|
||||
}
|
|
@ -48,6 +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);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
@ -107,6 +108,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);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
|
|
@ -152,21 +152,28 @@ namespace sts::lr {
|
|||
}
|
||||
|
||||
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<Path, 0x1> out, ncm::TitleId tid) {
|
||||
R_DEBUG_START
|
||||
Path path;
|
||||
|
||||
if (this->debug_program_redirector.FindRedirection(&path, tid)) {
|
||||
|
@ -182,21 +189,28 @@ namespace sts::lr {
|
|||
|
||||
*out.pointer = path;
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result RedirectOnlyLocationResolverInterface::RedirectProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) {
|
||||
R_DEBUG_START
|
||||
this->debug_program_redirector.SetRedirection(tid, *path.pointer);
|
||||
return ResultSuccess;
|
||||
R_DEBUG_END
|
||||
}
|
||||
|
||||
Result RedirectOnlyLocationResolverInterface::RedirectApplicationProgramPathForDebug(InPointer<const Path> 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
|
||||
}
|
||||
|
||||
}
|
|
@ -21,10 +21,6 @@
|
|||
|
||||
namespace sts::ncm {
|
||||
|
||||
ContentManagerService::~ContentManagerService() {
|
||||
impl::FinalizeContentManager();
|
||||
}
|
||||
|
||||
Result ContentManagerService::CreateContentStorage(StorageId storage_id) {
|
||||
R_DEBUG_START
|
||||
return impl::CreateContentStorage(storage_id);
|
||||
|
|
|
@ -40,8 +40,6 @@ namespace sts::ncm {
|
|||
ActivateContentMetaDatabase = 11,
|
||||
InactivateContentMetaDatabase = 12,
|
||||
};
|
||||
public:
|
||||
~ContentManagerService();
|
||||
public:
|
||||
virtual Result CreateContentStorage(StorageId storage_id);
|
||||
virtual Result CreateContentMetaDatabase(StorageId storage_id);
|
||||
|
|
|
@ -209,10 +209,12 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
Result ContentMetaDatabaseInterface::GetContentIdByType(Out<ContentId> 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<u32> out_count, OutBuffer<ContentInfo> out_info, ContentMetaKey key, u32 offset) {
|
||||
|
@ -664,13 +666,16 @@ namespace sts::ncm {
|
|||
}
|
||||
|
||||
Result OnMemoryContentMetaDatabaseInterface::LookupOrphanContent(OutBuffer<bool> out_orphaned, InBuffer<ContentId> 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
|
||||
}
|
||||
|
||||
}
|
|
@ -22,6 +22,8 @@
|
|||
#include "lr_manager_service.hpp"
|
||||
#include "ncm_content_manager_service.hpp"
|
||||
|
||||
#include "debug.hpp"
|
||||
|
||||
extern "C" {
|
||||
extern u32 __start__;
|
||||
|
||||
|
@ -160,6 +162,8 @@ int main(int argc, char **argv)
|
|||
|
||||
s_content_manager_thread.Join();
|
||||
s_location_resolver_thread.Join();
|
||||
|
||||
sts::ncm::impl::FinalizeContentManager();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue