loader: patch am to recover homebrew compatibility
This patch is to be removed if/once hbmenu/libnx re-designs the exiting logic
This commit is contained in:
@@ -108,6 +108,7 @@ namespace ams::ldr {
|
||||
};
|
||||
|
||||
#include "ldr_embedded_usb_patches.inc"
|
||||
#include "ldr_embedded_am_patches.inc"
|
||||
|
||||
}
|
||||
|
||||
@@ -140,6 +141,18 @@ namespace ams::ldr {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Remove this if/when a cleaner solution is implemented by hbmenu/libnx. */
|
||||
for (const auto &patch : AmDisableTeardownPatches) {
|
||||
if (std::memcmp(std::addressof(patch.module_id), std::addressof(module_id), sizeof(module_id)) == 0) {
|
||||
for (size_t i = 0; i < patch.num_entries; ++i) {
|
||||
const auto &entry = patch.entries[i];
|
||||
if (entry.offset + entry.size <= mapped_size) {
|
||||
std::memcpy(reinterpret_cast<void *>(mapped_nso + entry.offset), entry.data, entry.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user