Skip to content

Commit 366da3c

Browse files
committed
The previous fix for #174 was buggy
1 parent b559b93 commit 366da3c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

player.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3556,7 +3556,8 @@ void Link_APress_LiftCarryThrow() { // 87b1ca
35563556
} else {
35573557
static const uint8 kLiftTab0[10] = { 8, 24, 8, 24, 8, 32, 6, 8, 13, 13 };
35583558
static const uint8 kLiftTab1[10] = { 0, 1, 0, 1, 0, 1, 0, 1, 2, 3 };
3559-
static const uint8 kLiftTab2[] = { 6, 7, 7, 5 };
3559+
static const uint8 kLiftTab2[29] = { 6, 7, 7, 5, 10, 0, 23, 0, 18, 0, 18, 0, 8, 0, 8, 0, 254, 255, 17, 0,
3560+
0x54, 0x52, 0x50, 0xFF, 0x51, 0x53, 0x55, 0x56, 0x57 };
35603561

35613562
if (player_handler_timer != 0) {
35623563
if (player_handler_timer + 1 != 9) {
@@ -3576,7 +3577,7 @@ void Link_APress_LiftCarryThrow() { // 87b1ca
35763577
}
35773578
} else {
35783579
// fix OOB read triggered when lifting for too long
3579-
if (some_animation_timer_steps >= 3)
3580+
if (some_animation_timer_steps >= sizeof(kLiftTab2) - 1)
35803581
return;
35813582
some_animation_timer = kLiftTab2[++some_animation_timer_steps];
35823583
assert(some_animation_timer_steps < arraysize(kLiftTab2));

snes/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static void cpu_doOpcode(Cpu* cpu, uint8_t opcode) {
741741
uint32_t addr = (cpu->k << 16) | cpu->pc;
742742
switch (addr - 1) {
743743
case 0x7B269: // Link_APress_LiftCarryThrow reads OOB
744-
if ((cpu->x & 0xff) >= 3)
744+
if ((cpu->x & 0xff) >= 28)
745745
cpu->pc = 0xB280; // RTS
746746
opcode = 0xE8;
747747
goto RESTART;

0 commit comments

Comments
 (0)