sub_8121A1C

This commit is contained in:
PikalaxALT 2017-10-13 08:47:26 -04:00
parent 3c4478b370
commit 74c59af856
4 changed files with 63 additions and 132 deletions

View File

@ -5,128 +5,6 @@
.text .text
thumb_func_start sub_8121A1C
sub_8121A1C: @ 8121A1C
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r6, 0
movs r5, 0
ldr r2, =gUnknown_0203A134
ldr r0, [r2]
movs r1, 0x8A
lsls r1, 2
adds r0, r1
ldr r0, [r0]
ldrb r0, [r0]
cmp r5, r0
bcs _08121A8A
mov r8, r2
adds r7, r1, 0
_08121A3C:
lsls r0, r5, 6
mov r1, r8
ldr r2, [r1]
adds r0, r2, r0
movs r3, 0x85
lsls r3, 2
adds r1, r2, r3
lsls r3, r6, 1
ldr r1, [r1]
adds r1, r3
adds r2, r7
ldr r2, [r2]
ldr r2, [r2, 0x8]
lsls r4, r5, 2
adds r2, r4, r2
ldr r2, [r2]
lsls r2, 30
lsrs r2, 30
movs r3, 0x1
bl ConvertEasyChatWordsToString
mov r1, r8
ldr r0, [r1]
adds r0, r7
ldr r1, [r0]
ldr r0, [r1, 0x8]
adds r4, r0
ldr r0, [r4]
lsls r0, 30
lsrs r0, 30
adds r0, r6, r0
lsls r0, 24
lsrs r6, r0, 24
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
ldrb r1, [r1]
cmp r5, r1
bcc _08121A3C
_08121A8A:
ldr r4, =gUnknown_0203A134
ldr r1, [r4]
movs r2, 0x80
lsls r2, 2
adds r0, r1, r2
movs r3, 0x85
lsls r3, 2
adds r1, r3
ldr r1, [r1]
adds r1, 0x12
bl StringCopy
adds r2, r0, 0
ldr r1, [r4]
ldr r3, =0x0000021e
adds r0, r1, r3
ldrb r0, [r0]
cmp r0, 0
bne _08121AF0
ldr r1, =gText_FromSpace
adds r0, r2, 0
bl StringCopy
ldr r0, [r4]
movs r1, 0x80
lsls r1, 2
adds r0, r1
bl StringLength
ldr r2, [r4]
movs r3, 0x8A
lsls r3, 2
adds r1, r2, r3
ldr r1, [r1]
lsls r0, 16
lsrs r0, 13
subs r0, 0x60
ldrb r1, [r1, 0x2]
subs r1, r0
ldr r0, =0x00000219
adds r2, r0
strb r1, [r2]
b _08121B0C
.pool
_08121AF0:
movs r2, 0x80
lsls r2, 2
adds r0, r1, r2
bl sub_81DB52C
ldr r0, [r4]
movs r3, 0x8A
lsls r3, 2
adds r1, r0, r3
ldr r1, [r1]
ldrb r1, [r1, 0x2]
ldr r2, =0x00000219
adds r0, r2
strb r1, [r0]
_08121B0C:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8121A1C
thumb_func_start sub_8121B1C thumb_func_start sub_8121B1C
sub_8121B1C: @ 8121B1C sub_8121B1C: @ 8121B1C
push {r4-r7,lr} push {r4-r7,lr}

View File

@ -0,0 +1,11 @@
#ifndef GUARD_INTERNATIONAL_STRING_UTIL_H
#define GUARD_INTERNATIONAL_STRING_UTIL_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
void sub_81DB52C(const u8 *src);
#endif //GUARD_INTERNATIONAL_STRING_UTIL_H

12
include/strings.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef GUARD_STRINGS_H
#define GUARD_STRINGS_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
extern const u8 gText_FromSpace[];
#endif //GUARD_STRINGS_H

View File

