diff --git a/tools/cheat-builder/asm/key_onoff.s b/tools/cheat-builder/asm/key_onoff.s index a9d2c2f..e8a73b3 100644 --- a/tools/cheat-builder/asm/key_onoff.s +++ b/tools/cheat-builder/asm/key_onoff.s @@ -7,18 +7,30 @@ _start: mov r0, #0x4000000 ldr r0, [r0, #0x130] @ r0 = read_io(0x4000130) - ldrh r1, [pc, #0x24] @ r1 = 0x384 key:L+R+D+SEL - ldrh r2, [pc, #0x22] @ r2 = 0x3ff + ldrh r1, [pc, #0x3c] @ r1 = 0x384 key:L+R+D+SEL + ldrh r2, [pc, #0x3a] @ r2 = 0x3ff and r0, r0, r2 @ r0 = r0 & 0x3ff - ldr r2, [pc, #0x1c] @ r2 = static_addr(isOn) + ldr r2, [pc, #0x34] @ r2 = static_addr(isOn) ldrb r3, [r2] @ r3 = *isOn + cmp r0, r1 - eoreq r3, r3, #1 @ if r0 == key then *isOn = !r3 - streqb r3, [r2] + beq _mark + @ if r0 != key + ands r1, r3, #0x10 + andne r3, r3, #0xf + strneb r3, [r2] @ if r3 & 0x10 then *isOn = r3 & 0xf end + +_final: cmp r3, #0 - bne _next @ if r3 != 0 then next else return + bne _next bx lr +_mark: @ else // r0 == key + ands r1, r3, #0x10 + eoreq r3, r3, #0x11 + streqb r3, [r2] @ if r3 & 0x10 == 0 then *isOn = !r3 | 0x10 end + b _final + _const: .long 0x03ff0384 .long 0