revert stuff i didnt mean to checkin
This commit is contained in:
parent
820cb84717
commit
7d493c16c4
189
src/MMU.cpp
189
src/MMU.cpp
|
@ -97,19 +97,7 @@ static const int save_types[7][2] = {
|
||||||
{MC_TYPE_FLASH,MC_SIZE_4MBITS}
|
{MC_TYPE_FLASH,MC_SIZE_4MBITS}
|
||||||
};
|
};
|
||||||
|
|
||||||
//Card rom & ram
|
u16 partie = 1;
|
||||||
|
|
||||||
u16 SPI_CNT;
|
|
||||||
u16 SPI_CMD;
|
|
||||||
u16 AUX_SPI_CNT;
|
|
||||||
u16 AUX_SPI_CMD;
|
|
||||||
|
|
||||||
u32 rom_mask = 0;
|
|
||||||
|
|
||||||
u32 DMASrc[2][4];
|
|
||||||
u32 DMADst[2][4];
|
|
||||||
|
|
||||||
u16 partie;
|
|
||||||
u32 _MMU_MAIN_MEM_MASK = 0x3FFFFF;
|
u32 _MMU_MAIN_MEM_MASK = 0x3FFFFF;
|
||||||
|
|
||||||
#define ROM_MASK 3
|
#define ROM_MASK 3
|
||||||
|
@ -190,7 +178,6 @@ void mmu_log_debug_ARM7(u32 adr, const char *fmt, ...)
|
||||||
#define DUP16(x) x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x
|
#define DUP16(x) x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x
|
||||||
|
|
||||||
MMU_struct MMU;
|
MMU_struct MMU;
|
||||||
MMU_static_struct MMU_static;
|
|
||||||
|
|
||||||
u8 * MMU_struct::MMU_MEM[2][256] = {
|
u8 * MMU_struct::MMU_MEM[2][256] = {
|
||||||
//arm9
|
//arm9
|
||||||
|
@ -371,15 +358,6 @@ static FORCEINLINE u32 MMU_LCDmap(u32 addr, bool& unmapped)
|
||||||
{
|
{
|
||||||
unmapped = false;
|
unmapped = false;
|
||||||
|
|
||||||
if(addr==0x6201dc0)
|
|
||||||
{
|
|
||||||
int zzz=9;
|
|
||||||
}
|
|
||||||
if((addr&0x0F000000)==0x06000000 && PROCNUM==1)
|
|
||||||
{
|
|
||||||
printf("%08x\n",addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
//in case the address is entirely outside of the interesting ranges
|
//in case the address is entirely outside of the interesting ranges
|
||||||
if(addr < 0x06000000) return addr;
|
if(addr < 0x06000000) return addr;
|
||||||
if(addr >= 0x07000000) return addr;
|
if(addr >= 0x07000000) return addr;
|
||||||
|
@ -549,7 +527,7 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
u8 en = VRAMBankCnt & 0x80;
|
u8 en = VRAMBankCnt & 0x80;
|
||||||
if(!en) return;
|
if(!en) return;
|
||||||
|
|
||||||
int mst,ofs=0;
|
int mst,ofs;
|
||||||
switch(bank) {
|
switch(bank) {
|
||||||
case VRAM_BANK_A:
|
case VRAM_BANK_A:
|
||||||
case VRAM_BANK_B:
|
case VRAM_BANK_B:
|
||||||
|
@ -563,7 +541,7 @@ 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_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
|
||||||
|
@ -571,7 +549,7 @@ 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_lcdc(bank);
|
||||||
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ+ofs*8);
|
MMU_vram_arm9(bank,VRAM_PAGE_AOBJ+ofs*8);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -597,7 +575,7 @@ 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_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
|
||||||
|
@ -619,7 +597,7 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
|
||||||
ARM9Mem.texInfo.textureSlotAddr[ofs] = MMU_vram_physical(vram_bank_info[bank].page_addr);
|
ARM9Mem.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);
|
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
|
||||||
|
@ -641,11 +619,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_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);
|
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;
|
||||||
|
@ -681,13 +659,13 @@ 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_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_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;
|
||||||
|
@ -729,7 +707,7 @@ 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_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;
|
||||||
|
@ -754,13 +732,13 @@ 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_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_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
|
||||||
|
@ -914,20 +892,33 @@ void MMU_Init(void) {
|
||||||
|
|
||||||
LOG("MMU init\n");
|
LOG("MMU init\n");
|
||||||
|
|
||||||
MMU_clearMem();
|
memset(&MMU, 0, sizeof(MMU_struct));
|
||||||
|
|
||||||
MMU_static.CART_ROM = MMU.UNUSED_RAM;
|
MMU.CART_ROM = MMU.UNUSED_RAM;
|
||||||
|
|
||||||
for(i = 0x80; i<0xA0; ++i)
|
for(i = 0x80; i<0xA0; ++i)
|
||||||
{
|
{
|
||||||
MMU_struct::MMU_MEM[0][i] = MMU_static.CART_ROM;
|
MMU_struct::MMU_MEM[0][i] = MMU.CART_ROM;
|
||||||
MMU_struct::MMU_MEM[1][i] = MMU_static.CART_ROM;
|
MMU_struct::MMU_MEM[1][i] = MMU.CART_ROM;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_init(&MMU_static.fw, MC_TYPE_FLASH); /* init fw device */
|
MMU.DTCMRegion = 0x027C0000;
|
||||||
mc_alloc(&MMU_static.fw, NDS_FW_SIZE_V1);
|
MMU.ITCMRegion = 0x00000000;
|
||||||
MMU_static.fw.fp = NULL;
|
|
||||||
|
|
||||||
|
IPC_FIFOinit(ARMCPU_ARM9);
|
||||||
|
IPC_FIFOinit(ARMCPU_ARM7);
|
||||||
|
GFX_FIFOclear();
|
||||||
|
DISP_FIFOinit();
|
||||||
|
|
||||||
|
mc_init(&MMU.fw, MC_TYPE_FLASH); /* init fw device */
|
||||||
|
mc_alloc(&MMU.fw, NDS_FW_SIZE_V1);
|
||||||
|
MMU.fw.fp = NULL;
|
||||||
|
|
||||||
|
// Init Backup Memory device, this should really be done when the rom is loaded
|
||||||
|
mc_init(&MMU.bupmem, MC_TYPE_AUTODETECT);
|
||||||
|
mc_alloc(&MMU.bupmem, 1);
|
||||||
|
MMU.bupmem.fp = NULL;
|
||||||
|
rtcInit();
|
||||||
addonsInit();
|
addonsInit();
|
||||||
if(Mic_Init() == FALSE)
|
if(Mic_Init() == FALSE)
|
||||||
INFO("Microphone init failed.\n");
|
INFO("Microphone init failed.\n");
|
||||||
|
@ -937,52 +928,78 @@ void MMU_Init(void) {
|
||||||
|
|
||||||
void MMU_DeInit(void) {
|
void MMU_DeInit(void) {
|
||||||
LOG("MMU deinit\n");
|
LOG("MMU deinit\n");
|
||||||
if (MMU_static.fw.fp)
|
if (MMU.fw.fp)
|
||||||
fclose(MMU_static.fw.fp);
|
fclose(MMU.fw.fp);
|
||||||
mc_free(&MMU_static.fw);
|
mc_free(&MMU.fw);
|
||||||
if (MMU_static.bupmem.fp)
|
if (MMU.bupmem.fp)
|
||||||
fclose(MMU_static.bupmem.fp);
|
fclose(MMU.bupmem.fp);
|
||||||
mc_free(&MMU_static.bupmem);
|
mc_free(&MMU.bupmem);
|
||||||
addonsClose();
|
addonsClose();
|
||||||
Mic_DeInit();
|
Mic_DeInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Card rom & ram
|
||||||
|
|
||||||
|
u16 SPI_CNT = 0;
|
||||||
|
u16 SPI_CMD = 0;
|
||||||
|
u16 AUX_SPI_CNT = 0;
|
||||||
|
u16 AUX_SPI_CMD = 0;
|
||||||
|
|
||||||
|
u32 rom_mask = 0;
|
||||||
|
|
||||||
|
u32 DMASrc[2][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
|
||||||
|
u32 DMADst[2][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
|
||||||
|
|
||||||
void MMU_clearMem()
|
void MMU_clearMem()
|
||||||
{
|
{
|
||||||
printf("-------------------------clear---\n");
|
memset(ARM9Mem.ARM9_DTCM, 0, sizeof(ARM9Mem.ARM9_DTCM));
|
||||||
|
memset(ARM9Mem.ARM9_ITCM, 0, sizeof(ARM9Mem.ARM9_ITCM));
|
||||||
|
memset(ARM9Mem.ARM9_LCD, 0, sizeof(ARM9Mem.ARM9_LCD));
|
||||||
|
memset(ARM9Mem.ARM9_OAM, 0, sizeof(ARM9Mem.ARM9_OAM));
|
||||||
|
memset(ARM9Mem.ARM9_REG, 0, sizeof(ARM9Mem.ARM9_REG));
|
||||||
|
memset(ARM9Mem.ARM9_VMEM, 0, sizeof(ARM9Mem.ARM9_VMEM));
|
||||||
|
memset(ARM9Mem.MAIN_MEM, 0, sizeof(ARM9Mem.MAIN_MEM));
|
||||||
|
|
||||||
partie = 1;
|
memset(ARM9Mem.blank_memory, 0, sizeof(ARM9Mem.blank_memory));
|
||||||
|
|
||||||
memset(&ARM9Mem,0,sizeof(ARM9Mem));
|
memset(MMU.ARM7_ERAM, 0, sizeof(MMU.ARM7_ERAM));
|
||||||
memset(&MMU,0,sizeof(MMU));
|
memset(MMU.ARM7_REG, 0, sizeof(MMU.ARM7_REG));
|
||||||
|
|
||||||
//things which used to be only static initialized, now cleared here
|
|
||||||
memset(DMASrc,0,sizeof(DMASrc));
|
|
||||||
memset(DMADst,0,sizeof(DMADst));
|
|
||||||
SPI_CNT = 0;
|
|
||||||
SPI_CMD = 0;
|
|
||||||
AUX_SPI_CNT = 0;
|
|
||||||
AUX_SPI_CMD = 0;
|
|
||||||
|
|
||||||
MMU_VRAM_unmap_all();
|
|
||||||
|
|
||||||
//reset gpu system
|
|
||||||
MainScreen.offset = 0;
|
|
||||||
SubScreen.offset = 192;
|
|
||||||
if(osdA != NULL) osdA->setOffset(MainScreen.offset);
|
|
||||||
if(osdB != NULL) osdB->setOffset(SubScreen.offset);
|
|
||||||
|
|
||||||
IPC_FIFOinit(ARMCPU_ARM9);
|
IPC_FIFOinit(ARMCPU_ARM9);
|
||||||
IPC_FIFOinit(ARMCPU_ARM7);
|
IPC_FIFOinit(ARMCPU_ARM7);
|
||||||
GFX_FIFOclear();
|
GFX_FIFOclear();
|
||||||
DISP_FIFOinit();
|
DISP_FIFOinit();
|
||||||
|
|
||||||
//-------
|
|
||||||
//setup non-zero registers
|
|
||||||
MMU.DTCMRegion = 0x027C0000;
|
MMU.DTCMRegion = 0x027C0000;
|
||||||
|
MMU.ITCMRegion = 0x00000000;
|
||||||
|
|
||||||
|
memset(MMU.timer, 0, sizeof(u16) * 2 * 4);
|
||||||
|
memset(MMU.timerMODE, 0, sizeof(s32) * 2 * 4);
|
||||||
|
memset(MMU.timerON, 0, sizeof(u32) * 2 * 4);
|
||||||
|
memset(MMU.timerRUN, 0, sizeof(u32) * 2 * 4);
|
||||||
|
memset(MMU.timerReload, 0, sizeof(u16) * 2 * 4);
|
||||||
|
|
||||||
|
memset(MMU.reg_IME, 0, sizeof(u32) * 2);
|
||||||
|
memset(MMU.reg_IE, 0, sizeof(u32) * 2);
|
||||||
|
memset(MMU.reg_IF, 0, sizeof(u32) * 2);
|
||||||
|
|
||||||
|
memset(MMU.DMAStartTime, 0, sizeof(u32) * 2 * 4);
|
||||||
|
memset(MMU.DMACycle, 0, sizeof(s32) * 2 * 4);
|
||||||
|
memset(MMU.DMACrt, 0, sizeof(u32) * 2 * 4);
|
||||||
|
memset(MMU.DMAing, 0, sizeof(BOOL) * 2 * 4);
|
||||||
|
|
||||||
|
memset(MMU.dscard, 0, sizeof(nds_dscard) * 2);
|
||||||
|
|
||||||
// Enable the sound speakers
|
// Enable the sound speakers
|
||||||
T1WriteWord(MMU.ARM7_REG, 0x304, 0x0001);
|
T1WriteWord(MMU.ARM7_REG, 0x304, 0x0001);
|
||||||
|
|
||||||
|
MainScreen.offset = 0;
|
||||||
|
SubScreen.offset = 192;
|
||||||
|
osdA->setOffset(MainScreen.offset);
|
||||||
|
osdB->setOffset(SubScreen.offset);
|
||||||
|
|
||||||
|
MMU_VRAM_unmap_all();
|
||||||
|
|
||||||
MMU.powerMan_CntReg = 0x00;
|
MMU.powerMan_CntReg = 0x00;
|
||||||
MMU.powerMan_CntRegWritten = FALSE;
|
MMU.powerMan_CntRegWritten = FALSE;
|
||||||
MMU.powerMan_Reg[0] = 0x0B;
|
MMU.powerMan_Reg[0] = 0x0B;
|
||||||
|
@ -990,15 +1007,17 @@ void MMU_clearMem()
|
||||||
MMU.powerMan_Reg[2] = 0x01;
|
MMU.powerMan_Reg[2] = 0x01;
|
||||||
MMU.powerMan_Reg[3] = 0x00;
|
MMU.powerMan_Reg[3] = 0x00;
|
||||||
|
|
||||||
MMU.DTCMRegion = 0x027C0000;
|
rtcInit();
|
||||||
MMU.ITCMRegion = 0x00000000;
|
partie = 1;
|
||||||
|
addonsReset();
|
||||||
|
Mic_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU_setRom(u8 * rom, u32 mask)
|
void MMU_setRom(u8 * rom, u32 mask)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
MMU_static.CART_ROM = rom;
|
MMU.CART_ROM = rom;
|
||||||
MMU_static.CART_ROM_MASK = mask;
|
MMU.CART_ROM_MASK = mask;
|
||||||
|
|
||||||
for(i = 0x80; i<0xA0; ++i)
|
for(i = 0x80; i<0xA0; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1013,7 +1032,7 @@ void MMU_setRom(u8 * rom, u32 mask)
|
||||||
void MMU_unsetRom()
|
void MMU_unsetRom()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
MMU_static.CART_ROM=MMU.UNUSED_RAM;
|
MMU.CART_ROM=MMU.UNUSED_RAM;
|
||||||
|
|
||||||
for(i = 0x80; i<0xA0; ++i)
|
for(i = 0x80; i<0xA0; ++i)
|
||||||
{
|
{
|
||||||
|
@ -2201,14 +2220,14 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
||||||
AUX_SPI_CNT = val;
|
AUX_SPI_CNT = val;
|
||||||
|
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
mc_reset_com(&MMU_static.bupmem); /* reset backup memory device communication */
|
mc_reset_com(&MMU.bupmem); /* reset backup memory device communication */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case REG_AUXSPIDATA:
|
case REG_AUXSPIDATA:
|
||||||
if(val!=0)
|
if(val!=0)
|
||||||
AUX_SPI_CMD = val & 0xFF;
|
AUX_SPI_CMD = val & 0xFF;
|
||||||
|
|
||||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU_static.bupmem, val));
|
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val));
|
||||||
return;
|
return;
|
||||||
case REG_DISPA_BG0CNT :
|
case REG_DISPA_BG0CNT :
|
||||||
//GPULOG("MAIN BG0 SETPROP 16B %08X\r\n", val);
|
//GPULOG("MAIN BG0 SETPROP 16B %08X\r\n", val);
|
||||||
|
@ -3379,7 +3398,7 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr)
|
||||||
{
|
{
|
||||||
MMU.dscard[ARMCPU_ARM9].address = (0x8000 + (MMU.dscard[ARMCPU_ARM9].address&0x1FF));
|
MMU.dscard[ARMCPU_ARM9].address = (0x8000 + (MMU.dscard[ARMCPU_ARM9].address&0x1FF));
|
||||||
}
|
}
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, MMU.dscard[ARMCPU_ARM9].address & MMU_static.CART_ROM_MASK);
|
val = T1ReadLong(MMU.CART_ROM, MMU.dscard[ARMCPU_ARM9].address & MMU.CART_ROM_MASK);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3544,14 +3563,14 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
|
||||||
AUX_SPI_CNT = val;
|
AUX_SPI_CNT = val;
|
||||||
|
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
mc_reset_com(&MMU_static.bupmem); // reset backup memory device communication
|
mc_reset_com(&MMU.bupmem); // reset backup memory device communication
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case REG_AUXSPIDATA:
|
case REG_AUXSPIDATA:
|
||||||
if(val!=0)
|
if(val!=0)
|
||||||
AUX_SPI_CMD = val & 0xFF;
|
AUX_SPI_CMD = val & 0xFF;
|
||||||
|
|
||||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU_static.bupmem, val));
|
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case REG_SPICNT :
|
case REG_SPICNT :
|
||||||
|
@ -3570,11 +3589,11 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//MMU_static.fw.com == 0; // reset fw device communication
|
//MMU.fw.com == 0; // reset fw device communication
|
||||||
if ( reset_firmware)
|
if ( reset_firmware)
|
||||||
{
|
{
|
||||||
// reset fw device communication
|
// reset fw device communication
|
||||||
mc_reset_com(&MMU_static.fw);
|
mc_reset_com(&MMU.fw);
|
||||||
}
|
}
|
||||||
SPI_CNT = val;
|
SPI_CNT = val;
|
||||||
|
|
||||||
|
@ -3622,7 +3641,7 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
|
||||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, 0);
|
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, fw_transfer(&MMU_static.fw, val));
|
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, fw_transfer(&MMU.fw, val));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 2 :
|
case 2 :
|
||||||
|
@ -4378,7 +4397,7 @@ u32 FASTCALL _MMU_ARM7_read32(u32 adr)
|
||||||
case 0xB7:
|
case 0xB7:
|
||||||
{
|
{
|
||||||
/* TODO: prevent read if the address is out of range */
|
/* TODO: prevent read if the address is out of range */
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, MMU.dscard[ARMCPU_ARM7].address);
|
val = T1ReadLong(MMU.CART_ROM, MMU.dscard[ARMCPU_ARM7].address);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -4497,5 +4516,5 @@ void mmu_select_savetype(int type, int *bmemtype, u32 *bmemsize) {
|
||||||
if (type<0 || type > 6) return;
|
if (type<0 || type > 6) return;
|
||||||
*bmemtype=save_types[type][0];
|
*bmemtype=save_types[type][0];
|
||||||
*bmemsize=save_types[type][1];
|
*bmemsize=save_types[type][1];
|
||||||
mc_realloc(&MMU_static.bupmem, *bmemtype, *bmemsize);
|
mc_realloc(&MMU.bupmem, *bmemtype, *bmemsize);
|
||||||
}
|
}
|
||||||
|
|
40
src/MMU.h
40
src/MMU.h
|
@ -47,38 +47,33 @@
|
||||||
|
|
||||||
typedef const u32 TWaitState;
|
typedef const u32 TWaitState;
|
||||||
|
|
||||||
struct MMU_static_struct {
|
|
||||||
|
|
||||||
//Card rom
|
|
||||||
u8 * CART_ROM;
|
|
||||||
u32 CART_ROM_MASK;
|
|
||||||
|
|
||||||
memory_chip_t fw;
|
|
||||||
memory_chip_t bupmem;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MMU_struct {
|
struct MMU_struct {
|
||||||
//ARM7 mem
|
//ARM7 mem
|
||||||
u8 ARM7_BIOS[0x4000];
|
u8 ARM7_BIOS[0x4000];
|
||||||
u8 ARM7_ERAM[0x10000];
|
u8 ARM7_ERAM[0x10000];
|
||||||
u8 ARM7_REG[0x10000];
|
u8 ARM7_REG[0x10000];
|
||||||
u8 ARM7_WIRAM[0x10000];
|
u8 ARM7_WIRAM[0x10000];
|
||||||
u8 CART_RAM[0x10000];
|
|
||||||
//this is here so that we can trap glitchy emulator code
|
|
||||||
//which is accessing offsets 5,6,7 of unused ram due to unaligned accesses
|
|
||||||
//(also since the emulator doesn't prevent unaligned accesses)
|
|
||||||
u8 MORE_UNUSED_RAM[4];
|
|
||||||
//Shared ram
|
|
||||||
u8 SWIRAM[0x8000];
|
|
||||||
//Unused ram
|
|
||||||
u8 UNUSED_RAM[4];
|
|
||||||
|
|
||||||
// VRAM mapping
|
// VRAM mapping
|
||||||
u8 VRAM_MAP[4][32];
|
u8 VRAM_MAP[4][32];
|
||||||
u32 LCD_VRAM_ADDR[10];
|
u32 LCD_VRAM_ADDR[10];
|
||||||
u8 LCDCenable[10];
|
u8 LCDCenable[10];
|
||||||
|
|
||||||
|
//Shared ram
|
||||||
|
u8 SWIRAM[0x8000];
|
||||||
|
|
||||||
|
//Card rom & ram
|
||||||
|
u8 * CART_ROM;
|
||||||
|
u32 CART_ROM_MASK;
|
||||||
|
u8 CART_RAM[0x10000];
|
||||||
|
|
||||||
|
//Unused ram
|
||||||
|
u8 UNUSED_RAM[4];
|
||||||
|
|
||||||
|
//this is here so that we can trap glitchy emulator code
|
||||||
|
//which is accessing offsets 5,6,7 of unused ram due to unaligned accesses
|
||||||
|
//(also since the emulator doesn't prevent unaligned accesses)
|
||||||
|
u8 MORE_UNUSED_RAM[4];
|
||||||
|
|
||||||
static u8 * MMU_MEM[2][256];
|
static u8 * MMU_MEM[2][256];
|
||||||
static u32 MMU_MASK[2][256];
|
static u32 MMU_MASK[2][256];
|
||||||
|
@ -121,13 +116,16 @@ struct MMU_struct {
|
||||||
BOOL powerMan_CntRegWritten;
|
BOOL powerMan_CntRegWritten;
|
||||||
u8 powerMan_Reg[4];
|
u8 powerMan_Reg[4];
|
||||||
|
|
||||||
|
memory_chip_t fw;
|
||||||
|
memory_chip_t bupmem;
|
||||||
|
|
||||||
nds_dscard dscard[2];
|
nds_dscard dscard[2];
|
||||||
u32 CheckTimers;
|
u32 CheckTimers;
|
||||||
u32 CheckDMAs;
|
u32 CheckDMAs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MMU_struct MMU;
|
extern MMU_struct MMU;
|
||||||
extern MMU_static_struct MMU_static;
|
|
||||||
|
|
||||||
|
|
||||||
struct armcpu_memory_iface {
|
struct armcpu_memory_iface {
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "cheatSystem.h"
|
#include "cheatSystem.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
#include "rtc.h"
|
|
||||||
#include "mic.h"
|
|
||||||
#include "addons.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "./windows/disView.h"
|
#include "./windows/disView.h"
|
||||||
|
@ -56,7 +53,7 @@ static Driver _stub_driver;
|
||||||
Driver* driver = &_stub_driver;
|
Driver* driver = &_stub_driver;
|
||||||
std::string InputDisplayString;
|
std::string InputDisplayString;
|
||||||
|
|
||||||
static BOOL LidClosed;
|
static BOOL LidClosed = FALSE;
|
||||||
static u8 countLid = 0;
|
static u8 countLid = 0;
|
||||||
char pathToROM[MAX_PATH];
|
char pathToROM[MAX_PATH];
|
||||||
char pathFilenameToROMwithoutExt[MAX_PATH];
|
char pathFilenameToROMwithoutExt[MAX_PATH];
|
||||||
|
@ -492,17 +489,21 @@ struct armcpu_ctrl_iface **arm7_ctrl_iface) {
|
||||||
#else
|
#else
|
||||||
int NDS_Init( void) {
|
int NDS_Init( void) {
|
||||||
#endif
|
#endif
|
||||||
|
nds.ARM9Cycle = 0;
|
||||||
|
nds.ARM7Cycle = 0;
|
||||||
|
nds.cycles = 0;
|
||||||
|
nds.idleFrameCounter = 0;
|
||||||
|
memset(nds.runCycleCollector,0,sizeof(nds.runCycleCollector));
|
||||||
MMU_Init();
|
MMU_Init();
|
||||||
|
nds.nextHBlank = 3168;
|
||||||
|
nds.VCount = 0;
|
||||||
|
nds.lignerendu = FALSE;
|
||||||
|
|
||||||
|
nds.sleeping = FALSE;
|
||||||
|
|
||||||
if (Screen_Init(GFXCORE_DUMMY) != 0)
|
if (Screen_Init(GFXCORE_DUMMY) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
//reset gpu system
|
|
||||||
MainScreen.offset = 0;
|
|
||||||
SubScreen.offset = 192;
|
|
||||||
osdA->setOffset(MainScreen.offset);
|
|
||||||
osdB->setOffset(SubScreen.offset);
|
|
||||||
|
|
||||||
gfx3d_init();
|
gfx3d_init();
|
||||||
|
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
|
@ -529,7 +530,7 @@ int NDS_Init( void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDS_DeInit(void) {
|
void NDS_DeInit(void) {
|
||||||
if(MMU_static.CART_ROM != MMU.UNUSED_RAM)
|
if(MMU.CART_ROM != MMU.UNUSED_RAM)
|
||||||
NDS_FreeROM();
|
NDS_FreeROM();
|
||||||
|
|
||||||
nds.nextHBlank = 3168;
|
nds.nextHBlank = 3168;
|
||||||
|
@ -555,45 +556,45 @@ NDS_header * NDS_getROMHeader(void)
|
||||||
{
|
{
|
||||||
NDS_header * header = new NDS_header;
|
NDS_header * header = new NDS_header;
|
||||||
|
|
||||||
memcpy(header->gameTile, MMU_static.CART_ROM, 12);
|
memcpy(header->gameTile, MMU.CART_ROM, 12);
|
||||||
memcpy(header->gameCode, MMU_static.CART_ROM + 12, 4);
|
memcpy(header->gameCode, MMU.CART_ROM + 12, 4);
|
||||||
header->makerCode = T1ReadWord(MMU_static.CART_ROM, 16);
|
header->makerCode = T1ReadWord(MMU.CART_ROM, 16);
|
||||||
header->unitCode = MMU_static.CART_ROM[18];
|
header->unitCode = MMU.CART_ROM[18];
|
||||||
header->deviceCode = MMU_static.CART_ROM[19];
|
header->deviceCode = MMU.CART_ROM[19];
|
||||||
header->cardSize = MMU_static.CART_ROM[20];
|
header->cardSize = MMU.CART_ROM[20];
|
||||||
memcpy(header->cardInfo, MMU_static.CART_ROM + 21, 8);
|
memcpy(header->cardInfo, MMU.CART_ROM + 21, 8);
|
||||||
header->flags = MMU_static.CART_ROM[29];
|
header->flags = MMU.CART_ROM[29];
|
||||||
header->ARM9src = T1ReadLong(MMU_static.CART_ROM, 32);
|
header->ARM9src = T1ReadLong(MMU.CART_ROM, 32);
|
||||||
header->ARM9exe = T1ReadLong(MMU_static.CART_ROM, 36);
|
header->ARM9exe = T1ReadLong(MMU.CART_ROM, 36);
|
||||||
header->ARM9cpy = T1ReadLong(MMU_static.CART_ROM, 40);
|
header->ARM9cpy = T1ReadLong(MMU.CART_ROM, 40);
|
||||||
header->ARM9binSize = T1ReadLong(MMU_static.CART_ROM, 44);
|
header->ARM9binSize = T1ReadLong(MMU.CART_ROM, 44);
|
||||||
header->ARM7src = T1ReadLong(MMU_static.CART_ROM, 48);
|
header->ARM7src = T1ReadLong(MMU.CART_ROM, 48);
|
||||||
header->ARM7exe = T1ReadLong(MMU_static.CART_ROM, 52);
|
header->ARM7exe = T1ReadLong(MMU.CART_ROM, 52);
|
||||||
header->ARM7cpy = T1ReadLong(MMU_static.CART_ROM, 56);
|
header->ARM7cpy = T1ReadLong(MMU.CART_ROM, 56);
|
||||||
header->ARM7binSize = T1ReadLong(MMU_static.CART_ROM, 60);
|
header->ARM7binSize = T1ReadLong(MMU.CART_ROM, 60);
|
||||||
header->FNameTblOff = T1ReadLong(MMU_static.CART_ROM, 64);
|
header->FNameTblOff = T1ReadLong(MMU.CART_ROM, 64);
|
||||||
header->FNameTblSize = T1ReadLong(MMU_static.CART_ROM, 68);
|
header->FNameTblSize = T1ReadLong(MMU.CART_ROM, 68);
|
||||||
header->FATOff = T1ReadLong(MMU_static.CART_ROM, 72);
|
header->FATOff = T1ReadLong(MMU.CART_ROM, 72);
|
||||||
header->FATSize = T1ReadLong(MMU_static.CART_ROM, 76);
|
header->FATSize = T1ReadLong(MMU.CART_ROM, 76);
|
||||||
header->ARM9OverlayOff = T1ReadLong(MMU_static.CART_ROM, 80);
|
header->ARM9OverlayOff = T1ReadLong(MMU.CART_ROM, 80);
|
||||||
header->ARM9OverlaySize = T1ReadLong(MMU_static.CART_ROM, 84);
|
header->ARM9OverlaySize = T1ReadLong(MMU.CART_ROM, 84);
|
||||||
header->ARM7OverlayOff = T1ReadLong(MMU_static.CART_ROM, 88);
|
header->ARM7OverlayOff = T1ReadLong(MMU.CART_ROM, 88);
|
||||||
header->ARM7OverlaySize = T1ReadLong(MMU_static.CART_ROM, 92);
|
header->ARM7OverlaySize = T1ReadLong(MMU.CART_ROM, 92);
|
||||||
header->unknown2a = T1ReadLong(MMU_static.CART_ROM, 96);
|
header->unknown2a = T1ReadLong(MMU.CART_ROM, 96);
|
||||||
header->unknown2b = T1ReadLong(MMU_static.CART_ROM, 100);
|
header->unknown2b = T1ReadLong(MMU.CART_ROM, 100);
|
||||||
header->IconOff = T1ReadLong(MMU_static.CART_ROM, 104);
|
header->IconOff = T1ReadLong(MMU.CART_ROM, 104);
|
||||||
header->CRC16 = T1ReadWord(MMU_static.CART_ROM, 108);
|
header->CRC16 = T1ReadWord(MMU.CART_ROM, 108);
|
||||||
header->ROMtimeout = T1ReadWord(MMU_static.CART_ROM, 110);
|
header->ROMtimeout = T1ReadWord(MMU.CART_ROM, 110);
|
||||||
header->ARM9unk = T1ReadLong(MMU_static.CART_ROM, 112);
|
header->ARM9unk = T1ReadLong(MMU.CART_ROM, 112);
|
||||||
header->ARM7unk = T1ReadLong(MMU_static.CART_ROM, 116);
|
header->ARM7unk = T1ReadLong(MMU.CART_ROM, 116);
|
||||||
memcpy(header->unknown3c, MMU_static.CART_ROM + 120, 8);
|
memcpy(header->unknown3c, MMU.CART_ROM + 120, 8);
|
||||||
header->ROMSize = T1ReadLong(MMU_static.CART_ROM, 128);
|
header->ROMSize = T1ReadLong(MMU.CART_ROM, 128);
|
||||||
header->HeaderSize = T1ReadLong(MMU_static.CART_ROM, 132);
|
header->HeaderSize = T1ReadLong(MMU.CART_ROM, 132);
|
||||||
memcpy(header->unknown5, MMU_static.CART_ROM + 136, 56);
|
memcpy(header->unknown5, MMU.CART_ROM + 136, 56);
|
||||||
memcpy(header->logo, MMU_static.CART_ROM + 192, 156);
|
memcpy(header->logo, MMU.CART_ROM + 192, 156);
|
||||||
header->logoCRC16 = T1ReadWord(MMU_static.CART_ROM, 348);
|
header->logoCRC16 = T1ReadWord(MMU.CART_ROM, 348);
|
||||||
header->headerCRC16 = T1ReadWord(MMU_static.CART_ROM, 350);
|
header->headerCRC16 = T1ReadWord(MMU.CART_ROM, 350);
|
||||||
memcpy(header->reserved, MMU_static.CART_ROM + 352, 160);
|
memcpy(header->reserved, MMU.CART_ROM + 352, 160);
|
||||||
|
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
@ -797,7 +798,7 @@ int NDS_LoadROM( const char *filename, int bmtype, u32 bmsize,
|
||||||
|
|
||||||
// Make sure old ROM is freed first(at least this way we won't be eating
|
// Make sure old ROM is freed first(at least this way we won't be eating
|
||||||
// up a ton of ram before the old ROM is freed)
|
// up a ton of ram before the old ROM is freed)
|
||||||
if(MMU_static.CART_ROM != MMU.UNUSED_RAM)
|
if(MMU.CART_ROM != MMU.UNUSED_RAM)
|
||||||
NDS_FreeROM();
|
NDS_FreeROM();
|
||||||
|
|
||||||
data = new u8[mask + 1];
|
data = new u8[mask + 1];
|
||||||
|
@ -831,8 +832,8 @@ int NDS_LoadROM( const char *filename, int bmtype, u32 bmsize,
|
||||||
strcpy(buf, pathFilenameToROMwithoutExt);
|
strcpy(buf, pathFilenameToROMwithoutExt);
|
||||||
strcat(buf, ".sav"); // DeSmuME memory card :)
|
strcat(buf, ".sav"); // DeSmuME memory card :)
|
||||||
|
|
||||||
mc_realloc(&MMU_static.bupmem, bmtype, bmsize);
|
mc_realloc(&MMU.bupmem, bmtype, bmsize);
|
||||||
mc_load_file(&MMU_static.bupmem, buf);
|
mc_load_file(&MMU.bupmem, buf);
|
||||||
|
|
||||||
memset(buf, 0, MAX_PATH);
|
memset(buf, 0, MAX_PATH);
|
||||||
strcpy(buf, pathFilenameToROMwithoutExt);
|
strcpy(buf, pathFilenameToROMwithoutExt);
|
||||||
|
@ -846,8 +847,8 @@ int NDS_LoadROM( const char *filename, int bmtype, u32 bmsize,
|
||||||
|
|
||||||
void MovieSRAM()
|
void MovieSRAM()
|
||||||
{
|
{
|
||||||
int bmtype = MMU_static.bupmem.type;
|
int bmtype = MMU.bupmem.type;
|
||||||
u32 bmsize = MMU_static.bupmem.size;
|
u32 bmsize = MMU.bupmem.size;
|
||||||
|
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
|
|
||||||
|
@ -859,19 +860,18 @@ void MovieSRAM()
|
||||||
strcat(buf, "movie");
|
strcat(buf, "movie");
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_realloc(&MMU_static.bupmem,MC_TYPE_AUTODETECT,0);
|
mc_realloc(&MMU.bupmem, bmtype, bmsize);
|
||||||
//mc_realloc(&MMU_static.bupmem, bmtype, bmsize);
|
mc_load_file(&MMU.bupmem, buf);
|
||||||
mc_load_file(&MMU_static.bupmem, buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDS_FreeROM(void)
|
void NDS_FreeROM(void)
|
||||||
{
|
{
|
||||||
if (MMU_static.CART_ROM != MMU.UNUSED_RAM)
|
if (MMU.CART_ROM != MMU.UNUSED_RAM)
|
||||||
delete [] MMU_static.CART_ROM;
|
delete [] MMU.CART_ROM;
|
||||||
MMU_unsetRom();
|
MMU_unsetRom();
|
||||||
if (MMU_static.bupmem.fp)
|
if (MMU.bupmem.fp)
|
||||||
fclose(MMU_static.bupmem.fp);
|
fclose(MMU.bupmem.fp);
|
||||||
MMU_static.bupmem.fp = NULL;
|
MMU.bupmem.fp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDS_Reset( void)
|
void NDS_Reset( void)
|
||||||
|
@ -886,10 +886,10 @@ void NDS_Reset( void)
|
||||||
|
|
||||||
if (!header) return ;
|
if (!header) return ;
|
||||||
|
|
||||||
if (MMU_static.bupmem.fp)
|
if (MMU.bupmem.fp)
|
||||||
{
|
{
|
||||||
fclose(MMU_static.bupmem.fp);
|
fclose(MMU.bupmem.fp);
|
||||||
MMU_static.bupmem.fp = NULL;
|
MMU.bupmem.fp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
lagframecounter=0;
|
lagframecounter=0;
|
||||||
|
@ -900,11 +900,6 @@ void NDS_Reset( void)
|
||||||
currFrameCounter=0;
|
currFrameCounter=0;
|
||||||
|
|
||||||
MMU_clearMem();
|
MMU_clearMem();
|
||||||
//things formerly from MMU_clearMem before we changed it to do less:
|
|
||||||
rtcInit();
|
|
||||||
addonsReset();
|
|
||||||
Mic_Reset();
|
|
||||||
//------------
|
|
||||||
|
|
||||||
//ARM7 BIOS IRQ HANDLER
|
//ARM7 BIOS IRQ HANDLER
|
||||||
if(CommonSettings.UseExtBIOS == true)
|
if(CommonSettings.UseExtBIOS == true)
|
||||||
|
@ -993,7 +988,7 @@ void NDS_Reset( void)
|
||||||
|
|
||||||
for(i = 0; i < (header->ARM9binSize>>2); ++i)
|
for(i = 0; i < (header->ARM9binSize>>2); ++i)
|
||||||
{
|
{
|
||||||
_MMU_write32<ARMCPU_ARM9>(dst, T1ReadLong(MMU_static.CART_ROM, src));
|
_MMU_write32<ARMCPU_ARM9>(dst, T1ReadLong(MMU.CART_ROM, src));
|
||||||
dst += 4;
|
dst += 4;
|
||||||
src += 4;
|
src += 4;
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +998,7 @@ void NDS_Reset( void)
|
||||||
|
|
||||||
for(i = 0; i < (header->ARM7binSize>>2); ++i)
|
for(i = 0; i < (header->ARM7binSize>>2); ++i)
|
||||||
{
|
{
|
||||||
_MMU_write32<ARMCPU_ARM7>(dst, T1ReadLong(MMU_static.CART_ROM, src));
|
_MMU_write32<ARMCPU_ARM7>(dst, T1ReadLong(MMU.CART_ROM, src));
|
||||||
dst += 4;
|
dst += 4;
|
||||||
src += 4;
|
src += 4;
|
||||||
}
|
}
|
||||||
|
@ -1015,8 +1010,6 @@ void NDS_Reset( void)
|
||||||
nds.ARM9Cycle = 0;
|
nds.ARM9Cycle = 0;
|
||||||
nds.ARM7Cycle = 0;
|
nds.ARM7Cycle = 0;
|
||||||
nds.cycles = 0;
|
nds.cycles = 0;
|
||||||
nds.idleFrameCounter = 0;
|
|
||||||
memset(nds.runCycleCollector,0,sizeof(nds.runCycleCollector));
|
|
||||||
memset(nds.timerCycle, 0, sizeof(s32) * 2 * 4);
|
memset(nds.timerCycle, 0, sizeof(s32) * 2 * 4);
|
||||||
memset(nds.timerOver, 0, sizeof(BOOL) * 2 * 4);
|
memset(nds.timerOver, 0, sizeof(BOOL) * 2 * 4);
|
||||||
nds.nextHBlank = 3168;
|
nds.nextHBlank = 3168;
|
||||||
|
@ -1024,7 +1017,6 @@ void NDS_Reset( void)
|
||||||
nds.old = 0;
|
nds.old = 0;
|
||||||
nds.diff = 0;
|
nds.diff = 0;
|
||||||
nds.lignerendu = FALSE;
|
nds.lignerendu = FALSE;
|
||||||
nds.sleeping = FALSE;
|
|
||||||
nds.touchX = nds.touchY = 0;
|
nds.touchX = nds.touchY = 0;
|
||||||
nds.isTouch = 0;
|
nds.isTouch = 0;
|
||||||
nds.debugConsole = CommonSettings.DebugConsole;
|
nds.debugConsole = CommonSettings.DebugConsole;
|
||||||
|
@ -1045,7 +1037,7 @@ void NDS_Reset( void)
|
||||||
u8 temp_buffer[NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT];
|
u8 temp_buffer[NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT];
|
||||||
int fw_index;
|
int fw_index;
|
||||||
|
|
||||||
if ( copy_firmware_user_data( temp_buffer, MMU_static.fw.data)) {
|
if ( copy_firmware_user_data( temp_buffer, MMU.fw.data)) {
|
||||||
for ( fw_index = 0; fw_index < NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT; fw_index++)
|
for ( fw_index = 0; fw_index < NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT; fw_index++)
|
||||||
_MMU_write08<ARMCPU_ARM9>(0x027FFC80 + fw_index, temp_buffer[fw_index]);
|
_MMU_write08<ARMCPU_ARM9>(0x027FFC80 + fw_index, temp_buffer[fw_index]);
|
||||||
}
|
}
|
||||||
|
@ -1054,11 +1046,11 @@ void NDS_Reset( void)
|
||||||
// Copy the whole header to Main RAM 0x27FFE00 on startup.
|
// Copy the whole header to Main RAM 0x27FFE00 on startup.
|
||||||
// Reference: http://nocash.emubase.de/gbatek.htm#dscartridgeheader
|
// Reference: http://nocash.emubase.de/gbatek.htm#dscartridgeheader
|
||||||
for (i = 0; i < ((0x170+0x90)/4); i++) {
|
for (i = 0; i < ((0x170+0x90)/4); i++) {
|
||||||
_MMU_write32<ARMCPU_ARM9>(0x027FFE00+i*4, LE_TO_LOCAL_32(((u32*)MMU_static.CART_ROM)[i]));
|
_MMU_write32<ARMCPU_ARM9>(0x027FFE00+i*4, LE_TO_LOCAL_32(((u32*)MMU.CART_ROM)[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the header checksum to memory (the firmware needs it to see the cart)
|
// Write the header checksum to memory (the firmware needs it to see the cart)
|
||||||
_MMU_write16<ARMCPU_ARM9>(0x027FF808, T1ReadWord(MMU_static.CART_ROM, 0x15E));
|
_MMU_write16<ARMCPU_ARM9>(0x027FF808, T1ReadWord(MMU.CART_ROM, 0x15E));
|
||||||
|
|
||||||
MainScreen.offset = 0;
|
MainScreen.offset = 0;
|
||||||
SubScreen.offset = 192;
|
SubScreen.offset = 192;
|
||||||
|
@ -1083,7 +1075,7 @@ void NDS_Reset( void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy(FW_Mac, (MMU_static.fw.data + 0x36), 6);
|
memcpy(FW_Mac, (MMU.fw.data + 0x36), 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
int NDS_ImportSave(const char *filename)
|
int NDS_ImportSave(const char *filename)
|
||||||
|
@ -1092,7 +1084,7 @@ int NDS_ImportSave(const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (memcmp(filename+strlen(filename)-4, ".duc", 4) == 0)
|
if (memcmp(filename+strlen(filename)-4, ".duc", 4) == 0)
|
||||||
return mc_load_duc(&MMU_static.bupmem, filename);
|
return mc_load_duc(&MMU.bupmem, filename);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1423,85 +1415,85 @@ int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings)
|
||||||
/*
|
/*
|
||||||
* Create the firmware header
|
* Create the firmware header
|
||||||
*/
|
*/
|
||||||
memset( MMU_static.fw.data, 0, 0x40000);
|
memset( MMU.fw.data, 0, 0x40000);
|
||||||
|
|
||||||
/* firmware identifier */
|
/* firmware identifier */
|
||||||
MMU_static.fw.data[0x8] = 'M';
|
MMU.fw.data[0x8] = 'M';
|
||||||
MMU_static.fw.data[0x8 + 1] = 'A';
|
MMU.fw.data[0x8 + 1] = 'A';
|
||||||
MMU_static.fw.data[0x8 + 2] = 'C';
|
MMU.fw.data[0x8 + 2] = 'C';
|
||||||
MMU_static.fw.data[0x8 + 3] = 'P';
|
MMU.fw.data[0x8 + 3] = 'P';
|
||||||
|
|
||||||
/* DS type */
|
/* DS type */
|
||||||
if ( user_settings->ds_type == NDS_FW_DS_TYPE_LITE)
|
if ( user_settings->ds_type == NDS_FW_DS_TYPE_LITE)
|
||||||
MMU_static.fw.data[0x1d] = 0x20;
|
MMU.fw.data[0x1d] = 0x20;
|
||||||
else
|
else
|
||||||
MMU_static.fw.data[0x1d] = 0xff;
|
MMU.fw.data[0x1d] = 0xff;
|
||||||
|
|
||||||
/* User Settings offset 0x3fe00 / 8 */
|
/* User Settings offset 0x3fe00 / 8 */
|
||||||
MMU_static.fw.data[0x20] = 0xc0;
|
MMU.fw.data[0x20] = 0xc0;
|
||||||
MMU_static.fw.data[0x21] = 0x7f;
|
MMU.fw.data[0x21] = 0x7f;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* User settings (at 0x3FE00 and 0x3FF00)
|
* User settings (at 0x3FE00 and 0x3FF00)
|
||||||
*/
|
*/
|
||||||
fill_user_data_area( user_settings, &MMU_static.fw.data[ 0x3FE00], 0);
|
fill_user_data_area( user_settings, &MMU.fw.data[ 0x3FE00], 0);
|
||||||
fill_user_data_area( user_settings, &MMU_static.fw.data[ 0x3FF00], 1);
|
fill_user_data_area( user_settings, &MMU.fw.data[ 0x3FF00], 1);
|
||||||
|
|
||||||
/* Wifi config length */
|
/* Wifi config length */
|
||||||
MMU_static.fw.data[0x2C] = 0x38;
|
MMU.fw.data[0x2C] = 0x38;
|
||||||
MMU_static.fw.data[0x2D] = 0x01;
|
MMU.fw.data[0x2D] = 0x01;
|
||||||
|
|
||||||
MMU_static.fw.data[0x2E] = 0x00;
|
MMU.fw.data[0x2E] = 0x00;
|
||||||
|
|
||||||
/* Wifi version */
|
/* Wifi version */
|
||||||
MMU_static.fw.data[0x2F] = 0x00;
|
MMU.fw.data[0x2F] = 0x00;
|
||||||
|
|
||||||
/* MAC address */
|
/* MAC address */
|
||||||
memcpy((MMU_static.fw.data + 0x36), FW_Mac, sizeof(FW_Mac));
|
memcpy((MMU.fw.data + 0x36), FW_Mac, sizeof(FW_Mac));
|
||||||
|
|
||||||
/* Enabled channels */
|
/* Enabled channels */
|
||||||
MMU_static.fw.data[0x3C] = 0xFE;
|
MMU.fw.data[0x3C] = 0xFE;
|
||||||
MMU_static.fw.data[0x3D] = 0x3F;
|
MMU.fw.data[0x3D] = 0x3F;
|
||||||
|
|
||||||
MMU_static.fw.data[0x3E] = 0xFF;
|
MMU.fw.data[0x3E] = 0xFF;
|
||||||
MMU_static.fw.data[0x3F] = 0xFF;
|
MMU.fw.data[0x3F] = 0xFF;
|
||||||
|
|
||||||
/* RF related */
|
/* RF related */
|
||||||
MMU_static.fw.data[0x40] = 0x02;
|
MMU.fw.data[0x40] = 0x02;
|
||||||
MMU_static.fw.data[0x41] = 0x18;
|
MMU.fw.data[0x41] = 0x18;
|
||||||
MMU_static.fw.data[0x42] = 0x0C;
|
MMU.fw.data[0x42] = 0x0C;
|
||||||
|
|
||||||
MMU_static.fw.data[0x43] = 0x01;
|
MMU.fw.data[0x43] = 0x01;
|
||||||
|
|
||||||
/* Wifi I/O init values */
|
/* Wifi I/O init values */
|
||||||
memcpy((MMU_static.fw.data + 0x44), FW_WIFIInit, sizeof(FW_WIFIInit));
|
memcpy((MMU.fw.data + 0x44), FW_WIFIInit, sizeof(FW_WIFIInit));
|
||||||
|
|
||||||
/* Wifi BB init values */
|
/* Wifi BB init values */
|
||||||
memcpy((MMU_static.fw.data + 0x64), FW_BBInit, sizeof(FW_BBInit));
|
memcpy((MMU.fw.data + 0x64), FW_BBInit, sizeof(FW_BBInit));
|
||||||
|
|
||||||
/* Wifi RF init values */
|
/* Wifi RF init values */
|
||||||
memcpy((MMU_static.fw.data + 0xCE), FW_RFInit, sizeof(FW_RFInit));
|
memcpy((MMU.fw.data + 0xCE), FW_RFInit, sizeof(FW_RFInit));
|
||||||
|
|
||||||
/* Wifi channel-related init values */
|
/* Wifi channel-related init values */
|
||||||
memcpy((MMU_static.fw.data + 0xF2), FW_RFChannel, sizeof(FW_RFChannel));
|
memcpy((MMU.fw.data + 0xF2), FW_RFChannel, sizeof(FW_RFChannel));
|
||||||
memcpy((MMU_static.fw.data + 0x146), FW_BBChannel, sizeof(FW_BBChannel));
|
memcpy((MMU.fw.data + 0x146), FW_BBChannel, sizeof(FW_BBChannel));
|
||||||
memset((MMU_static.fw.data + 0x154), 0x10, 0xE);
|
memset((MMU.fw.data + 0x154), 0x10, 0xE);
|
||||||
|
|
||||||
/* WFC profiles */
|
/* WFC profiles */
|
||||||
memcpy((MMU_static.fw.data + 0x3FA40), &FW_WFCProfile1, sizeof(FW_WFCProfile));
|
memcpy((MMU.fw.data + 0x3FA40), &FW_WFCProfile1, sizeof(FW_WFCProfile));
|
||||||
memcpy((MMU_static.fw.data + 0x3FB40), &FW_WFCProfile2, sizeof(FW_WFCProfile));
|
memcpy((MMU.fw.data + 0x3FB40), &FW_WFCProfile2, sizeof(FW_WFCProfile));
|
||||||
memcpy((MMU_static.fw.data + 0x3FC40), &FW_WFCProfile3, sizeof(FW_WFCProfile));
|
memcpy((MMU.fw.data + 0x3FC40), &FW_WFCProfile3, sizeof(FW_WFCProfile));
|
||||||
(*(u16*)(MMU_static.fw.data + 0x3FAFE)) = (u16)calc_CRC16(0, (MMU_static.fw.data + 0x3FA00), 0xFE);
|
(*(u16*)(MMU.fw.data + 0x3FAFE)) = (u16)calc_CRC16(0, (MMU.fw.data + 0x3FA00), 0xFE);
|
||||||
(*(u16*)(MMU_static.fw.data + 0x3FBFE)) = (u16)calc_CRC16(0, (MMU_static.fw.data + 0x3FB00), 0xFE);
|
(*(u16*)(MMU.fw.data + 0x3FBFE)) = (u16)calc_CRC16(0, (MMU.fw.data + 0x3FB00), 0xFE);
|
||||||
(*(u16*)(MMU_static.fw.data + 0x3FCFE)) = (u16)calc_CRC16(0, (MMU_static.fw.data + 0x3FC00), 0xFE);
|
(*(u16*)(MMU.fw.data + 0x3FCFE)) = (u16)calc_CRC16(0, (MMU.fw.data + 0x3FC00), 0xFE);
|
||||||
|
|
||||||
|
|
||||||
MMU_static.fw.data[0x162] = 0x19;
|
MMU.fw.data[0x162] = 0x19;
|
||||||
memset((MMU_static.fw.data + 0x163), 0xFF, 0x9D);
|
memset((MMU.fw.data + 0x163), 0xFF, 0x9D);
|
||||||
|
|
||||||
/* Wifi settings CRC16 */
|
/* Wifi settings CRC16 */
|
||||||
(*(u16*)(MMU_static.fw.data + 0x2A)) = calc_CRC16(0, (MMU_static.fw.data + 0x2C), 0x138);
|
(*(u16*)(MMU.fw.data + 0x2A)) = calc_CRC16(0, (MMU.fw.data + 0x2C), 0x138);
|
||||||
|
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
@ -1554,26 +1546,26 @@ int NDS_LoadFirmware(const char *filename)
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
//FILE *file;
|
//FILE *file;
|
||||||
|
|
||||||
if ((MMU_static.fw.fp = fopen(filename, "rb+")) == NULL)
|
if ((MMU.fw.fp = fopen(filename, "rb+")) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
fseek(MMU_static.fw.fp, 0, SEEK_END);
|
fseek(MMU.fw.fp, 0, SEEK_END);
|
||||||
size = ftell(MMU_static.fw.fp);
|
size = ftell(MMU.fw.fp);
|
||||||
fseek(MMU_static.fw.fp, 0, SEEK_SET);
|
fseek(MMU.fw.fp, 0, SEEK_SET);
|
||||||
|
|
||||||
if(size > MMU_static.fw.size)
|
if(size > MMU.fw.size)
|
||||||
{
|
{
|
||||||
fclose(MMU_static.fw.fp);
|
fclose(MMU.fw.fp);
|
||||||
fw_success = FALSE;
|
fw_success = FALSE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = fread(MMU_static.fw.data, size, 1, MMU_static.fw.fp);
|
i = fread(MMU.fw.data, size, 1, MMU.fw.fp);
|
||||||
//fclose(file);
|
//fclose(file);
|
||||||
|
|
||||||
INFO("Firmware: decrypting NDS firmware %s...\n", filename);
|
INFO("Firmware: decrypting NDS firmware %s...\n", filename);
|
||||||
|
|
||||||
if(decryptFirmware(MMU_static.fw.data) == FALSE)
|
if(decryptFirmware(MMU.fw.data) == FALSE)
|
||||||
{
|
{
|
||||||
INFO("Firmware: decryption failed.\n");
|
INFO("Firmware: decryption failed.\n");
|
||||||
fw_success = FALSE;
|
fw_success = FALSE;
|
||||||
|
@ -1728,7 +1720,6 @@ u32 NDS_exec(s32 nb)
|
||||||
{
|
{
|
||||||
if(!nds.lignerendu)
|
if(!nds.lignerendu)
|
||||||
{
|
{
|
||||||
printf("%04d %03d: %08X\n",currFrameCounter,nds.VCount,NDS_ARM9.instruct_adr);
|
|
||||||
T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 2);
|
T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 2);
|
||||||
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 2);
|
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 2);
|
||||||
NDS_ARM9HBlankInt();
|
NDS_ARM9HBlankInt();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "Disassembler.h"
|
#include "Disassembler.h"
|
||||||
#include "ndssystem.h"
|
|
||||||
|
|
||||||
template<u32> static u32 armcpu_prefetch();
|
template<u32> static u32 armcpu_prefetch();
|
||||||
|
|
||||||
|
@ -179,12 +179,6 @@ int armcpu_new( armcpu_t *armcpu, u32 id,
|
||||||
int armcpu_new( armcpu_t *armcpu, u32 id)
|
int armcpu_new( armcpu_t *armcpu, u32 id)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(armcpu->initialized) return 0;
|
|
||||||
armcpu->initialized = true;
|
|
||||||
|
|
||||||
for(int i = 0; i < 16; ++i)
|
|
||||||
armcpu->coproc[i] = NULL;
|
|
||||||
|
|
||||||
armcpu->proc_ID = id;
|
armcpu->proc_ID = id;
|
||||||
|
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
|
@ -214,15 +208,6 @@ void armcpu_init(armcpu_t *armcpu, u32 adr)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
//TODO - breaks gdb stub
|
|
||||||
if(armcpu->coproc[15]) free(armcpu->coproc[15]);
|
|
||||||
u32 proc_ID = armcpu->proc_ID;
|
|
||||||
//memset(armcpu,0,sizeof(armcpu_t));
|
|
||||||
armcpu->initialized = true;
|
|
||||||
armcpu->proc_ID = proc_ID;
|
|
||||||
|
|
||||||
armcpu->coproc[15] = (armcp_t*)armcp15_new(armcpu);
|
|
||||||
|
|
||||||
armcpu->LDTBit = (armcpu->proc_ID==0); //Si ARM9 utiliser le syte v5 pour le load
|
armcpu->LDTBit = (armcpu->proc_ID==0); //Si ARM9 utiliser le syte v5 pour le load
|
||||||
armcpu->intVector = 0xFFFF0000 * (armcpu->proc_ID==0);
|
armcpu->intVector = 0xFFFF0000 * (armcpu->proc_ID==0);
|
||||||
armcpu->waitIRQ = FALSE;
|
armcpu->waitIRQ = FALSE;
|
||||||
|
@ -230,9 +215,17 @@ void armcpu_init(armcpu_t *armcpu, u32 adr)
|
||||||
|
|
||||||
armcpu->newIrqFlags = 0;
|
armcpu->newIrqFlags = 0;
|
||||||
|
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
armcpu->irq_flag = 0;
|
armcpu->irq_flag = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(armcpu->coproc[15]) free(armcpu->coproc[15]);
|
||||||
|
|
||||||
|
for(i = 0; i < 15; ++i)
|
||||||
|
{
|
||||||
|
armcpu->R[i] = 0;
|
||||||
|
armcpu->coproc[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
armcpu->CPSR.val = armcpu->SPSR.val = SYS;
|
armcpu->CPSR.val = armcpu->SPSR.val = SYS;
|
||||||
|
|
||||||
|
@ -245,18 +238,20 @@ void armcpu_init(armcpu_t *armcpu, u32 adr)
|
||||||
|
|
||||||
armcpu->SPSR_svc.val = armcpu->SPSR_abt.val = armcpu->SPSR_und.val = armcpu->SPSR_irq.val = armcpu->SPSR_fiq.val = 0;
|
armcpu->SPSR_svc.val = armcpu->SPSR_abt.val = armcpu->SPSR_und.val = armcpu->SPSR_irq.val = armcpu->SPSR_fiq.val = 0;
|
||||||
|
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
armcpu->instruct_adr = adr;
|
armcpu->instruct_adr = adr;
|
||||||
armcpu->R[15] = adr + 8;
|
armcpu->R[15] = adr + 8;
|
||||||
#else
|
#else
|
||||||
armcpu->R[15] = adr;
|
armcpu->R[15] = adr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
armcpu->next_instruction = adr;
|
armcpu->next_instruction = adr;
|
||||||
|
|
||||||
#ifndef GDB_STUB
|
armcpu->coproc[15] = (armcp_t*)armcp15_new(armcpu);
|
||||||
|
|
||||||
|
#ifndef GDB_STUB
|
||||||
armcpu_prefetch(armcpu);
|
armcpu_prefetch(armcpu);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 armcpu_switchMode(armcpu_t *armcpu, u8 mode)
|
u32 armcpu_switchMode(armcpu_t *armcpu, u8 mode)
|
||||||
|
@ -485,8 +480,6 @@ BOOL armcpu_irqException(armcpu_t *armcpu)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WANTASMLISTING
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
armcpu_flagIrq( armcpu_t *armcpu) {
|
armcpu_flagIrq( armcpu_t *armcpu) {
|
||||||
if(armcpu->CPSR.bits.I) return FALSE;
|
if(armcpu->CPSR.bits.I) return FALSE;
|
||||||
|
@ -531,13 +524,9 @@ u32 armcpu_exec()
|
||||||
{
|
{
|
||||||
if(PROCNUM==0) {
|
if(PROCNUM==0) {
|
||||||
#ifdef WANTASMLISTING
|
#ifdef WANTASMLISTING
|
||||||
extern int currFrameCounter;
|
|
||||||
char txt[128];
|
char txt[128];
|
||||||
if(currFrameCounter>26)
|
des_arm_instructions_set[INSTRUCTION_INDEX(ARMPROC.instruction)](ARMPROC.instruct_adr,ARMPROC.instruction,txt);
|
||||||
{
|
printf("%X: %X - %s\n", ARMPROC.instruct_adr,ARMPROC.instruction, txt);
|
||||||
// des_arm_instructions_set[INSTRUCTION_INDEX(ARMPROC.instruction)](ARMPROC.instruct_adr,ARMPROC.instruction,txt);
|
|
||||||
// printf("%04d %03d %08d: %X: %X - %s\n", currFrameCounter,nds.VCount,nds.cycles, ARMPROC.instruct_adr,ARMPROC.instruction, txt);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
c += arm_instructions_set_0[INSTRUCTION_INDEX(ARMPROC.instruction)]();
|
c += arm_instructions_set_0[INSTRUCTION_INDEX(ARMPROC.instruction)]();
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,13 +156,8 @@ struct armcpu_ctrl_iface {
|
||||||
|
|
||||||
typedef void* armcp_t;
|
typedef void* armcp_t;
|
||||||
|
|
||||||
struct armcpu_t
|
typedef struct armcpu_t
|
||||||
{
|
{
|
||||||
armcpu_t()
|
|
||||||
: initialized(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool initialized;
|
|
||||||
u32 proc_ID;
|
u32 proc_ID;
|
||||||
u32 instruction; //4
|
u32 instruction; //4
|
||||||
u32 instruct_adr; //8
|
u32 instruct_adr; //8
|
||||||
|
@ -212,7 +207,7 @@ struct armcpu_t
|
||||||
/** the ctrl interface */
|
/** the ctrl interface */
|
||||||
struct armcpu_ctrl_iface ctrl_iface;
|
struct armcpu_ctrl_iface ctrl_iface;
|
||||||
#endif
|
#endif
|
||||||
};
|
} armcpu_t;
|
||||||
|
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
int armcpu_new( armcpu_t *armcpu, u32 id, struct armcpu_memory_iface *mem_if,
|
int armcpu_new( armcpu_t *armcpu, u32 id, struct armcpu_memory_iface *mem_if,
|
||||||
|
|
|
@ -218,11 +218,11 @@ SFORMAT SF_MMU[]={
|
||||||
//we are skipping the firmware, because we really don't want to save the firmware to the savestate
|
//we are skipping the firmware, because we really don't want to save the firmware to the savestate
|
||||||
//but, we will need to think about the philosophy of this.
|
//but, we will need to think about the philosophy of this.
|
||||||
//should we perhaps hash the current firmware and save it, so that we can match it against the loader's firmware?
|
//should we perhaps hash the current firmware and save it, so that we can match it against the loader's firmware?
|
||||||
{ "BUCO", 1, 1, &MMU_static.bupmem.com},
|
{ "BUCO", 1, 1, &MMU.bupmem.com},
|
||||||
{ "BUAD", 4, 1, &MMU_static.bupmem.addr},
|
{ "BUAD", 4, 1, &MMU.bupmem.addr},
|
||||||
{ "BUAS", 1, 1, &MMU_static.bupmem.addr_shift},
|
{ "BUAS", 1, 1, &MMU.bupmem.addr_shift},
|
||||||
{ "BUAZ", 1, 1, &MMU_static.bupmem.addr_size},
|
{ "BUAZ", 1, 1, &MMU.bupmem.addr_size},
|
||||||
{ "BUWE", 4, 1, &MMU_static.bupmem.write_enable},
|
{ "BUWE", 4, 1, &MMU.bupmem.write_enable},
|
||||||
//writeable_buffer ???
|
//writeable_buffer ???
|
||||||
//end memory chips
|
//end memory chips
|
||||||
|
|
||||||
|
@ -257,9 +257,9 @@ static void mmu_savestate(std::ostream* os)
|
||||||
//version
|
//version
|
||||||
write32le(1,os);
|
write32le(1,os);
|
||||||
|
|
||||||
write32le(MMU_static.bupmem.type,os);
|
write32le(MMU.bupmem.type,os);
|
||||||
write32le(MMU_static.bupmem.size,os);
|
write32le(MMU.bupmem.size,os);
|
||||||
os->write((char*)MMU_static.bupmem.data,MMU_static.bupmem.size);
|
os->write((char*)MMU.bupmem.data,MMU.bupmem.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool mmu_loadstate(std::istream* is, int size)
|
static bool mmu_loadstate(std::istream* is, int size)
|
||||||
|
@ -277,8 +277,8 @@ static bool mmu_loadstate(std::istream* is, int size)
|
||||||
//it would silently fail if there was a size mismatch
|
//it would silently fail if there was a size mismatch
|
||||||
SAV_silent_fail_flag = true;
|
SAV_silent_fail_flag = true;
|
||||||
if(read32le(&bupmem_size,is) != 1) return false;
|
if(read32le(&bupmem_size,is) != 1) return false;
|
||||||
//if(bupmem_size != MMU_static.bupmem.size) return false; //mismatch between current initialized and saved size
|
//if(bupmem_size != MMU.bupmem.size) return false; //mismatch between current initialized and saved size
|
||||||
mc_realloc(&MMU_static.bupmem,MC_TYPE_AUTODETECT,bupmem_size);
|
mc_realloc(&MMU.bupmem,MC_TYPE_AUTODETECT,bupmem_size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -286,10 +286,10 @@ static bool mmu_loadstate(std::istream* is, int size)
|
||||||
int bupmem_type;
|
int bupmem_type;
|
||||||
if(read32le(&bupmem_type,is) != 1) return false;
|
if(read32le(&bupmem_type,is) != 1) return false;
|
||||||
if(read32le(&bupmem_size,is) != 1) return false;
|
if(read32le(&bupmem_size,is) != 1) return false;
|
||||||
mc_realloc(&MMU_static.bupmem,bupmem_type,bupmem_size);
|
mc_realloc(&MMU.bupmem,bupmem_type,bupmem_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
is->read((char*)MMU_static.bupmem.data,bupmem_size);
|
is->read((char*)MMU.bupmem.data,bupmem_size);
|
||||||
if(is->fail()) return false;
|
if(is->fail()) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -893,9 +893,6 @@ TEMPLATE static u32 FASTCALL OP_B_COND()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_SWI_THUMB()
|
TEMPLATE static u32 FASTCALL OP_SWI_THUMB()
|
||||||
{
|
{
|
||||||
if(cpu->proc_ID==0) {
|
|
||||||
int zzz=9;
|
|
||||||
}
|
|
||||||
if(cpu->swi_tab) {
|
if(cpu->swi_tab) {
|
||||||
//zero 25-dec-2008 - in arm, we were masking to 0x1F.
|
//zero 25-dec-2008 - in arm, we were masking to 0x1F.
|
||||||
//this is probably safer since an invalid opcode could crash the emu
|
//this is probably safer since an invalid opcode could crash the emu
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
|
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
|
||||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;BETA_VERSION;SPU_INTERPOLATE;HAVE_LIBZ;HAVE_LIBZZIP;NOMINMAX;DEBUG;WANTPROGINFO;EXPERIMENTAL_WIFI"
|
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;BETA_VERSION;SPU_INTERPOLATE;HAVE_LIBZ;HAVE_LIBZZIP;NOMINMAX;DEBUG;WANTPROGINFO;EXPERIMENTAL_WIFI"
|
||||||
ExceptionHandling="1"
|
ExceptionHandling="1"
|
||||||
BasicRuntimeChecks="0"
|
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
FloatingPointModel="2"
|
FloatingPointModel="2"
|
||||||
|
|
|
@ -54,8 +54,7 @@
|
||||||
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
|
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
|
||||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;EXPERIMENTAL_WIFI;HAVE_LIBZZIP;HAVE_LIBZ"
|
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;EXPERIMENTAL_WIFI;HAVE_LIBZZIP;HAVE_LIBZ"
|
||||||
ExceptionHandling="1"
|
ExceptionHandling="1"
|
||||||
BasicRuntimeChecks="3"
|
BufferSecurityCheck="false"
|
||||||
BufferSecurityCheck="true"
|
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
FloatingPointModel="2"
|
FloatingPointModel="2"
|
||||||
DebugInformationFormat="4"
|
DebugInformationFormat="4"
|
||||||
|
|
|
@ -87,35 +87,35 @@ LRESULT GInfo_Paint(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
hdc = BeginPaint(hDlg, &ps);
|
hdc = BeginPaint(hDlg, &ps);
|
||||||
|
|
||||||
icontitleOffset = T1ReadLong(MMU_static.CART_ROM, 0x68);
|
icontitleOffset = T1ReadLong(MMU.CART_ROM, 0x68);
|
||||||
|
|
||||||
if(icontitleOffset >= 0x8000)
|
if(icontitleOffset >= 0x8000)
|
||||||
{
|
{
|
||||||
utf16text = (wchar_t*)(MMU_static.CART_ROM + icontitleOffset + 0x240 + (0x100 * win_fw_config.language));
|
utf16text = (wchar_t*)(MMU.CART_ROM + icontitleOffset + 0x240 + (0x100 * win_fw_config.language));
|
||||||
sprintf(text, "%ws", utf16text);
|
sprintf(text, "%ws", utf16text);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLE), text);
|
||||||
|
|
||||||
utf16text = (wchar_t*)(MMU_static.CART_ROM + icontitleOffset + 0x240);
|
utf16text = (wchar_t*)(MMU.CART_ROM + icontitleOffset + 0x240);
|
||||||
sprintf(text, "%ws", utf16text);
|
sprintf(text, "%ws", utf16text);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEJP), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEJP), text);
|
||||||
|
|
||||||
utf16text = (wchar_t*)(MMU_static.CART_ROM + icontitleOffset + 0x340);
|
utf16text = (wchar_t*)(MMU.CART_ROM + icontitleOffset + 0x340);
|
||||||
sprintf(text, "%ws", utf16text);
|
sprintf(text, "%ws", utf16text);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEEN), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEEN), text);
|
||||||
|
|
||||||
utf16text = (wchar_t*)(MMU_static.CART_ROM + icontitleOffset + 0x440);
|
utf16text = (wchar_t*)(MMU.CART_ROM + icontitleOffset + 0x440);
|
||||||
sprintf(text, "%ws", utf16text);
|
sprintf(text, "%ws", utf16text);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEFR), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEFR), text);
|
||||||
|
|
||||||
utf16text = (wchar_t*)(MMU_static.CART_ROM + icontitleOffset + 0x540);
|
utf16text = (wchar_t*)(MMU.CART_ROM + icontitleOffset + 0x540);
|
||||||
sprintf(text, "%ws", utf16text);
|
sprintf(text, "%ws", utf16text);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEGE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEGE), text);
|
||||||
|
|
||||||
utf16text = (wchar_t*)(MMU_static.CART_ROM + icontitleOffset + 0x640);
|
utf16text = (wchar_t*)(MMU.CART_ROM + icontitleOffset + 0x640);
|
||||||
sprintf(text, "%ws", utf16text);
|
sprintf(text, "%ws", utf16text);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEIT), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLEIT), text);
|
||||||
|
|
||||||
utf16text = (wchar_t*)(MMU_static.CART_ROM + icontitleOffset + 0x740);
|
utf16text = (wchar_t*)(MMU.CART_ROM + icontitleOffset + 0x740);
|
||||||
sprintf(text, "%ws", utf16text);
|
sprintf(text, "%ws", utf16text);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLESP), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_TITLESP), text);
|
||||||
}
|
}
|
||||||
|
@ -132,69 +132,69 @@ LRESULT GInfo_Paint(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
memcpy(text, MMU_static.CART_ROM, 12);
|
memcpy(text, MMU.CART_ROM, 12);
|
||||||
text[12] = '\0';
|
text[12] = '\0';
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_GAMETITLE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_GAMETITLE), text);
|
||||||
|
|
||||||
memcpy(text, (MMU_static.CART_ROM+0xC), 4);
|
memcpy(text, (MMU.CART_ROM+0xC), 4);
|
||||||
text[4] = '\0';
|
text[4] = '\0';
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_GAMECODE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_GAMECODE), text);
|
||||||
|
|
||||||
memcpy(text, (MMU_static.CART_ROM+0x10), 2);
|
memcpy(text, (MMU.CART_ROM+0x10), 2);
|
||||||
text[2] = '\0';
|
text[2] = '\0';
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_MAKERCODE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_MAKERCODE), text);
|
||||||
|
|
||||||
val = T1ReadByte(MMU_static.CART_ROM, 0x14);
|
val = T1ReadByte(MMU.CART_ROM, 0x14);
|
||||||
sprintf(text, "%i kilobytes", (0x80 << val));
|
sprintf(text, "%i kilobytes", (0x80 << val));
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_CHIPSIZE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_CHIPSIZE), text);
|
||||||
|
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x20);
|
val = T1ReadLong(MMU.CART_ROM, 0x20);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM9ROM), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM9ROM), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x24);
|
val = T1ReadLong(MMU.CART_ROM, 0x24);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM9ENTRY), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM9ENTRY), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x28);
|
val = T1ReadLong(MMU.CART_ROM, 0x28);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM9START), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM9START), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x2C);
|
val = T1ReadLong(MMU.CART_ROM, 0x2C);
|
||||||
sprintf(text, "%i bytes", val);
|
sprintf(text, "%i bytes", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM9SIZE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM9SIZE), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x30);
|
val = T1ReadLong(MMU.CART_ROM, 0x30);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM7ROM), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM7ROM), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x34);
|
val = T1ReadLong(MMU.CART_ROM, 0x34);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM7ENTRY), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM7ENTRY), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x38);
|
val = T1ReadLong(MMU.CART_ROM, 0x38);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM7START), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM7START), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x3C);
|
val = T1ReadLong(MMU.CART_ROM, 0x3C);
|
||||||
sprintf(text, "%i bytes", val);
|
sprintf(text, "%i bytes", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM7SIZE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ARM7SIZE), text);
|
||||||
|
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x40);
|
val = T1ReadLong(MMU.CART_ROM, 0x40);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_FNTOFS), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_FNTOFS), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x44);
|
val = T1ReadLong(MMU.CART_ROM, 0x44);
|
||||||
sprintf(text, "%i bytes", val);
|
sprintf(text, "%i bytes", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_FNTSIZE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_FNTSIZE), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x48);
|
val = T1ReadLong(MMU.CART_ROM, 0x48);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_FATOFS), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_FATOFS), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x4C);
|
val = T1ReadLong(MMU.CART_ROM, 0x4C);
|
||||||
sprintf(text, "%i bytes", val);
|
sprintf(text, "%i bytes", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_FATSIZE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_FATSIZE), text);
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ LRESULT GInfo_Paint(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
||||||
sprintf(text, "0x%08X", icontitleOffset);
|
sprintf(text, "0x%08X", icontitleOffset);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_ICONTITLEOFS), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_ICONTITLEOFS), text);
|
||||||
|
|
||||||
val = T1ReadLong(MMU_static.CART_ROM, 0x80);
|
val = T1ReadLong(MMU.CART_ROM, 0x80);
|
||||||
sprintf(text, "0x%08X", val);
|
sprintf(text, "0x%08X", val);
|
||||||
SetWindowText(GetDlgItem(hDlg, IDC_GI_USEDROMSIZE), text);
|
SetWindowText(GetDlgItem(hDlg, IDC_GI_USEDROMSIZE), text);
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ LRESULT GInfo_IconBoxPaint(HWND hCtl, WPARAM wParam, LPARAM lParam)
|
||||||
bmph.bV4Width = 32;
|
bmph.bV4Width = 32;
|
||||||
bmph.bV4Height = -32;
|
bmph.bV4Height = -32;
|
||||||
|
|
||||||
icontitleOffset = T1ReadLong(MMU_static.CART_ROM, 0x68);
|
icontitleOffset = T1ReadLong(MMU.CART_ROM, 0x68);
|
||||||
|
|
||||||
if(icontitleOffset >= 0x8000)
|
if(icontitleOffset >= 0x8000)
|
||||||
{
|
{
|
||||||
|
@ -292,14 +292,14 @@ LRESULT GInfo_IconBoxPaint(HWND hCtl, WPARAM wParam, LPARAM lParam)
|
||||||
int tiley = (y % 8);
|
int tiley = (y % 8);
|
||||||
int mapoffset = ((tilenum * 64) + (tiley * 8) + tilex);
|
int mapoffset = ((tilenum * 64) + (tiley * 8) + tilex);
|
||||||
|
|
||||||
u8 val = T1ReadByte(MMU_static.CART_ROM, (icontitleOffset + 0x20 + (mapoffset>>1)));
|
u8 val = T1ReadByte(MMU.CART_ROM, (icontitleOffset + 0x20 + (mapoffset>>1)));
|
||||||
|
|
||||||
if(mapoffset & 1)
|
if(mapoffset & 1)
|
||||||
val = ((val >> 4) & 0xF);
|
val = ((val >> 4) & 0xF);
|
||||||
else
|
else
|
||||||
val = (val & 0xF);
|
val = (val & 0xF);
|
||||||
|
|
||||||
icon[(y * 32) + x] = T1ReadWord(MMU_static.CART_ROM, (icontitleOffset + 0x220 + (val<<1)));
|
icon[(y * 32) + x] = T1ReadWord(MMU.CART_ROM, (icontitleOffset + 0x220 + (val<<1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "ramwatch.h"
|
#include "ramwatch.h"
|
||||||
|
|
||||||
#include "ram_search.h"
|
#include "ram_search.h"
|
||||||
#include "main.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include "ramwatch.h"
|
#include "ramwatch.h"
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "NDSSystem.h"
|
#include "NDSSystem.h"
|
||||||
#include "ramwatch.h"
|
#include "ramwatch.h"
|
||||||
#include "ram_search.h"
|
#include "ram_search.h"
|
||||||
#include "main.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
|
Loading…
Reference in New Issue