summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm9/lib/include/MI_memory.h10
-rw-r--r--arm9/src/game_init.c10
-rw-r--r--arm9/src/pokemon.c10
-rw-r--r--arm9/src/sav_chatot.c4
-rw-r--r--arm9/src/save.c2
-rw-r--r--arm9/src/text.c2
-rw-r--r--arm9/src/unk_0200BA78.c2
-rw-r--r--arm9/src/unk_02016B94.c19
-rw-r--r--arm9/src/unk_02024E64.c6
-rw-r--r--arm9/src/unk_0202ABBC.c6
10 files changed, 41 insertions, 30 deletions
diff --git a/arm9/lib/include/MI_memory.h b/arm9/lib/include/MI_memory.h
index 339ff9b8..4e5722bb 100644
--- a/arm9/lib/include/MI_memory.h
+++ b/arm9/lib/include/MI_memory.h
@@ -25,6 +25,11 @@ static inline void MI_CpuClear8(void *dest, u32 size) {
MI_CpuFill8(dest, 0, size);
}
+static inline void MI_CpuFill16(void *dest, u16 data, u32 size)
+{
+ MIi_CpuClear16(data, dest, size);
+}
+
static inline void MI_CpuClear16(void * destp, u32 size)
{
MIi_CpuClear16(0, destp, size);
@@ -55,4 +60,9 @@ static inline void MI_CpuFillFast(void *dest, u32 data, u32 size)
MIi_CpuClearFast(data, dest, size);
}
+static inline void MI_CpuCopyFast(const void *src, void *dest, u32 size)
+{
+ MIi_CpuCopyFast(src, dest, size);
+}
+
#endif //POKEDIAMOND_ARM9_MI_MEMORY_H
diff --git a/arm9/src/game_init.c b/arm9/src/game_init.c
index 12d18629..64ea7a54 100644
--- a/arm9/src/game_init.c
+++ b/arm9/src/game_init.c
@@ -181,12 +181,12 @@ void InitSystemForTheGame(void)
void InitGraphicMemory(void)
{
GX_SetBankForLCDC(0x1FF);
- MIi_CpuClearFast(0, (void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE);
+ MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE);
GX_DisableBankForLCDC();
- MIi_CpuClearFast(0xC0, (void *)HW_OAM, HW_OAM_SIZE);
- MIi_CpuClearFast(0xC0, (void *)HW_DB_OAM, HW_DB_OAM_SIZE);
- MIi_CpuClearFast(0, (void *)HW_PLTT, HW_PLTT_SIZE);
- MIi_CpuClearFast(0, (void *)HW_DB_PLTT, HW_DB_PLTT_SIZE);
+ MI_CpuFillFast((void *)HW_OAM, 0xC0, HW_OAM_SIZE);
+ MI_CpuFillFast((void *)HW_DB_OAM, 0xC0, HW_DB_OAM_SIZE);
+ MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE);
+ MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE);
}
void * FUN_020161A4(u32 heap_id, const char * path)
diff --git a/arm9/src/pokemon.c b/arm9/src/pokemon.c
index b3e53d1a..29075833 100644
--- a/arm9/src/pokemon.c
+++ b/arm9/src/pokemon.c
@@ -176,14 +176,14 @@ const s8 sNatureStatMods[][5] = {
void ZeroMonData(struct Pokemon * pokemon)
{
- MIi_CpuClearFast(0, pokemon, sizeof(struct Pokemon));
+ MI_CpuClearFast(pokemon, sizeof(struct Pokemon));
ENCRYPT_BOX(&pokemon->box);
ENCRYPT_PTY(pokemon);
}
void ZeroBoxMonData(struct BoxPokemon * boxmon)
{
- MIi_CpuClearFast(0, boxmon, sizeof(struct BoxPokemon));
+ MI_CpuClearFast(boxmon, sizeof(struct BoxPokemon));
ENCRYPT_BOX(boxmon);
}
@@ -272,7 +272,7 @@ void CreateMon(struct Pokemon * pokemon, int species, int level, int fixedIV, in
FreeToHeap(mail);
capsule = 0;
SetMonData(pokemon, MON_DATA_CAPSULE, &capsule);
- MIi_CpuClearFast(0, seal_coords, sizeof(seal_coords));
+ MI_CpuClearFast(seal_coords, sizeof(seal_coords));
SetMonData(pokemon, MON_DATA_SEAL_COORDS, seal_coords);
CalcMonLevelAndStats(pokemon);
}
@@ -3004,7 +3004,7 @@ void CopyBoxPokemonToPokemon(struct BoxPokemon * src, struct Pokemon * dest)
SetMonData(dest, MON_DATA_MAIL_STRUCT, mail);
FreeToHeap(mail);
SetMonData(dest, MON_DATA_CAPSULE, &sp0);
- MIi_CpuClearFast(0, &sp4, sizeof(sp4));
+ MI_CpuClearFast(&sp4, sizeof(sp4));
SetMonData(dest, MON_DATA_SEAL_COORDS, &sp4);
CalcMonLevelAndStats(dest);
}
@@ -3724,7 +3724,7 @@ void Pokemon_RemoveCapsule(struct Pokemon * pokemon)
{
u8 sp0 = 0;
CapsuleArray sp1;
- MIi_CpuClearFast(0, &sp1, sizeof(sp1));
+ MI_CpuClearFast(&sp1, sizeof(sp1));
SetMonData(pokemon, MON_DATA_CAPSULE, &sp0);
SetMonData(pokemon, MON_DATA_SEAL_COORDS, &sp1);
}
diff --git a/arm9/src/sav_chatot.c b/arm9/src/sav_chatot.c
index 7b240a99..86786e66 100644
--- a/arm9/src/sav_chatot.c
+++ b/arm9/src/sav_chatot.c
@@ -10,7 +10,7 @@ THUMB_FUNC u32 Sav2_Chatot_sizeof(void)
THUMB_FUNC void Sav2_Chatot_init(struct SaveChatotSoundClip * chatot)
{
- MIi_CpuClear32(0, chatot, sizeof(struct SaveChatotSoundClip));
+ MI_CpuClear32(chatot, sizeof(struct SaveChatotSoundClip));
chatot->exists = FALSE;
}
@@ -94,5 +94,5 @@ THUMB_FUNC void Chatot_Encode(struct SaveChatotSoundClip * chatot, const s8 * da
THUMB_FUNC void Chatot_copy(struct SaveChatotSoundClip * dest, const struct SaveChatotSoundClip * src)
{
- MIi_CpuCopyFast(src, dest, sizeof(struct SaveChatotSoundClip));
+ MI_CpuCopyFast(src, dest, sizeof(struct SaveChatotSoundClip));
}
diff --git a/arm9/src/save.c b/arm9/src/save.c
index 85d18d06..89bd8374 100644
--- a/arm9/src/save.c
+++ b/arm9/src/save.c
@@ -82,7 +82,7 @@ BOOL FUN_0202263C(struct SaveBlock2 * sav2)
FlashClobberChunkFooter(sav2, 1, (u32)(sav2->unk_20220[1] == 0 ? 1 : 0));
FlashClobberChunkFooter(sav2, 0, (u32)(sav2->unk_20220[0]));
FlashClobberChunkFooter(sav2, 1, (u32)(sav2->unk_20220[1]));
- MIi_CpuClearFast(-1u, r6, 0x1000);
+ MI_CpuFillFast(r6, -1u, 0x1000);
for (int i = 0; i < 64; i++)
{
FlashWriteChunk((u32)(0x1000 * i), r6, 0x1000);
diff --git a/arm9/src/text.c b/arm9/src/text.c
index 5078f229..8676cbcc 100644
--- a/arm9/src/text.c
+++ b/arm9/src/text.c
@@ -331,7 +331,7 @@ THUMB_FUNC u16 *FUN_0201C1B0(void)
void *res = AllocFromHeap(0, 32 * 24 * sizeof(u16));
struct UnkStruct_0200B870_sub * var;
void *tmp = FUN_02006BB0(NARC_GRAPHIC_FONT, 5, 0, &var, 0);
- MIi_CpuCopy32(var->unk_14, res, 32 * 24 * sizeof(u16));
+ MI_CpuCopy32(var->unk_14, res, 32 * 24 * sizeof(u16));
FreeToHeap(tmp);
return res;
}
diff --git a/arm9/src/unk_0200BA78.c b/arm9/src/unk_0200BA78.c
index d98b5374..457001ef 100644
--- a/arm9/src/unk_0200BA78.c
+++ b/arm9/src/unk_0200BA78.c
@@ -25,7 +25,7 @@ THUMB_FUNC void FUN_0200BAAC(
{
if (param0->data[i] >= 0xa2 && param0->data[i] <= 0xab)
{
- MIi_CpuCopy32(
+ MI_CpuCopy32(
&param0->unk_4->unk_14[(param0->data[i] - 0xa2) << 5], dest + i * 0x20, 0x20);
}
else
diff --git a/arm9/src/unk_02016B94.c b/arm9/src/unk_02016B94.c
index a8be5958..e01b3133 100644
--- a/arm9/src/unk_02016B94.c
+++ b/arm9/src/unk_02016B94.c
@@ -312,7 +312,7 @@ THUMB_FUNC void FUN_02016C18(
{
param0->unk08[param1].unk08 = AllocFromHeap(param0->unk00, param2->unk08);
- MIi_CpuClear16(0, param0->unk08[param1].unk08, param2->unk08);
+ MI_CpuClear16(param0->unk08[param1].unk08, param2->unk08);
param0->unk08[param1].unk0c = param2->unk08;
param0->unk08[param1].unk10 = param2->unk0c;
@@ -2580,11 +2580,11 @@ THUMB_FUNC void FUN_02017C98(const void *param0, void *param1, u32 param2)
if (((u32)param0 % 4) == 0 && ((u32)param1 % 4) == 0 && ((u16)param2 % 4) == 0)
{
- MIi_CpuCopy32(param0, param1, param2);
+ MI_CpuCopy32(param0, param1, param2);
return;
}
- MIi_CpuCopy16(param0, param1, param2);
+ MI_CpuCopy16(param0, param1, param2);
}
THUMB_FUNC void FUN_02017CD0(struct UnkStruct_02016B94_2 *param0, u32 param1)
@@ -2749,7 +2749,7 @@ THUMB_FUNC void FUN_02017F48(
r5 = r5 << 0x18 | r5 << 0x10 | r5 << 8 | r5;
}
- MIi_CpuClearFast(r5, st4, st0);
+ MI_CpuFillFast(st4, r5, st0);
FUN_02017E84((u8)param1, st4, param0->unk08[param1].unk1f * param4, st0);
FreeToHeap(st4);
@@ -3285,7 +3285,7 @@ THUMB_FUNC void FUN_02018744(struct UnkStruct_02016B94_2 *param0, u32 param1)
{
if (param0->unk08[param1].unk08 != NULL)
{
- MIi_CpuClear16(0, param0->unk08[param1].unk08, param0->unk08[param1].unk0c);
+ MI_CpuClear16(param0->unk08[param1].unk08, param0->unk08[param1].unk0c);
FUN_02017CD0(param0, param1);
}
}
@@ -3294,7 +3294,7 @@ THUMB_FUNC void FUN_02018768(struct UnkStruct_02016B94_2 *param0, u32 param1, u1
{
if (param0->unk08[param1].unk08 != NULL)
{
- MIi_CpuClear16(param2, param0->unk08[param1].unk08, param0->unk08[param1].unk0c);
+ MI_CpuFill16(param0->unk08[param1].unk08, param2, param0->unk08[param1].unk0c);
FUN_02017CD0(param0, param1);
}
}
@@ -3303,7 +3303,7 @@ THUMB_FUNC void FUN_0201878C(struct UnkStruct_02016B94_2 *param0, u32 param1, u1
{
if (param0->unk08[param1].unk08 != NULL)
{
- MIi_CpuClear16(param2, param0->unk08[param1].unk08, param0->unk08[param1].unk0c);
+ MI_CpuFill16(param0->unk08[param1].unk08, param2, param0->unk08[param1].unk0c);
FUN_0201AC68(param0, param1);
}
}
@@ -4905,9 +4905,10 @@ THUMB_FUNC void FillWindowPixelBuffer(struct Window *window, u8 param1)
param1 |= param1 << 4;
}
- MIi_CpuClearFast((u32)((param1 << 0x18) | (param1 << 0x10) | (param1 << 0x8) | param1),
+ MI_CpuFillFast(
window->unk0c,
- (u32)(window->unk00->unk08[window->unk04].unk1f * window->width * window->height));
+ (u32)((param1 << 0x18) | (param1 << 0x10) | (param1 << 0x8) | param1),
+ (u32)(window->unk00->unk08[window->unk04].unk1f * window->width * window->height));
}
THUMB_FUNC void BlitBitmapRectToWindow(struct Window *window,
diff --git a/arm9/src/unk_02024E64.c b/arm9/src/unk_02024E64.c
index d8682531..ad6a7eac 100644
--- a/arm9/src/unk_02024E64.c
+++ b/arm9/src/unk_02024E64.c
@@ -10,14 +10,14 @@ THUMB_FUNC u32 FUN_02024E64()
THUMB_FUNC void FUN_02024E6C(struct UnkStruct_02024E64 *param0)
{
- MIi_CpuClearFast(0, param0, sizeof(struct UnkStruct_02024E64));
+ MI_CpuClearFast(param0, sizeof(struct UnkStruct_02024E64));
FUN_020250A4(param0->unk0);
FUN_02025484(param0->unk700);
- MIi_CpuClear16(0xFFFF, param0->rival_name_buf, sizeof(param0->rival_name_buf) / sizeof(u16));
- MIi_CpuClear16(0xFFFF, param0->unk734, sizeof(param0->unk734) / sizeof(u16));
+ MI_CpuFill16(param0->rival_name_buf, EOS, sizeof(param0->rival_name_buf) / sizeof(u16));
+ MI_CpuFill16(param0->unk734, EOS, sizeof(param0->unk734) / sizeof(u16));
}
THUMB_FUNC struct UnkStruct_02024E64 *FUN_02024EB4(struct SaveBlock2 *sav2)
diff --git a/arm9/src/unk_0202ABBC.c b/arm9/src/unk_0202ABBC.c
index 7bc9d3fc..75a43f60 100644
--- a/arm9/src/unk_0202ABBC.c
+++ b/arm9/src/unk_0202ABBC.c
@@ -15,7 +15,7 @@ THUMB_FUNC u32 FUN_0202ABC8()
THUMB_FUNC void FUN_0202ABCC(struct Unk0202ABBC* unk)
{
- MIi_CpuClearFast(0, unk, 0xf4);
+ MI_CpuClearFast(unk, sizeof(struct Unk0202ABBC));
}
THUMB_FUNC u16 FUN_0202ABDC(struct Unk0202ABBC* unk)
@@ -30,12 +30,12 @@ THUMB_FUNC void FUN_0202ABE4(struct Unk0202ABBC* unk, u16 data)
THUMB_FUNC void FUN_0202ABEC(void *srcp, void *destp)
{
- MIi_CpuCopyFast(srcp, destp, 0xec);
+ MI_CpuCopyFast(srcp, destp, 0xec);
}
THUMB_FUNC void FUN_0202ABF8(void *destp, void *srcp)
{
- MIi_CpuCopyFast(srcp, destp, 0xec);
+ MI_CpuCopyFast(srcp, destp, 0xec);
}
THUMB_FUNC u32 FUN_0202AC08(struct Unk0202ABBC* unk)