Fix issues with gen1 payload (tested on console)

This commit is contained in:
TimoVM
2026-06-11 22:00:30 +02:00
parent 11a79eed6a
commit 14608eabab
5 changed files with 8 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
tools/gb-payload-generator/build/specificPayloadGen1/specificPayloadGen1_en_r.bin
tools/gb-payload-generator/build/specificPayloadGen1/specificPayloadGen1_en_y.bin
tools/gb-payload-generator/build/universalPayloadGen1/universalPayloadGen1.bin
tools/gb-payload-generator/build/universalPayloadGen2/universalPayloadGen2.bin

View File

@@ -624,7 +624,7 @@ void LinkConnection::load_payload(GB_PayloadsFiles payload)
void LinkConnection::loadCurrGameFromChecksum()
{
if (((dataOutBuffer[0] + dataOutBuffer[1]) & 0x7F) != dataOutBuffer[3])
if (((dataOutBuffer[0] + dataOutBuffer[1]) & 0x7F) != dataOutBuffer[2])
{
currROM = GB_ROM_ERROR;
};

View File

@@ -31,7 +31,7 @@ DEF SerialOffset_C = 0x70
DEF PACKET_SEND = 0xC6D0
DEF PACKET_RECEIVE = 0xC6DC
DEF CHECKSUMPACKET_SIZE = 7
DEF CHECKSUMPACKET_SIZE = 4
DEF RNGSIZE_GEN2 = 0x11
DEF LINKDATASIZE_GEN2 = 0x1C2

View File

@@ -77,7 +77,7 @@ Payload:
call .changeInterruptsAndCommunicate
jr .searchCounter ; hl now points to 0xC6DC
.changeInterruptsAndCommunicate
call 0xC68A ; leftover from the universal payload, only allow serial interrupt and call Serial_ExchangeBytes
call 0xC68E ; leftover from the universal payload, only allow serial interrupt and call Serial_ExchangeBytes
ld a, IE_SERIAL | IE_TIMER | IE_VBLANK ; enable vblank interrupt so that a sound effect can play
ldh [rIE], a
ret

View File

@@ -169,6 +169,8 @@ SerialPatchListAligned:
ds 4, 0
push de ; push 0xC800 on the stack for the next ret
inc a
ld a, IE_SERIAL | IE_TIMER | IE_VBLANK
ldh [rIE], a
ret nz
ld a, 0xC3
ld hl, Start - 1
@@ -176,6 +178,7 @@ SerialPatchListAligned:
inc hl
cp a, [hl]
jr nz, .loopUntilJumpInit
ds 4, 0
jp hl
.findPointerAndPatch ; searches for specific opcodes from a certain offset and places the resulting pointer at a specific location
; b = first opcode to search for
@@ -184,7 +187,6 @@ SerialPatchListAligned:
; hl = offset to start searching from
; return destination pointer in hl, made to minimize amount of M-cycles taken
ld de, .callPatchedPointer + 1
ds 4, 0
.findPointerAndPatchLoop
ld a, [hli]
cp b
@@ -196,10 +198,10 @@ SerialPatchListAligned:
ld a, l
ld [de], a
inc de
ds 4, 0
ld a, h
ld [de], a
ret
ds 5, 0
.callSerial_ExchangeBytes
ld [hl], SERIAL_PREAMBLE_BYTE
ld b, 0