Skip to content

Commit

Permalink
Add signatures for SRAM_V110
Browse files Browse the repository at this point in the history
  • Loading branch information
metroid-maniac committed May 8, 2023
1 parent 1a27162 commit ab28152
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static unsigned char thumb_branch_thunk[] = { 0x00, 0x4b, 0x18, 0x47 };
static unsigned char arm_branch_thunk[] = { 0x00, 0x30, 0x9f, 0xe5, 0x13, 0xff, 0x2f, 0xe1 };

static unsigned char write_sram_signature[] = { 0x30, 0xB5, 0x05, 0x1C, 0x0C, 0x1C, 0x13, 0x1C, 0x0B, 0x4A, 0x10, 0x88, 0x0B, 0x49, 0x08, 0x40};
static unsigned char write_sram2_signature[] = { 0x80, 0xb5, 0x83, 0xb0, 0x6f, 0x46, 0x38, 0x60, 0x79, 0x60, 0xba, 0x60, 0x09, 0x48, 0x09, 0x49 };
static unsigned char write_sram_ram_signature[] = { 0x04, 0xC0, 0x90, 0xE4, 0x01, 0xC0, 0xC1, 0xE4, 0x2C, 0xC4, 0xA0, 0xE1, 0x01, 0xC0, 0xC1, 0xE4 };
static unsigned char write_eeprom_signature[] = { 0x70, 0xB5, 0x00, 0x04, 0x0A, 0x1C, 0x40, 0x0B, 0xE0, 0x21, 0x09, 0x05, 0x41, 0x18, 0x07, 0x31, 0x00, 0x23, 0x10, 0x78};
static unsigned char write_flash_signature[] = { 0x70, 0xB5, 0x00, 0x03, 0x0A, 0x1C, 0xE0, 0x21, 0x09, 0x05, 0x41, 0x18, 0x01, 0x23, 0x1B, 0x03};
Expand Down Expand Up @@ -205,6 +206,18 @@ int main(int argc, char **argv)
memcpy(write_location, thumb_branch_thunk, sizeof thumb_branch_thunk);
1[(uint32_t*) write_location] = 0x08000000 + payload_base + WRITE_SRAM_PATCHED[(uint32_t*) payload_bin];
}
SAVE_SIZE[(uint32_t*) &rom[payload_base]] = 0x8000;

}
if (!memcmp(write_location, write_sram2_signature, sizeof write_sram2_signature))
{
found_write_location = 1;
if (!mode)
{
printf("WriteSram 2 identified at offset %lx, patching\n", write_location - rom);
memcpy(write_location, thumb_branch_thunk, sizeof thumb_branch_thunk);
1[(uint32_t*) write_location] = 0x08000000 + payload_base + WRITE_SRAM_PATCHED[(uint32_t*) payload_bin];
}
SAVE_SIZE[(uint32_t*) &rom[payload_base]] = 0x8000;

}
Expand Down

0 comments on commit ab28152

Please sign in to comment.