[Atsoft-commit] CVS: dcgen/main event.c,1.2,1.3 ui-kos.c,1.12,1.13
Brought to you by:
atani
|
From: Mike D. <at...@us...> - 2002-04-10 04:53:12
|
Update of /cvsroot/atsoft/dcgen/main
In directory usw-pr-cvs1:/tmp/cvs-serv25081/main
Modified Files:
event.c ui-kos.c
Log Message:
Various speed hacks, fixes to the options screen and auto-frameskip code.
new feature: auto-frameskip.
Index: event.c
===================================================================
RCS file: /cvsroot/atsoft/dcgen/main/event.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** event.c 24 Jan 2002 06:05:36 -0000 1.2
--- event.c 10 Apr 2002 04:53:08 -0000 1.3
***************
*** 226,230 ****
int wide = vdp_reg[12] & 1;
int clocks, possible;
! double percent_possible;
int togo = (int)bytes;
--- 226,230 ----
int wide = vdp_reg[12] & 1;
int clocks, possible;
! float percent_possible;
int togo = (int)bytes;
***************
*** 249,253 ****
togo -= possible;
} else {
! event_freeze_clocks(((double)togo / possible) * clocks);
togo = 0;
}
--- 249,253 ----
togo -= possible;
} else {
! event_freeze_clocks(((float)togo / possible) * clocks);
togo = 0;
}
Index: ui-kos.c
===================================================================
RCS file: /cvsroot/atsoft/dcgen/main/ui-kos.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ui-kos.c 8 Apr 2002 01:15:33 -0000 1.12
--- ui-kos.c 10 Apr 2002 04:53:08 -0000 1.13
***************
*** 25,28 ****
--- 25,31 ----
char *ui_initload = NULL;
uint8 ui_vdpsimple = 0;
+ uint8 auto_frameskip = 0;
+ uint8 auto_frameskip_count = 4;
+ uint8 ui_no_plot = 0;
pvr_ptr_t txr_base;
pvr_ptr_t txr_base_ex;
***************
*** 161,170 ****
}
int ui_loop()
{
! while(!gen_quit)
{
! event_doframe();
! ui_updatepads();
}
gen_quit = 0;
--- 164,226 ----
}
+ #define USEC_FRAME_NTSC 16667
+ #define USEC_FRAME_PAL
+ #define USEC_FRAME (vdp_pal ? USEC_FRAME_PAL : USEC_FRAME_NTSC)
+
+ struct timeval
+ {
+ long tv_sec;
+ long tv_usec;
+ };
+
int ui_loop()
{
! struct timeval oldclk, newclk;
! uint8 frames_to_do;
! uint32 usec = 0;
!
! if(sound_on || !auto_frameskip)
{
! ui_no_plot = 0;
! // With sound enabled we do not need to worry about
! // frameskip as it is internally enabled by the frame
! // event runner.
! while(!gen_quit)
! {
! event_doframe();
! ui_updatepads();
! }
! }
! else
! {
! // Deal with auto-frameskip
! gettimeofday(&oldclk, NULL);
! while(!gen_quit)
! {
! //
! gettimeofday(&newclk, NULL);
! if(newclk.tv_usec < oldclk.tv_usec)
! {
! usec += 1000000 + newclk.tv_usec - oldclk.tv_usec;
! }
! else
! {
! usec += newclk.tv_usec - oldclk.tv_usec;
! }
! frames_to_do = usec / USEC_FRAME;
! usec %= USEC_FRAME;
! oldclk = newclk;
!
! frames_to_do %= auto_frameskip_count;
! for(; frames_to_do > 1; --frames_to_do)
! {
! ui_no_plot = 1;
! event_doframe();
! ui_updatepads();
! }
! ui_no_plot = 0;
! event_doframe();
! ui_updatepads();
! }
}
gen_quit = 0;
***************
*** 244,248 ****
uint8 *p;
! if(ui_vdpsimple)
{
return;
--- 300,304 ----
uint8 *p;
! if(ui_vdpsimple || ui_no_plot)
{
return;
***************
*** 261,265 ****
vdp_renderline(line, p, 0);
}
! //palette_update();
}
--- 317,321 ----
vdp_renderline(line, p, 0);
}
! palette_update();
}
***************
*** 273,276 ****
--- 329,336 ----
uint32 u_max = (vdp_reg[12] & 1) ? 320 : 256;
+ if(ui_no_plot)
+ {
+ return;
+ }
palette_update();
|