framecounter change

This commit is contained in:
Toni Wilen 2023-05-16 20:02:04 +03:00
parent e3fafef103
commit 820bee3da9
8 changed files with 17 additions and 19 deletions

View File

@ -11428,7 +11428,7 @@ static int calculate_lineno(int vp)
lineno++;
} else if (!interlace_seen && doublescan <= 0 && currprefs.gfx_vresolution && currprefs.gfx_pscanlines > 1) {
lineno *= 2;
if (timeframes & 1) {
if (vsync_counter & 1) {
lineno++;
nextline_how = currprefs.gfx_pscanlines == 3 ? nln_lower_black_always : nln_lower_black;
} else {
@ -14384,9 +14384,9 @@ void dumpcustom(void)
bplcon0, bplcon1, bplcon2, bplcon3, bplcon4,
lof_display, lof_store,
hdiwstate == diw_states::DIW_waiting_start ? 0 : 1, vdiwstate == diw_states::DIW_waiting_start ? 0 : 1);
if (timeframes) {
if (timeframes && vsync_counter) {
console_out_f(_T("Average frame time: %.2f ms [frames: %d time: %d]\n"),
(double)frametime / timeframes, timeframes, frametime);
(double)frametime / timeframes, vsync_counter, frametime);
if (total_skipped)
console_out_f(_T("Skipped frames: %d\n"), total_skipped);
}

View File

@ -2177,7 +2177,7 @@ void record_dma_write(uae_u16 reg, uae_u32 dat, uae_u32 addr, int hpos, int vpos
return;
dr = &dma_record[dma_record_toggle][vpos * NR_DMA_REC_HPOS + hpos];
dma_record_frame[dma_record_toggle] = timeframes;
dma_record_frame[dma_record_toggle] = vsync_counter;
if (dr->reg != 0xffff) {
dr->cf_reg = reg;
dr->cf_dat = dat;
@ -2268,7 +2268,7 @@ void record_cia_access(int r, int mask, uae_u16 value, bool rw, int hpos, int vp
return;
dr = &dma_record[dma_record_toggle][vpos * NR_DMA_REC_HPOS + hpos];
dma_record_frame[dma_record_toggle] = timeframes;
dma_record_frame[dma_record_toggle] = vsync_counter;
if (dr->ciaphase < 0) {
return;
@ -2295,7 +2295,7 @@ void record_dma_read(uae_u16 reg, uae_u32 addr, int hpos, int vpos, int type, in
return;
dr = &dma_record[dma_record_toggle][vpos * NR_DMA_REC_HPOS + hpos];
dma_record_frame[dma_record_toggle] = timeframes;
dma_record_frame[dma_record_toggle] = vsync_counter;
if (dr->reg != 0xffff) {
if (dr->reg != reg) {
dma_conflict(vpos, hp, dr, reg, false);
@ -7436,7 +7436,7 @@ void debug (void)
debugmem_disable();
if (trace_cycles && last_frame >= 0) {
if (last_frame + 2 >= timeframes || trace_cycles > 1) {
if (last_frame + 2 >= vsync_counter || trace_cycles > 1) {
evt_t c = last_cycles2 - last_cycles1;
uae_u32 cc;
if (c >= 0x7fffffff) {

View File

@ -4633,8 +4633,8 @@ static int do_specialties (int cycles)
x_do_cycles(8 * CYCLE_UNIT);
if (regs.spcflags & SPCFLAG_COPPER)
do_copper();
if (timeframes != vsyncstate) {
vsyncstate = timeframes;
if (vsync_counter != vsyncstate) {
vsyncstate = vsync_counter;
vsynccnt--;
}
}
@ -5300,8 +5300,8 @@ static void run_cpu_thread(void (*f)(void *))
break;
}
if (framecnt != timeframes) {
framecnt = timeframes;
if (framecnt != vsync_counter) {
framecnt = vsync_counter;
}
if (cpu_thread_reset) {

View File

@ -1818,7 +1818,7 @@ bool frame_drawn(int monid)
StreamSizeAudioExpected += ((float)wfxSrc.Format.nSamplesPerSec) / fps_in_use;
if (avioutput_video) {
int idiff = (int)(StreamSizeAudioGot - StreamSizeAudioExpected);
if ((timeframes % 5) == 0)
if ((vsync_counter % 5) == 0)
write_log(_T("%.1f %.1f %d\n"), StreamSizeAudioExpected, StreamSizeAudioGot, idiff);
if (idiff) {
StreamSizeAudioGot = StreamSizeAudioExpected;

View File

@ -1113,7 +1113,7 @@ static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, struct shaderdata
}
}
if (s->framecounterHandle)
s->pEffect->SetFloat(s->framecounterHandle, (FLOAT)timeframes);
s->pEffect->SetFloat(s->framecounterHandle, (FLOAT)vsync_counter);
return 1;
}
@ -3446,7 +3446,7 @@ static void D3D_render2(struct d3dstruct *d3d, int mode, int monid)
texelsize.z = 1; texelsize.w = 1;
hr = postEffect->SetVector (d3d->postTexelSize, &texelsize);
if (d3d->postFramecounterHandle)
postEffect->SetFloat(d3d->postFramecounterHandle, (FLOAT)timeframes);
postEffect->SetFloat(d3d->postFramecounterHandle, (FLOAT)vsync_counter);
if (masktexture) {
if (FAILED (hr = postEffect->SetTechnique (d3d->postTechnique)))

View File

@ -1295,7 +1295,7 @@ static int psEffect_SetTextures(ID3D11Texture2D *lpSourceTex, ID3D11ShaderResour
s->m_ScaleEffectHandle->SetFloatVector((float*)&fScale);
}
if (s->framecounterHandle) {
s->framecounterHandle->SetFloat((float)timeframes);
s->framecounterHandle->SetFloat((float)vsync_counter);
}
return 1;

View File

@ -26,8 +26,6 @@ static volatile int lcd_thread_active;
static volatile bool lcd_updated;
int logitech_lcd = 1;
extern unsigned long timeframes;
// Do it this way because stupid LogitechLCDLib.lib LogiLcdInit() refuses to link.
typedef bool(__cdecl *LOGILCDINIT)(const wchar_t*, int);

View File

@ -1687,8 +1687,8 @@ static int uaenet_int_handler2(TrapContext *ctx)
}
while (p) {
if (p->drop_start == 0)
p->drop_start = timeframes;
p->drop_count = timeframes;
p->drop_start = vsync_counter;
p->drop_count = vsync_counter;
p = p->next;
}
break;