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) {
this->html_docs_redirector.ClearRedirections();
this->program_redirector.ClearRedirections();
this->html_docs_redirector.ClearRedirections(flags);
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) {
@ -45,18 +45,22 @@ namespace ams::lr {
}
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();
return ResultSuccess();
}
if (num_ids == 0) {
this->ClearRedirections();
} else {
if (num_ids) {
/* If we have exclusion lists, explicitly clear our locations. */
this->registered_program_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->html_docs_redirector.ClearRedirections(excluding_ids, num_ids);
return ResultSuccess();

View file

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