add hidden LagReduction option

This commit is contained in:
gocha 2009-09-06 00:16:20 +00:00
parent 948f7154fc
commit 31d5f080dc
2 changed files with 29 additions and 20 deletions

View File

@ -494,46 +494,49 @@ armcpu_flagIrq( armcpu_t *armcpu) {
return TRUE;
}
bool fixCycleCount = false;
template<int PROCNUM>
u32 armcpu_exec()
{
u32 c = 1;
u32 c = fixCycleCount ? 0 : 1;
//this assert is annoying. but sometimes it is handy.
//assert(ARMPROC.instruct_adr!=0x00000000);
//this assert is annoying. but sometimes it is handy.
//assert(ARMPROC.instruct_adr!=0x00000000);
#ifdef GDB_STUB
if (ARMPROC.stalled)
return STALLED_CYCLE_COUNT;
if (ARMPROC.stalled)
return STALLED_CYCLE_COUNT;
/* check for interrupts */
if ( ARMPROC.irq_flag) {
armcpu_irqException( &ARMPROC);
}
/* check for interrupts */
if ( ARMPROC.irq_flag) {
armcpu_irqException( &ARMPROC);
}
c = armcpu_prefetch(&ARMPROC);
c += armcpu_prefetch(&ARMPROC);
if ( ARMPROC.stalled) {
return c;
}
if ( ARMPROC.stalled) {
return c;
}
#endif
if(ARMPROC.CPSR.bits.T == 0)
{
if((TEST_COND(CONDITION(ARMPROC.instruction), CODE(ARMPROC.instruction), ARMPROC.CPSR)))
if((TEST_COND(CONDITION(ARMPROC.instruction), CODE(ARMPROC.instruction), ARMPROC.CPSR)))
{
if(PROCNUM==0) {
#ifdef WANTASMLISTING
char txt[128];
char txt[128];
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);
#endif
c += arm_instructions_set_0[INSTRUCTION_INDEX(ARMPROC.instruction)]();
}
}
else
c += arm_instructions_set_1[INSTRUCTION_INDEX(ARMPROC.instruction)]();
}
else if (fixCycleCount)
c++;
#ifdef GDB_STUB
if ( ARMPROC.post_ex_fn != NULL) {
/* call the external post execute function */
@ -552,10 +555,10 @@ u32 armcpu_exec()
c += thumb_instructions_set_1[ARMPROC.instruction>>6]();
#ifdef GDB_STUB
if ( ARMPROC.post_ex_fn != NULL) {
/* call the external post execute function */
ARMPROC.post_ex_fn( ARMPROC.post_ex_fn_data, ARMPROC.instruct_adr, 1);
}
if ( ARMPROC.post_ex_fn != NULL) {
/* call the external post execute function */
ARMPROC.post_ex_fn( ARMPROC.post_ex_fn_data, ARMPROC.instruct_adr, 1);
}
#else
c += armcpu_prefetch<PROCNUM>();
#endif

View File

@ -1508,6 +1508,9 @@ int _main()
GetPrivateProfileString("Watches", str, "", &rw_recent_files[i][0], 1024, IniName);
}
extern bool fixCycleCount;
fixCycleCount = GetPrivateProfileInt("Timings", "LagReduction", 0, IniName) != 0;
//i think we should override the ini file with anything from the commandline
CommandLine cmdline;
cmdline.loadCommonOptions();
@ -2684,6 +2687,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
sprintf(str, "Recent Watch %d", i+1);
WritePrivateProfileString("Watches", str, &rw_recent_files[i][0], IniName);
}
extern bool fixCycleCount;
WritePrivateProfileInt("Timings", "LagReduction", fixCycleCount, IniName);
ExitRunLoop();
}