Skip to content

Commit

Permalink
Merge pull request #338 from DylanDoesProgramming664/fixes
Browse files Browse the repository at this point in the history
Possible TRAINER_NAME_LEN & MON_NAME_LEN locations
  • Loading branch information
lhearachel authored Jan 17, 2025
2 parents 5885ad2 + f2ed44c commit 9299eb7
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/overlay006/ov6_022489E4.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ BOOL ov6_02248CE8(UnkStruct_02095C48 *param0, int param1, const Strbuf *param2)
v0 = 8 * sizeof(u16);
v1 = 4;

Strbuf_ToChars(param2, v4, 8);
Strbuf_ToChars(param2, v4, 8); // Possibly TRAINER_NAME_LEN + 1

v2 = Heap_AllocFromHeap(20, v0 + v1);
MI_CpuCopy8(v4, &v2[v1], v0);
Expand Down
2 changes: 1 addition & 1 deletion src/overlay013/ov13_02227288.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static void ov13_022273CC(UnkStruct_ov13_02227244 *param0)
ov13_02227374(param0, 3, 6, FONT_SUBSCREEN, 8, TEXT_COLOR(3, 2, 1));

if (param0->unk_00->unk_20 != 0) {
Strbuf *v1 = MessageLoader_GetNewStrbuf(param0->unk_10, 8);
Strbuf *v1 = MessageLoader_GetNewStrbuf(param0->unk_10, 8); // Possibly TRAINER_NAME_LEN + 1

Text_AddPrinterWithParamsAndColor(&param0->unk_2C[4], FONT_SUBSCREEN, v1, 0, 6, TEXT_SPEED_NO_TRANSFER, TEXT_COLOR(3, 2, 1), NULL);
Strbuf_Free(v1);
Expand Down
2 changes: 1 addition & 1 deletion src/overlay043/ov43_02256544.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ BOOL ov43_02256544(UnkStruct_ov43_02256544 **param0, const UnkStruct_ov43_022565
v0->unk_30 = ov25_02254664();
v0->unk_B4 = MessageLoader_Init(1, 26, 624, 8);
v0->unk_B8 = MessageLoader_Init(1, 26, 456, 8);
v0->unk_BC = Strbuf_Init(128, 8);
v0->unk_BC = Strbuf_Init(128, 8); // Possibly TRAINER_NAME_LEN + 1
ov43_022565B4(v0);
*param0 = v0;

Expand Down
6 changes: 3 additions & 3 deletions src/overlay062/ov62_02248408.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ void ov62_02248408(BattleRecording *param0, FieldBattleDTO *param1, int param2)
v8 = Heap_AllocFromHeap(param2, sizeof(u16) * v9);

for (v4 = 0; v4 < v2; v4++) {
for (v10 = 8 - 1; v10 > -1; v10--) {
for (v10 = TRAINER_NAME_LEN; v10 > -1; v10--) {
if (param1->trainerData[v4].name[v10] == 0xffff) {
break;
}
}

if (v10 == -1) {
ov62_0224856C(v7, param2);
Strbuf_ToChars(v7, param1->trainerData[v4].name, 8);
Strbuf_ToChars(v7, param1->trainerData[v4].name, TRAINER_NAME_LEN + 1);
continue;
}

Expand All @@ -59,7 +59,7 @@ void ov62_02248408(BattleRecording *param0, FieldBattleDTO *param1, int param2)

if (Font_AreAllCharsValid(FONT_SYSTEM, v6, v7) == 0) {
ov62_0224856C(v7, param2);
Strbuf_ToChars(v7, param1->trainerData[v4].name, 8);
Strbuf_ToChars(v7, param1->trainerData[v4].name, TRAINER_NAME_LEN + 1);
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/unk_020298BC.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static void sub_02029990(UnkStruct_0202A138 *param0, Pokemon *param1, UnkStruct_

static void sub_020299C0(UnkStruct_0202A138 *param0, const Strbuf *param1, int param2)
{
Strbuf_ToChars(param1, param0->unk_20, 8);
Strbuf_ToChars(param1, param0->unk_20, 8); // Possibly TRAINER_NAME_LEN + 1
param0->unk_34 = param2;
}

Expand Down
6 changes: 3 additions & 3 deletions src/unk_0202DF8C.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void sub_0202DFA8(HallOfFame *param0, const Party *param1, const RTCDate *param2

v0 = &param0->unk_00[param0->unk_2AA8];
v3 = Party_GetCurrentCount(param1);
v2 = Strbuf_Init(11, 0);
v2 = Strbuf_Init(MON_NAME_LEN + 1, 0);

MI_CpuClear16(v0->unk_00, sizeof(UnkStruct_0202E1F4) * 6);

Expand All @@ -65,10 +65,10 @@ void sub_0202DFA8(HallOfFame *param0, const Party *param1, const RTCDate *param2

if (v2) {
Pokemon_GetValue(v1, MON_DATA_NICKNAME_STRBUF, v2);
Strbuf_ToChars(v2, v0->unk_00[v5].unk_0C, 11);
Strbuf_ToChars(v2, v0->unk_00[v5].unk_0C, MON_NAME_LEN + 1);

Pokemon_GetValue(v1, MON_DATA_OTNAME_STRBUF, v2);
Strbuf_ToChars(v2, v0->unk_00[v5].unk_22, 8);
Strbuf_ToChars(v2, v0->unk_00[v5].unk_22, TRAINER_NAME_LEN + 1);
} else {
v0->unk_00[v5].unk_0C[0] = 0xffff;
v0->unk_00[v5].unk_22[0] = 0xffff;
Expand Down
2 changes: 1 addition & 1 deletion src/unk_0204AEE8.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ static UnkStruct_0204B184 *sub_0204B184(UnkStruct_ov104_0223A348 *param0, u16 pa

v2 = MessageLoader_GetNewStrbuf(v1, param1);

Strbuf_ToChars(v2, &param0->unk_00.unk_08[0], 8);
Strbuf_ToChars(v2, &param0->unk_00.unk_08[0], 8); // Possibly TRAINER_NAME_LEN + 1
Strbuf_Free(v2);
MessageLoader_Free(v1);

Expand Down

0 comments on commit 9299eb7

Please sign in to comment.