From 389fb17a93d83c1c548f80d1b88f9050d15178ad Mon Sep 17 00:00:00 2001 From: PhoenixBound Date: Fri, 7 Feb 2025 18:02:12 -0600 Subject: [PATCH] Fix creation of IPS patches with records beginning at 454F46 As discovered by @Messianic, this code path was buggy and not properly tested. It made the record a single int instead of a bytes object. --- coilsnake/model/common/ips.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coilsnake/model/common/ips.py b/coilsnake/model/common/ips.py index 708b47ae..6ffe416a 100644 --- a/coilsnake/model/common/ips.py +++ b/coilsnake/model/common/ips.py @@ -128,7 +128,8 @@ def create(self, clean_rom, hacked_rom, patch_path): records[i] = t else: i -= 1 - records[i] = hr.to_list()[i] + index -= 1 + records[i] = hr.__getitem__(i).to_bytes(1, byteorder='big') if index < cr.__len__() and index < hr.__len__(): s = cr.__getitem__(index).to_bytes(1, byteorder='big') t = hr.__getitem__(index).to_bytes(1, byteorder='big') @@ -143,4 +144,4 @@ def create(self, clean_rom, hacked_rom, patch_path): pfile.write(len(records[r]).to_bytes(2, byteorder='big')) pfile.write(records[r]) pfile.write(b"EOF") - pfile.close() \ No newline at end of file + pfile.close()