summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/dma3.h45
-rw-r--r--include/pokemon_storage_system.h8
2 files changed, 49 insertions, 4 deletions
diff --git a/include/dma3.h b/include/dma3.h
index 19a69ea80..8eff34f55 100644
--- a/include/dma3.h
+++ b/include/dma3.h
@@ -1,6 +1,51 @@
#ifndef GUARD_DMA3_H
#define GUARD_DMA3_H
+// Maximum amount of data we will transfer in one operation
+#define MAX_DMA_BLOCK_SIZE 0x1000
+
+#define Dma3CopyLarge_(src, dest, size, bit) \
+{ \
+ const void *_src = src; \
+ void *_dest = dest; \
+ u32 _size = size; \
+ while (1) \
+ { \
+ if (_size <= MAX_DMA_BLOCK_SIZE) \
+ { \
+ DmaCopy##bit(3, _src, _dest, _size); \
+ break; \
+ } \
+ DmaCopy##bit(3, _src, _dest, MAX_DMA_BLOCK_SIZE); \
+ _src += MAX_DMA_BLOCK_SIZE; \
+ _dest += MAX_DMA_BLOCK_SIZE; \
+ _size -= MAX_DMA_BLOCK_SIZE; \
+ } \
+}
+
+#define Dma3CopyLarge16_(src, dest, size) Dma3CopyLarge_(src, dest, size, 16)
+#define Dma3CopyLarge32_(src, dest, size) Dma3CopyLarge_(src, dest, size, 32)
+
+#define Dma3FillLarge_(value, dest, size, bit) \
+{ \
+ void *_dest = dest; \
+ u32 _size = size; \
+ while (1) \
+ { \
+ if (_size <= MAX_DMA_BLOCK_SIZE) \
+ { \
+ DmaFill##bit(3, value, _dest, _size); \
+ break; \
+ } \
+ DmaFill##bit(3, value, _dest, MAX_DMA_BLOCK_SIZE); \
+ _dest += MAX_DMA_BLOCK_SIZE; \
+ _size -= MAX_DMA_BLOCK_SIZE; \
+ } \
+}
+
+#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16)
+#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32)
+
void ClearDma3Requests(void);
void ProcessDma3Requests(void);
s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode);
diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h
index 4b84856bb..a85ee5ff4 100644
--- a/include/pokemon_storage_system.h
+++ b/include/pokemon_storage_system.h
@@ -3,8 +3,8 @@
#define TOTAL_BOXES_COUNT 14
#define IN_BOX_ROWS 6
-#define IN_BOX_COLUMS 5
-#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS)
+#define IN_BOX_COLUMNS 5
+#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMNS)
/*
ROWS
@@ -23,7 +23,7 @@ struct PokemonStorage
/*0x83C2*/ u8 boxWallpapers[TOTAL_BOXES_COUNT];
};
-extern struct PokemonStorage* gPokemonStoragePtr;
+extern struct PokemonStorage *gPokemonStoragePtr;
u8 CountMonsInBox(u8 boxId);
s16 GetFirstFreeBoxSpot(u8 boxId);
@@ -54,7 +54,7 @@ u8 GetBoxWallpaper(u8 boxId);
void SetBoxWallpaper(u8 boxId, u8 wallpaperId);
s16 sub_80D214C(struct BoxPokemon *boxMons, u8 currIndex, u8 maxIndex, u8 arg3);
bool8 CheckFreePokemonStorageSpace(void);
-bool32 CheckBoxedMonSanity(u32 boxId, u32 boxPosition);
+bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition);
u32 CountStorageNonEggMons(void);
u32 CountAllStorageMons(void);
bool32 AnyStorageMonWithMove(u16 moveId);