fix ntview for new ppu?

[[Split portion of a mixed commit.]]
This commit is contained in:
zeromus 2009-12-08 05:54:21 +00:00
parent 60abe35afb
commit 621cc8e260
3 changed files with 20 additions and 3 deletions

View File

@ -299,10 +299,8 @@ void FCEUD_UpdateNTView(int scanline, bool drawall) {
//uint8 *pbitmap = ppuv_palette;
if (!hNTView) return;
xpos = ((RefreshAddr & 0x400) >> 2) | ((RefreshAddr & 0x1F) << 3) | XOffset;
ppu_getScroll(xpos,ypos);
ypos = ((RefreshAddr & 0x3E0) >> 2) | ((RefreshAddr & 0x7000) >> 12);
if(RefreshAddr & 0x800) ypos += 240;
//char str[50];
//sprintf(str,"%d,%d,%d",horzscroll,vertscroll,ntmirroring);

View File

@ -266,6 +266,7 @@ struct PPUREGS {
}
} ppur;
static void makeppulut(void)
{
int x;
@ -471,6 +472,22 @@ void (*FFCEUX_PPUWrite)(uint32 A, uint8 V) = 0;
//whether to use the new ppu (new PPU doesn't handle MMC5 extra nametables at all
int newppu = 0;
void ppu_getScroll(int &xpos, int &ypos)
{
if(newppu)
{
ypos = ppur._vt*8 + ppur._fv + ppur._v*256;
xpos = ppur._ht*8 + ppur.fh + ppur._h*256;
}
else
{
xpos = ((RefreshAddr & 0x400) >> 2) | ((RefreshAddr & 0x1F) << 3) | XOffset;
ypos = ((RefreshAddr & 0x3E0) >> 2) | ((RefreshAddr & 0x7000) >> 12);
if(RefreshAddr & 0x800) ypos += 240;
}
}
//---------------
static DECLFR(A2002)

View File

@ -17,6 +17,8 @@ extern uint8 PPUCHRRAM;
void FCEUPPU_SaveState(void);
void FCEUPPU_LoadState(int version);
uint8* FCEUPPU_GetCHR(uint32 vadr, uint32 refreshaddr);
void ppu_getScroll(int &xpos, int &ypos);
#ifdef _MSC_VER
#define FASTCALL __fastcall