Merge pull request #651 from Eebit/sio_tactician_revisit

Match last two `sio_tactician` functions
This commit is contained in:
Revo 2024-07-24 18:07:46 -04:00 committed by GitHub
commit 3c207595fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 51 additions and 121 deletions

View File

@ -1,116 +0,0 @@
.INCLUDE "macro.inc"
.SYNTAX UNIFIED
THUMB_FUNC_START GetTacticianTextConf
GetTacticianTextConf: @ 0x08044550
lsls r0, r0, #0x10
asrs r0, r0, #0xa
ldr r1, _0804455C @ gTacticianTextConf
adds r0, r0, r1
bx lr
.align 2, 0
_0804455C: .4byte gTacticianTextConf
THUMB_FUNC_END GetTacticianTextConf
THUMB_FUNC_START sub_8044560
sub_8044560: @ 0x08044560
push {r4, r5, r6, r7, lr}
mov r7, sl
mov r6, r9
mov r5, r8
push {r5, r6, r7}
sub sp, #0x10
mov sl, r0
mov r9, r1
movs r0, #0
str r0, [sp]
ldrb r0, [r1]
cmp r0, #0
beq _08044602
_0804457A:
movs r1, #0
mov r8, r1
mov r3, r9
adds r3, #2
str r3, [sp, #8]
_08044584:
mov r5, r8
lsls r0, r5, #0x10
asrs r0, r0, #0x10
bl GetTacticianTextConf
str r0, [sp, #4]
movs r7, #0
mov r6, r8
ldr r0, _080445D8 @ 0x00003FFF
ands r6, r0
movs r1, #0
mov ip, r1
_0804459C:
movs r4, #0
mov r3, r9
ldrh r3, [r3]
str r3, [sp, #0xc]
ldr r2, [sp, #4]
add r2, ip
adds r0, r7, #0
movs r5, #3
ands r0, r5
lsls r1, r0, #0xe
orrs r1, r6
ldr r3, [sp]
lsls r0, r3, #1
adds r0, #0x4c
mov r5, sl
adds r3, r0, r5
_080445BC:
ldr r0, [r2]
ldrh r0, [r0]
ldr r5, [sp, #0xc]
cmp r0, r5
bne _080445DC
strh r1, [r3]
mov r0, sl
adds r0, #0x39
strb r4, [r0]
ldr r0, [sp]
adds r0, #1
str r0, [sp]
b _080445F8
.align 2, 0
_080445D8: .4byte 0x00003FFF
_080445DC:
adds r2, #4
adds r4, #1
cmp r4, #2
ble _080445BC
movs r1, #0xc
add ip, r1
adds r7, #1
cmp r7, #2
ble _0804459C
movs r3, #1
add r8, r3
mov r5, r8
cmp r5, #0x50
ble _08044584
_080445F8:
ldr r0, [sp, #8]
mov r9, r0
ldrb r0, [r0]
cmp r0, #0
bne _0804457A
_08044602:
add sp, #0x10
pop {r3, r4, r5}
mov r8, r3
mov r9, r4
mov sl, r5
pop {r4, r5, r6, r7}
pop {r0}
bx r0
THUMB_FUNC_END sub_8044560
.align 2, 0

View File

@ -42,7 +42,7 @@ struct TacticianTextConf {
};
extern const struct TacticianTextConf gTacticianTextConf[];
struct TacticianTextConf * GetTacticianTextConf(s16);
const struct TacticianTextConf * GetTacticianTextConf(s16);
enum sio_save_config_bitfile {
SIO_SAVE_CONF_B3 = 1 << 3,

View File

@ -395,7 +395,6 @@ SECTIONS
src/sio_main.o(.text);
src/sio_main2.o(.text);
src/sio_teamlist.o(.text);
asm/code_sio_8042DC8.o(.text);
src/sio_tactician.o(.text);
src/sio_postbattle.o(.text);
src/sio_bat.o(.text);

View File

@ -11,6 +11,53 @@
#include "uiutils.h"
#include "constants/characters.h"
//! FE8U = 0x08044550
const struct TacticianTextConf * GetTacticianTextConf(s16 idx)
{
return gTacticianTextConf + idx;
}
void sub_8044560(struct ProcTactician * proc, u8 * str_buf)
{
int i;
int j;
int k;
int idx = 0;
for (; *str_buf != 0 ; str_buf += 2)
{
for (i = 0; i <= 0x50; i++)
{
const struct TacticianTextConf * conf = GetTacticianTextConf(i);
for (j = 0; j < 3; j++)
{
for (k = 0; k < 3; k++)
{
u16 * str = (u16 *)(conf->str + j * 3)[k];
if (*str == *(u16 *)str_buf)
{
proc->unk4C[idx] = ((j & 3) << 0xe) | (i & 0x3FFF);
proc->unk39 = k;
idx++;
goto _080445F8;
}
}
}
}
_080445F8:
// need a semi-colon for modern compilers
; // exit loop
}
return;
}
void sub_8044614(struct ProcTactician * proc)
{
int i, j;
@ -83,7 +130,7 @@ void Tactician_InitScreen(struct ProcTactician * proc)
int i, char_cnt;
char * str;
u8 str_buf[0x10];
struct TacticianTextConf * conf;
const struct TacticianTextConf * conf;
ClearSioBG();
InitSioBG();
@ -280,7 +327,7 @@ bool sub_8044B78(struct ProcTactician * proc, const struct TacticianTextConf * c
if (proc->cur_len != 0)
{
struct TacticianTextConf * conf2;
const struct TacticianTextConf * conf2;
int r8, line_idx;
u16 conf_idx;
@ -489,7 +536,7 @@ void sub_8044C54(struct ProcTactician * proc, const struct TacticianTextConf * c
void Tactician_Loop(struct ProcTactician * proc)
{
char _cbuf[proc->max_len + 1];
struct TacticianTextConf * conf = GetTacticianTextConf(proc->conf_idx);
const struct TacticianTextConf * conf = GetTacticianTextConf(proc->conf_idx);
proc->unk36 = proc->conf_idx;
sub_8044C54(proc, conf);