From 15a140073d64d0abbd5208ecc2f4d17c8dd59758 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Sat, 10 Jan 2026 22:46:49 +0100 Subject: [PATCH] Remove SERIAL_PATCH_PREAMBLE_LENGTH from mail patch list --- constants/serial_constants.asm | 2 ++ ram/wram.asm | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/constants/serial_constants.asm b/constants/serial_constants.asm index c14aba55..5949e054 100644 --- a/constants/serial_constants.asm +++ b/constants/serial_constants.asm @@ -45,6 +45,8 @@ DEF SERIAL_MAIL_PREAMBLE_BYTE EQU $20 DEF SERIAL_MAIL_PREAMBLE_LENGTH EQU 5 ; used to replace SERIAL_NO_DATA_BYTE DEF SERIAL_MAIL_REPLACEMENT_BYTE EQU $21 +; length of the mail patch list (it's bigger than the mail patched area by 18 bytes) +DEF SERIAL_MAIL_PATCH_LIST_LENGTH EQU (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1) + 3) * PARTY_LENGTH + 1 ; timeout duration after exchanging a byte DEF SERIAL_LINK_BYTE_TIMEOUT EQU $5000 diff --git a/ram/wram.asm b/ram/wram.asm index 73a9e755..72b210d7 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -506,13 +506,13 @@ wLinkSendMail:: wLinkSendMailPreamble:: ds SERIAL_MAIL_PREAMBLE_LENGTH wLinkSendMailMessages:: ds (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH wLinkSendMailMetadata:: ds (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH -wLinkSendMailPatchSet:: ds 100 + SERIAL_PATCH_PREAMBLE_LENGTH +wLinkSendMailPatchSet:: ds SERIAL_MAIL_PATCH_LIST_LENGTH wLinkSendMailEnd:: ds 10 ; during a link session, other Game Boy's raw mail data is initially stored here wLinkReceivedMail:: - ds SERIAL_MAIL_PREAMBLE_LENGTH + MAIL_STRUCT_LENGTH * PARTY_LENGTH + 100 + SERIAL_PATCH_PREAMBLE_LENGTH + ds SERIAL_MAIL_PREAMBLE_LENGTH + MAIL_STRUCT_LENGTH * PARTY_LENGTH + SERIAL_MAIL_PATCH_LIST_LENGTH wLinkReceivedMailEnd:: ds 10 @@ -560,7 +560,7 @@ endr ; received mail data, stripped of the serial preamble wLinkReceivedMailMessages:: ds (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH wLinkReceivedMailMetadata:: ds (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH -wLinkReceivedMailPatchSet:: ds 100 + SERIAL_PATCH_PREAMBLE_LENGTH +wLinkReceivedMailPatchSet:: ds SERIAL_MAIL_PATCH_LIST_LENGTH NEXTU ; Gen 1 (Time Tapsule) link player party data