Skip to content

Commit

Permalink
renderers: fix incorrect ovebright bits displayed at startup
Browse files Browse the repository at this point in the history
common: try to init logfile cvar as early as possible
makefile: fixed (I hope) warning with new grep
code cleanup
  • Loading branch information
Eugene committed Nov 6, 2022
1 parent 9247faa commit 1dc4132
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ SDL_LIBS = -lSDL2
endif

# extract version info
VERSION=$(shell grep "\#define Q3_VERSION" $(CMDIR)/q_shared.h | \
VERSION=$(shell grep ".\+define[ \t]\+Q3_VERSION[ \t]\+\+" $(CMDIR)/q_shared.h | \
sed -e 's/.*".* \([^ ]*\)"/\1/')

# common qvm definition
Expand Down
21 changes: 10 additions & 11 deletions code/qcommon/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3293,7 +3293,7 @@ static void CPUID( int func, unsigned int *regs )
static void Sys_GetProcessorId( char *vendor )
{
uint32_t regs[4]; // EAX, EBX, ECX, EDX
uint32_t cpuid_level, cpuid_level_ex;
uint32_t cpuid_level_ex;
char vendor_str[12 + 1]; // short CPU vendor string

// setup initial features
Expand All @@ -3309,7 +3309,6 @@ static void Sys_GetProcessorId( char *vendor )

// get CPUID level & short CPU vendor string
CPUID( 0x0, regs );
cpuid_level = regs[0];
memcpy(vendor_str + 0, (char*)&regs[1], 4);
memcpy(vendor_str + 4, (char*)&regs[3], 4);
memcpy(vendor_str + 8, (char*)&regs[2], 4);
Expand Down Expand Up @@ -3646,6 +3645,15 @@ void Com_Init( char *commandLine ) {

FS_InitFilesystem();

com_logfile = Cvar_Get( "logfile", "0", CVAR_TEMP );
Cvar_CheckRange( com_logfile, "0", "4", CV_INTEGER );
Cvar_SetDescription( com_logfile, "System console logging:\n"
" 0 - disabled\n"
" 1 - overwrite mode, buffered\n"
" 2 - overwrite mode, synced\n"
" 3 - append mode, buffered\n"
" 4 - append mode, synced\n" );

Com_InitJournaling();

Com_ExecuteCfg();
Expand Down Expand Up @@ -3692,15 +3700,6 @@ void Com_Init( char *commandLine ) {

// com_blood = Cvar_Get( "com_blood", "1", CVAR_ARCHIVE_ND );

com_logfile = Cvar_Get( "logfile", "0", CVAR_TEMP );
Cvar_CheckRange( com_logfile, "0", "4", CV_INTEGER );
Cvar_SetDescription( com_logfile, "System console logging:\n"
" 0 - disabled\n"
" 1 - overwrite mode, buffered\n"
" 2 - overwrite mode, synced\n"
" 3 - append mode, buffered\n"
" 4 - append mode, synced\n" );

com_timescale = Cvar_Get( "timescale", "1", CVAR_CHEAT | CVAR_SYSTEMINFO );
Cvar_CheckRange( com_timescale, "0", NULL, CV_FLOAT );
Cvar_SetDescription( com_timescale, "System timing factor:\n < 1: Slows the game down\n = 1: Regular speed\n > 1: Speeds the game up" );
Expand Down
4 changes: 2 additions & 2 deletions code/renderer/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,6 @@ static void InitOpenGL( void )
gls.initTime = ri.Milliseconds();
}

VarInfo();

// set default state
GL_SetDefaultState();

Expand Down Expand Up @@ -1843,6 +1841,8 @@ void R_Init( void ) {

R_InitImages();

VarInfo();

R_InitShaders();

R_InitSkins();
Expand Down
4 changes: 2 additions & 2 deletions code/renderervk/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,6 @@ static void InitOpenGL( void )
}
#endif

VarInfo();

// set default state
GL_SetDefaultState();

Expand Down Expand Up @@ -1884,6 +1882,8 @@ void R_Init( void ) {

R_InitImages();

VarInfo();

#ifdef USE_VULKAN
vk_create_pipelines();
#endif
Expand Down
9 changes: 6 additions & 3 deletions code/unix/unix_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ void Sys_Sleep( int msec ) {
fd_set fdset;
int res;

if ( msec == 0 )
return;
//if ( msec == 0 )
// return;

if ( msec < 0 ) {
// special case: wait for console input or network packet
Expand All @@ -637,7 +637,9 @@ void Sys_Sleep( int msec ) {
}
return;
}

#if 1
usleep( msec * 1000 );
#else
if ( com_dedicated->integer && stdin_active ) {
FD_ZERO( &fdset );
FD_SET( STDIN_FILENO, &fdset );
Expand All @@ -647,6 +649,7 @@ void Sys_Sleep( int msec ) {
} else {
usleep( msec * 1000 );
}
#endif
}


Expand Down
4 changes: 2 additions & 2 deletions code/win32/win_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ void Sys_Sleep( int msec ) {
}

// busy wait there because Sleep(0) will relinquish CPU - which is not what we want
if ( msec == 0 )
return;
//if ( msec == 0 )
// return;

Sleep ( msec );
}
Expand Down

0 comments on commit 1dc4132

Please sign in to comment.