tweaks to lag frame
This commit is contained in:
parent
fd09b81b07
commit
e1f77790cc
|
@ -52,9 +52,6 @@
|
||||||
#define ASSERT_UNALIGNED(x)
|
#define ASSERT_UNALIGNED(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int LagFrameFlag=0;
|
|
||||||
|
|
||||||
|
|
||||||
//http://home.utah.edu/~nahaj/factoring/isqrt.c.html
|
//http://home.utah.edu/~nahaj/factoring/isqrt.c.html
|
||||||
static u64 isqrt (u64 x) {
|
static u64 isqrt (u64 x) {
|
||||||
u64 squaredbit, remainder, root;
|
u64 squaredbit, remainder, root;
|
||||||
|
@ -2864,12 +2861,6 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
||||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr&MMU.MMU_MASK[ARMCPU_ARM9][adr>>20], val);
|
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr&MMU.MMU_MASK[ARMCPU_ARM9][adr>>20], val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckLag(u32 adr) {
|
|
||||||
|
|
||||||
if (adr == 0x04000130 || 0x04000136)
|
|
||||||
LagFrameFlag=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//================================================= MMU ARM9 read 08
|
//================================================= MMU ARM9 read 08
|
||||||
u8 FASTCALL _MMU_ARM9_read08(u32 adr)
|
u8 FASTCALL _MMU_ARM9_read08(u32 adr)
|
||||||
{
|
{
|
||||||
|
@ -2891,7 +2882,6 @@ u8 FASTCALL _MMU_ARM9_read08(u32 adr)
|
||||||
if ((adr>=0x9000000)&&(adr<0x9900000))
|
if ((adr>=0x9000000)&&(adr<0x9900000))
|
||||||
return (unsigned char)cflash_read(adr);
|
return (unsigned char)cflash_read(adr);
|
||||||
#endif
|
#endif
|
||||||
CheckLag(adr);
|
|
||||||
|
|
||||||
#ifdef _MMU_DEBUG
|
#ifdef _MMU_DEBUG
|
||||||
mmu_log_debug_ARM9(adr, "(read08) %0x%X",
|
mmu_log_debug_ARM9(adr, "(read08) %0x%X",
|
||||||
|
@ -2926,13 +2916,12 @@ u16 FASTCALL _MMU_ARM9_read16(u32 adr)
|
||||||
|
|
||||||
adr &= 0x0FFFFFFF;
|
adr &= 0x0FFFFFFF;
|
||||||
|
|
||||||
CheckLag(adr);
|
|
||||||
|
|
||||||
if (adr >> 24 == 4)
|
if (adr >> 24 == 4)
|
||||||
{
|
{
|
||||||
/* Address is an IO register */
|
// Address is an IO register
|
||||||
switch(adr)
|
switch(adr)
|
||||||
{
|
{
|
||||||
|
// ============================================= 3D
|
||||||
case 0x04000604:
|
case 0x04000604:
|
||||||
return (gfx3d_GetNumPolys()&2047);
|
return (gfx3d_GetNumPolys()&2047);
|
||||||
case 0x04000606:
|
case 0x04000606:
|
||||||
|
@ -2961,6 +2950,12 @@ u16 FASTCALL _MMU_ARM9_read16(u32 adr)
|
||||||
case REG_TM3CNTL :
|
case REG_TM3CNTL :
|
||||||
return MMU.timer[ARMCPU_ARM9][(adr&0xF)>>2];
|
return MMU.timer[ARMCPU_ARM9][(adr&0xF)>>2];
|
||||||
|
|
||||||
|
case 0x04000130:
|
||||||
|
case 0x04000136:
|
||||||
|
//not sure whether these should trigger from byte reads
|
||||||
|
LagFrameFlag=0;
|
||||||
|
break;
|
||||||
|
|
||||||
case REG_POSTFLG :
|
case REG_POSTFLG :
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -3011,8 +3006,6 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr)
|
||||||
|
|
||||||
adr &= 0x0FFFFFFF;
|
adr &= 0x0FFFFFFF;
|
||||||
|
|
||||||
CheckLag(adr);
|
|
||||||
|
|
||||||
// Address is an IO register
|
// Address is an IO register
|
||||||
if((adr >> 24) == 4)
|
if((adr >> 24) == 4)
|
||||||
{
|
{
|
||||||
|
@ -4015,6 +4008,14 @@ u16 FASTCALL _MMU_ARM7_read16(u32 adr)
|
||||||
case REG_TM3CNTL :
|
case REG_TM3CNTL :
|
||||||
return MMU.timer[ARMCPU_ARM7][(adr&0xF)>>2];
|
return MMU.timer[ARMCPU_ARM7][(adr&0xF)>>2];
|
||||||
|
|
||||||
|
|
||||||
|
case 0x04000130:
|
||||||
|
case 0x04000136:
|
||||||
|
//here is an example of what not to do:
|
||||||
|
//since the arm7 polls this every frame, we shouldnt count this as an input check
|
||||||
|
//LagFrameFlag=0;
|
||||||
|
break;
|
||||||
|
|
||||||
case REG_POSTFLG :
|
case REG_POSTFLG :
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,6 @@ struct MMU_struct {
|
||||||
|
|
||||||
extern MMU_struct MMU;
|
extern MMU_struct MMU;
|
||||||
|
|
||||||
extern int LagFrameFlag;
|
|
||||||
|
|
||||||
struct armcpu_memory_iface {
|
struct armcpu_memory_iface {
|
||||||
/** the 32 bit instruction prefetch */
|
/** the 32 bit instruction prefetch */
|
||||||
|
|
|
@ -65,6 +65,8 @@ BOOL fw_success = FALSE;
|
||||||
NDSSystem nds;
|
NDSSystem nds;
|
||||||
|
|
||||||
int lagframecounter=0;
|
int lagframecounter=0;
|
||||||
|
int LagFrameFlag=0;
|
||||||
|
int lastLag=0;
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
/* FIRMWARE DECRYPTION */
|
/* FIRMWARE DECRYPTION */
|
||||||
|
@ -1422,6 +1424,7 @@ u32 NDS_exec(s32 nb)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
//TODO - since NDS_exec is not necessarily called one frame at a time, this could be wrong.
|
||||||
LagFrameFlag=1;
|
LagFrameFlag=1;
|
||||||
|
|
||||||
nb += nds.cycles;//(nds.cycles>>26)<<26;
|
nb += nds.cycles;//(nds.cycles>>26)<<26;
|
||||||
|
@ -2213,7 +2216,14 @@ u32 NDS_exec(s32 nb)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(LagFrameFlag)
|
if(LagFrameFlag)
|
||||||
|
{
|
||||||
lagframecounter++;
|
lagframecounter++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastLag = lagframecounter;
|
||||||
|
lagframecounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return nds.cycles;
|
return nds.cycles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,6 +331,9 @@ public:
|
||||||
extern Driver* driver;
|
extern Driver* driver;
|
||||||
|
|
||||||
extern std::string InputDisplayString;
|
extern std::string InputDisplayString;
|
||||||
|
extern int LagFrameFlag;
|
||||||
|
extern int lastLag;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1015,7 +1015,7 @@ DWORD WINAPI run()
|
||||||
frameCounter++;
|
frameCounter++;
|
||||||
if (frameCounterDisplay) osd->addFixed(0, 25, "%d",frameCounter);
|
if (frameCounterDisplay) osd->addFixed(0, 25, "%d",frameCounter);
|
||||||
if (ShowInputDisplay) osd->addFixed(0, 45, "%s",InputDisplayString.c_str());
|
if (ShowInputDisplay) osd->addFixed(0, 45, "%s",InputDisplayString.c_str());
|
||||||
if (ShowLagFrameCounter) osd->addFixed(0, 65, "%d",lagframecounter);
|
if (ShowLagFrameCounter) osd->addFixed(0, 65, "%d",lastLag);
|
||||||
DisplayMessage();
|
DisplayMessage();
|
||||||
CheckMessages();
|
CheckMessages();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue