mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-14 07:33:44 +01:00
sub_8121B1C
This commit is contained in:
parent
e24f3808f4
commit
cc84713249
143
asm/mail.s
143
asm/mail.s
@ -5,149 +5,6 @@
|
|||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
thumb_func_start sub_8121B1C
|
|
||||||
sub_8121B1C: @ 8121B1C
|
|
||||||
push {r4-r7,lr}
|
|
||||||
mov r7, r10
|
|
||||||
mov r6, r9
|
|
||||||
mov r5, r8
|
|
||||||
push {r5-r7}
|
|
||||||
sub sp, 0x2C
|
|
||||||
movs r7, 0
|
|
||||||
movs r0, 0
|
|
||||||
bl PutWindowTilemap
|
|
||||||
movs r0, 0x1
|
|
||||||
bl PutWindowTilemap
|
|
||||||
movs r0, 0
|
|
||||||
movs r1, 0
|
|
||||||
bl FillWindowPixelBuffer
|
|
||||||
movs r0, 0x1
|
|
||||||
movs r1, 0
|
|
||||||
bl FillWindowPixelBuffer
|
|
||||||
movs r6, 0
|
|
||||||
ldr r1, =gUnknown_0203A134
|
|
||||||
ldr r0, [r1]
|
|
||||||
movs r2, 0x8A
|
|
||||||
lsls r2, 2
|
|
||||||
mov r10, r2
|
|
||||||
add r0, r10
|
|
||||||
ldr r0, [r0]
|
|
||||||
ldrb r0, [r0]
|
|
||||||
cmp r6, r0
|
|
||||||
bcs _08121BCC
|
|
||||||
mov r9, r1
|
|
||||||
mov r8, r10
|
|
||||||
_08121B60:
|
|
||||||
mov r0, r9
|
|
||||||
ldr r1, [r0]
|
|
||||||
lsls r0, r6, 6
|
|
||||||
adds r5, r1, r0
|
|
||||||
ldrb r0, [r5]
|
|
||||||
cmp r0, 0xFF
|
|
||||||
beq _08121BB8
|
|
||||||
cmp r0, 0
|
|
||||||
beq _08121BB8
|
|
||||||
mov r2, r8
|
|
||||||
adds r0, r1, r2
|
|
||||||
ldr r1, [r0]
|
|
||||||
ldr r0, [r1, 0x8]
|
|
||||||
lsls r4, r6, 2
|
|
||||||
adds r0, r4, r0
|
|
||||||
ldr r2, [r0]
|
|
||||||
lsls r2, 24
|
|
||||||
lsrs r2, 26
|
|
||||||
ldrb r0, [r1, 0x4]
|
|
||||||
adds r2, r0
|
|
||||||
lsls r2, 24
|
|
||||||
lsrs r2, 24
|
|
||||||
ldrb r3, [r1, 0x3]
|
|
||||||
adds r3, r7, r3
|
|
||||||
lsls r3, 24
|
|
||||||
lsrs r3, 24
|
|
||||||
ldr r0, =gUnknown_0859F2AC
|
|
||||||
str r0, [sp]
|
|
||||||
movs r0, 0
|
|
||||||
str r0, [sp, 0x4]
|
|
||||||
str r5, [sp, 0x8]
|
|
||||||
movs r1, 0x1
|
|
||||||
bl box_print
|
|
||||||
mov r1, r9
|
|
||||||
ldr r0, [r1]
|
|
||||||
add r0, r8
|
|
||||||
ldr r0, [r0]
|
|
||||||
ldr r0, [r0, 0x8]
|
|
||||||
adds r4, r0
|
|
||||||
ldrb r0, [r4, 0x1]
|
|
||||||
adds r0, r7, r0
|
|
||||||
lsls r0, 24
|
|
||||||
lsrs r7, r0, 24
|
|
||||||
_08121BB8:
|
|
||||||
adds r0, r6, 0x1
|
|
||||||
lsls r0, 16
|
|
||||||
lsrs r6, r0, 16
|
|
||||||
ldr r2, =gUnknown_0203A134
|
|
||||||
ldr r0, [r2]
|
|
||||||
add r0, r10
|
|
||||||
ldr r0, [r0]
|
|
||||||
ldrb r0, [r0]
|
|
||||||
cmp r6, r0
|
|
||||||
bcc _08121B60
|
|
||||||
_08121BCC:
|
|
||||||
ldr r1, =gText_FromSpace
|
|
||||||
add r0, sp, 0xC
|
|
||||||
bl StringCopy
|
|
||||||
ldr r4, =gUnknown_0203A134
|
|
||||||
ldr r1, [r4]
|
|
||||||
movs r2, 0x80
|
|
||||||
lsls r2, 2
|
|
||||||
adds r1, r2
|
|
||||||
bl StringCopy
|
|
||||||
ldr r0, [r4]
|
|
||||||
ldr r1, =0x00000219
|
|
||||||
adds r0, r1
|
|
||||||
ldrb r2, [r0]
|
|
||||||
movs r0, 0x1
|
|
||||||
add r1, sp, 0xC
|
|
||||||
bl GetStringCenterAlignXOffset
|
|
||||||
adds r2, r0, 0
|
|
||||||
adds r2, 0x68
|
|
||||||
ldr r0, [r4]
|
|
||||||
movs r1, 0x8A
|
|
||||||
lsls r1, 2
|
|
||||||
adds r0, r1
|
|
||||||
ldr r0, [r0]
|
|
||||||
ldrb r3, [r0, 0x1]
|
|
||||||
adds r3, 0x58
|
|
||||||
lsls r2, 24
|
|
||||||
lsrs r2, 24
|
|
||||||
lsls r3, 24
|
|
||||||
lsrs r3, 24
|
|
||||||
ldr r0, =gUnknown_0859F2AC
|
|
||||||
str r0, [sp]
|
|
||||||
movs r0, 0
|
|
||||||
str r0, [sp, 0x4]
|
|
||||||
add r0, sp, 0xC
|
|
||||||
str r0, [sp, 0x8]
|
|
||||||
movs r0, 0
|
|
||||||
movs r1, 0x1
|
|
||||||
bl box_print
|
|
||||||
movs r0, 0
|
|
||||||
movs r1, 0x3
|
|
||||||
bl CopyWindowToVram
|
|
||||||
movs r0, 0x1
|
|
||||||
movs r1, 0x3
|
|
||||||
bl CopyWindowToVram
|
|
||||||
add sp, 0x2C
|
|
||||||
pop {r3-r5}
|
|
||||||
mov r8, r3
|
|
||||||
mov r9, r4
|
|
||||||
mov r10, r5
|
|
||||||
pop {r4-r7}
|
|
||||||
pop {r0}
|
|
||||||
bx r0
|
|
||||||
.pool
|
|
||||||
thumb_func_end sub_8121B1C
|
|
||||||
|
|
||||||
thumb_func_start sub_8121C50
|
thumb_func_start sub_8121C50
|
||||||
sub_8121C50: @ 8121C50
|
sub_8121C50: @ 8121C50
|
||||||
push {lr}
|
push {lr}
|
||||||
|
@ -10,5 +10,6 @@
|
|||||||
void sub_81DB52C(const u8 *src);
|
void sub_81DB52C(const u8 *src);
|
||||||
void TVShowConvertInternationalString(void *dest, const void *src, u8 language);
|
void TVShowConvertInternationalString(void *dest, const void *src, u8 language);
|
||||||
u32 sub_81DB604(const u8 *);
|
u32 sub_81DB604(const u8 *);
|
||||||
|
s32 GetStringCenterAlignXOffset(u8 fontId, const u8 *str, s32 totalWidth);
|
||||||
|
|
||||||
#endif //GUARD_INTERNATIONAL_STRING_UTIL_H
|
#endif //GUARD_INTERNATIONAL_STRING_UTIL_H
|
||||||
|
113
src/mail.c
113
src/mail.c
@ -27,10 +27,8 @@
|
|||||||
struct UnkMailStruct
|
struct UnkMailStruct
|
||||||
{
|
{
|
||||||
u32 unk_0_0:2;
|
u32 unk_0_0:2;
|
||||||
u32 unk_0_2:2;
|
u32 unk_0_2:6;
|
||||||
u32 unk_0_4:4;
|
u32 unk_1:8;
|
||||||
u32 unk_1_0:4;
|
|
||||||
u32 unk_1_4:1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MailLayout
|
struct MailLayout
|
||||||
@ -38,9 +36,8 @@ struct MailLayout
|
|||||||
u8 var0;
|
u8 var0;
|
||||||
u8 var1;
|
u8 var1;
|
||||||
u8 var2;
|
u8 var2;
|
||||||
u8 var3_0:4;
|
u8 var3;
|
||||||
u8 var3_4:4;
|
u8 var4;
|
||||||
u32 var4;
|
|
||||||
const struct UnkMailStruct *var8;
|
const struct UnkMailStruct *var8;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -52,7 +49,7 @@ struct Unk203A134
|
|||||||
/*0x0210*/ MainCallback callback2;
|
/*0x0210*/ MainCallback callback2;
|
||||||
/*0x0214*/ struct MailStruct *mail;
|
/*0x0214*/ struct MailStruct *mail;
|
||||||
/*0x0218*/ bool8 flag;
|
/*0x0218*/ bool8 flag;
|
||||||
/*0x0219*/ u8 unk_0219;
|
/*0x0219*/ u8 signatureWidth;
|
||||||
/*0x021a*/ u8 mailType;
|
/*0x021a*/ u8 mailType;
|
||||||
/*0x021b*/ u8 unk_021b;
|
/*0x021b*/ u8 unk_021b;
|
||||||
/*0x021c*/ u8 unk_021c;
|
/*0x021c*/ u8 unk_021c;
|
||||||
@ -200,47 +197,47 @@ const struct MailGraphics gUnknown_0859F2B8[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const struct UnkMailStruct Unknown_0859F3A8[] = {
|
const struct UnkMailStruct Unknown_0859F3A8[] = {
|
||||||
{ .unk_0_0 = 3, .unk_1_4 = TRUE },
|
{ .unk_0_0 = 3, .unk_1 = 16 },
|
||||||
{ .unk_0_0 = 3, .unk_1_4 = TRUE },
|
{ .unk_0_0 = 3, .unk_1 = 16 },
|
||||||
{ .unk_0_0 = 3, .unk_1_4 = TRUE }
|
{ .unk_0_0 = 3, .unk_1 = 16 }
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct MailLayout gUnknown_0859F3B4[] = {
|
const struct MailLayout gUnknown_0859F3B4[] = {
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x08, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 },
|
{ 0x03, 0x08, 0x00, 0x02, 0x04, Unknown_0859F3A8 },
|
||||||
{ 0x03, 0x00, 0x00, 0x2, 0x0, 0x00, Unknown_0859F3A8 }
|
{ 0x03, 0x00, 0x00, 0x02, 0x00, Unknown_0859F3A8 }
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct UnkMailStruct Unknown_0859F444[] = {
|
const struct UnkMailStruct Unknown_0859F444[] = {
|
||||||
{ .unk_0_0 = 2, .unk_1_4 = TRUE },
|
{ .unk_0_0 = 2, .unk_1 = 16 },
|
||||||
{ .unk_0_0 = 2, .unk_1_4 = TRUE },
|
{ .unk_0_0 = 2, .unk_1 = 16 },
|
||||||
{ .unk_0_0 = 2, .unk_1_4 = TRUE },
|
{ .unk_0_0 = 2, .unk_1 = 16 },
|
||||||
{ .unk_0_0 = 2, .unk_1_4 = TRUE },
|
{ .unk_0_0 = 2, .unk_1 = 16 },
|
||||||
{ .unk_0_0 = 1, .unk_1_4 = TRUE }
|
{ .unk_0_0 = 1, .unk_1 = 16 }
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct MailLayout gUnknown_0859F458[] = {
|
const struct MailLayout gUnknown_0859F458[] = {
|
||||||
{ 0x05, 0x07, 0x58, 0xb, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x07, 0x58, 0x0b, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x0a, 0x60, 0x9, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x0a, 0x60, 0x09, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x0c, 0x68, 0x5, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x0c, 0x68, 0x05, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x05, 0x60, 0x8, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x05, 0x60, 0x08, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x0a, 0x60, 0x9, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x0a, 0x60, 0x09, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x09, 0x70, 0x5, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x09, 0x70, 0x05, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x0c, 0x68, 0x9, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x0c, 0x68, 0x09, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x0d, 0x68, 0xd, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x0d, 0x68, 0x0d, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x09, 0x60, 0x9, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x09, 0x60, 0x09, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x09, 0x60, 0x9, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x09, 0x60, 0x09, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x11, 0x68, 0xf, 0x0, 0x1e, Unknown_0859F444 },
|
{ 0x05, 0x11, 0x68, 0x0f, 0x1e, Unknown_0859F444 },
|
||||||
{ 0x05, 0x09, 0x60, 0x5, 0x0, 0x1e, Unknown_0859F444 }
|
{ 0x05, 0x09, 0x60, 0x05, 0x1e, Unknown_0859F444 }
|
||||||
};
|
};
|
||||||
|
|
||||||
// What the heck are these meant to be? Call them u16 for now.
|
// What the heck are these meant to be? Call them u16 for now.
|
||||||
@ -481,11 +478,43 @@ void sub_8121A1C(void)
|
|||||||
if (!gUnknown_0203A134->playerIsSender)
|
if (!gUnknown_0203A134->playerIsSender)
|
||||||
{
|
{
|
||||||
StringCopy(ptr, gText_FromSpace);
|
StringCopy(ptr, gText_FromSpace);
|
||||||
gUnknown_0203A134->unk_0219 = gUnknown_0203A134->layout->var2 - (StringLength(gUnknown_0203A134->playerName) * 8 - 0x60);
|
gUnknown_0203A134->signatureWidth = gUnknown_0203A134->layout->var2 - (StringLength(gUnknown_0203A134->playerName) * 8 - 0x60);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sub_81DB52C(gUnknown_0203A134->playerName);
|
sub_81DB52C(gUnknown_0203A134->playerName);
|
||||||
gUnknown_0203A134->unk_0219 = gUnknown_0203A134->layout->var2;
|
gUnknown_0203A134->signatureWidth = gUnknown_0203A134->layout->var2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sub_8121B1C(void)
|
||||||
|
{
|
||||||
|
u16 i;
|
||||||
|
u8 strbuf[0x20];
|
||||||
|
u8 y;
|
||||||
|
u8 *bufptr;
|
||||||
|
s32 box_x;
|
||||||
|
s32 box_y;
|
||||||
|
|
||||||
|
y = 0;
|
||||||
|
PutWindowTilemap(0);
|
||||||
|
PutWindowTilemap(1);
|
||||||
|
FillWindowPixelBuffer(0, 0);
|
||||||
|
FillWindowPixelBuffer(1, 0);
|
||||||
|
for (i = 0; i < gUnknown_0203A134->layout->var0; i ++)
|
||||||
|
{
|
||||||
|
if (gUnknown_0203A134->strbuf[i][0] == EOS || gUnknown_0203A134->strbuf[i][0] == CHAR_SPACE)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
box_print(0, 1, gUnknown_0203A134->layout->var8[i].unk_0_2 + gUnknown_0203A134->layout->var4, y + gUnknown_0203A134->layout->var3, gUnknown_0859F2AC, 0, gUnknown_0203A134->strbuf[i]);
|
||||||
|
y += gUnknown_0203A134->layout->var8[i].unk_1;
|
||||||
|
}
|
||||||
|
bufptr = StringCopy(strbuf, gText_FromSpace);
|
||||||
|
StringCopy(bufptr, gUnknown_0203A134->playerName);
|
||||||
|
box_x = GetStringCenterAlignXOffset(1, strbuf, gUnknown_0203A134->signatureWidth) + 0x68;
|
||||||
|
box_y = gUnknown_0203A134->layout->var1 + 0x58;
|
||||||
|
box_print(0, 1, box_x, box_y, gUnknown_0859F2AC, 0, strbuf);
|
||||||
|
CopyWindowToVram(0, 3);
|
||||||
|
CopyWindowToVram(1, 3);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user