several warnings less
deleted redundant code --> some more FPS
This commit is contained in:
parent
a3e5dd1261
commit
fc4a4e8cb5
|
@ -359,108 +359,6 @@ void GPU_addBack(GPU * gpu, u8 num)
|
||||||
GPU_resortBGs(gpu);
|
GPU_resortBGs(gpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
// PARAMETERS OF BACKGROUNDS
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void GPU_scrollX(GPU * gpu, u8 num, u16 v)
|
|
||||||
{
|
|
||||||
gpu->BGSX[num] = v;
|
|
||||||
}
|
|
||||||
void GPU_scrollY(GPU * gpu, u8 num, u16 v)
|
|
||||||
{
|
|
||||||
gpu->BGSY[num] = v;
|
|
||||||
}
|
|
||||||
void GPU_scrollXY(GPU * gpu, u8 num, u32 v)
|
|
||||||
{
|
|
||||||
gpu->BGSX[num] = (v & 0xFFFF);
|
|
||||||
gpu->BGSY[num] = (v >> 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
// PARAMETERS OF EFFECTS
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void GPU_setBLDCNT(GPU *gpu, u16 v)
|
|
||||||
{
|
|
||||||
gpu->BLDCNT = v ;
|
|
||||||
}
|
|
||||||
void GPU_setBLDALPHA(GPU *gpu, u16 v)
|
|
||||||
{
|
|
||||||
gpu->BLDALPHA = v ;
|
|
||||||
}
|
|
||||||
void GPU_setBLDY(GPU *gpu, u16 v)
|
|
||||||
{
|
|
||||||
gpu->BLDY = v ;
|
|
||||||
}
|
|
||||||
void GPU_setMOSAIC(GPU *gpu, u16 v)
|
|
||||||
{
|
|
||||||
gpu->MOSAIC = v ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
// PARAMETERS OF WINDOWS
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void GPU_setWINDOW_XDIM(GPU *gpu, u16 v, u8 num)
|
|
||||||
{
|
|
||||||
gpu->WINDOW_XDIM[num].val = v ;
|
|
||||||
}
|
|
||||||
void GPU_setWINDOW_XDIM_Component(GPU *gpu, u8 v, u8 num) /* write start/end seperately */
|
|
||||||
{
|
|
||||||
if (num & 1) {
|
|
||||||
gpu->WINDOW_XDIM[num >> 1].bits.start = v ;
|
|
||||||
} else {
|
|
||||||
gpu->WINDOW_XDIM[num >> 1].bits.end = v ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GPU_setWINDOW_YDIM(GPU *gpu, u16 v, u8 num)
|
|
||||||
{
|
|
||||||
gpu->WINDOW_YDIM[num].val = v ;
|
|
||||||
}
|
|
||||||
void GPU_setWINDOW_YDIM_Component(GPU *gpu, u8 v, u8 num) /* write start/end seperately */
|
|
||||||
{
|
|
||||||
if (num & 1) {
|
|
||||||
gpu->WINDOW_YDIM[num >> 1].bits.start = v ;
|
|
||||||
} else {
|
|
||||||
gpu->WINDOW_YDIM[num >> 1].bits.end = v ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GPU_setWINDOW_INCNT(GPU *gpu, u16 v)
|
|
||||||
{
|
|
||||||
gpu->WINDOW_INCNT.val = v ;
|
|
||||||
}
|
|
||||||
void GPU_setWINDOW_INCNT_Component(GPU *gpu, u8 v,u8 num)
|
|
||||||
{
|
|
||||||
switch (num)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
gpu->WINDOW_INCNT.bytes.low = v ;
|
|
||||||
break ;
|
|
||||||
case 1:
|
|
||||||
gpu->WINDOW_INCNT.bytes.high = v ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GPU_setWINDOW_OUTCNT(GPU *gpu, u16 v)
|
|
||||||
{
|
|
||||||
gpu->WINDOW_OUTCNT.val = v ;
|
|
||||||
}
|
|
||||||
void GPU_setWINDOW_OUTCNT_Component(GPU *gpu, u8 v,u8 num)
|
|
||||||
{
|
|
||||||
switch (num)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
gpu->WINDOW_OUTCNT.bytes.low = v ;
|
|
||||||
break ;
|
|
||||||
case 1:
|
|
||||||
gpu->WINDOW_OUTCNT.bytes.high = v ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// ROUTINES FOR INSIDE / OUTSIDE WINDOW CHECKS
|
// ROUTINES FOR INSIDE / OUTSIDE WINDOW CHECKS
|
||||||
|
@ -488,14 +386,15 @@ INLINE BOOL withinRect (u8 x,u8 y, u16 startX, u16 startY, u16 endX, u16 endY)
|
||||||
void renderline_checkWindows(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL *effect)
|
void renderline_checkWindows(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL *effect)
|
||||||
{
|
{
|
||||||
struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits;
|
struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits;
|
||||||
|
WINCNT * wcnt = &gpu->dispx_st->dispx_WINCNT;
|
||||||
BOOL wwin0=0, wwin1=0, wwobj=0, windows=0;
|
BOOL wwin0=0, wwin1=0, wwobj=0, windows=0;
|
||||||
|
|
||||||
// Check if win0 if enabled, and only check if it is
|
// Check if win0 if enabled, and only check if it is
|
||||||
if (dispCnt->Win0_Enable)
|
if (dispCnt->Win0_Enable)
|
||||||
{
|
{
|
||||||
wwin0 = withinRect( x,y,
|
wwin0 = withinRect( x,y,
|
||||||
gpu->WINDOW_XDIM[0].bits.start,gpu->WINDOW_YDIM[0].bits.start,
|
wcnt->WIN0H.bits.start,wcnt->WIN0V.bits.start,
|
||||||
gpu->WINDOW_XDIM[0].bits.end, gpu->WINDOW_YDIM[0].bits.end);
|
wcnt->WIN0H.bits.end, wcnt->WIN0V.bits.end);
|
||||||
windows = 1;
|
windows = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,8 +402,8 @@ void renderline_checkWindows(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL
|
||||||
if (dispCnt->Win1_Enable)
|
if (dispCnt->Win1_Enable)
|
||||||
{
|
{
|
||||||
wwin1 = withinRect( x,y,
|
wwin1 = withinRect( x,y,
|
||||||
gpu->WINDOW_XDIM[1].bits.start,gpu->WINDOW_YDIM[1].bits.start,
|
wcnt->WIN1H.bits.start,wcnt->WIN1V.bits.start,
|
||||||
gpu->WINDOW_XDIM[1].bits.end, gpu->WINDOW_YDIM[1].bits.end);
|
wcnt->WIN1H.bits.end, wcnt->WIN1V.bits.end);
|
||||||
windows = 1;
|
windows = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,39 +414,30 @@ void renderline_checkWindows(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windows) {
|
if (windows) {
|
||||||
/*
|
|
||||||
// HOW THE HELL THIS DOES NOT WORK !!!
|
|
||||||
|
|
||||||
win0 = (gpu->WINDOW_INCNT.bytes.low & (1<<bgnum))&&1;
|
|
||||||
win1 = (gpu->WINDOW_INCNT.bytes.high & (1<<bgnum))&&1;
|
|
||||||
outwin = (gpu->WINDOW_OUTCNT.bytes.low & (1<<bgnum))&&1;
|
|
||||||
winOBJ = (gpu->WINDOW_OUTCNT.bytes.high & (1<<bgnum))&&1;
|
|
||||||
|
|
||||||
// CHECK THE FOLLOWING, SAME MEANING BUT IT WORKS
|
|
||||||
*/
|
|
||||||
// it is in win0, do we display ?
|
// it is in win0, do we display ?
|
||||||
// high priority
|
// high priority
|
||||||
if (wwin0) {
|
if (wwin0) {
|
||||||
*draw = (gpu->WINDOW_INCNT.bytes.low >> bgnum)&1;
|
*draw = (wcnt->WININ.bytes.low >> bgnum)&1;
|
||||||
*effect = gpu->WINDOW_INCNT.bits.WIN0_Effect_Enable;
|
*effect = wcnt->WININ.bits.win0.WINx_Effect_Enable;
|
||||||
}
|
}
|
||||||
// it is in win1, do we display ?
|
// it is in win1, do we display ?
|
||||||
// mid priority
|
// mid priority
|
||||||
else if (wwin1) {
|
else if (wwin1) {
|
||||||
*draw = (gpu->WINDOW_INCNT.bytes.high >> bgnum)&1;
|
*draw = (wcnt->WININ.bytes.high >> bgnum)&1;
|
||||||
*effect = gpu->WINDOW_INCNT.bits.WIN1_Effect_Enable;
|
*effect = wcnt->WININ.bits.win1.WINx_Effect_Enable;
|
||||||
}
|
}
|
||||||
// it is in winOBJ, do we display ?
|
// it is in winOBJ, do we display ?
|
||||||
// low priority
|
// low priority
|
||||||
else if (wwobj) {
|
else if (wwobj) {
|
||||||
*draw = (gpu->WINDOW_OUTCNT.bytes.high>> bgnum)&1;
|
*draw = (wcnt->WINOUT.bytes.high>> bgnum)&1;
|
||||||
*effect = gpu->WINDOW_OUTCNT.bits.WIN1_Effect_Enable;
|
*effect = wcnt->WINOUT.bits.win1.WINx_Effect_Enable;
|
||||||
}
|
}
|
||||||
// it is outside of windows, do we display ?
|
// it is outside of windows, do we display ?
|
||||||
// fallback
|
// fallback
|
||||||
else if (!(wwin0||wwin1||wwobj)) {
|
else if (!(wwin0||wwin1||wwobj)) {
|
||||||
*draw = (gpu->WINDOW_OUTCNT.bytes.low >> bgnum)&1;
|
*draw = (wcnt->WINOUT.bytes.low >> bgnum)&1;
|
||||||
*effect = gpu->WINDOW_OUTCNT.bits.WIN0_Effect_Enable;
|
*effect = wcnt->WINOUT.bits.win0.WINx_Effect_Enable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,12 +448,13 @@ void renderline_checkWindows(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL
|
||||||
|
|
||||||
INLINE BOOL renderline_setFinalColor(GPU *gpu,u32 passing,u8 bgnum,u8 *dst,u16 color,u16 x, u16 y) {
|
INLINE BOOL renderline_setFinalColor(GPU *gpu,u32 passing,u8 bgnum,u8 *dst,u16 color,u16 x, u16 y) {
|
||||||
BOOL windowDraw = TRUE, windowEffect = TRUE ;
|
BOOL windowDraw = TRUE, windowEffect = TRUE ;
|
||||||
|
MISCCNT * msccnt = &gpu->dispx_st->dispx_MISC;
|
||||||
/* window priority: insides, if no rule, check outside */
|
/* window priority: insides, if no rule, check outside */
|
||||||
renderline_checkWindows(gpu,bgnum,x,y,&windowDraw,&windowEffect);
|
renderline_checkWindows(gpu,bgnum,x,y,&windowDraw,&windowEffect);
|
||||||
|
|
||||||
if (((gpu->BLDCNT>>bgnum)&1) && (windowEffect)) /* the bg to draw has a special color effect */
|
if (((msccnt->BLDCNT>>bgnum)&1) && (windowEffect)) /* the bg to draw has a special color effect */
|
||||||
{
|
{
|
||||||
switch (gpu->BLDCNT & 0xC0) /* type of special color effect */
|
switch (msccnt->BLDCNT & 0xC0) /* type of special color effect */
|
||||||
{
|
{
|
||||||
case 0x00: /* none (plain color passing) */
|
case 0x00: /* none (plain color passing) */
|
||||||
T2WriteWord(dst, passing, color) ;
|
T2WriteWord(dst, passing, color) ;
|
||||||
|
@ -573,7 +464,7 @@ INLINE BOOL renderline_setFinalColor(GPU *gpu,u32 passing,u8 bgnum,u8 *dst,u16 c
|
||||||
//if (!(color & 0x8000)) return ;
|
//if (!(color & 0x8000)) return ;
|
||||||
/* we cant do alpha on an invisible pixel */
|
/* we cant do alpha on an invisible pixel */
|
||||||
|
|
||||||
u16 sourceFraction = (gpu->BLDALPHA & 0x1F),
|
u16 sourceFraction = (msccnt->BLDALPHA & 0x1F),
|
||||||
sourceR, sourceG, sourceB,targetFraction;
|
sourceR, sourceG, sourceB,targetFraction;
|
||||||
if (!sourceFraction)
|
if (!sourceFraction)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -582,7 +473,7 @@ INLINE BOOL renderline_setFinalColor(GPU *gpu,u32 passing,u8 bgnum,u8 *dst,u16 c
|
||||||
/* weighted component from color to draw */
|
/* weighted component from color to draw */
|
||||||
sourceG = (((color>>5) & 0x1F) * sourceFraction) >> 4 ;
|
sourceG = (((color>>5) & 0x1F) * sourceFraction) >> 4 ;
|
||||||
sourceB = (((color>>10) & 0x1F) * sourceFraction) >> 4 ;
|
sourceB = (((color>>10) & 0x1F) * sourceFraction) >> 4 ;
|
||||||
targetFraction = (gpu->BLDALPHA & 0x1F00) >> 8 ;
|
targetFraction = (msccnt->BLDALPHA & 0x1F00) >> 8 ;
|
||||||
if (targetFraction) {
|
if (targetFraction) {
|
||||||
/* when we dont take any fraction from existing pixel, we can just draw */
|
/* when we dont take any fraction from existing pixel, we can just draw */
|
||||||
u16 targetR, targetG, targetB;
|
u16 targetR, targetG, targetB;
|
||||||
|
@ -604,8 +495,8 @@ INLINE BOOL renderline_setFinalColor(GPU *gpu,u32 passing,u8 bgnum,u8 *dst,u16 c
|
||||||
break ;
|
break ;
|
||||||
case 0x80: /* brightness increase */
|
case 0x80: /* brightness increase */
|
||||||
{
|
{
|
||||||
if (gpu->BLDY != 0x0) { /* dont slow down if there is nothing to do */
|
if (msccnt->BLDY != 0x0) { /* dont slow down if there is nothing to do */
|
||||||
u16 modFraction = (gpu->BLDY & 0x1F) ;
|
u16 modFraction = (msccnt->BLDY & 0x1F) ;
|
||||||
u16 sourceR = (color & 0x1F) ;
|
u16 sourceR = (color & 0x1F) ;
|
||||||
u16 sourceG = ((color>>5) & 0x1F) ;
|
u16 sourceG = ((color>>5) & 0x1F) ;
|
||||||
u16 sourceB = ((color>>10) & 0x1F) ;
|
u16 sourceB = ((color>>10) & 0x1F) ;
|
||||||
|
@ -619,8 +510,8 @@ INLINE BOOL renderline_setFinalColor(GPU *gpu,u32 passing,u8 bgnum,u8 *dst,u16 c
|
||||||
break ;
|
break ;
|
||||||
case 0xC0: /* brightness decrease */
|
case 0xC0: /* brightness decrease */
|
||||||
{
|
{
|
||||||
if (gpu->BLDY!=0) { /* dont slow down if there is nothing to do */
|
if (msccnt->BLDY!=0) { /* dont slow down if there is nothing to do */
|
||||||
u16 modFraction = (gpu->BLDY & 0x1F) ;
|
u16 modFraction = (msccnt->BLDY & 0x1F) ;
|
||||||
u16 sourceR = (color & 0x1F) ;
|
u16 sourceR = (color & 0x1F) ;
|
||||||
u16 sourceG = ((color>>5) & 0x1F) ;
|
u16 sourceG = ((color>>5) & 0x1F) ;
|
||||||
u16 sourceB = ((color>>10) & 0x1F) ;
|
u16 sourceB = ((color>>10) & 0x1F) ;
|
||||||
|
@ -635,7 +526,7 @@ INLINE BOOL renderline_setFinalColor(GPU *gpu,u32 passing,u8 bgnum,u8 *dst,u16 c
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* only draw when effect is enabled on this pixel as source, or drawing itself is enabled */
|
/* only draw when effect is enabled on this pixel as source, or drawing itself is enabled */
|
||||||
if (((windowEffect) && (gpu->BLDCNT & (0x100 << bgnum))) || (windowDraw))
|
if (((windowEffect) && (msccnt->BLDCNT & (0x100 << bgnum))) || (windowDraw))
|
||||||
T2WriteWord(dst, passing, color) ;
|
T2WriteWord(dst, passing, color) ;
|
||||||
}
|
}
|
||||||
return windowDraw;
|
return windowDraw;
|
||||||
|
@ -663,6 +554,7 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
|
||||||
u16 x = 0;
|
u16 x = 0;
|
||||||
u16 xfin;
|
u16 xfin;
|
||||||
u16 palette_size;
|
u16 palette_size;
|
||||||
|
u16 mosaic = gpu->dispx_st->dispx_MISC.MOSAIC;
|
||||||
|
|
||||||
s8 line_dir = 1;
|
s8 line_dir = 1;
|
||||||
u8 pt_xor = 0;
|
u8 pt_xor = 0;
|
||||||
|
@ -685,8 +577,8 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
|
||||||
/* test NDS: #2 of
|
/* test NDS: #2 of
|
||||||
http://desmume.sourceforge.net/forums/index.php?action=vthread&forum=2&topic=50&page=0#msg192 */
|
http://desmume.sourceforge.net/forums/index.php?action=vthread&forum=2&topic=50&page=0#msg192 */
|
||||||
|
|
||||||
u8 mw = (gpu->MOSAIC & 0xF) +1 ; /* horizontal granularity of the mosaic */
|
u8 mw = (mosaic & 0xF) +1 ; /* horizontal granularity of the mosaic */
|
||||||
u8 mh = ((gpu->MOSAIC>>4) & 0xF) +1 ; /* vertical granularity of the mosaic */
|
u8 mh = ((mosaic>>4) & 0xF) +1 ; /* vertical granularity of the mosaic */
|
||||||
YBG = (YBG / mh) * mh ; /* align y by vertical granularity */
|
YBG = (YBG / mh) * mh ; /* align y by vertical granularity */
|
||||||
yoff = ((YBG&7)<<2);
|
yoff = ((YBG&7)<<2);
|
||||||
|
|
||||||
|
@ -963,7 +855,8 @@ INLINE void extRotBG2(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16 PA,
|
||||||
|
|
||||||
void lineText(GPU * gpu, u8 num, u16 l, u8 * DST)
|
void lineText(GPU * gpu, u8 num, u16 l, u8 * DST)
|
||||||
{
|
{
|
||||||
renderline_textBG(gpu, num, DST, l, gpu->BGSX[num], l + gpu->BGSY[num], 256);
|
BGxOFS * ofs = &gpu->dispx_st->dispx_BGxOFS[num];
|
||||||
|
renderline_textBG(gpu, num, DST, l, ofs->BGxHOFS, l + ofs->BGxVOFS, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lineRot(GPU * gpu, u8 num, u16 l, u8 * DST)
|
void lineRot(GPU * gpu, u8 num, u16 l, u8 * DST)
|
||||||
|
|
|
@ -141,20 +141,65 @@ typedef struct {
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
this structure is for windows parameters
|
these structures are for window description,
|
||||||
|
windows are square regions and can "subclass"
|
||||||
|
background layers or object layers (i.e window controls the layers)
|
||||||
|
|
||||||
|
screen
|
||||||
|
|
|
||||||
|
+-- Window0/Window1/OBJwindow/OutOfWindows
|
||||||
|
|
|
||||||
|
+-- BG0/BG1/BG2/BG3/OBJ
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
struct {
|
||||||
|
u8 end:8;
|
||||||
|
u8 start:8;
|
||||||
|
} bits ;
|
||||||
|
u16 val;
|
||||||
|
} WINxDIM;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u16 WIN0H;
|
/* 0*/ u8 WINx_BG0_Enable:1;
|
||||||
u16 WIN1H;
|
/* 1*/ u8 WINx_BG1_Enable:1;
|
||||||
u16 WIN0V;
|
/* 2*/ u8 WINx_BG2_Enable:1;
|
||||||
u16 WIN1V;
|
/* 3*/ u8 WINx_BG3_Enable:1;
|
||||||
u16 WININ;
|
/* 4*/ u8 WINx_OBJ_Enable:1;
|
||||||
u16 WINOUT;
|
/* 5*/ u8 WINx_Effect_Enable:1;
|
||||||
|
/* 6*/ u8 :2;
|
||||||
|
} WINxBIT;
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
struct {
|
||||||
|
WINxBIT win0;
|
||||||
|
WINxBIT win1;
|
||||||
|
} bits;
|
||||||
|
struct {
|
||||||
|
u8 win0_en:5;
|
||||||
|
u8 :3;
|
||||||
|
u8 win1_en:5;
|
||||||
|
u8 :3;
|
||||||
|
} packed_bits;
|
||||||
|
struct {
|
||||||
|
u8 low;
|
||||||
|
u8 high;
|
||||||
|
} bytes;
|
||||||
|
u16 val ;
|
||||||
|
} WINxCNT ;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
WINxDIM WIN0H;
|
||||||
|
WINxDIM WIN1H;
|
||||||
|
WINxDIM WIN0V;
|
||||||
|
WINxDIM WIN1V;
|
||||||
|
WINxCNT WININ;
|
||||||
|
WINxCNT WINOUT;
|
||||||
} WINCNT;
|
} WINCNT;
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
this structure is for miscellanous settings
|
this structure is for miscellanous settings
|
||||||
|
//TODO: needs further description
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -438,62 +483,6 @@ typedef struct
|
||||||
} size;
|
} size;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
these structures are for window description,
|
|
||||||
windows are square regions and can "subclass"
|
|
||||||
background layers or object layers (i.e window controls the layers)
|
|
||||||
|
|
||||||
screen
|
|
||||||
|
|
|
||||||
+-- Window0/Window1/OBJwindow/OutOfWindows
|
|
||||||
|
|
|
||||||
+-- BG0/BG1/BG2/BG3/OBJ
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef union windowdim_t
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
/* 0*/ unsigned end:8;
|
|
||||||
/* 8*/ unsigned start:8;
|
|
||||||
} bits ;
|
|
||||||
unsigned short val ;
|
|
||||||
} windowdim_t ;
|
|
||||||
|
|
||||||
typedef union windowcnt_t
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
/* 0*/ unsigned WIN0_BG0_Enable:1;
|
|
||||||
/* 1*/ unsigned WIN0_BG1_Enable:1;
|
|
||||||
/* 2*/ unsigned WIN0_BG2_Enable:1;
|
|
||||||
/* 3*/ unsigned WIN0_BG3_Enable:1;
|
|
||||||
/* 4*/ unsigned WIN0_OBJ_Enable:1;
|
|
||||||
/* 5*/ unsigned WIN0_Effect_Enable:1;
|
|
||||||
/* 6*/ unsigned :2;
|
|
||||||
/* 8*/ unsigned WIN1_BG0_Enable:1;
|
|
||||||
/* 9*/ unsigned WIN1_BG1_Enable:1;
|
|
||||||
/*10*/ unsigned WIN1_BG2_Enable:1;
|
|
||||||
/*11*/ unsigned WIN1_BG3_Enable:1;
|
|
||||||
/*12*/ unsigned WIN1_OBJ_Enable:1;
|
|
||||||
/*13*/ unsigned WIN1_Effect_Enable:1;
|
|
||||||
/*14*/ unsigned :2;
|
|
||||||
} bits ;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned char low ;
|
|
||||||
unsigned char high ;
|
|
||||||
} bytes ;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned win0_en:5;
|
|
||||||
unsigned :3;
|
|
||||||
unsigned win1_en:5;
|
|
||||||
unsigned :3;
|
|
||||||
} windows ;
|
|
||||||
unsigned short val ;
|
|
||||||
} windowcnt_t ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -534,8 +523,6 @@ struct _GPU
|
||||||
|
|
||||||
u8 BGExtPalSlot[4];
|
u8 BGExtPalSlot[4];
|
||||||
u32 BGSize[4][2];
|
u32 BGSize[4][2];
|
||||||
u16 BGSX[4];
|
|
||||||
u16 BGSY[4];
|
|
||||||
|
|
||||||
u8 lcd;
|
u8 lcd;
|
||||||
u8 core;
|
u8 core;
|
||||||
|
@ -553,16 +540,6 @@ struct _GPU
|
||||||
u8 sprBMPMode;
|
u8 sprBMPMode;
|
||||||
u32 sprEnable ;
|
u32 sprEnable ;
|
||||||
|
|
||||||
u16 BLDCNT ;
|
|
||||||
u16 BLDALPHA ;
|
|
||||||
u16 BLDY ;
|
|
||||||
u16 MOSAIC ;
|
|
||||||
|
|
||||||
windowdim_t WINDOW_XDIM[2] ;
|
|
||||||
windowdim_t WINDOW_YDIM[2] ;
|
|
||||||
windowcnt_t WINDOW_INCNT ;
|
|
||||||
windowcnt_t WINDOW_OUTCNT ;
|
|
||||||
|
|
||||||
void (*spriteRender)(GPU * gpu, u16 l, u8 * dst, u8 * prioTab);
|
void (*spriteRender)(GPU * gpu, u16 l, u8 * dst, u8 * prioTab);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -642,25 +619,11 @@ extern GraphicsInterface_struct GFXDummy;
|
||||||
void GPU_setVideoProp(GPU *, u32 p);
|
void GPU_setVideoProp(GPU *, u32 p);
|
||||||
void GPU_setBGProp(GPU *, u16 num, u16 p);
|
void GPU_setBGProp(GPU *, u16 num, u16 p);
|
||||||
|
|
||||||
void GPU_scrollX(GPU *, u8 num, u16 v);
|
|
||||||
void GPU_scrollY(GPU *, u8 num, u16 v);
|
|
||||||
void GPU_scrollXY(GPU *, u8 num, u32 v);
|
|
||||||
|
|
||||||
void GPU_setBLDCNT(GPU *gpu, u16 v) ;
|
void GPU_setBLDCNT(GPU *gpu, u16 v) ;
|
||||||
void GPU_setBLDALPHA(GPU *gpu, u16 v) ;
|
void GPU_setBLDALPHA(GPU *gpu, u16 v) ;
|
||||||
void GPU_setBLDY(GPU *gpu, u16 v) ;
|
void GPU_setBLDY(GPU *gpu, u16 v) ;
|
||||||
void GPU_setMOSAIC(GPU *gpu, u16 v) ;
|
void GPU_setMOSAIC(GPU *gpu, u16 v) ;
|
||||||
|
|
||||||
void GPU_setWINDOW_XDIM(GPU *gpu, u16 v, u8 num) ;
|
|
||||||
void GPU_setWINDOW_YDIM(GPU *gpu, u16 v, u8 num) ;
|
|
||||||
void GPU_setWINDOW_XDIM_Component(GPU *gpu, u8 v, u8 num) ;
|
|
||||||
void GPU_setWINDOW_YDIM_Component(GPU *gpu, u8 v, u8 num) ;
|
|
||||||
|
|
||||||
void GPU_setWINDOW_INCNT(GPU *gpu, u16 v) ;
|
|
||||||
void GPU_setWINDOW_OUTCNT(GPU *gpu, u16 v) ;
|
|
||||||
void GPU_setWINDOW_INCNT_Component(GPU *gpu, u8 v,u8 num) ;
|
|
||||||
void GPU_setWINDOW_OUTCNT_Component(GPU *gpu, u8 v,u8 num) ;
|
|
||||||
|
|
||||||
|
|
||||||
void GPU_remove(GPU *, u8 num);
|
void GPU_remove(GPU *, u8 num);
|
||||||
void GPU_addBack(GPU *, u8 num);
|
void GPU_addBack(GPU *, u8 num);
|
||||||
|
|
|
@ -990,78 +990,6 @@ void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val)
|
||||||
MMU_VRAMReloadFromLCD(adr-REG_VRAMCNTI,val) ;
|
MMU_VRAMReloadFromLCD(adr-REG_VRAMCNTI,val) ;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REG_DISPA_WIN0H:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(MainScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN0H+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(MainScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN1H:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(MainScreen.gpu,val,2) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN1H+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(MainScreen.gpu,val,3) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN0H:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(SubScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN0H+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(SubScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN1H:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(SubScreen.gpu,val,2) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN1H+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(SubScreen.gpu,val,3) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN0V:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(MainScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN0V+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(MainScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN1V:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(MainScreen.gpu,val,2) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN1V+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(MainScreen.gpu,val,3) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN0V:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(SubScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN0V+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(SubScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN1V:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(SubScreen.gpu,val,2) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN1V+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(SubScreen.gpu,val,3) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WININ:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT_Component(MainScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WININ+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT_Component(MainScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WINOUT:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT_Component(MainScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WINOUT+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT_Component(MainScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WININ:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT_Component(SubScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WININ+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT_Component(SubScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WINOUT:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT_Component(SubScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WINOUT+1:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT_Component(SubScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
#ifdef LOG_CARD
|
#ifdef LOG_CARD
|
||||||
case 0x040001A0 : /* TODO (clear): ??? */
|
case 0x040001A0 : /* TODO (clear): ??? */
|
||||||
|
@ -1303,54 +1231,6 @@ void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val)
|
||||||
|
|
||||||
/* NOTICE: Perhaps we have to use gbatek-like reg names instead of libnds-like ones ...*/
|
/* NOTICE: Perhaps we have to use gbatek-like reg names instead of libnds-like ones ...*/
|
||||||
|
|
||||||
case REG_DISPA_BG0HOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollX(MainScreen.gpu, 0, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG1HOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollX(MainScreen.gpu, 1, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG2HOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollX(MainScreen.gpu, 2, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG3HOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollX(MainScreen.gpu, 3, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG0HOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollX(SubScreen.gpu, 0, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG1HOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollX(SubScreen.gpu, 1, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG2HOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollX(SubScreen.gpu, 2, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG3HOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollX(SubScreen.gpu, 3, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG0VOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollY(MainScreen.gpu, 0, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG1VOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollY(MainScreen.gpu, 1, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG2VOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollY(MainScreen.gpu, 2, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG3VOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollY(MainScreen.gpu, 3, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG0VOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollY(SubScreen.gpu, 0, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG1VOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollY(SubScreen.gpu, 1, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG2VOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollY(SubScreen.gpu, 2, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG3VOFS :
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_scrollY(SubScreen.gpu, 3, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG0CNT :
|
case REG_DISPA_BG0CNT :
|
||||||
//GPULOG("MAIN BG0 SETPROP 16B %08X\r\n", val);
|
//GPULOG("MAIN BG0 SETPROP 16B %08X\r\n", val);
|
||||||
if(proc == ARMCPU_ARM9) GPU_setBGProp(MainScreen.gpu, 0, val);
|
if(proc == ARMCPU_ARM9) GPU_setBGProp(MainScreen.gpu, 0, val);
|
||||||
|
@ -1391,66 +1271,6 @@ void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val)
|
||||||
if(proc == ARMCPU_ARM9) GPU_setBGProp(SubScreen.gpu, 3, val);
|
if(proc == ARMCPU_ARM9) GPU_setBGProp(SubScreen.gpu, 3, val);
|
||||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x100E, val);
|
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x100E, val);
|
||||||
return;
|
return;
|
||||||
case REG_DISPA_BLDCNT:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setBLDCNT(MainScreen.gpu,val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_BLDCNT:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setBLDCNT(SubScreen.gpu,val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_BLDALPHA:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setBLDALPHA(MainScreen.gpu,val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_BLDALPHA:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setBLDALPHA(SubScreen.gpu,val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_BLDY:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setBLDY(MainScreen.gpu,val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_BLDY:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setBLDY(SubScreen.gpu,val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_MOSAIC:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setMOSAIC(MainScreen.gpu,val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_MOSAIC:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setMOSAIC(SubScreen.gpu,val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN0H:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM(MainScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN1H:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM(MainScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN0H:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM(SubScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN1H:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM(SubScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN0V:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM(MainScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WIN1V:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM(MainScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN0V:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM(SubScreen.gpu,val,0) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WIN1V:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM(SubScreen.gpu,val,1) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WININ:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT(MainScreen.gpu, val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPA_WINOUT:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT(MainScreen.gpu, val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WININ:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT(SubScreen.gpu, val) ;
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WINOUT:
|
|
||||||
if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT(SubScreen.gpu, val) ;
|
|
||||||
break ;
|
|
||||||
case REG_IME :
|
case REG_IME :
|
||||||
MMU.reg_IME[proc] = val&1;
|
MMU.reg_IME[proc] = val&1;
|
||||||
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x208, val);
|
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x208, val);
|
||||||
|
@ -1818,30 +1638,6 @@ void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
|
||||||
if (proc == ARMCPU_ARM9) gl_print_cmd(adr);
|
if (proc == ARMCPU_ARM9) gl_print_cmd(adr);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case REG_DISPA_BG0HOFS :
|
|
||||||
if (proc == ARMCPU_ARM9) GPU_scrollXY(MainScreen.gpu, 0, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG1HOFS :
|
|
||||||
if (proc == ARMCPU_ARM9) GPU_scrollXY(MainScreen.gpu, 1, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG2HOFS :
|
|
||||||
if (proc == ARMCPU_ARM9) GPU_scrollXY(MainScreen.gpu, 2, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_BG3HOFS :
|
|
||||||
if (proc == ARMCPU_ARM9) GPU_scrollXY(MainScreen.gpu, 3, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG0HOFS :
|
|
||||||
if (proc == ARMCPU_ARM9) GPU_scrollXY(SubScreen.gpu, 0, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG1HOFS :
|
|
||||||
if (proc == ARMCPU_ARM9) GPU_scrollXY(SubScreen.gpu, 1, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG2HOFS :
|
|
||||||
if (proc == ARMCPU_ARM9) GPU_scrollXY(SubScreen.gpu, 2, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPB_BG3HOFS :
|
|
||||||
if (proc == ARMCPU_ARM9) GPU_scrollXY(SubScreen.gpu, 3, val);
|
|
||||||
return;
|
|
||||||
case REG_DISPA_DISPCNT :
|
case REG_DISPA_DISPCNT :
|
||||||
if(proc == ARMCPU_ARM9) GPU_setVideoProp(MainScreen.gpu, val);
|
if(proc == ARMCPU_ARM9) GPU_setVideoProp(MainScreen.gpu, val);
|
||||||
|
|
||||||
|
@ -1854,20 +1650,6 @@ void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
|
||||||
//GPULOG("SUB INIT 32B %08X\r\n", val);
|
//GPULOG("SUB INIT 32B %08X\r\n", val);
|
||||||
T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x1000, val);
|
T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x1000, val);
|
||||||
return;
|
return;
|
||||||
case REG_DISPA_WININ:
|
|
||||||
if(proc == ARMCPU_ARM9)
|
|
||||||
{
|
|
||||||
GPU_setWINDOW_INCNT(MainScreen.gpu, val & 0xFFFF) ;
|
|
||||||
GPU_setWINDOW_OUTCNT(MainScreen.gpu, (val >> 16) & 0xFFFF) ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case REG_DISPB_WININ:
|
|
||||||
if(proc == ARMCPU_ARM9)
|
|
||||||
{
|
|
||||||
GPU_setWINDOW_INCNT(SubScreen.gpu, val & 0xFFFF) ;
|
|
||||||
GPU_setWINDOW_OUTCNT(SubScreen.gpu, (val >> 16) & 0xFFFF) ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case REG_VRAMCNTA:
|
case REG_VRAMCNTA:
|
||||||
case REG_VRAMCNTE:
|
case REG_VRAMCNTE:
|
||||||
MMU_write8(proc,adr,val & 0xFF) ;
|
MMU_write8(proc,adr,val & 0xFF) ;
|
||||||
|
@ -2286,21 +2068,6 @@ void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
|
||||||
}
|
}
|
||||||
T1WriteLong(ARM9Mem.ARM9_REG, 0x100C, val);
|
T1WriteLong(ARM9Mem.ARM9_REG, 0x100C, val);
|
||||||
return;
|
return;
|
||||||
case REG_DISPA_BLDCNT:
|
|
||||||
if (proc == ARMCPU_ARM9)
|
|
||||||
{
|
|
||||||
GPU_setBLDCNT (MainScreen.gpu,val&0xffff);
|
|
||||||
GPU_setBLDALPHA (MainScreen.gpu,val>>16);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case REG_DISPB_BLDCNT:
|
|
||||||
if (proc == ARMCPU_ARM9)
|
|
||||||
{
|
|
||||||
GPU_setBLDCNT (SubScreen.gpu,val&0xffff);
|
|
||||||
GPU_setBLDALPHA (SubScreen.gpu,val>>16);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case REG_DISPA_DISPMMEMFIFO:
|
case REG_DISPA_DISPMMEMFIFO:
|
||||||
{
|
{
|
||||||
// NOTE: right now, the capture unit is not taken into account,
|
// NOTE: right now, the capture unit is not taken into account,
|
||||||
|
|
|
@ -104,7 +104,7 @@ BOOL init_joy(u16 joyCfg[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set all buttons at once */
|
/* Set all buttons at once */
|
||||||
void set_joy_keys(u16 joyCfg[])
|
void set_joy_keys(const u16 joyCfg[])
|
||||||
{
|
{
|
||||||
memcpy(joypad_cfg, joyCfg, sizeof(joypad_cfg));
|
memcpy(joypad_cfg, joyCfg, sizeof(joypad_cfg));
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ void set_mouse_coord(signed long x,signed long y);
|
||||||
void load_default_config();
|
void load_default_config();
|
||||||
BOOL init_joy();
|
BOOL init_joy();
|
||||||
void uninit_joy();
|
void uninit_joy();
|
||||||
void set_joy_keys(u16 joyCfg[]);
|
void set_joy_keys(const u16 joyCfg[]);
|
||||||
void set_kb_keys(u16 kbCfg[]);
|
void set_kb_keys(u16 kbCfg[]);
|
||||||
u16 get_set_joy_key(int index);
|
u16 get_set_joy_key(int index);
|
||||||
void get_set_joy_axis(int index, int index_opp);
|
void get_set_joy_axis(int index, int index_opp);
|
||||||
|
|
|
@ -124,21 +124,23 @@ void on_wtools_2_r32_toggled (GtkToggleButton *togglebutton, gpointer
|
||||||
|
|
||||||
/* which address */
|
/* which address */
|
||||||
#define RANGE_MIN 0
|
#define RANGE_MIN 0
|
||||||
#define RANGE_MAX 0x100000000
|
#define RANGE_MAX 0x10000000
|
||||||
#define ADDR_MASK 0xFFFFFFF0
|
#define ADDR_MASK 0xFFFFFFF
|
||||||
#define STEP_ONE_LINE 0x10
|
#define STEP_ONE_LINE 0x1
|
||||||
#define STEP_ONE_PAGE 0x100
|
#define STEP_ONE_PAGE 0x10
|
||||||
#define STEP_x10_PAGE 0x1000
|
#define STEP_x10_PAGE 0x100
|
||||||
|
|
||||||
static void scroll_address(u32 addr) {
|
static void scroll_address(u32 addr) {
|
||||||
address = addr & ADDR_MASK;
|
address = (addr & ADDR_MASK);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
static void change_address(u32 addr) {
|
static void change_address(u32 addr) {
|
||||||
|
addr /= 0x10;
|
||||||
gtk_range_set_value(wRange, addr);
|
gtk_range_set_value(wRange, addr);
|
||||||
}
|
}
|
||||||
static void add_to_address(u32 inc) {
|
static void add_to_address(s32 inc) {
|
||||||
change_address(address+inc);
|
u32 addr = (address+inc) & ADDR_MASK;
|
||||||
|
gtk_range_set_value(wRange, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_wtools_2_GotoAddress_activate (GtkEntry *entry, gpointer user_data) {
|
void on_wtools_2_GotoAddress_activate (GtkEntry *entry, gpointer user_data) {
|
||||||
|
@ -240,8 +242,9 @@ static void refresh() {
|
||||||
|
|
||||||
if (!init) return;
|
if (!init) return;
|
||||||
|
|
||||||
|
addr=address * 0x10;
|
||||||
for (i=0; i<0x100; i++)
|
for (i=0; i<0x100; i++)
|
||||||
mem[i] = MMU_readByte(cpu, address+i);
|
mem[i] = MMU_readByte(cpu, addr+i);
|
||||||
|
|
||||||
dTools_display_clear(&dsp);
|
dTools_display_clear(&dsp);
|
||||||
switch(packmode) {
|
switch(packmode) {
|
||||||
|
@ -252,7 +255,6 @@ static void refresh() {
|
||||||
|
|
||||||
|
|
||||||
// draw memory content here
|
// draw memory content here
|
||||||
addr=address;
|
|
||||||
for (i=0; i<0x10; i++) {
|
for (i=0; i<0x10; i++) {
|
||||||
ptxt = txt;
|
ptxt = txt;
|
||||||
sprintf(ptxt, "%04X:%04X | ", (addr>>16)&0xFFFF, addr&0xFFFF); ptxt+=12;
|
sprintf(ptxt, "%04X:%04X | ", (addr>>16)&0xFFFF, addr&0xFFFF); ptxt+=12;
|
||||||
|
|
|
@ -1,127 +1,254 @@
|
||||||
/* -*- Mode: C; c-basic-offset: 4 -*-
|
/* -*- Mode: C; c-basic-offset: 4 -*-
|
||||||
* libglade - a library for building interfaces from XML files at runtime
|
|
||||||
* Copyright (C) 1998-2002 James Henstridge <james@daa.com.au>
|
* libglade - a library for building interfaces from XML files at runtime
|
||||||
*
|
|
||||||
* glade-xml.c: implementation of core public interface functions
|
* Copyright (C) 1998-2002 James Henstridge <james@daa.com.au>
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
*
|
||||||
* modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
* glade-xml.c: implementation of core public interface functions
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* This library is free software; you can redistribute it and/or
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
* modify it under the terms of the GNU Library General Public
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
* License as published by the Free Software Foundation; either
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* version 2 of the License, or (at your option) any later version.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
*
|
||||||
|
|
||||||
#include "globals.h"
|
* This library is distributed in the hope that it will be useful,
|
||||||
#include <glade/glade-xml.h>
|
|
||||||
#include <glade/glade-init.h>
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
#include <glade/glade-build.h>
|
|
||||||
#include <gmodule.h>
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
|
||||||
typedef struct _GladeXMLPrivate nopriv_GladeXMLPrivate;
|
* Library General Public License for more details.
|
||||||
static struct _GladeXMLPrivate {
|
|
||||||
GladeInterface *tree; /* the tree for this GladeXML */
|
*
|
||||||
GtkTooltips *tooltips; /* if not NULL, holds all tooltip info */
|
|
||||||
GHashTable *name_hash;
|
* You should have received a copy of the GNU Library General Public
|
||||||
GHashTable *signals;
|
|
||||||
GtkWindow *toplevel;
|
* License along with this library; if not, write to the
|
||||||
GtkAccelGroup *accel_group;
|
|
||||||
GtkWidget *focus_widget;
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
GtkWidget *default_widget;
|
|
||||||
GList *deferred_props;
|
* Boston, MA 02111-1307, USA.
|
||||||
};
|
|
||||||
|
*/
|
||||||
typedef struct _GladeSignalData GladeSignalData;
|
|
||||||
struct _GladeSignalData {
|
|
||||||
GObject *signal_object;
|
|
||||||
char *signal_name;
|
#include "globals.h"
|
||||||
char *connect_object; /* or NULL if there is none */
|
|
||||||
gboolean signal_after;
|
#include <glade/glade-xml.h>
|
||||||
};
|
|
||||||
|
#include <glade/glade-init.h>
|
||||||
static void
|
|
||||||
autoconnect_foreach_StringObject(const char *signal_handler, GList *signals,
|
#include <glade/glade-build.h>
|
||||||
GModule *allsymbols)
|
|
||||||
{
|
#include <gmodule.h>
|
||||||
GCallback func;
|
|
||||||
|
|
||||||
if (!g_module_symbol(allsymbols, signal_handler, (gpointer)&func))
|
|
||||||
g_warning("could not find signal handler '%s'.", signal_handler);
|
typedef struct _GladeXMLPrivate nopriv_GladeXMLPrivate;
|
||||||
else
|
|
||||||
for (; signals != NULL; signals = signals->next) {
|
struct _GladeXMLPrivate {
|
||||||
GladeSignalData *data = signals->data;
|
|
||||||
if (data->connect_object) {
|
GladeInterface *tree; /* the tree for this GladeXML */
|
||||||
GladeXML *self = glade_get_widget_tree(
|
|
||||||
GTK_WIDGET(data->signal_object));
|
GtkTooltips *tooltips; /* if not NULL, holds all tooltip info */
|
||||||
char format[]="%_\0\0";
|
|
||||||
if (sscanf(data->connect_object,"%%%c:", &format[1])) {
|
GHashTable *name_hash;
|
||||||
// this should solve 64bit problems but now memory gets
|
|
||||||
// (it should get) deallocated when program is destroyed
|
GHashTable *signals;
|
||||||
gpointer argument = g_malloc(sizeof(callback_arg));
|
|
||||||
sscanf(data->connect_object+3,format, argument);
|
GtkWindow *toplevel;
|
||||||
|
|
||||||
// printf ("%f \n",obj);
|
GtkAccelGroup *accel_group;
|
||||||
if (data->signal_after)
|
|
||||||
g_signal_connect_after(data->signal_object, data->signal_name,
|
GtkWidget *focus_widget;
|
||||||
func, argument);
|
|
||||||
else
|
GtkWidget *default_widget;
|
||||||
g_signal_connect(data->signal_object, data->signal_name,
|
|
||||||
func, argument);
|
GList *deferred_props;
|
||||||
|
|
||||||
} else {
|
};
|
||||||
GObject *other = g_hash_table_lookup(self->priv->name_hash,
|
|
||||||
data->connect_object);
|
|
||||||
g_signal_connect_object(data->signal_object, data->signal_name,
|
|
||||||
func, other, (data->signal_after ? G_CONNECT_AFTER : 0)
|
typedef struct _GladeSignalData GladeSignalData;
|
||||||
| G_CONNECT_SWAPPED);
|
|
||||||
}
|
struct _GladeSignalData {
|
||||||
} else {
|
|
||||||
/* the signal_data argument is just a string, but may
|
GObject *signal_object;
|
||||||
* be helpful for someone */
|
|
||||||
if (data->signal_after)
|
char *signal_name;
|
||||||
g_signal_connect_after(data->signal_object,
|
|
||||||
data->signal_name, func, NULL);
|
char *connect_object; /* or NULL if there is none */
|
||||||
else
|
|
||||||
g_signal_connect(data->signal_object, data->signal_name,
|
gboolean signal_after;
|
||||||
func, NULL);
|
|
||||||
}
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
static void
|
||||||
* glade_xml_signal_autoconnect_StringObject:
|
|
||||||
* @self: the GladeXML object.
|
autoconnect_foreach_StringObject(const char *signal_handler, GList *signals,
|
||||||
*
|
|
||||||
* This function is a variation of glade_xml_signal_connect. It uses
|
GModule *allsymbols)
|
||||||
* gmodule's introspective features (by openning the module %NULL) to
|
|
||||||
* look at the application's symbol table. From here it tries to match
|
{
|
||||||
* the signal handler names given in the interface description with
|
|
||||||
* symbols in the application and connects the signals.
|
GCallback func;
|
||||||
*
|
|
||||||
* Note that this function will not work correctly if gmodule is not
|
|
||||||
* supported on the platform.
|
|
||||||
*/
|
if (!g_module_symbol(allsymbols, signal_handler, (gpointer)&func))
|
||||||
void
|
|
||||||
glade_xml_signal_autoconnect_StringObject (GladeXML *self)
|
g_warning("could not find signal handler '%s'.", signal_handler);
|
||||||
{
|
|
||||||
GModule *allsymbols;
|
else
|
||||||
nopriv_GladeXMLPrivate * priv;
|
|
||||||
|
for (; signals != NULL; signals = signals->next) {
|
||||||
g_return_if_fail(self != NULL);
|
|
||||||
if (!g_module_supported())
|
GladeSignalData *data = signals->data;
|
||||||
g_error("glade_xml_signal_autoconnect requires working gmodule");
|
|
||||||
|
if (data->connect_object) {
|
||||||
/* get a handle on the main executable -- use this to find symbols */
|
|
||||||
allsymbols = g_module_open(NULL, 0);
|
GladeXML *self = glade_get_widget_tree(
|
||||||
priv = (nopriv_GladeXMLPrivate *)self->priv;
|
|
||||||
g_hash_table_foreach(priv->signals, (GHFunc)autoconnect_foreach_StringObject,
|
GTK_WIDGET(data->signal_object));
|
||||||
allsymbols);
|
|
||||||
}
|
char format[]="%_\0\0";
|
||||||
|
|
||||||
|
if (sscanf(data->connect_object,"%%%c:", &format[1])) {
|
||||||
|
|
||||||
|
// this should solve 64bit problems but now memory gets
|
||||||
|
|
||||||
|
// (it should get) deallocated when program is destroyed
|
||||||
|
|
||||||
|
gpointer argument = g_malloc(sizeof(callback_arg));
|
||||||
|
|
||||||
|
sscanf(data->connect_object+3,format, argument);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// printf ("%f \n",obj);
|
||||||
|
|
||||||
|
if (data->signal_after)
|
||||||
|
|
||||||
|
g_signal_connect_after(data->signal_object, data->signal_name,
|
||||||
|
|
||||||
|
func, argument);
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
g_signal_connect(data->signal_object, data->signal_name,
|
||||||
|
|
||||||
|
func, argument);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
GObject *other = g_hash_table_lookup(self->priv->name_hash,
|
||||||
|
|
||||||
|
data->connect_object);
|
||||||
|
|
||||||
|
g_signal_connect_object(data->signal_object, data->signal_name,
|
||||||
|
|
||||||
|
func, other, (data->signal_after ? G_CONNECT_AFTER : 0)
|
||||||
|
|
||||||
|
| G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* the signal_data argument is just a string, but may
|
||||||
|
|
||||||
|
* be helpful for someone */
|
||||||
|
|
||||||
|
if (data->signal_after)
|
||||||
|
|
||||||
|
g_signal_connect_after(data->signal_object,
|
||||||
|
|
||||||
|
data->signal_name, func, NULL);
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
g_signal_connect(data->signal_object, data->signal_name,
|
||||||
|
|
||||||
|
func, NULL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* glade_xml_signal_autoconnect_StringObject:
|
||||||
|
|
||||||
|
* @self: the GladeXML object.
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
* This function is a variation of glade_xml_signal_connect. It uses
|
||||||
|
|
||||||
|
* gmodule's introspective features (by openning the module %NULL) to
|
||||||
|
|
||||||
|
* look at the application's symbol table. From here it tries to match
|
||||||
|
|
||||||
|
* the signal handler names given in the interface description with
|
||||||
|
|
||||||
|
* symbols in the application and connects the signals.
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
* Note that this function will not work correctly if gmodule is not
|
||||||
|
|
||||||
|
* supported on the platform.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
|
||||||
|
glade_xml_signal_autoconnect_StringObject (GladeXML *self)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
GModule *allsymbols;
|
||||||
|
|
||||||
|
nopriv_GladeXMLPrivate * priv;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
g_return_if_fail(self != NULL);
|
||||||
|
|
||||||
|
if (!g_module_supported())
|
||||||
|
|
||||||
|
g_error("glade_xml_signal_autoconnect requires working gmodule");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* get a handle on the main executable -- use this to find symbols */
|
||||||
|
|
||||||
|
allsymbols = g_module_open(NULL, 0);
|
||||||
|
|
||||||
|
priv = (nopriv_GladeXMLPrivate *)self->priv;
|
||||||
|
|
||||||
|
g_hash_table_foreach(priv->signals, (GHFunc)autoconnect_foreach_StringObject,
|
||||||
|
|
||||||
|
allsymbols);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue