Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

messdecode review: renamed as msg #442

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions asm/code.s
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ sub_808F128: @ 0x0808F128
lsls r0, r0, #0x18
cmp r0, #0
beq _0808F166
bl sub_800A2A4
bl StringInsertSpecialPrefixByCtrl
str r0, [r4, #0x2c]
_0808F166:
adds r0, r4, #0
Expand Down Expand Up @@ -1094,7 +1094,7 @@ _0808F214:
lsls r0, r0, #0x18
cmp r0, #0
beq _0808F254
bl sub_800A2A4
bl StringInsertSpecialPrefixByCtrl
str r0, [r4, #0x2c]
_0808F254:
add sp, #0xc
Expand Down
2 changes: 1 addition & 1 deletion asm/evtscr.s
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ _0800E348: .4byte gUnknown_030004E4
_0800E34C:
adds r0, r7, #0
bl GetStringFromIndex
bl sub_800A2A4
bl StringInsertSpecialPrefixByCtrl
add r2, sp, #4
mov r1, sp
bl sub_808AADC
Expand Down
8 changes: 4 additions & 4 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ void sub_800915C(int, int, int, int, int, int, int, ProcPtr);
// ??? sub_8009198(???);
// ??? sub_8009200(???);
// ??? sub_8009250(???);
// ??? sub_800A048(???);
void PrependArticleToString(char *a, const char *b, s8 c);
// ??? GetStrPrefix(???);
void InsertPrefix(char *a, const char *b, s8 c);
// ??? SomethingRelatedToText(???);
char *GetStringFromIndex(int index);
char *GetStringFromIndexInBuffer(int index, char *buffer);
char *sub_800A2A4(void);
char* FilterSomeTextFromStandardBuffer(void);
char *StringInsertSpecialPrefixByCtrl(void);
char* StrInsertTact(void);
// ??? sub_800A42C(???);
// ??? sub_800A4E8(???);
// ??? sub_800A518(???);
Expand Down
12 changes: 6 additions & 6 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ enum PlaySt_chapterModeIndex {
CHAPTER_MODE_EPHRAIM = 3,
};

struct TextBuffer0202A6AC
struct MsgBuffer
{
u8 buffer0202A6AC[0x555];
u8 buffer0202AC01[0x555];
u8 buffer0202B156[0x356];
u8 buffer0202B4AC[0x100];
u8 buffer0202B5AC[1]; // unknown length
u8 buffer1[0x555];
u8 buffer2[0x555];
u8 buffer3[0x356];
u8 buffer4[0x100];
u8 buffer5[0x100];
};

struct ActionData
Expand Down
10 changes: 2 additions & 8 deletions include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ extern u8 gGenericBuffer[0x2000];
// extern ??? gUnknown_02026E10
// extern ??? gUnknown_02028F78
// extern ??? gUnknown_02029D88
extern struct TextBuffer0202A6AC gUnknown_0202A6AC;
//extern u8 gUnknown_0202AC01[];
//extern u8 gUnknown_0202B156[];
extern u8 gUnknown_0202B4AC[];
// extern ??? gUnknown_0202B5AC
extern int gUnknown_0202B6AC;
extern struct BmSt gBmSt;
extern struct PlaySt gPlaySt;
// extern ??? gUnknown_0202BD30
Expand Down Expand Up @@ -580,8 +574,8 @@ extern struct Glyph *TextGlyphs_Special[];
// extern ??? gUnknown_0859160C
// extern ??? gUnknown_08591624
// extern ??? gUnknown_0859163C
extern const char *gUnknown_08591AA4[][2];
//extern struct {u32 *unk0; u32 *unk4; u32 *unk8;} gUnknown_08591AA4;
extern const char *gStrPrefix[][2];
//extern struct {u32 *unk0; u32 *unk4; u32 *unk8;} gStrPrefix;
// extern ??? gUnknown_08591AB4

// extern ??? sProcScr_Popup
Expand Down
6 changes: 3 additions & 3 deletions ldscript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SECTIONS
asm/scene.o(.text);
src/ap.o(.text);
src/gamecontrol.o(.text);
src/messdecode.o(.text);
src/msg.o(.text);
asm/spline.o(.text);
asm/evtcmd_gmap.o(.text);
src/event.o(.text);
Expand Down Expand Up @@ -351,7 +351,7 @@ SECTIONS
. = ALIGN(4); src/scene.o(.rodata);
. = ALIGN(4); src/ap.o(.rodata);
. = ALIGN(4); src/gamecontrol.o(.rodata);
. = ALIGN(4); src/messdecode.o(.rodata);
. = ALIGN(4); src/msg.o(.rodata);
. = ALIGN(4); data/const_data_D792C.o(.rodata);
. = ALIGN(4); src/bmlib.o(.rodata);
. = ALIGN(4); src/bm.o(.rodata);
Expand Down Expand Up @@ -493,7 +493,7 @@ SECTIONS
. = ALIGN(4); src/scene.o(.data);
. = ALIGN(4); src/ap.o(.data);
. = ALIGN(4); src/gamecontrol.o(.data);
. = ALIGN(4); src/messdecode.o(.data);
. = ALIGN(4); src/msg.o(.data);
. = ALIGN(4); data/data_591AB4.o(.data);
. = ALIGN(4); src/popup.o(.data);
. = ALIGN(4); data/data_5924D8.o(.data);
Expand Down
4 changes: 2 additions & 2 deletions src/bmitem.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ char* GetItemNameWithArticle(int item, s8 capitalize) {
article = NULL;

result = GetItemName(item);
PrependArticleToString(result, article, capitalize);
InsertPrefix(result, article, capitalize);

return result;
}
Expand All @@ -88,7 +88,7 @@ inline char* GetItemName(int item) {
char* result;

result = GetStringFromIndex(GetItemData(ITEM_INDEX(item))->nameTextId);
result = FilterSomeTextFromStandardBuffer();
result = StrInsertTact();

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fontgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ void GetStringTextBox(const char* _str, int *out_width, int *out_height)
*out_width = 0;
*out_height = 0;

str = sub_800A2A4();
str = StringInsertSpecialPrefixByCtrl();
while (*str != 0 && *str != CHAR_NEWLINE) {
int width = GetStringTextLen(str);

Expand Down
64 changes: 32 additions & 32 deletions src/helpbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ struct HelpBox8A016E0Proc {
struct HelpBox8A01760Proc {
/* 00 */ PROC_HEADER;

/* 2C */ const char* unk_2c;
/* 30 */ struct Font* unk_30;
/* 34 */ struct Text* unk_34[5];
/* 2C */ const char * str;
/* 30 */ struct Font * unk_30;
/* 34 */ struct Text * unk_34[5];

/* 48 */ s16 unk_48;
/* 4A */ s16 unk_4a;
Expand Down Expand Up @@ -601,7 +601,7 @@ void sub_808A00C(struct HelpBox8A01650Proc* proc) {
// TODO: Unknown? Seems pointless, but needed for match
GetStringFromIndex(proc->unk_5c);

otherProc->unk_2c = sub_800A2A4();
otherProc->unk_2c = StringInsertSpecialPrefixByCtrl();

otherProc->unk_62 = 1;

Expand Down Expand Up @@ -1536,7 +1536,7 @@ void sub_808AC0C(int x, int y, int msg) {
// ??
GetStringFromIndex(proc->mid);

sub_808AADC(sub_800A2A4(), &wInner, &hInner);
sub_808AADC(StringInsertSpecialPrefixByCtrl(), &wInner, &hInner);

SetTextFontGlyphs(0);

Expand Down Expand Up @@ -1655,7 +1655,7 @@ void sub_808B09C(struct HelpBox8A01760Proc* proc) {
proc->unk_50 = helpBoxProc->xBox - 8;
proc->unk_51 = helpBoxProc->yBox - 8;

sub_808AB98(proc->unk_2c, &proc->unk_52);
sub_808AB98(proc->str, &proc->unk_52);

return;
}
Expand Down Expand Up @@ -1729,15 +1729,15 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
int r0;
int a, b;

switch (*proc->unk_2c) {
switch (*proc->str) {
case 0x18: // [Yes]
sub_808B0D4();

r3 = Proc_Find(gUnknown_08A01740);

sub_80900EC(gUnknown_08A016D8, proc->unk_34[proc->unk_48], r3->xBoxFinal, r3->yBoxFinal + proc->unk_48 * 16, 6, 1, proc);

proc->unk_2c++;
proc->str++;
goto _0808B772;

case 0x19: // [No]
Expand All @@ -1747,17 +1747,17 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {

sub_80900EC(gUnknown_08A016D8, proc->unk_34[proc->unk_48], r3->xBoxFinal, r3->yBoxFinal + proc->unk_48 * 16, 6, 2, proc);

proc->unk_2c++;
proc->str++;
goto _0808B772;

case 0x80:
r1 = proc->unk_2c + 1;
proc->unk_2c = r1;
r1 = proc->str + 1;
proc->str = r1;

if (*r1 == 0x21) { // [ToggleRed]
r0 = proc->unk_59;
proc->unk_59 = (r0+1) & 1;
proc->unk_2c++;
proc->str++;
i--;

continue;
Expand All @@ -1768,12 +1768,12 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
Proc_Goto(proc, 1);

Proc_EndEach(gUnknown_08A01818);
proc->unk_2c++;
proc->str++;

goto _0808B772;

} else if (*r1 == 0x25) { // [ToggleColorInvert]
proc->unk_2c++;
proc->str++;

goto _0808B772;
}
Expand All @@ -1788,14 +1788,14 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {

sub_808B0D4();

proc->unk_2c++;
if (*proc->unk_2c == 0x01) {
proc->unk_2c++;
proc->str++;
if (*proc->str == 0x01) {
proc->str++;
}

if (r4 != 0) {
sub_808B11C(proc);
sub_808AADC(proc->unk_2c, &a, &b);
sub_808AADC(proc->str, &a, &b);

proc->unk_56 = a;
proc->unk_57 = b;
Expand Down Expand Up @@ -1827,7 +1827,7 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
case 0x01: // [NL]
sub_808B0D4();

proc->unk_2c++;
proc->str++;

if (proc->unk_55 == (proc->unk_48 + 1)) {
// b _0808B1DE
Expand All @@ -1844,7 +1844,7 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
case 0x04: // [....]
sub_808B0D4();

proc->unk_2c++;
proc->str++;

proc->unk_4a = 8;

Expand All @@ -1853,7 +1853,7 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
case 0x05: // [.....]
sub_808B0D4();

proc->unk_2c++;
proc->str++;

proc->unk_4a = 0x10;

Expand All @@ -1862,7 +1862,7 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
case 0x06: // [......]
sub_808B0D4();

proc->unk_2c++;
proc->str++;

proc->unk_4a = 0x20;

Expand All @@ -1871,7 +1871,7 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
case 0x07: // [.......]
sub_808B0D4();

proc->unk_2c++;
proc->str++;

proc->unk_4a = 0x40;

Expand All @@ -1880,13 +1880,13 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
case 0x02: // [NL2]
sub_808B0D4();

proc->unk_2c++;
proc->str++;

if (*proc->unk_2c == 0x01) { // [NL]
proc->unk_2c++;
if (*proc->str == 0x01) { // [NL]
proc->str++;
}

if (*proc->unk_2c == 0x00) { // [X]
if (*proc->str == 0x00) { // [X]
if ((GetDialogueBoxConfig() & 2) == 0) {
Proc_Break(proc);
} else {
Expand All @@ -1898,7 +1898,7 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
if ((GetDialogueBoxConfig() & 0x10) != 0) {
sub_808B11C(proc);
} else {
if (*proc->unk_2c != 0) {
if (*proc->str != 0) {
proc->unk_58 = 0;
Proc_Goto(proc, 5);
}
Expand All @@ -1914,15 +1914,15 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {

sub_808B0D4();

proc->unk_2c++;
proc->str++;

r0 = Proc_Find(gUnknown_08A01740);

x = r0->xBoxFinal + proc->unk_52;
y = r0->yBoxFinal + proc->unk_48 * 16;
StartTalkWaitForInput(proc, x, y + 8);

sub_808AB98(proc->unk_2c, &proc->unk_52);
sub_808AB98(proc->str, &proc->unk_52);

goto _0808B772;
}
Expand All @@ -1940,7 +1940,7 @@ void BoxDialogueInterpreter_Main(struct HelpBox8A01760Proc* proc) {
}
}

proc->unk_2c = Text_DrawCharacter(proc->unk_34[proc->unk_48], proc->unk_2c);
proc->str = Text_DrawCharacter(proc->unk_34[proc->unk_48], proc->str);

if (GetTextDisplaySpeed() != 1 || (GetGameClock() & 1) != 0) {

Expand Down Expand Up @@ -2126,7 +2126,7 @@ void sub_808B928(struct HelpBox8A01800Proc* proc) {

GetStringFromIndex(proc->unk_5c);

otherProc->unk_2c = sub_800A2A4();
otherProc->str = StringInsertSpecialPrefixByCtrl();
otherProc->unk_54 = proc->unk_2c;
otherProc->unk_55 = proc->unk_30;

Expand Down
Loading