* fix VRAM address calculation for GPU A
* add support for mode 5
This commit is contained in:
parent
12ebf83665
commit
c3e2f7ad9b
48
GPU2D.cpp
48
GPU2D.cpp
|
@ -171,6 +171,9 @@ void GPU2D::DrawScanline(u32 line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// temp. hax
|
||||||
|
#define DrawBG_Text DrawBG_Text_4bpp
|
||||||
|
|
||||||
void GPU2D::DrawScanline_Mode1(u32 line, u16* dst)
|
void GPU2D::DrawScanline_Mode1(u32 line, u16* dst)
|
||||||
{
|
{
|
||||||
u32 backdrop;
|
u32 backdrop;
|
||||||
|
@ -191,32 +194,61 @@ void GPU2D::DrawScanline_Mode1(u32 line, u16* dst)
|
||||||
switch (DispCnt & 0x7)
|
switch (DispCnt & 0x7)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
//printf("disp %08X %04X %04X %04X %04X\n", DispCnt, BGCnt[0], BGCnt[1], BGCnt[2], BGCnt[3]);
|
|
||||||
for (int i = 3; i >= 0; i--)
|
for (int i = 3; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if ((BGCnt[3] & 0x3) == i)
|
if ((BGCnt[3] & 0x3) == i)
|
||||||
{
|
{
|
||||||
if (DispCnt & 0x0800) DrawBG_Text_4bpp(line, dst, 3);
|
if (DispCnt & 0x0800) DrawBG_Text(line, dst, 3);
|
||||||
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x38000, dst);
|
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x38000, dst);
|
||||||
}
|
}
|
||||||
if ((BGCnt[2] & 0x3) == i)
|
if ((BGCnt[2] & 0x3) == i)
|
||||||
{
|
{
|
||||||
if (DispCnt & 0x0400) DrawBG_Text_4bpp(line, dst, 2);
|
if (DispCnt & 0x0400) DrawBG_Text(line, dst, 2);
|
||||||
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x28000, dst);
|
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x28000, dst);
|
||||||
}
|
}
|
||||||
if ((BGCnt[1] & 0x3) == i)
|
if ((BGCnt[1] & 0x3) == i)
|
||||||
{
|
{
|
||||||
if (DispCnt & 0x0200) DrawBG_Text_4bpp(line, dst, 1);
|
if (DispCnt & 0x0200) DrawBG_Text(line, dst, 1);
|
||||||
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x18000, dst);
|
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x18000, dst);
|
||||||
}
|
}
|
||||||
if ((BGCnt[0] & 0x3) == i)
|
if ((BGCnt[0] & 0x3) == i)
|
||||||
{
|
{
|
||||||
if (DispCnt & 0x0100) DrawBG_Text_4bpp(line, dst, 0);
|
if (DispCnt & 0x0100) DrawBG_Text(line, dst, 0);
|
||||||
|
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x08000, dst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
for (int i = 3; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if ((BGCnt[3] & 0x3) == i)
|
||||||
|
{
|
||||||
|
// ext. todo
|
||||||
|
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x38000, dst);
|
||||||
|
}
|
||||||
|
if ((BGCnt[2] & 0x3) == i)
|
||||||
|
{
|
||||||
|
// ext. todo
|
||||||
|
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x28000, dst);
|
||||||
|
}
|
||||||
|
if ((BGCnt[1] & 0x3) == i)
|
||||||
|
{
|
||||||
|
if (DispCnt & 0x0200) DrawBG_Text(line, dst, 1);
|
||||||
|
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x18000, dst);
|
||||||
|
}
|
||||||
|
if ((BGCnt[0] & 0x3) == i)
|
||||||
|
{
|
||||||
|
if (DispCnt & 0x0100) DrawBG_Text(line, dst, 0);
|
||||||
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x08000, dst);
|
if (DispCnt & 0x1000) InterleaveSprites(spritebuf, 0x08000, dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// debug crap
|
||||||
|
//for (int i = 0; i < 256; i++)
|
||||||
|
// dst[i] = *(u16*)&GPU::Palette[Num*0x400 + (i>>4)*2 + (line>>4)*32];
|
||||||
}
|
}
|
||||||
|
|
||||||
// char 06218000
|
// char 06218000
|
||||||
|
@ -247,7 +279,7 @@ void GPU2D::DrawBG_Text_4bpp(u32 line, u16* dst, u32 bgnum)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tileset = (u8*)GPU::VRAM_ABG[((DispCnt & 0x07000000) >> 22) + ((bgcnt & 0x003C) >> 2)];
|
tileset = (u8*)GPU::VRAM_ABG[((DispCnt & 0x07000000) >> 22) + ((bgcnt & 0x003C) >> 2)];
|
||||||
tilemap = (u16*)GPU::VRAM_ABG[((DispCnt & 0x38000000) >> 27) + ((bgcnt & 0x1800) >> 11)];
|
tilemap = (u16*)GPU::VRAM_ABG[((DispCnt & 0x38000000) >> 25) + ((bgcnt & 0x1800) >> 11)];
|
||||||
if (!tileset || !tilemap) return;
|
if (!tileset || !tilemap) return;
|
||||||
tilemap += ((bgcnt & 0x0700) << 2);
|
tilemap += ((bgcnt & 0x0700) << 2);
|
||||||
|
|
||||||
|
@ -299,9 +331,7 @@ void GPU2D::DrawBG_Text_4bpp(u32 line, u16* dst, u32 bgnum)
|
||||||
{
|
{
|
||||||
color = *pixels & 0x0F;
|
color = *pixels & 0x0F;
|
||||||
}
|
}
|
||||||
//color = (i >> 4) + ((line >> 4) << 4);
|
|
||||||
//if (Num) color = 0;
|
|
||||||
//if (yoff>127) color=0;
|
|
||||||
if (color)
|
if (color)
|
||||||
dst[i] = curpal[color];
|
dst[i] = curpal[color];
|
||||||
|
|
||||||
|
|
4
NDS.cpp
4
NDS.cpp
|
@ -282,7 +282,7 @@ void Reset()
|
||||||
//LoadROM();
|
//LoadROM();
|
||||||
//LoadFirmware();
|
//LoadFirmware();
|
||||||
NDSCart::LoadROM("rom/nsmb.nds");
|
NDSCart::LoadROM("rom/nsmb.nds");
|
||||||
//LoadROM();
|
LoadROM();
|
||||||
|
|
||||||
Running = true; // hax
|
Running = true; // hax
|
||||||
}
|
}
|
||||||
|
@ -1452,6 +1452,8 @@ u32 ARM9IORead32(u32 addr)
|
||||||
case 0x040002A8: return DivRemainder[0];
|
case 0x040002A8: return DivRemainder[0];
|
||||||
case 0x040002AC: return DivRemainder[1];
|
case 0x040002AC: return DivRemainder[1];
|
||||||
|
|
||||||
|
case 0x04000600: return 0x04000000; // hax
|
||||||
|
|
||||||
case 0x04100000:
|
case 0x04100000:
|
||||||
if (IPCFIFOCnt9 & 0x8000)
|
if (IPCFIFOCnt9 & 0x8000)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# depslib dependency file v1.0
|
# depslib dependency file v1.0
|
||||||
1485812673 source:c:\documents\sources\melonds\main.cpp
|
1485834524 source:c:\documents\sources\melonds\main.cpp
|
||||||
<stdio.h>
|
<stdio.h>
|
||||||
<windows.h>
|
<windows.h>
|
||||||
"NDS.h"
|
"NDS.h"
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
1481161027 c:\documents\sources\melonds\types.h
|
1481161027 c:\documents\sources\melonds\types.h
|
||||||
|
|
||||||
1485831079 source:c:\documents\sources\melonds\nds.cpp
|
1485868426 source:c:\documents\sources\melonds\nds.cpp
|
||||||
<stdio.h>
|
<stdio.h>
|
||||||
<string.h>
|
<string.h>
|
||||||
"NDS.h"
|
"NDS.h"
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
"RTC.h"
|
"RTC.h"
|
||||||
"Wifi.h"
|
"Wifi.h"
|
||||||
|
|
||||||
1485830997 source:c:\documents\sources\melonds\arm.cpp
|
1485871611 source:c:\documents\sources\melonds\arm.cpp
|
||||||
<stdio.h>
|
<stdio.h>
|
||||||
"NDS.h"
|
"NDS.h"
|
||||||
"ARM.h"
|
"ARM.h"
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
1485799621 c:\documents\sources\melonds\cp15.h
|
1485799621 c:\documents\sources\melonds\cp15.h
|
||||||
|
|
||||||
1485830984 source:c:\documents\sources\melonds\cp15.cpp
|
1485833371 source:c:\documents\sources\melonds\cp15.cpp
|
||||||
<stdio.h>
|
<stdio.h>
|
||||||
<string.h>
|
<string.h>
|
||||||
"NDS.h"
|
"NDS.h"
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
"NDS.h"
|
"NDS.h"
|
||||||
"SPI.h"
|
"SPI.h"
|
||||||
|
|
||||||
1485016053 source:c:\documents\sources\melonds\gpu2d.cpp
|
1485873275 source:c:\documents\sources\melonds\gpu2d.cpp
|
||||||
<stdio.h>
|
<stdio.h>
|
||||||
<string.h>
|
<string.h>
|
||||||
"NDS.h"
|
"NDS.h"
|
||||||
|
|
Loading…
Reference in New Issue