Skip to content

Commit

Permalink
Merge pull request #651 from Eebit/sio_tactician_revisit
Browse files Browse the repository at this point in the history
Match last two `sio_tactician` functions
  • Loading branch information
RevoSucks authored Jul 24, 2024
2 parents b672291 + 6f5e6cc commit 3c20759
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 121 deletions.
116 changes: 0 additions & 116 deletions asm/code_sio_8042DC8.s

This file was deleted.

2 changes: 1 addition & 1 deletion include/sio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion ldscript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
53 changes: 50 additions & 3 deletions src/sio_tactician.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3c20759

Please sign in to comment.