diff options
author | Cleverking2003 <30466983+Cleverking2003@users.noreply.github.com> | 2020-08-01 16:50:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-01 16:50:32 +0300 |
commit | 138893481737a0d057a86dad8ed5181e0ade92d6 (patch) | |
tree | 3f92850d745a65eac315cb5521366c76826e2672 /arm9/lib/include | |
parent | 45e607288e3b6bc4898f63ace0d428c79f97f027 (diff) | |
parent | b5fbb5f9a8917d1061f6b534664ee5071215aef2 (diff) |
Merge pull request #249 from red031000/mod63
mod63_021DB450
Diffstat (limited to 'arm9/lib/include')
-rw-r--r-- | arm9/lib/include/GX_g2.h | 34 | ||||
-rw-r--r-- | arm9/lib/include/registers.h | 13 |
2 files changed, 47 insertions, 0 deletions
diff --git a/arm9/lib/include/GX_g2.h b/arm9/lib/include/GX_g2.h index d1d1c82c..372be12b 100644 --- a/arm9/lib/include/GX_g2.h +++ b/arm9/lib/include/GX_g2.h @@ -2,6 +2,7 @@ #define GUARD_GX_G2_H #include "fx.h" +#include "registers.h" void G2x_SetBGyAffine_(u32 *ptr, struct Mtx22 *mtx, fx32 a, fx32 b, fx32 c, fx32 d); void G2x_SetBlendAlpha_(u32 *ptr, fx32 a, fx32 b, fx32 c, fx32 d); @@ -9,6 +10,39 @@ void G2x_SetBlendBrightness_(u16 *ptr, fx32 a, fx32 brightness); void G2x_SetBlendBrightnessExt_(u16 *ptr, fx32 a, fx32 b, fx32 c, fx32 d, fx32 brightness); void G2x_ChangeBlendBrightness_(u16 *ptr, fx32 brightness); +typedef struct +{ + u8 planeMask:5; + u8 effect:1; + u8 _reserve:2; +} + GXWndPlane; + +typedef enum +{ + GX_WND_PLANEMASK_NONE = 0x0000, + GX_WND_PLANEMASK_BG0 = 0x0001, + GX_WND_PLANEMASK_BG1 = 0x0002, + GX_WND_PLANEMASK_BG2 = 0x0004, + GX_WND_PLANEMASK_BG3 = 0x0008, + GX_WND_PLANEMASK_OBJ = 0x0010 +} + GXWndPlaneMask; + +static inline void G2_SetWndOutsidePlane(int wnd, BOOL effect) +{ + u32 tmp; + + tmp = ((reg_G2_WINOUT & ~REG_G2_WINOUT_WINOUT_MASK) | ((u32)wnd << REG_G2_WINOUT_WINOUT_SHIFT)); + + if (effect) + { + tmp |= (0x20 << REG_G2_WINOUT_WINOUT_SHIFT); // EFCT + } + + reg_G2_WINOUT = (u16)tmp; +} + //The g2 and g2_oam headers contain a lot of inline functions and enums that may want to be ported over at some point #endif //GUARD_GX_G2_H diff --git a/arm9/lib/include/registers.h b/arm9/lib/include/registers.h index 37ca97e6..6bfb52ac 100644 --- a/arm9/lib/include/registers.h +++ b/arm9/lib/include/registers.h @@ -454,6 +454,19 @@ #define REG_PAD_KEYCNT_A_SIZE 1 #define REG_PAD_KEYCNT_A_MASK 0x0001 +#define REG_G2_WINOUT_OBJWININ_SHIFT 8 +#define REG_G2_WINOUT_OBJWININ_SIZE 6 +#define REG_G2_WINOUT_OBJWININ_MASK 0x3f00 + +#define REG_G2_WINOUT_WINOUT_SHIFT 0 +#define REG_G2_WINOUT_WINOUT_SIZE 6 +#define REG_G2_WINOUT_WINOUT_MASK 0x003f + +#define REG_G2_WINOUT_FIELD( objwinin, winout ) \ + (u16)( \ + ((u32)(objwinin) << REG_G2_WINOUT_OBJWININ_SHIFT) | \ + ((u32)(winout) << REG_G2_WINOUT_WINOUT_SHIFT)) + #ifndef SDK_ASM #define REG_PAD_KEYCNT_FIELD( logic, intr, l, r, down, up, left, right, start, sel, b, a ) \ (u16)( \ |