fix care of magical creatures (relies on invalid vram mapping behaviour); maybe break other things?
This commit is contained in:
parent
acb25f73a2
commit
0ba2839065
|
@ -443,13 +443,6 @@ static inline u8* MMU_vram_physical(const int page)
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo - templateize
|
//todo - templateize
|
||||||
//note: it doesnt seem right to me to map LCDC whenever a bank is allocated to BG/OBJ but thats how it is
|
|
||||||
//(in FF4, when entering a town from worldmap, the subscreen tiles are via LCDC while mapped to sub BG)
|
|
||||||
//UPDATED: i had to take them out in order to fix tetris DS music mode.
|
|
||||||
//since then, other issues fixed FF4's problems, so they are staying out for now
|
|
||||||
//as further, almost definitive proof that these should remain unmapped,
|
|
||||||
//making them mapped permit's spiderman2's legal screens / intro FMV to render garbage
|
|
||||||
//on top of the studio logo if you interrupt it by pressing enter.
|
|
||||||
static inline void MMU_VRAMmapRefreshBank(const int bank)
|
static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
{
|
{
|
||||||
int block = bank;
|
int block = bank;
|
||||||
|
@ -476,7 +469,6 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
break;
|
break;
|
||||||
case 1: //ABG
|
case 1: //ABG
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::ABG;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::ABG;
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_ABG+ofs*8);
|
MMU_vram_arm9(bank,VRAM_PAGE_ABG+ofs*8);
|
||||||
break;
|
break;
|
||||||
case 2: //AOBJ
|
case 2: //AOBJ
|
||||||
|
@ -484,7 +476,6 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
switch(ofs) {
|
switch(ofs) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ+ofs*8);
|
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ+ofs*8);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -512,7 +503,6 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
break;
|
break;
|
||||||
case 1: //ABG
|
case 1: //ABG
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::ABG;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::ABG;
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_ABG+ofs*8);
|
MMU_vram_arm9(bank,VRAM_PAGE_ABG+ofs*8);
|
||||||
break;
|
break;
|
||||||
case 2: //arm7
|
case 2: //arm7
|
||||||
|
@ -534,7 +524,6 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
MMU.texInfo.textureSlotAddr[ofs] = MMU_vram_physical(vram_bank_info[bank].page_addr);
|
MMU.texInfo.textureSlotAddr[ofs] = MMU_vram_physical(vram_bank_info[bank].page_addr);
|
||||||
break;
|
break;
|
||||||
case 4: //BGB or BOBJ
|
case 4: //BGB or BOBJ
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
if(bank == VRAM_BANK_C) {
|
if(bank == VRAM_BANK_C) {
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::BBG;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::BBG;
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_BBG); //BBG
|
MMU_vram_arm9(bank,VRAM_PAGE_BBG); //BBG
|
||||||
|
@ -558,11 +547,9 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
break;
|
break;
|
||||||
case 1: //ABG
|
case 1: //ABG
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::ABG;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::ABG;
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_ABG);
|
MMU_vram_arm9(bank,VRAM_PAGE_ABG);
|
||||||
break;
|
break;
|
||||||
case 2: //AOBJ
|
case 2: //AOBJ
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::AOBJ;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::AOBJ;
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ);
|
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ);
|
||||||
break;
|
break;
|
||||||
|
@ -599,13 +586,11 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
break;
|
break;
|
||||||
case 1: //ABG
|
case 1: //ABG
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::ABG;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::ABG;
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_ABG+pageofs);
|
MMU_vram_arm9(bank,VRAM_PAGE_ABG+pageofs);
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_ABG+pageofs+2); //unexpected mirroring (required by spyro eternal night)
|
MMU_vram_arm9(bank,VRAM_PAGE_ABG+pageofs+2); //unexpected mirroring (required by spyro eternal night)
|
||||||
break;
|
break;
|
||||||
case 2: //AOBJ
|
case 2: //AOBJ
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::AOBJ;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::AOBJ;
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ+pageofs);
|
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ+pageofs);
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ+pageofs+2); //unexpected mirroring - I have no proof, but it is inferred from the ABG above
|
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ+pageofs+2); //unexpected mirroring - I have no proof, but it is inferred from the ABG above
|
||||||
break;
|
break;
|
||||||
|
@ -649,7 +634,6 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
break;
|
break;
|
||||||
case 1: //BBG
|
case 1: //BBG
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::BBG;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::BBG;
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_BBG);
|
MMU_vram_arm9(bank,VRAM_PAGE_BBG);
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_BBG + 4); //unexpected mirroring
|
MMU_vram_arm9(bank,VRAM_PAGE_BBG + 4); //unexpected mirroring
|
||||||
break;
|
break;
|
||||||
|
@ -675,13 +659,11 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
break;
|
break;
|
||||||
case 1: //BBG
|
case 1: //BBG
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::BBG;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::BBG;
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_BBG+2);
|
MMU_vram_arm9(bank,VRAM_PAGE_BBG+2);
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_BBG+3); //unexpected mirroring
|
MMU_vram_arm9(bank,VRAM_PAGE_BBG+3); //unexpected mirroring
|
||||||
break;
|
break;
|
||||||
case 2: //BOBJ
|
case 2: //BOBJ
|
||||||
vramConfiguration.banks[bank].purpose = VramConfiguration::BOBJ;
|
vramConfiguration.banks[bank].purpose = VramConfiguration::BOBJ;
|
||||||
//MMU_vram_lcdc(bank);
|
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_BOBJ);
|
MMU_vram_arm9(bank,VRAM_PAGE_BOBJ);
|
||||||
break;
|
break;
|
||||||
case 3: //B OBJ extended palette
|
case 3: //B OBJ extended palette
|
||||||
|
@ -757,11 +739,25 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt)
|
||||||
T1WriteByte(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x240 + block, VRAMBankCnt);
|
T1WriteByte(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x240 + block, VRAMBankCnt);
|
||||||
|
|
||||||
//refresh all bank settings
|
//refresh all bank settings
|
||||||
for(int i=0;i<VRAM_BANKS;i++)
|
//these are enumerated so that we can tune the order they get applied
|
||||||
MMU_VRAMmapRefreshBank(i);
|
//in order to emulate prioritization rules for memory regions
|
||||||
|
//with multiple banks mapped.
|
||||||
|
//We're probably still not mapping things 100% correctly, but this helped us get closer:
|
||||||
|
//goblet of fire "care of magical creatures" maps I and D to BOBJ (the I is an accident)
|
||||||
|
//and requires A to override it.
|
||||||
|
//This may create other bugs....
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_I);
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_H);
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_G);
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_F);
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_E);
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_D);
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_C);
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_B);
|
||||||
|
MMU_VRAMmapRefreshBank(VRAM_BANK_A);
|
||||||
|
|
||||||
//printf(vramConfiguration.describe().c_str());
|
printf(vramConfiguration.describe().c_str());
|
||||||
//printf("vram remapped at vcount=%d\n",nds.VCount);
|
printf("vram remapped at vcount=%d\n",nds.VCount);
|
||||||
|
|
||||||
//if texInfo changed, trigger notifications
|
//if texInfo changed, trigger notifications
|
||||||
if(memcmp(&oldTexInfo,&MMU.texInfo,sizeof(MMU_struct::TextureInfo)))
|
if(memcmp(&oldTexInfo,&MMU.texInfo,sizeof(MMU_struct::TextureInfo)))
|
||||||
|
|
Loading…
Reference in New Issue