diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/bg.h | 75 | ||||
-rw-r--r-- | include/dma3.h | 7 | ||||
-rw-r--r-- | include/global.h | 3 | ||||
-rw-r--r-- | include/gpu_regs.h | 14 | ||||
-rw-r--r-- | include/m4a.h | 1 | ||||
-rw-r--r-- | include/pokemon.h | 4 | ||||
-rw-r--r-- | include/text.h | 17 | ||||
-rw-r--r-- | include/trig.h | 3 | ||||
-rw-r--r-- | include/window.h | 13 |
9 files changed, 128 insertions, 9 deletions
diff --git a/include/bg.h b/include/bg.h new file mode 100644 index 000000000..0dcb84a34 --- /dev/null +++ b/include/bg.h @@ -0,0 +1,75 @@ +#ifndef GUARD_BG_H +#define GUARD_BG_H + +enum +{ + BG_CTRL_ATTR_VISIBLE = 1, + BG_CTRL_ATTR_CHARBASEINDEX = 2, + BG_CTRL_ATTR_MAPBASEINDEX = 3, + BG_CTRL_ATTR_SCREENSIZE = 4, + BG_CTRL_ATTR_PALETTEMODE = 5, + BG_CTRL_ATTR_PRIORITY = 6, + BG_CTRL_ATTR_MOSAIC = 7, + BG_CTRL_ATTR_WRAPAROUND = 8, +}; + +struct BgTemplate +{ + u32 bg:2; // 0x1, 0x2 -> 0x3 + u32 charBaseIndex:2; // 0x4, 0x8 -> 0xC + u32 mapBaseIndex:5; // 0x10, 0x20, 0x40, 0x80, 0x100 -> 0x1F0 + u32 screenSize:2; // 0x200, 0x400 -> 0x600 + u32 paletteMode:1; // 0x800 + u32 priority:2; // 0x1000, 0x2000 > 0x3000 + u32 baseTile:10; +}; + +void ResetBgs(void); +u8 GetBgMode(void); +void ResetBgControlStructs(void); +void Unused_ResetBgControlStruct(u8 bg); +void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 screenSize, u8 paletteMode, u8 priority, u8 mosaic, u8 wraparound); +u16 GetBgControlAttribute(u8 bg, u8 attributeId); +u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode); +void SetTextModeAndHideBgs(void); +bool8 IsInvalidBg(u8 bg); +int DummiedOutFireRedLeafGreenTileAllocFunc(int a1, int a2, int a3, int a4); +void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable); +void InitBgsFromTemplates(u8 bgMode, const struct BgTemplate *templates, u8 numTemplates); +void InitBgFromTemplate(const struct BgTemplate *template); +void SetBgMode(u8 bgMode); +u16 LoadBgTiles(u8 bg, const void* src, u16 size, u16 destOffset); +u16 LoadBgTilemap(u8 bg, const void *src, u16 size, u16 destOffset); +u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset); +bool8 IsDma3ManagerBusyWithBgCopy(void); +void ShowBg(u8 bg); +void HideBg(u8 bg); +void SetBgAttribute(u8 bg, u8 attributeId, u8 value); +u16 GetBgAttribute(u8 bg, u8 attributeId); +u32 ChangeBgX(u8 bg, u32 value, u8 op); +u32 GetBgX(u8 bg); +u32 ChangeBgY(u8 bg, u32 value, u8 op); +u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op); +u32 GetBgY(u8 bg); +void SetBgAffine(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle); +u8 Unused_AdjustBgMosaic(u8 a1, u8 a2); +void SetBgTilemapBuffer(u8 bg, void *tilemap); +void UnsetBgTilemapBuffer(u8 bg); +void* GetBgTilemapBuffer(u8 bg); +void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset); +void CopyBgTilemapBufferToVram(u8 bg); +void CopyToBgTilemapBufferRect(u8 bg, void* src, u8 destX, u8 destY, u8 width, u8 height); +void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette); +void CopyRectToBgTilemapBufferRect(u8 bg, void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2); +void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height); +void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette); +void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, s16 tileNumDelta); +u16 GetBgMetricTextMode(u8 bg, u8 whichMetric); +u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric); +u32 GetTileMapIndexFromCoords(s32 x, s32 y, s32 screenSize, u32 screenWidth, u32 screenHeight); +void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2); +u32 GetBgType(u8 bg); +bool32 IsInvalidBg32(u8 bg); +bool32 IsTileMapOutsideWram(u8 bg); + +#endif // GUARD_BG_H diff --git a/include/dma3.h b/include/dma3.h index beb00745d..db75ea9e3 100644 --- a/include/dma3.h +++ b/include/dma3.h @@ -6,7 +6,7 @@ extern u8 gDma3RequestCursor; struct DmaRequestsStruct { - /* 0x00 */ u8 *src; + /* 0x00 */ const u8 *src; /* 0x04 */ u8 *dest; /* 0x08 */ u16 size; /* 0x0A */ u16 mode; @@ -17,7 +17,8 @@ extern struct DmaRequestsStruct gDma3Requests[128]; void ClearDma3Requests(void); void ProcessDma3Requests(void); -int RequestDma3Copy(void *src, void *dest, u16 size, u8 mode); +int RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode); int RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode); +int CheckForSpaceForDma3Request(s16 index); -#endif +#endif // GUARD_DMA3_H diff --git a/include/global.h b/include/global.h index 33c6771c3..a1f79e985 100644 --- a/include/global.h +++ b/include/global.h @@ -645,7 +645,8 @@ struct DaycareMon struct MailStruct mail; u8 OT_name[OT_NAME_LENGTH + 1]; u8 monName[11]; - u8 language; + u8 language_maybe : 4; + u8 unknown : 4; u32 stepsTaken; }; diff --git a/include/gpu_regs.h b/include/gpu_regs.h new file mode 100644 index 000000000..2675571f4 --- /dev/null +++ b/include/gpu_regs.h @@ -0,0 +1,14 @@ +#ifndef GUARD_GPU_REGS_H +#define GUARD_GPU_REGS_H + +void InitGpuRegManager(void); +void CopyBufferedValuesToGpuRegs(void); +void SetGpuReg(u8 regOffset, u16 value); +void SetGpuReg_ForcedBlank(u8 regOffset, u16 value); +u16 GetGpuReg(u8 regOffset); +void SetGpuRegBits(u8 regOffset, u16 mask); +void ClearGpuRegBits(u8 regOffset, u16 mask); +void EnableInterrupts(u16 mask); +void DisableInterrupts(u16 mask); + +#endif // GUARD_GPU_REGS_H diff --git a/include/m4a.h b/include/m4a.h index b6c8f9072..8c3380dd8 100644 --- a/include/m4a.h +++ b/include/m4a.h @@ -4,6 +4,7 @@ #include "gba/m4a_internal.h" void m4aSoundVSync(void); +void m4aSoundVSyncOn(void); void m4aSoundInit(void); void m4aSoundMain(void); diff --git a/include/pokemon.h b/include/pokemon.h index 595ec38fd..9d01c051e 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -620,4 +620,8 @@ bool8 IsPokeSpriteNotFlipped(u16 species); bool8 IsMonShiny(struct Pokemon *mon); bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); +#include "sprite.h" + +void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); + #endif // GUARD_POKEMON_H diff --git a/include/text.h b/include/text.h index 73e6e5437..f584b61ea 100644 --- a/include/text.h +++ b/include/text.h @@ -138,28 +138,37 @@ struct FontInfo u8 shadowColor:4; }; -struct GlyphWidthFunc{ +struct GlyphWidthFunc +{ u32 font_id; u32 (*func)(u16 glyphId, bool32 isJapanese); }; -struct KeypadIcon { +struct KeypadIcon +{ u16 tile_offset; u8 width; u8 height; }; +struct __attribute__((packed)) TextColor +{ + u8 fgColor; + u8 bgColor; + u8 shadowColor; +}; + extern u8 gStringVar1[]; extern u8 gStringVar2[]; extern u8 gStringVar3[]; extern u8 gStringVar4[]; void SetFontsPointer(const struct FontInfo *fonts); -void DeactivateAllTextPrinters (void); +void DeactivateAllTextPrinters(void); u16 PrintTextOnWindow(u8 windowId, u8 fontId, u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextSubPrinter *, u16)); bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*callback)(struct TextSubPrinter *, u16)); void RunTextPrinters(void); -bool8 IsTextPrinterActive(u8 id); +bool16 IsTextPrinterActive(u8 id); u32 RenderFont(struct TextPrinter *textPrinter); void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); void SaveTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor); diff --git a/include/trig.h b/include/trig.h index a2f98a3e6..477a0163f 100644 --- a/include/trig.h +++ b/include/trig.h @@ -1,6 +1,9 @@ #ifndef GUARD_TRIG_H #define GUARD_TRIG_H +// Converts a number to Q8.8 fixed-point format +#define Q_8_8(n) ((s16)((n) * 256)) + extern const s16 gSineTable[]; s16 Sin(s16 index, s16 amplitude); diff --git a/include/window.h b/include/window.h index 36a71a1e0..e8af82e81 100644 --- a/include/window.h +++ b/include/window.h @@ -24,13 +24,24 @@ struct WindowTemplate u16 baseBlock; }; +#define DUMMY_WIN_TEMPLATE \ +{ \ + 0xFF, \ + 0, \ + 0, \ + 0, \ + 0, \ + 0, \ + 0, \ +} + struct Window { struct WindowTemplate window; u8 *tileData; }; -bool16 InitWindows(struct WindowTemplate *templates); +bool16 InitWindows(const struct WindowTemplate *templates); u16 AddWindow(const struct WindowTemplate *template); int AddWindowWithoutTileMap(struct WindowTemplate *template); void RemoveWindow(u8 windowId); |