fasterer BG/OBJ VRAM reads

This commit is contained in:
Arisotura 2019-06-09 16:06:01 +02:00
parent 10df601023
commit 434a3007e2
3 changed files with 141 additions and 41 deletions

View File

@ -161,7 +161,7 @@ void ARM::SetupCodeMem(u32 addr)
//NDS::ARM7GetMemRegion(addr, false, &CodeMem); //NDS::ARM7GetMemRegion(addr, false, &CodeMem);
} }
} }
extern u64 vbltime;
void ARMv5::JumpTo(u32 addr, bool restorecpsr) void ARMv5::JumpTo(u32 addr, bool restorecpsr)
{ {
if (restorecpsr) if (restorecpsr)

View File

@ -49,7 +49,8 @@ u8 VRAM_F[ 16*1024];
u8 VRAM_G[ 16*1024]; u8 VRAM_G[ 16*1024];
u8 VRAM_H[ 32*1024]; u8 VRAM_H[ 32*1024];
u8 VRAM_I[ 16*1024]; u8 VRAM_I[ 16*1024];
u8* VRAM[9] = {VRAM_A, VRAM_B, VRAM_C, VRAM_D, VRAM_E, VRAM_F, VRAM_G, VRAM_H, VRAM_I}; u8* VRAM[9] = {VRAM_A, VRAM_B, VRAM_C, VRAM_D, VRAM_E, VRAM_F, VRAM_G, VRAM_H, VRAM_I};
u32 VRAMMask[9] = {0x1FFFF, 0x1FFFF, 0x1FFFF, 0x1FFFF, 0xFFFF, 0x3FFF, 0x3FFF, 0x7FFF, 0x3FFF};
u8 VRAMCNT[9]; u8 VRAMCNT[9];
u8 VRAMSTAT; u8 VRAMSTAT;
@ -71,6 +72,11 @@ u32 VRAMMap_TexPal[8];
u32 VRAMMap_ARM7[2]; u32 VRAMMap_ARM7[2];
u8* VRAMPtr_ABG[0x20];
u8* VRAMPtr_AOBJ[0x10];
u8* VRAMPtr_BBG[0x8];
u8* VRAMPtr_BOBJ[0x8];
int FrontBuffer; int FrontBuffer;
u32* Framebuffer[2][2]; u32* Framebuffer[2][2];
bool Accelerated; bool Accelerated;
@ -151,6 +157,11 @@ void Reset()
VRAMMap_ARM7[0] = 0; VRAMMap_ARM7[0] = 0;
VRAMMap_ARM7[1] = 0; VRAMMap_ARM7[1] = 0;
memset(VRAMPtr_ABG, 0, sizeof(VRAMPtr_ABG));
memset(VRAMPtr_AOBJ, 0, sizeof(VRAMPtr_AOBJ));
memset(VRAMPtr_BBG, 0, sizeof(VRAMPtr_BBG));
memset(VRAMPtr_BOBJ, 0, sizeof(VRAMPtr_BOBJ));
int fbsize; int fbsize;
if (Accelerated) fbsize = (256*3 + 1) * 192; if (Accelerated) fbsize = (256*3 + 1) * 192;
else fbsize = 256 * 192; else fbsize = 256 * 192;
@ -232,6 +243,18 @@ void DoSavestate(Savestate* file)
file->Var32(&VRAMMap_ARM7[0]); file->Var32(&VRAMMap_ARM7[0]);
file->Var32(&VRAMMap_ARM7[1]); file->Var32(&VRAMMap_ARM7[1]);
if (!file->Saving)
{
for (int i = 0; i < 0x20; i++)
VRAMPtr_ABG[i] = GetUniqueBankPtr(VRAMMap_ABG[i], i << 14);
for (int i = 0; i < 0x10; i++)
VRAMPtr_AOBJ[i] = GetUniqueBankPtr(VRAMMap_AOBJ[i], i << 14);
for (int i = 0; i < 0x8; i++)
VRAMPtr_BBG[i] = GetUniqueBankPtr(VRAMMap_BBG[i], i << 14);
for (int i = 0; i < 0x8; i++)
VRAMPtr_BOBJ[i] = GetUniqueBankPtr(VRAMMap_BOBJ[i], i << 14);
}
GPU2D_A->DoSavestate(file); GPU2D_A->DoSavestate(file);
GPU2D_B->DoSavestate(file); GPU2D_B->DoSavestate(file);
GPU3D::DoSavestate(file); GPU3D::DoSavestate(file);
@ -310,8 +333,30 @@ void SetDisplaySettings(bool accel)
// when reading: values are read from each bank and ORed together // when reading: values are read from each bank and ORed together
// when writing: value is written to each bank // when writing: value is written to each bank
#define MAP_RANGE(map, base, n) for (int i = 0; i < n; i++) map[(base)+i] |= bankmask; u8* GetUniqueBankPtr(u32 mask, u32 offset)
#define UNMAP_RANGE(map, base, n) for (int i = 0; i < n; i++) map[(base)+i] &= ~bankmask; {
if (!mask) return NULL;
int num = 0;
if (!(mask & 0xFF)) { mask >>= 8; num += 8; }
else
{
if (!(mask & 0xF)) { mask >>= 4; num += 4; }
if (!(mask & 0x3)) { mask >>= 2; num += 2; }
if (!(mask & 0x1)) { mask >>= 1; num += 1; }
}
if (mask != 1) return NULL;
return &VRAM[num][offset & VRAMMask[num]];
}
#define MAP_RANGE(map, base, n) for (int i = 0; i < n; i++) VRAMMap_##map[(base)+i] |= bankmask;
#define UNMAP_RANGE(map, base, n) for (int i = 0; i < n; i++) VRAMMap_##map[(base)+i] &= ~bankmask;
#define MAP_RANGE_PTR(map, base, n) \
for (int i = 0; i < n; i++) { VRAMMap_##map[(base)+i] |= bankmask; VRAMPtr_##map[(base)+i] = GetUniqueBankPtr(VRAMMap_##map[(base)+i], ((base)+i)<<14); }
#define UNMAP_RANGE_PTR(map, base, n) \
for (int i = 0; i < n; i++) { VRAMMap_##map[(base)+i] &= ~bankmask; VRAMPtr_##map[(base)+i] = GetUniqueBankPtr(VRAMMap_##map[(base)+i], ((base)+i)<<14); }
void MapVRAM_AB(u32 bank, u8 cnt) void MapVRAM_AB(u32 bank, u8 cnt)
{ {
@ -333,12 +378,12 @@ void MapVRAM_AB(u32 bank, u8 cnt)
break; break;
case 1: // ABG case 1: // ABG
UNMAP_RANGE(VRAMMap_ABG, oldofs<<3, 8); UNMAP_RANGE_PTR(ABG, oldofs<<3, 8);
break; break;
case 2: // AOBJ case 2: // AOBJ
oldofs &= 0x1; oldofs &= 0x1;
UNMAP_RANGE(VRAMMap_AOBJ, oldofs<<3, 8); UNMAP_RANGE_PTR(AOBJ, oldofs<<3, 8);
break; break;
case 3: // texture case 3: // texture
@ -356,12 +401,12 @@ void MapVRAM_AB(u32 bank, u8 cnt)
break; break;
case 1: // ABG case 1: // ABG
MAP_RANGE(VRAMMap_ABG, ofs<<3, 8); MAP_RANGE_PTR(ABG, ofs<<3, 8);
break; break;
case 2: // AOBJ case 2: // AOBJ
ofs &= 0x1; ofs &= 0x1;
MAP_RANGE(VRAMMap_AOBJ, ofs<<3, 8); MAP_RANGE_PTR(AOBJ, ofs<<3, 8);
break; break;
case 3: // texture case 3: // texture
@ -393,7 +438,7 @@ void MapVRAM_CD(u32 bank, u8 cnt)
break; break;
case 1: // ABG case 1: // ABG
UNMAP_RANGE(VRAMMap_ABG, oldofs<<3, 8); UNMAP_RANGE_PTR(ABG, oldofs<<3, 8);
break; break;
case 2: // ARM7 VRAM case 2: // ARM7 VRAM
@ -408,11 +453,11 @@ void MapVRAM_CD(u32 bank, u8 cnt)
case 4: // BBG/BOBJ case 4: // BBG/BOBJ
if (bank == 2) if (bank == 2)
{ {
UNMAP_RANGE(VRAMMap_BBG, 0, 8); UNMAP_RANGE_PTR(BBG, 0, 8);
} }
else else
{ {
UNMAP_RANGE(VRAMMap_BOBJ, 0, 8); UNMAP_RANGE_PTR(BOBJ, 0, 8);
} }
break; break;
} }
@ -427,7 +472,7 @@ void MapVRAM_CD(u32 bank, u8 cnt)
break; break;
case 1: // ABG case 1: // ABG
MAP_RANGE(VRAMMap_ABG, ofs<<3, 8); MAP_RANGE_PTR(ABG, ofs<<3, 8);
break; break;
case 2: // ARM7 VRAM case 2: // ARM7 VRAM
@ -443,11 +488,11 @@ void MapVRAM_CD(u32 bank, u8 cnt)
case 4: // BBG/BOBJ case 4: // BBG/BOBJ
if (bank == 2) if (bank == 2)
{ {
MAP_RANGE(VRAMMap_BBG, 0, 8); MAP_RANGE_PTR(BBG, 0, 8);
} }
else else
{ {
MAP_RANGE(VRAMMap_BOBJ, 0, 8); MAP_RANGE_PTR(BOBJ, 0, 8);
} }
break; break;
} }
@ -472,19 +517,19 @@ void MapVRAM_E(u32 bank, u8 cnt)
break; break;
case 1: // ABG case 1: // ABG
UNMAP_RANGE(VRAMMap_ABG, 0, 4); UNMAP_RANGE_PTR(ABG, 0, 4);
break; break;
case 2: // AOBJ case 2: // AOBJ
UNMAP_RANGE(VRAMMap_AOBJ, 0, 4); UNMAP_RANGE_PTR(AOBJ, 0, 4);
break; break;
case 3: // texture palette case 3: // texture palette
UNMAP_RANGE(VRAMMap_TexPal, 0, 4); UNMAP_RANGE(TexPal, 0, 4);
break; break;
case 4: // ABG ext palette case 4: // ABG ext palette
UNMAP_RANGE(VRAMMap_ABGExtPal, 0, 4); UNMAP_RANGE(ABGExtPal, 0, 4);
GPU2D_A->BGExtPalDirty(0); GPU2D_A->BGExtPalDirty(0);
GPU2D_A->BGExtPalDirty(2); GPU2D_A->BGExtPalDirty(2);
break; break;
@ -500,19 +545,19 @@ void MapVRAM_E(u32 bank, u8 cnt)
break; break;
case 1: // ABG case 1: // ABG
MAP_RANGE(VRAMMap_ABG, 0, 4); MAP_RANGE_PTR(ABG, 0, 4);
break; break;
case 2: // AOBJ case 2: // AOBJ
MAP_RANGE(VRAMMap_AOBJ, 0, 4); MAP_RANGE_PTR(AOBJ, 0, 4);
break; break;
case 3: // texture palette case 3: // texture palette
MAP_RANGE(VRAMMap_TexPal, 0, 4); MAP_RANGE(TexPal, 0, 4);
break; break;
case 4: // ABG ext palette case 4: // ABG ext palette
MAP_RANGE(VRAMMap_ABGExtPal, 0, 4); MAP_RANGE(ABGExtPal, 0, 4);
GPU2D_A->BGExtPalDirty(0); GPU2D_A->BGExtPalDirty(0);
GPU2D_A->BGExtPalDirty(2); GPU2D_A->BGExtPalDirty(2);
break; break;
@ -540,13 +585,23 @@ void MapVRAM_FG(u32 bank, u8 cnt)
break; break;
case 1: // ABG case 1: // ABG
VRAMMap_ABG[(oldofs & 0x1) + ((oldofs & 0x2) << 1)] &= ~bankmask; {
VRAMMap_ABG[(oldofs & 0x1) + ((oldofs & 0x2) << 1) + 2] &= ~bankmask; u32 base = (oldofs & 0x1) + ((oldofs & 0x2) << 1);
VRAMMap_ABG[base] &= ~bankmask;
VRAMMap_ABG[base + 2] &= ~bankmask;
VRAMPtr_ABG[base] = GetUniqueBankPtr(VRAMMap_ABG[base], base << 14);
VRAMPtr_ABG[base + 2] = GetUniqueBankPtr(VRAMMap_ABG[base + 2], (base + 2) << 14);
}
break; break;
case 2: // AOBJ case 2: // AOBJ
VRAMMap_AOBJ[(oldofs & 0x1) + ((oldofs & 0x2) << 1)] &= ~bankmask; {
VRAMMap_AOBJ[(oldofs & 0x1) + ((oldofs & 0x2) << 1) + 2] &= ~bankmask; u32 base = (oldofs & 0x1) + ((oldofs & 0x2) << 1);
VRAMMap_AOBJ[base] &= ~bankmask;
VRAMMap_AOBJ[base + 2] &= ~bankmask;
VRAMPtr_AOBJ[base] = GetUniqueBankPtr(VRAMMap_AOBJ[base], base << 14);
VRAMPtr_AOBJ[base + 2] = GetUniqueBankPtr(VRAMMap_AOBJ[base + 2], (base + 2) << 14);
}
break; break;
case 3: // texture palette case 3: // texture palette
@ -575,13 +630,23 @@ void MapVRAM_FG(u32 bank, u8 cnt)
break; break;
case 1: // ABG case 1: // ABG
VRAMMap_ABG[(ofs & 0x1) + ((ofs & 0x2) << 1)] |= bankmask; {
VRAMMap_ABG[(ofs & 0x1) + ((ofs & 0x2) << 1) + 2] |= bankmask; u32 base = (ofs & 0x1) + ((ofs & 0x2) << 1);
VRAMMap_ABG[base] |= bankmask;
VRAMMap_ABG[base + 2] |= bankmask;
VRAMPtr_ABG[base] = GetUniqueBankPtr(VRAMMap_ABG[base], base << 14);
VRAMPtr_ABG[base + 2] = GetUniqueBankPtr(VRAMMap_ABG[base + 2], (base + 2) << 14);
}
break; break;
case 2: // AOBJ case 2: // AOBJ
VRAMMap_AOBJ[(ofs & 0x1) + ((ofs & 0x2) << 1)] |= bankmask; {
VRAMMap_AOBJ[(ofs & 0x1) + ((ofs & 0x2) << 1) + 2] |= bankmask; u32 base = (ofs & 0x1) + ((ofs & 0x2) << 1);
VRAMMap_AOBJ[base] |= bankmask;
VRAMMap_AOBJ[base + 2] |= bankmask;
VRAMPtr_AOBJ[base] = GetUniqueBankPtr(VRAMMap_AOBJ[base], base << 14);
VRAMPtr_AOBJ[base + 2] = GetUniqueBankPtr(VRAMMap_AOBJ[base + 2], (base + 2) << 14);
}
break; break;
case 3: // texture palette case 3: // texture palette
@ -624,10 +689,14 @@ void MapVRAM_H(u32 bank, u8 cnt)
VRAMMap_BBG[1] &= ~bankmask; VRAMMap_BBG[1] &= ~bankmask;
VRAMMap_BBG[4] &= ~bankmask; VRAMMap_BBG[4] &= ~bankmask;
VRAMMap_BBG[5] &= ~bankmask; VRAMMap_BBG[5] &= ~bankmask;
VRAMPtr_BBG[0] = GetUniqueBankPtr(VRAMMap_BBG[0], 0 << 14);
VRAMPtr_BBG[1] = GetUniqueBankPtr(VRAMMap_BBG[1], 1 << 14);
VRAMPtr_BBG[4] = GetUniqueBankPtr(VRAMMap_BBG[4], 4 << 14);
VRAMPtr_BBG[5] = GetUniqueBankPtr(VRAMMap_BBG[5], 5 << 14);
break; break;
case 2: // BBG ext palette case 2: // BBG ext palette
UNMAP_RANGE(VRAMMap_BBGExtPal, 0, 4); UNMAP_RANGE(BBGExtPal, 0, 4);
GPU2D_B->BGExtPalDirty(0); GPU2D_B->BGExtPalDirty(0);
GPU2D_B->BGExtPalDirty(2); GPU2D_B->BGExtPalDirty(2);
break; break;
@ -647,10 +716,14 @@ void MapVRAM_H(u32 bank, u8 cnt)
VRAMMap_BBG[1] |= bankmask; VRAMMap_BBG[1] |= bankmask;
VRAMMap_BBG[4] |= bankmask; VRAMMap_BBG[4] |= bankmask;
VRAMMap_BBG[5] |= bankmask; VRAMMap_BBG[5] |= bankmask;
VRAMPtr_BBG[0] = GetUniqueBankPtr(VRAMMap_BBG[0], 0 << 14);
VRAMPtr_BBG[1] = GetUniqueBankPtr(VRAMMap_BBG[1], 1 << 14);
VRAMPtr_BBG[4] = GetUniqueBankPtr(VRAMMap_BBG[4], 4 << 14);
VRAMPtr_BBG[5] = GetUniqueBankPtr(VRAMMap_BBG[5], 5 << 14);
break; break;
case 2: // BBG ext palette case 2: // BBG ext palette
MAP_RANGE(VRAMMap_BBGExtPal, 0, 4); MAP_RANGE(BBGExtPal, 0, 4);
GPU2D_B->BGExtPalDirty(0); GPU2D_B->BGExtPalDirty(0);
GPU2D_B->BGExtPalDirty(2); GPU2D_B->BGExtPalDirty(2);
break; break;
@ -680,10 +753,14 @@ void MapVRAM_I(u32 bank, u8 cnt)
VRAMMap_BBG[3] &= ~bankmask; VRAMMap_BBG[3] &= ~bankmask;
VRAMMap_BBG[6] &= ~bankmask; VRAMMap_BBG[6] &= ~bankmask;
VRAMMap_BBG[7] &= ~bankmask; VRAMMap_BBG[7] &= ~bankmask;
VRAMPtr_BBG[2] = GetUniqueBankPtr(VRAMMap_BBG[2], 2 << 14);
VRAMPtr_BBG[3] = GetUniqueBankPtr(VRAMMap_BBG[3], 3 << 14);
VRAMPtr_BBG[6] = GetUniqueBankPtr(VRAMMap_BBG[6], 6 << 14);
VRAMPtr_BBG[7] = GetUniqueBankPtr(VRAMMap_BBG[7], 7 << 14);
break; break;
case 2: // BOBJ case 2: // BOBJ
UNMAP_RANGE(VRAMMap_BOBJ, 0, 8); UNMAP_RANGE_PTR(BOBJ, 0, 8);
break; break;
case 3: // BOBJ ext palette case 3: // BOBJ ext palette
@ -706,10 +783,14 @@ void MapVRAM_I(u32 bank, u8 cnt)
VRAMMap_BBG[3] |= bankmask; VRAMMap_BBG[3] |= bankmask;
VRAMMap_BBG[6] |= bankmask; VRAMMap_BBG[6] |= bankmask;
VRAMMap_BBG[7] |= bankmask; VRAMMap_BBG[7] |= bankmask;
VRAMPtr_BBG[2] = GetUniqueBankPtr(VRAMMap_BBG[2], 2 << 14);
VRAMPtr_BBG[3] = GetUniqueBankPtr(VRAMMap_BBG[3], 3 << 14);
VRAMPtr_BBG[6] = GetUniqueBankPtr(VRAMMap_BBG[6], 6 << 14);
VRAMPtr_BBG[7] = GetUniqueBankPtr(VRAMMap_BBG[7], 7 << 14);
break; break;
case 2: // BOBJ case 2: // BOBJ
MAP_RANGE(VRAMMap_BOBJ, 0, 8); MAP_RANGE_PTR(BOBJ, 0, 8);
break; break;
case 3: // BOBJ ext palette case 3: // BOBJ ext palette

View File

@ -61,6 +61,11 @@ extern u32 VRAMMap_Texture[4];
extern u32 VRAMMap_TexPal[8]; extern u32 VRAMMap_TexPal[8];
extern u32 VRAMMap_ARM7[2]; extern u32 VRAMMap_ARM7[2];
extern u8* VRAMPtr_ABG[0x20];
extern u8* VRAMPtr_AOBJ[0x10];
extern u8* VRAMPtr_BBG[0x8];
extern u8* VRAMPtr_BOBJ[0x8];
extern int FrontBuffer; extern int FrontBuffer;
extern u32* Framebuffer[2][2]; extern u32* Framebuffer[2][2];
@ -78,6 +83,8 @@ void DoSavestate(Savestate* file);
void SetDisplaySettings(bool accel); void SetDisplaySettings(bool accel);
u8* GetUniqueBankPtr(u32 mask, u32 offset);
void MapVRAM_AB(u32 bank, u8 cnt); void MapVRAM_AB(u32 bank, u8 cnt);
void MapVRAM_CD(u32 bank, u8 cnt); void MapVRAM_CD(u32 bank, u8 cnt);
void MapVRAM_E(u32 bank, u8 cnt); void MapVRAM_E(u32 bank, u8 cnt);
@ -218,7 +225,10 @@ void WriteVRAM_LCDC(u32 addr, T val)
template<typename T> template<typename T>
T ReadVRAM_ABG(u32 addr) T ReadVRAM_ABG(u32 addr)
{ {
u32 ret = 0; u8* ptr = VRAMPtr_ABG[(addr >> 14) & 0x1F];
if (ptr) return *(T*)&ptr[addr & 0x3FFF];
T ret = 0;
u32 mask = VRAMMap_ABG[(addr >> 14) & 0x1F]; u32 mask = VRAMMap_ABG[(addr >> 14) & 0x1F];
if (mask & (1<<0)) ret |= *(T*)&VRAM_A[addr & 0x1FFFF]; if (mask & (1<<0)) ret |= *(T*)&VRAM_A[addr & 0x1FFFF];
@ -250,7 +260,10 @@ void WriteVRAM_ABG(u32 addr, T val)
template<typename T> template<typename T>
T ReadVRAM_AOBJ(u32 addr) T ReadVRAM_AOBJ(u32 addr)
{ {
u32 ret = 0; u8* ptr = VRAMPtr_AOBJ[(addr >> 14) & 0xF];
if (ptr) return *(T*)&ptr[addr & 0x3FFF];
T ret = 0;
u32 mask = VRAMMap_AOBJ[(addr >> 14) & 0xF]; u32 mask = VRAMMap_AOBJ[(addr >> 14) & 0xF];
if (mask & (1<<0)) ret |= *(T*)&VRAM_A[addr & 0x1FFFF]; if (mask & (1<<0)) ret |= *(T*)&VRAM_A[addr & 0x1FFFF];
@ -278,7 +291,10 @@ void WriteVRAM_AOBJ(u32 addr, T val)
template<typename T> template<typename T>
T ReadVRAM_BBG(u32 addr) T ReadVRAM_BBG(u32 addr)
{ {
u32 ret = 0; u8* ptr = VRAMPtr_BBG[(addr >> 14) & 0x7];
if (ptr) return *(T*)&ptr[addr & 0x3FFF];
T ret = 0;
u32 mask = VRAMMap_BBG[(addr >> 14) & 0x7]; u32 mask = VRAMMap_BBG[(addr >> 14) & 0x7];
if (mask & (1<<2)) ret |= *(T*)&VRAM_C[addr & 0x1FFFF]; if (mask & (1<<2)) ret |= *(T*)&VRAM_C[addr & 0x1FFFF];
@ -302,7 +318,10 @@ void WriteVRAM_BBG(u32 addr, T val)
template<typename T> template<typename T>
T ReadVRAM_BOBJ(u32 addr) T ReadVRAM_BOBJ(u32 addr)
{ {
u32 ret = 0; u8* ptr = VRAMPtr_BOBJ[(addr >> 14) & 0x7];
if (ptr) return *(T*)&ptr[addr & 0x3FFF];
T ret = 0;
u32 mask = VRAMMap_BOBJ[(addr >> 14) & 0x7]; u32 mask = VRAMMap_BOBJ[(addr >> 14) & 0x7];
if (mask & (1<<3)) ret |= *(T*)&VRAM_D[addr & 0x1FFFF]; if (mask & (1<<3)) ret |= *(T*)&VRAM_D[addr & 0x1FFFF];
@ -324,7 +343,7 @@ void WriteVRAM_BOBJ(u32 addr, T val)
template<typename T> template<typename T>
T ReadVRAM_ARM7(u32 addr) T ReadVRAM_ARM7(u32 addr)
{ {
u32 ret = 0; T ret = 0;
u32 mask = VRAMMap_ARM7[(addr >> 17) & 0x1]; u32 mask = VRAMMap_ARM7[(addr >> 17) & 0x1];
if (mask & (1<<2)) ret |= *(T*)&VRAM_C[addr & 0x1FFFF]; if (mask & (1<<2)) ret |= *(T*)&VRAM_C[addr & 0x1FFFF];
@ -365,7 +384,7 @@ T ReadVRAM_OBJ(u32 addr)
template<typename T> template<typename T>
T ReadVRAM_Texture(u32 addr) T ReadVRAM_Texture(u32 addr)
{ {
u32 ret = 0; T ret = 0;
u32 mask = VRAMMap_Texture[(addr >> 17) & 0x3]; u32 mask = VRAMMap_Texture[(addr >> 17) & 0x3];
if (mask & (1<<0)) ret |= *(T*)&VRAM_A[addr & 0x1FFFF]; if (mask & (1<<0)) ret |= *(T*)&VRAM_A[addr & 0x1FFFF];
@ -379,7 +398,7 @@ T ReadVRAM_Texture(u32 addr)
template<typename T> template<typename T>
T ReadVRAM_TexPal(u32 addr) T ReadVRAM_TexPal(u32 addr)
{ {
u32 ret = 0; T ret = 0;
u32 mask = VRAMMap_TexPal[(addr >> 14) & 0x7]; u32 mask = VRAMMap_TexPal[(addr >> 14) & 0x7];
if (mask & (1<<4)) ret |= *(T*)&VRAM_E[addr & 0xFFFF]; if (mask & (1<<4)) ret |= *(T*)&VRAM_E[addr & 0xFFFF];