diff --git a/desmume/src/GPU.h b/desmume/src/GPU.h index 1fcec8840..befcfac10 100644 --- a/desmume/src/GPU.h +++ b/desmume/src/GPU.h @@ -877,7 +877,7 @@ extern MMU_struct MMU; #define GFXCORE_FULLSCREEN (1 << 0) -typedef struct +struct GraphicsInterface_struct { int id; // ID number for core(see above defines) const char *Name; // Name of core @@ -886,7 +886,7 @@ typedef struct void (*DeInit)(); // Deinitializes stuff related to core void (*Resize)(int width, int height, BOOL fullscreen); // Resizes window or fullscreen void (*OnScreenText)(char *string, ...); // For handling save state messages, etc. -} GraphicsInterface_struct; +} ; extern GraphicsInterface_struct GFXDummy; @@ -907,43 +907,46 @@ void GPU_set_DISPCAPCNT(u32 val) ; void GPU_ligne(NDS_Screen * screen, u16 l) ; void GPU_setMasterBrightness (GPU *gpu, u16 val); -#define GPU_setWIN0_H(gpu, val) {gpu->WIN0H0 = val >> 8; gpu->WIN0H1 = val&0xFF; gpu->need_update_winh[0] = true; } -#define GPU_setWIN0_H0(gpu, val) { gpu->WIN0H0 = val; gpu->need_update_winh[0] = true; } -#define GPU_setWIN0_H1(gpu, val) { gpu->WIN0H1 = val; gpu->need_update_winh[0] = true; } +inline void GPU_setWIN0_H(GPU* gpu, u16 val) { gpu->WIN0H0 = val >> 8; gpu->WIN0H1 = val&0xFF; gpu->need_update_winh[0] = true; } +inline void GPU_setWIN0_H0(GPU* gpu, u8 val) { gpu->WIN0H0 = val; gpu->need_update_winh[0] = true; } +inline void GPU_setWIN0_H1(GPU* gpu, u8 val) { gpu->WIN0H1 = val; gpu->need_update_winh[0] = true; } -#define GPU_setWIN0_V(gpu, val) {gpu->WIN0V0 = val >> 8; gpu->WIN0V1 = val&0xFF;} -#define GPU_setWIN0_V0(gpu, val) gpu->WIN0V0 = val -#define GPU_setWIN0_V1(gpu, val) gpu->WIN0V1 = val +inline void GPU_setWIN0_V(GPU* gpu, u16 val) { gpu->WIN0V0 = val >> 8; gpu->WIN0V1 = val&0xFF;} +inline void GPU_setWIN0_V0(GPU* gpu, u8 val) { gpu->WIN0V0 = val; } +inline void GPU_setWIN0_V1(GPU* gpu, u8 val) { gpu->WIN0V1 = val; } -#define GPU_setWIN1_H(gpu, val) {gpu->WIN1H0 = val >> 8; gpu->WIN1H1 = val&0xFF; gpu->need_update_winh[1] = true; } -#define GPU_setWIN1_H0(gpu, val) { gpu->WIN1H0 = val; gpu->need_update_winh[1] = true; } -#define GPU_setWIN1_H1(gpu, val) { gpu->WIN1H1 = val; gpu->need_update_winh[1] = true; } +inline void GPU_setWIN1_H(GPU* gpu, u16 val) {gpu->WIN1H0 = val >> 8; gpu->WIN1H1 = val&0xFF; gpu->need_update_winh[1] = true; } +inline void GPU_setWIN1_H0(GPU* gpu, u8 val) { gpu->WIN1H0 = val; gpu->need_update_winh[1] = true; } +inline void GPU_setWIN1_H1(GPU* gpu, u8 val) { gpu->WIN1H1 = val; gpu->need_update_winh[1] = true; } -#define GPU_setWIN1_V(gpu, val) {gpu->WIN1V0 = val >> 8; gpu->WIN1V1 = val&0xFF;} -#define GPU_setWIN1_V0(gpu, val) gpu->WIN1V0 = val -#define GPU_setWIN1_V1(gpu, val) gpu->WIN1V1 = val +inline void GPU_setWIN1_V(GPU* gpu, u16 val) { gpu->WIN1V0 = val >> 8; gpu->WIN1V1 = val&0xFF; } +inline void GPU_setWIN1_V0(GPU* gpu, u8 val) { gpu->WIN1V0 = val; } +inline void GPU_setWIN1_V1(GPU* gpu, u8 val) { gpu->WIN1V1 = val; } -#define GPU_setWININ(gpu, val) {gpu->WININ0=val&0x1F;\ - gpu->WININ0_SPECIAL=(val>>5)&1;\ - gpu->WININ1=(val>>8)&0x1F;\ - gpu->WININ1_SPECIAL=(val>>13)&1;\ - } -#define GPU_setWININ0(gpu, val) {gpu->WININ0 = val&0x1F; gpu->WININ0_SPECIAL = (val>>5)&1;} -#define GPU_setWININ1(gpu, val) {gpu->WININ1 = val&0x1F; gpu->WININ1_SPECIAL = (val>>5)&1;} +inline void GPU_setWININ(GPU* gpu, u16 val) { + gpu->WININ0=val&0x1F; + gpu->WININ0_SPECIAL=(val>>5)&1; + gpu->WININ1=(val>>8)&0x1F; + gpu->WININ1_SPECIAL=(val>>13)&1; +} -#define GPU_setWINOUT16(gpu, val) { gpu->WINOUT=val&0x1F;\ - gpu->WINOUT_SPECIAL=(val>>5)&1;\ - gpu->WINOBJ=(val>>8)&0x1F;\ - gpu->WINOBJ_SPECIAL=(val>>13)&1;\ - } -#define GPU_setWINOUT(gpu, val) {gpu->WINOUT = val&0x1F; gpu->WINOUT_SPECIAL = (val>>5)&1;} -#define GPU_setWINOBJ(gpu, val) {gpu->WINOBJ = val&0x1F; gpu->WINOBJ_SPECIAL = (val>>5)&1;} +inline void GPU_setWININ0(GPU* gpu, u8 val) { gpu->WININ0 = val&0x1F; gpu->WININ0_SPECIAL = (val>>5)&1; } +inline void GPU_setWININ1(GPU* gpu, u8 val) { gpu->WININ1 = val&0x1F; gpu->WININ1_SPECIAL = (val>>5)&1; } + +inline void GPU_setWINOUT16(GPU* gpu, u16 val) { + gpu->WINOUT=val&0x1F; + gpu->WINOUT_SPECIAL=(val>>5)&1; + gpu->WINOBJ=(val>>8)&0x1F; + gpu->WINOBJ_SPECIAL=(val>>13)&1; +} +inline void GPU_setWINOUT(GPU* gpu, u8 val) { gpu->WINOUT = val&0x1F; gpu->WINOUT_SPECIAL = (val>>5)&1; } +inline void GPU_setWINOBJ(GPU* gpu, u8 val) { gpu->WINOBJ = val&0x1F; gpu->WINOBJ_SPECIAL = (val>>5)&1; } // Blending void SetupFinalPixelBlitter (GPU *gpu); -#define GPU_setBLDCNT_LOW(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF00) | val; SetupFinalPixelBlitter (gpu);} +#define GPU_setBLDCNT_LOW(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF00) | (val); SetupFinalPixelBlitter (gpu);} #define GPU_setBLDCNT_HIGH(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF) | (val<<8); SetupFinalPixelBlitter (gpu);} -#define GPU_setBLDCNT(gpu, val) {gpu->BLDCNT = val; SetupFinalPixelBlitter (gpu);} +#define GPU_setBLDCNT(gpu, val) {gpu->BLDCNT = (val); SetupFinalPixelBlitter (gpu);}