mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-29 22:15:17 -04:00
namespace sts -> namespace ams
namespace sts::ams -> ams::exosphere, ams::. This is to facilitate future use of ams:: namespace code in mesosphere, as we'll want to include ams::util, ams::result, ams::svc...
This commit is contained in:
parent
4059dc6187
commit
8cb77ac136
397 changed files with 968 additions and 926 deletions
|
@ -27,7 +27,7 @@
|
|||
|
||||
/* IPS Patching adapted from Luma3DS (https://github.com/AuroraWright/Luma3DS/blob/master/sysmodules/loader/source/patcher.c) */
|
||||
|
||||
namespace sts::patcher {
|
||||
namespace ams::patcher {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -101,11 +101,11 @@ namespace sts::patcher {
|
|||
|
||||
void ApplyIpsPatch(u8 *mapped_module, size_t mapped_size, size_t protected_size, size_t offset, bool is_ips32, FILE *f_ips) {
|
||||
/* Validate offset/protected size. */
|
||||
STS_ASSERT(offset <= protected_size);
|
||||
AMS_ASSERT(offset <= protected_size);
|
||||
|
||||
u8 buffer[sizeof(Ips32TailMagic)];
|
||||
while (true) {
|
||||
STS_ASSERT(fread(buffer, is_ips32 ? sizeof(Ips32TailMagic) : sizeof(IpsTailMagic), 1, f_ips) == 1);
|
||||
AMS_ASSERT(fread(buffer, is_ips32 ? sizeof(Ips32TailMagic) : sizeof(IpsTailMagic), 1, f_ips) == 1);
|
||||
|
||||
if (IsIpsTail(is_ips32, buffer)) {
|
||||
break;
|
||||
|
@ -115,18 +115,18 @@ namespace sts::patcher {
|
|||
u32 patch_offset = GetIpsPatchOffset(is_ips32, buffer);
|
||||
|
||||
/* Size of patch. */
|
||||
STS_ASSERT(fread(buffer, 2, 1, f_ips) == 1);
|
||||
AMS_ASSERT(fread(buffer, 2, 1, f_ips) == 1);
|
||||
u32 patch_size = GetIpsPatchSize(is_ips32, buffer);
|
||||
|
||||
/* Check for RLE encoding. */
|
||||
if (patch_size == 0) {
|
||||
/* Size of RLE. */
|
||||
STS_ASSERT(fread(buffer, 2, 1, f_ips) == 1);
|
||||
AMS_ASSERT(fread(buffer, 2, 1, f_ips) == 1);
|
||||
|
||||
u32 rle_size = (buffer[0] << 8) | (buffer[1]);
|
||||
|
||||
/* Value for RLE. */
|
||||
STS_ASSERT(fread(buffer, 1, 1, f_ips) == 1);
|
||||
AMS_ASSERT(fread(buffer, 1, 1, f_ips) == 1);
|
||||
|
||||
/* Ensure we don't write to protected region. */
|
||||
if (patch_offset < protected_size) {
|
||||
|
@ -169,7 +169,7 @@ namespace sts::patcher {
|
|||
if (patch_offset + read_size > mapped_size) {
|
||||
read_size = mapped_size - patch_offset;
|
||||
}
|
||||
STS_ASSERT(fread(mapped_module + patch_offset, read_size, 1, f_ips) == 1);
|
||||
AMS_ASSERT(fread(mapped_module + patch_offset, read_size, 1, f_ips) == 1);
|
||||
if (patch_size > read_size) {
|
||||
fseek(f_ips, patch_size - read_size, SEEK_CUR);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue