addcont: add user add-ons with --addcont and a launcher list

This commit is contained in:
nmzik committed 2026-10-25 02:20:44 +02:00
1 parent 87e49282b8
commit 66e21a6245
15 files changed
+242 -45

No files matched your search

+17 -6
View File
@@ -10,10 +10,24 @@ namespace Loader {
static std::vector<AddContentEntry> g_add_content;
void AddContentLoad(const std::filesystem::path& dir, const std::string& title_id) {
static auto FindLabel(std::string_view label) {
return std::find_if(g_add_content.begin(), g_add_content.end(),
[&](const auto& entry) { return entry.entitlement_label == label; });
}
void AddContentLoad(const std::filesystem::path& dir, const std::vector<AddContentEntry>& user,
const std::string& title_id) {
g_add_content = Common::FindAddContent(dir, title_id);
for (const auto& entry: user) {
const auto it = FindLabel(entry.entitlement_label);
if (it == g_add_content.end()) {
g_add_content.push_back(entry);
} else {
*it = entry;
}
}
for (const auto& entry: g_add_content) {
LOGF("AddContent: registered %s -> %s\n", entry.content_id.c_str(),
LOGF("AddContent: registered %s -> %s\n", entry.entitlement_label.c_str(),
Common::PathToString(entry.mount_dir).c_str());
}
}
@@ -26,10 +40,7 @@ const AddContentEntry* AddContentFind(const char* label, size_t label_size) {
if (label == nullptr || label_size == 0) {
return nullptr;
}
const std::string_view value(label, std::find(label, label + label_size, '\0') - label);
const auto it =
std::find_if(g_add_content.begin(), g_add_content.end(),
[&](const auto& entry) { return entry.entitlement_label == value; });
const auto it = FindLabel({label, std::find(label, label + label_size, '\0')});
return it == g_add_content.end() ? nullptr : &*it;
}
+3 -1
View File
@@ -9,7 +9,9 @@ namespace Loader {
using AddContentEntry = Common::AddContentEntry;
void AddContentLoad(const std::filesystem::path& dir, const std::string& title_id);
// User entries replace detected packages with the same label.
void AddContentLoad(const std::filesystem::path& dir, const std::vector<AddContentEntry>& user,
const std::string& title_id);
const std::vector<AddContentEntry>& AddContentGetAll();
const AddContentEntry* AddContentFind(const char* label, size_t label_size);