void dynarec(unsigned int address){ while(!stop){ refresh_stat(); start_section(TRAMP_SECTION); PowerPC_block* dst_block = blocks_get(address>>12); unsigned long paddr = update_invalid_addr(address); /* sprintf(txtbuffer, "trampolining to 0x%08x\n", address); DEBUG_print(txtbuffer, DBG_USBGECKO); */ if(!paddr){ link_branch = NULL; address = interp_addr; dst_block = blocks_get(address>>12); paddr = update_invalid_addr(address); } if(!dst_block){ /*sprintf(txtbuffer, "block at %08x doesn't exist\n", address&~0xFFF); DEBUG_print(txtbuffer, DBG_USBGECKO);*/ dst_block = calloc(1, sizeof(PowerPC_block)); blocks_set(address>>12, dst_block); dst_block->start_address = address & ~0xFFF; dst_block->end_address = (address & ~0xFFF) + 0x1000; init_block(dst_block); } else if(invalid_code_get(address>>12)){
void new_vi(void) { DWORD Dif; DWORD CurrentFPSTime; static DWORD LastFPSTime = 0; static DWORD CounterTime = 0; static DWORD CalculatedTime; static int VI_Counter = 0; static int VI_WaitCounter = 0; long time; start_section(IDLE_SECTION); // if ( (!Config.showVIS) && (!Config.limitFps) ) return; VI_Counter++; CurrentFPSTime = ticks_to_microsecs(gettick()); Dif = CurrentFPSTime - LastFPSTime; if (Timers.limitVIs) { if (Timers.limitVIs == 2 && Timers.frameDrawn == 0) VI_WaitCounter++; else { if (Dif < (double) VILimitMicroseconds * (VI_WaitCounter + 1) ) { CalculatedTime = CounterTime + (double)VILimitMicroseconds * (double)VI_Counter; time = (int)(CalculatedTime - CurrentFPSTime); if (time>0&&time<1000000) { usleep(time); } CurrentFPSTime = CurrentFPSTime + time; } Timers.frameDrawn = 0; VI_WaitCounter = 0; } } // DWORD diff_millisecs = ticks_to_millisecs(diff_ticks(CounterTime,CurrentFPSTime)); if (CounterTime > CurrentFPSTime) { CounterTime = ticks_to_microsecs(gettick()); VI_Counter = 0 ; } else if (CurrentFPSTime - CounterTime >= 500000.0 ) { Timers.vis = (float) (VI_Counter * 1000000.0 / (CurrentFPSTime - CounterTime)); // sprintf(txtbuffer,"Timer.VIs: Current = %dus; Last = %dus; diff_ms = %d; FPS_count = %d", CurrentFPSTime, CounterTime, diff_millisecs, VI_Counter); // DEBUG_print(txtbuffer,0); CounterTime = ticks_to_microsecs(gettick()); VI_Counter = 0 ; } LastFPSTime = CurrentFPSTime ; Timers.lastViTime = CurrentFPSTime; end_section(IDLE_SECTION); }
void new_vi(void) { int Dif; unsigned int CurrentFPSTime; static unsigned int LastFPSTime = 0; static unsigned int CounterTime = 0; static unsigned int CalculatedTime ; static int VI_Counter = 0; double AdjustedLimit = VILimitMilliseconds * 100.0 / l_SpeedFactor; // adjust for selected emulator speed int time; start_section(IDLE_SECTION); VI_Counter++; #ifdef DBG if(g_DebuggerActive) DebuggerCallback(DEBUG_UI_VI, 0); #endif if(LastFPSTime == 0) { LastFPSTime = gettimeofday_msec(); CounterTime = gettimeofday_msec(); return; } CurrentFPSTime = gettimeofday_msec(); Dif = CurrentFPSTime - LastFPSTime; if (Dif < AdjustedLimit) { CalculatedTime = CounterTime + AdjustedLimit * VI_Counter; time = (int)(CalculatedTime - CurrentFPSTime); if (time > 0) { #ifdef WIN32 Sleep(time); #else usleep(time * 1000); #endif } CurrentFPSTime = CurrentFPSTime + time; } if (CurrentFPSTime - CounterTime >= 1000.0 ) { CounterTime = gettimeofday_msec(); VI_Counter = 0 ; } LastFPSTime = CurrentFPSTime ; end_section(IDLE_SECTION); }