Changed #include dependencies again.

Fixed a bug in GPU (xfin could be greater than LG causing a segfault).
Moved GPUs from NDS to global.
This commit is contained in:
yabause 2006-06-27 09:28:02 +00:00
parent de4acb537f
commit e82af37a36
3 changed files with 30 additions and 3 deletions

View File

@ -28,6 +28,8 @@
#include "nds/video.h"
extern BOOL click;
Screen MainScreen;
Screen SubScreen;
//#define DEBUG_TRI
@ -124,14 +126,14 @@ GPU * GPUInit(u8 l)
memset(g, 0, sizeof(GPU));
g->lcd = l;
g->core = l;
g->core = l;
g->BGSize[0][0] = g->BGSize[1][0] = g->BGSize[2][0] = g->BGSize[3][0] = 256;
g->BGSize[0][1] = g->BGSize[1][1] = g->BGSize[2][1] = g->BGSize[3][1] = 256;
g->dispBG[0] = g->dispBG[1] = g->dispBG[2] = g->dispBG[3] = TRUE;
g->spriteRender = sprite1D;
if(g->core == GPU_SUB)
if(g->core == GPU_SUB)
{
g->oam = (OAM *)(ARM9.ARM9_OAM + 0x400);
g->sprMem = ARM9.ARM9_BOBJ;
@ -660,6 +662,8 @@ INLINE void textBG2(GPU * gpu, u8 num, u16 * DST, u16 X, u16 Y, u16 LG)
mapinfo += 32*32;
u8 * ligne = (u8 * )tile + (((*mapinfo)&0x3FF)*0x20) + (((*mapinfo)& 0x800 ? (7*4)-yoff : yoff));
u16 xfin = x + (8 - (xoff&7));
if (xfin > LG)
xfin = LG;
if((*mapinfo)& 0x400)
{
@ -711,6 +715,8 @@ INLINE void textBG2(GPU * gpu, u8 num, u16 * DST, u16 X, u16 Y, u16 LG)
mapinfo += 32*32;
u8 * ligne = (u8 * )tile + (((*mapinfo)&0x3FF)*0x40) + (((*mapinfo)& 0x800 ? (7*8)-yoff : yoff));
u16 xfin = x + (8 - (xoff&7));
if (xfin > LG)
xfin = LG;
if((*mapinfo)& 0x400)
{
@ -1460,3 +1466,13 @@ void sprite2D(GPU * gpu, u16 l, u16 * dst, u8 * prioTab)
}
}
}
void ScreenInit(void) {
MainScreen.gpu = GPUInit(0);
SubScreen.gpu = GPUInit(1);
}
void ScreenDeInit(void) {
GPUDeInit(MainScreen.gpu);
GPUDeInit(SubScreen.gpu);
}

View File

@ -105,6 +105,17 @@ extern size sprSizeTab[4][4];
extern s8 mode2type[8][4];
extern void (*modeRender[8][4])(GPU * gpu, u8 num, u16 l, u16 * DST);
typedef struct {
GPU * gpu;
u16 offset;
} Screen;
extern Screen MainScreen;
extern Screen SubScreen;
void ScreenInit(void);
void ScreenDeInit(void);
INLINE void GPU_ligne(GPU * gpu, u16 * buffer, u16 l)
{
u16 * dst = buffer + l*256;

View File

@ -22,7 +22,7 @@
#ifndef ARM_CPU
#define ARM_CPU
#include "MMU.hpp"
#include "types.h"
#include "bits.h"