From 9218c2ce16777bba33fea2b606c5805553d190de Mon Sep 17 00:00:00 2001 From: shinyquagsire23 Date: Sun, 10 Sep 2017 21:46:26 -0600 Subject: [PATCH] Decompile to STWI_send_TestModeREQ --- asm/librfu.s | 30 ------------------------------ src/librfu.c | 13 ++++++++++++- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/asm/librfu.s b/asm/librfu.s index eb33c7768a..a01d4e505c 100644 --- a/asm/librfu.s +++ b/asm/librfu.s @@ -4,36 +4,6 @@ .text - thumb_func_start STWI_send_TestModeREQ -STWI_send_TestModeREQ: @ 82E3134 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - movs r0, 0x31 - bl STWI_init - lsls r0, 16 - cmp r0, 0 - bne _082E3160 - ldr r2, _082E3168 - ldr r1, [r2] - movs r0, 0x1 - strb r0, [r1, 0x4] - ldr r0, [r2] - ldr r1, [r0, 0x24] - lsls r0, r4, 8 - orrs r0, r5 - str r0, [r1, 0x4] - bl STWI_start_Command -_082E3160: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_082E3168: .4byte gRfuState - thumb_func_end STWI_send_TestModeREQ - thumb_func_start STWI_send_CPR_StartREQ STWI_send_CPR_StartREQ: @ 82E316C push {r4-r6,lr} diff --git a/src/librfu.c b/src/librfu.c index 67b76b0d99..00dde830b5 100644 --- a/src/librfu.c +++ b/src/librfu.c @@ -36,7 +36,7 @@ enum RFU_UNK2E, RFU_UNK2F, RFU_DISCONNECT, - RFU_UNK31, + RFU_TEST_MODE, RFU_UNK32, RFU_UNK33, RFU_UNK34, @@ -534,3 +534,14 @@ void STWI_send_DisconnectREQ(u8 unk) STWI_start_Command(); } } + +void STWI_send_TestModeREQ(u8 unk0, u8 unk1) +{ + if (!STWI_init(RFU_TEST_MODE)) + { + gRfuState->txParams = 1; + gRfuState->txPacket->data[0] = unk0 | (unk1 << 8); + + STWI_start_Command(); + } +}