fix a couple of thumb opcode regressions.

allow ds, ds/dsi hybrid and dsi only nds files to be opened.
This commit is contained in:
normmatt234 2010-04-06 16:20:48 +00:00
parent 3eb9de4614
commit d2d18907c3
2 changed files with 9 additions and 3 deletions

View File

@ -784,7 +784,10 @@ TEMPLATE static u32 FASTCALL OP_STR_IMM_OFF(const u32 i)
TEMPLATE static u32 FASTCALL OP_LDR_IMM_OFF(const u32 i)
{
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>4)&0x7C);
cpu->R[REG_NUM(i, 0)] = READ32(cpu->mem_if->data, adr);
u32 tempValue = READ32(cpu->mem_if->data, adr);
adr = (adr&3)*8;
tempValue = (tempValue>>adr) | (tempValue<<(32-adr));
cpu->R[REG_NUM(i, 0)] = tempValue;
return MMU_aluMemAccessCycles<PROCNUM,32,MMU_AD_READ>(3, adr);
}
@ -801,7 +804,10 @@ TEMPLATE static u32 FASTCALL OP_STR_REG_OFF(const u32 i)
TEMPLATE static u32 FASTCALL OP_LDR_REG_OFF(const u32 i)
{
u32 adr = (cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]);
cpu->R[REG_NUM(i, 0)] = READ32(cpu->mem_if->data, adr);
u32 tempValue = READ32(cpu->mem_if->data, adr);
adr = (adr&3)*8;
tempValue = (tempValue>>adr) | (tempValue<<(32-adr));
cpu->R[REG_NUM(i, 0)] = tempValue;
return MMU_aluMemAccessCycles<PROCNUM,32,MMU_AD_READ>(3, adr);
}

View File

@ -71,7 +71,7 @@ int DetectRomType(const Header& header, char* romdata)
unsigned int * data = (unsigned int*)(romdata + 0x4000);
//this is attempting to check for an utterly invalid nds header
if(header.unitcode != 0 && header.unitcode != 2) return ROMTYPE_INVALID;
if(header.unitcode < 0 && header.unitcode > 3) return ROMTYPE_INVALID;
if (header.arm9_rom_offset < 0x4000) return ROMTYPE_HOMEBREW;
if (data[0] == 0x00000000 && data[1] == 0x00000000) return ROMTYPE_MULTIBOOT;