loader: refactor ro manager/improve accuracy

This commit is contained in:
Michael Scire 2021-10-10 18:22:32 -07:00
parent d8a36e39f2
commit d9dc04318d
24 changed files with 328 additions and 218 deletions

View file

@ -56,8 +56,8 @@ namespace ams::patcher {
/* Read module id from name. */
std::memset(out_module_id, 0, sizeof(*out_module_id));
for (unsigned int name_ofs = 0, id_ofs = 0; name_ofs < name_len - extension_len && id_ofs < sizeof(*out_module_id); id_ofs++) {
out_module_id->build_id[id_ofs] |= ConvertHexNybble(name[name_ofs++]) << 4;
out_module_id->build_id[id_ofs] |= ConvertHexNybble(name[name_ofs++]);
out_module_id->data[id_ofs] |= ConvertHexNybble(name[name_ofs++]) << 4;
out_module_id->data[id_ofs] |= ConvertHexNybble(name[name_ofs++]);
}
return true;
@ -76,7 +76,7 @@ namespace ams::patcher {
bool IsIpsFileForModule(const char *name, const ro::ModuleId *module_id) {
const size_t name_len = std::strlen(name);
/* The path must be correct size for a build id (with trailing zeroes optionally trimmed) + ".ips". */
/* The path must be correct size for a module id (with trailing zeroes optionally trimmed) + ".ips". */
if (!(IpsFileExtensionLength < name_len && name_len <= ModuleIpsPatchLength)) {
return false;
}