With SDL 1.2 builds, make the profiling be cancelable by pressing any key.

git-svn-id: https://svn.eduke32.com/eduke32@3022 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-09-15 15:28:30 +00:00
parent 95d11b9703
commit 7e05f5884c
6 changed files with 23 additions and 3 deletions

View file

@ -106,6 +106,7 @@ void initprintf(const char *, ...) ATTRIBUTE((format(printf,1,2)));
void debugprintf(const char *,...) ATTRIBUTE((format(printf,1,2)));
int32_t handleevents(void);
int32_t handleevents_peekkeys(void);
extern inline void idle(void);
extern inline void idle_waitevent(void);
extern inline void idle_waitevent_timeout(uint32_t timeout);

View file

@ -1862,6 +1862,17 @@ static SDL_Surface *loadappicon(void)
//
//
int32_t handleevents_peekkeys(void)
{
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION == 2)
SDL_PumpEvents();
return SDL_PeepEvents(NULL, 1, SDL_PEEKEVENT, SDL_EVENTMASK(SDL_KEYDOWN));
#else
// SDL 1.3 up has not been tested to compile.
return 0;
#endif
}
//
// handleevents() -- process the SDL message queue

View file

@ -799,6 +799,11 @@ void debugprintf(const char *f, ...)
}
int32_t handleevents_peekkeys(void)
{
return 0;
}
//
// handleevents() -- process the Windows message queue
// returns !0 if there was an important event worth checking (like quitting)

View file

@ -371,7 +371,7 @@ int32_t Demo_IsProfiling(void)
return (g_demo_profile > 0);
}
void Demo_StopProfiling(void)
static void Demo_StopProfiling(void)
{
g_demo_stopProfile = 1;
}
@ -821,6 +821,9 @@ nextdemo_nomenu:
// draw status
Demo_DisplayProfStatus();
if (handleevents_peekkeys())
Demo_StopProfiling();
}
else if (r_maxfps == 0 || tt >= nextrender)
{

View file

@ -51,7 +51,6 @@ void G_OpenDemoWrite(void);
void Demo_PlayFirst(int32_t prof);
int32_t Demo_IsProfiling(void);
void Demo_StopProfiling(void);
#if KRANDDEBUG
int32_t krd_print(const char *filename);

View file

@ -296,7 +296,8 @@ static int32_t osdcmd_map(const osdfuncparm_t *parm)
// Notes:
// * The demos should be recorded with demorec_diffs set to 0, so that the
// game state updates are actually computed.
// * There's currently no way to abort the profiling.
// * Currently, the profiling can only be aborted on SDL 1.2 builds by
// pressing any key.
// * With <prof> greater than 1, interpolation should be calculated properly,
// though this has not been verified by looking at the frames.
// * When testing whether a change in the source has an effect on performance,