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

View File

@ -1508,6 +1508,9 @@ int _main()
GetPrivateProfileString("Watches", str, "", &rw_recent_files[i][0], 1024, IniName); 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 //i think we should override the ini file with anything from the commandline
CommandLine cmdline; CommandLine cmdline;
cmdline.loadCommonOptions(); cmdline.loadCommonOptions();
@ -2685,6 +2688,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
WritePrivateProfileString("Watches", str, &rw_recent_files[i][0], IniName); WritePrivateProfileString("Watches", str, &rw_recent_files[i][0], IniName);
} }
extern bool fixCycleCount;
WritePrivateProfileInt("Timings", "LagReduction", fixCycleCount, IniName);
ExitRunLoop(); ExitRunLoop();
} }
else else