More feedback addressed

This commit is contained in:
Adubbz 2020-02-26 00:35:30 +11:00
parent b6c9bf42df
commit d1d910362d
2 changed files with 25 additions and 21 deletions

View File

@ -24,8 +24,8 @@ namespace ams::lr {
} }
void RegisteredLocationResolverInterface::ClearRedirections(u32 flags) { void RegisteredLocationResolverInterface::ClearRedirections(u32 flags) {
this->html_docs_redirector.ClearRedirections(); this->html_docs_redirector.ClearRedirections(flags);
this->program_redirector.ClearRedirections(); this->program_redirector.ClearRedirections(flags);
} }
void RegisteredLocationResolverInterface::RegisterPath(const Path& path, impl::RegisteredLocations<ncm::ProgramId, RegisteredLocationResolverInterface::MaxRegisteredLocations>* locations, ncm::ProgramId id, ncm::ProgramId owner_id) { void RegisteredLocationResolverInterface::RegisterPath(const Path& path, impl::RegisteredLocations<ncm::ProgramId, RegisteredLocationResolverInterface::MaxRegisteredLocations>* locations, ncm::ProgramId id, ncm::ProgramId owner_id) {
@ -45,18 +45,22 @@ namespace ams::lr {
} }
Result RegisteredLocationResolverInterface::RefreshImpl(const ncm::ProgramId* excluding_ids, size_t num_ids) { Result RegisteredLocationResolverInterface::RefreshImpl(const ncm::ProgramId* excluding_ids, size_t num_ids) {
if (hos::GetVersion() < hos::Version_900) { /* On < 9.0.0, exclusion lists were not supported yet, so simply clear and return. */
if (hos::GetVersion < hos::Version_900) {
this->ClearRedirections(); this->ClearRedirections();
return ResultSuccess(); return ResultSuccess();
} }
if (num_ids == 0) { if (num_ids) {
this->ClearRedirections(); /* If we have exclusion lists, explicitly clear our locations. */
} else {
this->registered_program_locations.ClearExcluding(excluding_ids, num_ids); this->registered_program_locations.ClearExcluding(excluding_ids, num_ids);
this->registered_html_docs_locations.ClearExcluding(excluding_ids, num_ids); this->registered_html_docs_locations.ClearExcluding(excluding_ids, num_ids);
} else {
/* If we don't, just perform a general clear (as pre 9.0.0 did). */
this->ClearRedirections();
} }
/* Clear redirectors using exclusion lists. */
this->program_redirector.ClearRedirections(excluding_ids, num_ids); this->program_redirector.ClearRedirections(excluding_ids, num_ids);
this->html_docs_redirector.ClearRedirections(excluding_ids, num_ids); this->html_docs_redirector.ClearRedirections(excluding_ids, num_ids);
return ResultSuccess(); return ResultSuccess();

View File

@ -28,20 +28,20 @@ namespace ams::lr {
static constexpr size_t MaxRegisteredLocations = 0x20; static constexpr size_t MaxRegisteredLocations = 0x20;
protected: protected:
enum class CommandId { enum class CommandId {
ResolveProgramPath = 0, ResolveProgramPath = 0,
RegisterProgramPathDeprecated = 1, RegisterProgramPathDeprecated = 1,
RegisterProgramPath = 1, RegisterProgramPath = 1,
UnregisterProgramPath = 2, UnregisterProgramPath = 2,
RedirectProgramPathDeprecated = 3, RedirectProgramPathDeprecated = 3,
RedirectProgramPath = 3, RedirectProgramPath = 3,
ResolveHtmlDocumentPath = 4, ResolveHtmlDocumentPath = 4,
RegisterHtmlDocumentPathDeprecated = 5, RegisterHtmlDocumentPathDeprecated = 5,
RegisterHtmlDocumentPath = 5, RegisterHtmlDocumentPath = 5,
UnregisterHtmlDocumentPath = 6, UnregisterHtmlDocumentPath = 6,
RedirectHtmlDocumentPathDeprecated = 7, RedirectHtmlDocumentPathDeprecated = 7,
RedirectHtmlDocumentPath = 7, RedirectHtmlDocumentPath = 7,
Refresh = 8, Refresh = 8,
RefreshExcluding = 9, RefreshExcluding = 9,
}; };
private: private:
impl::LocationRedirector program_redirector; impl::LocationRedirector program_redirector;