Skip to content
Closed
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 arm9/src/daycare.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ void DaycareMon_Extras_Init(DaycareMail *mail) {
mail->nickname[i] = 0;
}

mail->ot_name[0] = EOS;
mail->nickname[0] = EOS;
mail->ot_name[0] = CHAR_EOS;
mail->nickname[0] = CHAR_EOS;
}

void DaycareMon_Init(DaycareMon *mon) {
Expand Down
6 changes: 3 additions & 3 deletions arm9/src/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ u32 sub_02002F40(u32 param0, struct String *str, u32 param2, u32 param3) {

u32 sub_02002F58(const u16 *str) {
u32 r5 = 1;
while (*str != EOS) {
if (*str == EXT_CTRL_CODE_BEGIN) {
while (*str != CHAR_EOS) {
if (*str == CHAR_CONTROL_CODE_ARG) {
str = MsgArray_SkipControlCode(str);
continue;
}

if (*str == CHAR_LF) {
if (*str == CHAR_LINE_BREAK) {
r5++;
str++;
continue;
Expand Down
4 changes: 2 additions & 2 deletions arm9/src/hall_of_fame.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ void Save_HOF_RecordParty(struct HallOfFame *hof, struct Party *party, RTCDate *
GetMonData(mon, MON_DATA_OT_NAME_STRING, str);
CopyStringToU16Array(str, hof_party->party[j].otname, PLAYER_NAME_LENGTH + 1);
} else {
hof_party->party[j].nickname[0] = EOS;
hof_party->party[j].otname[0] = EOS;
hof_party->party[j].nickname[0] = CHAR_EOS;
hof_party->party[j].otname[0] = CHAR_EOS;
}
j++;
}
Expand Down
4 changes: 2 additions & 2 deletions arm9/src/mail_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ u32 MailMsg_NumFields(u16 bank, u16 num) {
str = ReadMsgData_NewNarc_NewString(NARC_MSGDATA_MSG, sMessageBanks[bank], num, HEAP_ID_DEFAULT);
cstr = String_c_str(str);
count = 0;
while (*cstr != EOS) {
if (*cstr == EXT_CTRL_CODE_BEGIN) {
while (*cstr != CHAR_EOS) {
if (*cstr == CHAR_CONTROL_CODE_ARG) {
if (MsgArray_ControlCodeIsStrVar(cstr)) {
count++;
}
Expand Down
6 changes: 3 additions & 3 deletions arm9/src/message_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ void MessageFormat_UpperFirstChar(MessageFormat *messageFormat, u32 idx) {
void StringExpandPlaceholders(MessageFormat *messageFormat, struct String *dest, struct String *src) {
const u16 *cstr = String_c_str(src);
String_SetEmpty(dest);
while (*cstr != EOS) {
if (*cstr == EXT_CTRL_CODE_BEGIN) {
while (*cstr != CHAR_EOS) {
if (*cstr == CHAR_CONTROL_CODE_ARG) {
if (MsgArray_ControlCodeIsStrVar(cstr)) {
u32 idx = MsgArray_ControlCodeGetField(cstr, 0);
GF_ASSERT(idx < messageFormat->count);
Expand Down Expand Up @@ -688,7 +688,7 @@ void sub_0200B9A8(struct UnkStruct_0200B870 *a0, int a1, struct Window *a2, int

void sub_0200B9EC(struct UnkStruct_0200B870 *string, u32 value, u32 n, enum PrintingMode mode, struct Window *window, int x, int y) {
ConvertUIntToDecimalString(string->data, value, mode, n);
for (int i = 0; string->data[i] != EOS; i++) {
for (int i = 0; string->data[i] != CHAR_EOS; i++) {
if (string->data[i] >= CHAR_JP_0 && string->data[i] <= CHAR_JP_9) {
BlitBitmapRectToWindow(window, string->unk_4->pRawData + (string->data[i] - CHAR_JP_0) * 32, 0, 0, 8, 8, (u16)x, (u16)y, 8, 8);
} else {
Expand Down
4 changes: 2 additions & 2 deletions arm9/src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ u32 GetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *dest) {
for (ret = 0; ret < POKEMON_NAME_LENGTH; ret++) {
dest16[ret] = blockC->nickname[ret];
}
dest16[ret] = EOS;
dest16[ret] = CHAR_EOS;
}
break;
case MON_DATA_NICKNAME_STRING_AND_FLAG:
Expand Down Expand Up @@ -862,7 +862,7 @@ u32 GetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *dest) {
for (ret = 0; ret < PLAYER_NAME_LENGTH; ret++) {
dest16[ret] = blockD->otTrainerName[ret];
}
dest16[ret] = EOS;
dest16[ret] = CHAR_EOS;
} break;
case MON_DATA_OT_NAME_STRING:
CopyU16ArrayToString(dest, blockD->otTrainerName);
Expand Down
6 changes: 3 additions & 3 deletions arm9/src/render_text.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ u32 RenderText(struct TextPrinter *printer) {
GF_ASSERT(currentChar != 0xF100);

switch (currentChar) {
case EOS:
case CHAR_EOS:
return 1;
case CHAR_LF:
case CHAR_LINE_BREAK:
printer->printerTemplate.currentX = printer->printerTemplate.x;
s32 fontAttribute = GetFontAttribute(printer->printerTemplate.fontId, 1);

Expand All @@ -64,7 +64,7 @@ u32 RenderText(struct TextPrinter *printer) {
case 0xF0FD:
printer->printerTemplate.currentChar.raw++;
return 2;
case EXT_CTRL_CODE_BEGIN:
case CHAR_CONTROL_CODE_ARG:
printer->printerTemplate.currentChar.raw--;
switch ((u16)MsgArray_GetControlCode(printer->printerTemplate.currentChar.raw)) {
case 0xFF00:
Expand Down
6 changes: 3 additions & 3 deletions arm9/src/rs_migrate_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ BOOL ConvertRSStringToDPStringInternational(const u8 *rs_str, u16 *dp_str, u32 l

notFullWidth = (language != LANGUAGE_JAPANESE);
for (i = 0; i < length - 1; i++) {
if (rs_str[i] == 0xFF) { // RS: EOS
if (rs_str[i] == 0xFF) { // RS: CHAR_EOS
break;
}
if (rs_str[i] >= 0xF7) // RS: DYNAMIC
Expand All @@ -302,7 +302,7 @@ BOOL ConvertRSStringToDPStringInternational(const u8 *rs_str, u16 *dp_str, u32 l
for (r1 = 0; r1 < r3; r1++) {
dp_str[r1] = 0x1AC; // DP: ?
}
dp_str[r1] = EOS;
dp_str[r1] = CHAR_EOS;
return FALSE;
}
switch (conversion_table[rs_str[i]][notFullWidth]) {
Expand All @@ -317,6 +317,6 @@ BOOL ConvertRSStringToDPStringInternational(const u8 *rs_str, u16 *dp_str, u32 l
break;
}
}
dp_str[i] = EOS;
dp_str[i] = CHAR_EOS;
return TRUE;
}
8 changes: 4 additions & 4 deletions arm9/src/string_control_code.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "global.h"

const u16 *MsgArray_SkipControlCode(const u16 *arr) {
GF_ASSERT(*arr == EXT_CTRL_CODE_BEGIN);
if (*arr == EXT_CTRL_CODE_BEGIN) {
GF_ASSERT(*arr == CHAR_CONTROL_CODE_ARG);
if (*arr == CHAR_CONTROL_CODE_ARG) {
u16 size = arr[2];
arr += 3;
arr += size;
Expand All @@ -13,7 +13,7 @@ const u16 *MsgArray_SkipControlCode(const u16 *arr) {
}

u32 MsgArray_GetControlCode(const u16 *arr) {
GF_ASSERT(*arr == EXT_CTRL_CODE_BEGIN);
GF_ASSERT(*arr == CHAR_CONTROL_CODE_ARG);
return arr[1];
}

Expand All @@ -22,7 +22,7 @@ BOOL MsgArray_ControlCodeIsStrVar(const u16 *arr) {
}

u32 MsgArray_ControlCodeGetField(const u16 *arr, u32 fieldno) {
GF_ASSERT(*arr == EXT_CTRL_CODE_BEGIN);
GF_ASSERT(*arr == CHAR_CONTROL_CODE_ARG);
GF_ASSERT(fieldno < arr[2]);
return arr[3 + fieldno];
}
18 changes: 9 additions & 9 deletions arm9/src/string_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ const s32 gPowersOfTen[] = {

void CopyU16StringArray(u16 *dest, const u16 *src) {
u16 c = *src;
while (c != EOS) {
while (c != CHAR_EOS) {
src++;
*dest = c;
c = *src;
dest++;
}
*dest = EOS;
*dest = CHAR_EOS;
}

u16 *CopyU16StringArrayN(u16 *dest, const u16 *src, u32 num) {
Expand All @@ -62,13 +62,13 @@ u16 *CopyU16StringArrayN(u16 *dest, const u16 *src, u32 num) {

u32 StringLength(const u16 *str) {
int i;
for (i = 0; str[i] != EOS; i++) {}
for (i = 0; str[i] != CHAR_EOS; i++) {}
return i;
}

BOOL StringNotEqual(const u16 *s1, const u16 *s2) {
for (; *s1 == *s2; s1++, s2++) {
if (*s1 == EOS) {
if (*s1 == CHAR_EOS) {
return FALSE;
}
}
Expand All @@ -83,7 +83,7 @@ BOOL StringNotEqualN(const u16 *s1, const u16 *s2, u32 num) {
if (num == 0) {
return FALSE;
}
if (*s1 == EOS && *s2 == EOS) {
if (*s1 == CHAR_EOS && *s2 == CHAR_EOS) {
return FALSE;
}
s1++;
Expand All @@ -109,25 +109,25 @@ u16 *StringFill(u16 *dest, u16 value, u32 num) {
}

u16 *StringFillEOS(u16 *dest, u32 num) {
return StringFill(dest, EOS, num);
return StringFill(dest, CHAR_EOS, num);
}

u16 *ConvertUIntToDecimalString(u16 *dest, u32 value, enum PrintingMode mode, u32 n) {
for (u32 x = (u32)gPowersOfTen[n - 1]; x != 0; x = x / 10) {
u16 res = (u16)(value / x);
value = value - x * res;
if (mode == PRINTING_MODE_LEADING_ZEROS) {
*dest = res >= 10 ? (u16)CHAR_JP_QUESTION_MARK : gDigitTable[res];
*dest = res >= 10 ? (u16)CHAR_JP_QMARK : gDigitTable[res];
dest++;
} else if (res != 0 || x == 1) {
mode = PRINTING_MODE_LEADING_ZEROS;
*dest = res >= 10 ? (u16)CHAR_JP_QUESTION_MARK : gDigitTable[res];
*dest = res >= 10 ? (u16)CHAR_JP_QMARK : gDigitTable[res];
dest++;
} else if (mode == PRINTING_MODE_RIGHT_ALIGN) {
*dest = 1;
dest++;
}
}
*dest = EOS;
*dest = CHAR_EOS;
return dest;
}
16 changes: 8 additions & 8 deletions arm9/src/unk_02021590.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ void DecompressGlyphTiles_LazyFromNarc(struct FontData *ptr, u16 param1, struct
u32 GetStringWidth(struct FontData *ptr, const u16 *str, u32 letterSpacing) {
u32 width = 0;

while (*str != EOS) {
if (*str == EXT_CTRL_CODE_BEGIN) {
while (*str != CHAR_EOS) {
if (*str == CHAR_CONTROL_CODE_ARG) {
str = MsgArray_SkipControlCode(str);
if (*str == EOS) {
if (*str == CHAR_EOS) {
break;
}
}
Expand All @@ -191,10 +191,10 @@ int GetGlyphWidth_FixedWidth(struct FontData *ptr, int a1) {
s32 GetStringWidthMultiline(struct FontData *r7, const u16 *arr, u32 r6) {
s32 ret = 0;
u32 r4 = 0;
while (*arr != EOS) {
if (*arr == EXT_CTRL_CODE_BEGIN) {
while (*arr != CHAR_EOS) {
if (*arr == CHAR_CONTROL_CODE_ARG) {
arr = MsgArray_SkipControlCode(arr);
} else if (*arr == CHAR_LF) {
} else if (*arr == CHAR_LINE_BREAK) {
if (ret < r4 - r6) {
ret = (int)(r4 - r6);
}
Expand All @@ -213,8 +213,8 @@ s32 GetStringWidthMultiline(struct FontData *r7, const u16 *arr, u32 r6) {

s32 StringGetWidth_SingleLine_HandleClearToControlCode(struct FontData *r6, const u16 *arr) {
s32 ret = 0;
while (*arr != EOS) {
if (*arr == EXT_CTRL_CODE_BEGIN) {
while (*arr != CHAR_EOS) {
if (*arr == CHAR_CONTROL_CODE_ARG) {
if (MsgArray_GetControlCode(arr) == 515) {
ret = MsgArray_ControlCodeGetField(arr, 0) - 12;
}
Expand Down
26 changes: 13 additions & 13 deletions arm9/src/unk_02021934.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct String *String_New(u32 length, enum HeapID heapID) {
ret->magic = STR16_MAGIC;
ret->maxsize = (u16)length;
ret->size = 0;
ret->data[0] = EOS;
ret->data[0] = CHAR_EOS;
}
return ret;
}
Expand All @@ -26,7 +26,7 @@ void String_Delete(struct String *str) {
void String_SetEmpty(struct String *str) {
ASSERT_STR16(str);
str->size = 0;
str->data[0] = EOS;
str->data[0] = CHAR_EOS;
}

void StringCopy(struct String *dest, struct String *src) {
Expand Down Expand Up @@ -101,7 +101,7 @@ void String16_FormatInteger(struct String *str, int num, u32 ndigits, enum Print
}
dividend /= 10;
}
str->data[str->size] = EOS;
str->data[str->size] = CHAR_EOS;
return;
}
GF_ASSERT(FALSE);
Expand Down Expand Up @@ -139,7 +139,7 @@ BOOL String_Compare(struct String *str1, struct String *str2) {
ASSERT_STR16(str2);

for (int i = 0; str1->data[i] == str2->data[i]; i++) {
if (str1->data[i] == EOS) {
if (str1->data[i] == CHAR_EOS) {
return FALSE;
}
}
Expand All @@ -156,7 +156,7 @@ int StringCountLines(volatile struct String *str) {

int i, nline;
for (i = 0, nline = 1; i < str->size; i++) {
if (str->data[i] == CHAR_LF) {
if (str->data[i] == CHAR_LINE_BREAK) {
nline++;
}
}
Expand All @@ -170,7 +170,7 @@ void StringGetLineN(struct String *dest, volatile struct String *src, u32 n) {
int i = 0;
if (n != 0) {
for (i = 0; i < src->size; i++) {
if (src->data[i] == CHAR_LF && --n == 0) {
if (src->data[i] == CHAR_LINE_BREAK && --n == 0) {
i++;
break;
}
Expand All @@ -179,7 +179,7 @@ void StringGetLineN(struct String *dest, volatile struct String *src, u32 n) {
String_SetEmpty(dest);
for (; i < src->size; i++) {
u16 c = src->data[i];
if (c == CHAR_LF) {
if (c == CHAR_LINE_BREAK) {
break;
}
StrAddChar(dest, c);
Expand All @@ -189,14 +189,14 @@ void StringGetLineN(struct String *dest, volatile struct String *src, u32 n) {
void CopyU16ArrayToString(struct String *str, u16 *buf) {
ASSERT_STR16(str);

for (str->size = 0; *buf != EOS;) {
for (str->size = 0; *buf != CHAR_EOS;) {
if (str->size >= str->maxsize - 1) {
GF_ASSERT(0);
break;
}
str->data[str->size++] = *buf++;
}
str->data[str->size] = EOS;
str->data[str->size] = CHAR_EOS;
}

void CopyU16ArrayToStringN(struct String *str, u16 *buf, u32 length) {
Expand All @@ -206,13 +206,13 @@ void CopyU16ArrayToStringN(struct String *str, u16 *buf, u32 length) {
memcpy(str->data, buf, length * 2);
int i;
for (i = 0; i < length; i++) {
if (str->data[i] == EOS) {
if (str->data[i] == CHAR_EOS) {
break;
}
}
str->size = (u16)i;
if (i == length) {
str->data[length - 1] = EOS;
str->data[length - 1] = CHAR_EOS;
}
return;
}
Expand Down Expand Up @@ -252,7 +252,7 @@ void StrAddChar(struct String *str, u16 val) {

if (str->size + 1 < str->maxsize) {
str->data[str->size++] = val;
str->data[str->size] = EOS;
str->data[str->size] = CHAR_EOS;
return;
}
GF_ASSERT(0);
Expand Down Expand Up @@ -298,7 +298,7 @@ void StringCat_HandleTrainerName(struct String *dest, struct String *src) {
*dest_p++ = cur_char;
outsize++;
}
*dest_p = EOS;
*dest_p = CHAR_EOS;
dest->size += outsize;
} else {
StringCat(dest, src);
Expand Down
4 changes: 2 additions & 2 deletions arm9/src/unk_02024E64.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ void sub_02024E6C(struct UnkStruct_02024E64 *param0) {

sub_02025484(param0->unk700);

MI_CpuFill16(param0->rival_name_buf, EOS, sizeof(param0->rival_name_buf) / sizeof(u16));
MI_CpuFill16(param0->unk734, EOS, sizeof(param0->unk734) / sizeof(u16));
MI_CpuFill16(param0->rival_name_buf, CHAR_EOS, sizeof(param0->rival_name_buf) / sizeof(u16));
MI_CpuFill16(param0->unk734, CHAR_EOS, sizeof(param0->unk734) / sizeof(u16));
}

struct UnkStruct_02024E64 *sub_02024EB4(struct SaveData *save) {
Expand Down
Loading