@ -10,6 +10,9 @@
#include "menu_helpers.h" #include "menu_helpers.h"
#include "text.h" #include "text.h"
#include "text_window.h" #include "text_window.h"
#include "string_util.h"
#include "international_string_util.h"
#include "strings.h"
#include "gpu_regs.h" #include "gpu_regs.h"
#include "bg.h" #include "bg.h"
#include "pokemon_icon.h" #include "pokemon_icon.h"
@ -23,11 +26,11 @@
struct UnkMailStruct struct UnkMailStruct
{ {
u8 unk_0_0:2; u32 unk_0_0:2;
u8 unk_0_2:2; u32 unk_0_2:2;
u8 unk_0_4:4; u32 unk_0_4:4;
u8 unk_1_0:4; u32 unk_1_0:4;
u8 unk_1_4:1; u32 unk_1_4:1;
}; };
struct MailLayout struct MailLayout
@ -43,12 +46,13 @@ struct MailLayout
struct Unk203A134 struct Unk203A134
{ {
/*0x0000*/ u8 filler_0000[0x20c]; /*0x0000*/ u8 strbuf[8][64];
/*0x0200*/ u8 playerName[12];
/*0x020C*/ MainCallback callback; /*0x020C*/ MainCallback callback;
/*0x0210*/ MainCallback callback2; /*0x0210*/ MainCallback callback2;
/*0x0214*/ struct MailStruct *mail; /*0x0214*/ struct MailStruct *mail;
/*0x0218*/ bool8 flag; /*0x0218*/ bool8 flag;
/*0x0219*/ u8 filler_0219[1]; /*0x0219*/ u8 unk_0219;
/*0x021a*/ u8 mailType; /*0x021a*/ u8 mailType;
/*0x021b*/ u8 unk_021b; /*0x021b*/ u8 unk_021b;
/*0x021c*/ u8 unk_021c; /*0x021c*/ u8 unk_021c;
@ -115,9 +119,8 @@ const struct WindowTemplate gUnknown_0859F29C[] = {
.height = 15, .height = 15,
.paletteNum = 15, .paletteNum = 15,
.baseBlock = 1 .baseBlock = 1
}, { },
.priority = -1 DUMMY_WIN_TEMPLATE
}
}; };
const u8 gUnknown_0859F2AC[] = { const u8 gUnknown_0859F2AC[] = {
@ -240,6 +243,8 @@ const struct MailLayout gUnknown_0859F458[] = {
{ 0x05, 0x09, 0x60, 0x5, 0x0, 0x1e, Unknown_0859F444 } { 0x05, 0x09, 0x60, 0x5, 0x0, 0x1e, Unknown_0859F444 }
}; };
// What the heck are these meant to be? Call them u16 for now.
const u16 Unknown_0859F4E8[] = { const u16 Unknown_0859F4E8[] = {
0x00, 0x4000, 0x00, 0x00 0x00, 0x4000, 0x00, 0x00
}; };
@ -459,3 +464,28 @@ void sub_81219F0(void)
} }
} while (sub_81221AC() != TRUE); } while (sub_81221AC() != TRUE);
} }
void sub_8121A1C(void)
{
u16 i;
u8 total;
u8 *ptr;
total = 0;
for (i = 0; i < gUnknown_0203A134->layout->var0; i ++)
{
ConvertEasyChatWordsToString(gUnknown_0203A134->strbuf[i], &gUnknown_0203A134->mail->words[total], gUnknown_0203A134->layout->var8[i].unk_0_0, 1);
total += gUnknown_0203A134->layout->var8[i].unk_0_0;
}
ptr = StringCopy(gUnknown_0203A134->playerName, gUnknown_0203A134->mail->playerName);
if (!gUnknown_0203A134->playerIsSender)
{
StringCopy(ptr, gText_FromSpace);
gUnknown_0203A134->unk_0219 = gUnknown_0203A134->layout->var2 - (StringLength(gUnknown_0203A134->playerName) * 8 - 0x60);
}
else
{
sub_81DB52C(gUnknown_0203A134->playerName);
gUnknown_0203A134->unk_0219 = gUnknown_0203A134->layout->var2;
}
}