mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: platform: refactor variable declarations
This commit is contained in:
@@ -333,9 +333,9 @@ void Evdev_CloseDevice_f ( void )
|
||||
|
||||
void IN_EvdevFrame ( void )
|
||||
{
|
||||
int dx = 0, dy = 0, i;
|
||||
int dx = 0, dy = 0;
|
||||
|
||||
for( i = 0; i < evdev.devices; i++ )
|
||||
for( int i = 0; i < evdev.devices; i++ )
|
||||
{
|
||||
struct input_event ev;
|
||||
|
||||
@@ -403,8 +403,6 @@ void Evdev_SetGrab( qboolean grab )
|
||||
{
|
||||
// grab only if evdev is secondary input source
|
||||
#if XASH_INPUT != INPUT_EVDEV
|
||||
int i;
|
||||
|
||||
if( grab )
|
||||
{
|
||||
Key_Event( K_ESCAPE, 0 ); //Do not leave ESC down
|
||||
@@ -413,7 +411,7 @@ void Evdev_SetGrab( qboolean grab )
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; i < evdev.devices; i++ )
|
||||
for( int i = 0; i < evdev.devices; i++ )
|
||||
ioctl( evdev.fds[i], EVIOCGRAB, (void*) 0 );
|
||||
}
|
||||
evdev.grab = grab;
|
||||
@@ -454,14 +452,12 @@ void Evdev_Init( void )
|
||||
|
||||
void Evdev_Shutdown( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
Cmd_RemoveCommand( "evdev_open" );
|
||||
Cmd_RemoveCommand( "evdev_close" );
|
||||
Cmd_RemoveCommand( "evdev_autodetect" );
|
||||
Cvar_RegisterVariable( &evdev_keydebug );
|
||||
|
||||
for( i = 0; i < evdev.devices; i++ )
|
||||
for( int i = 0; i < evdev.devices; i++ )
|
||||
{
|
||||
ioctl( evdev.fds[i], EVIOCGRAB, (void*) 0 );
|
||||
close( evdev.fds[i] );
|
||||
|
||||
@@ -279,17 +279,15 @@ void SNDDMA_Submit( void )
|
||||
}
|
||||
else // period is 1/2 of samples
|
||||
{
|
||||
int s, w, frames;
|
||||
void *start;
|
||||
|
||||
if( !snd.buffer )
|
||||
return;
|
||||
|
||||
s = snd.samplepos * 2;
|
||||
start = (void *)&snd.buffer[s];
|
||||
frames = s_alsa.period_size / 2;
|
||||
int s = snd.samplepos * 2;
|
||||
void *start = (void *)&snd.buffer[s];
|
||||
int frames = s_alsa.period_size / 2;
|
||||
// write to card
|
||||
if( ( w = snd_pcm_writei( s_alsa.pcm_handle, start, frames ) ) < 0)
|
||||
int w = snd_pcm_writei( s_alsa.pcm_handle, start, frames );
|
||||
if( w < 0 )
|
||||
{
|
||||
// xrun occured
|
||||
snd_pcm_prepare( s_alsa.pcm_handle );
|
||||
|
||||
@@ -46,24 +46,20 @@ int Linux_GetProcessID( void )
|
||||
|
||||
qboolean Platform_DebuggerPresent( void )
|
||||
{
|
||||
char buf[4096];
|
||||
ssize_t num_read;
|
||||
int status_fd;
|
||||
|
||||
status_fd = open( "/proc/self/status", O_RDONLY );
|
||||
int status_fd = open( "/proc/self/status", O_RDONLY );
|
||||
if ( status_fd == -1 )
|
||||
return 0;
|
||||
|
||||
num_read = read( status_fd, buf, sizeof( buf ) );
|
||||
char buf[4096];
|
||||
ssize_t num_read = read( status_fd, buf, sizeof( buf ) );
|
||||
close( status_fd );
|
||||
|
||||
if ( num_read > 0 )
|
||||
{
|
||||
static const char TracerPid[] = "TracerPid:";
|
||||
const byte *tracer_pid;
|
||||
|
||||
buf[num_read] = 0;
|
||||
tracer_pid = (const byte*)Q_strstr( buf, TracerPid );
|
||||
const byte *tracer_pid = (const byte*)Q_strstr( buf, TracerPid );
|
||||
if( !tracer_pid )
|
||||
return false;
|
||||
|
||||
|
||||
@@ -52,13 +52,13 @@ void FB_GetScreenRes( int *x, int *y )
|
||||
|
||||
qboolean R_Init_Video( ref_graphic_apis_t type )
|
||||
{
|
||||
qboolean retval;
|
||||
string fbdev = DEFAULT_FBDEV;
|
||||
fb.fd = -1;
|
||||
|
||||
if( type != REF_SOFTWARE )
|
||||
return false;
|
||||
|
||||
string fbdev = DEFAULT_FBDEV;
|
||||
|
||||
Sys_GetParmFromCmdLine( "-fbdev", fbdev );
|
||||
|
||||
fb.fd = open( fbdev, O_RDWR );
|
||||
@@ -74,7 +74,8 @@ qboolean R_Init_Video( ref_graphic_apis_t type )
|
||||
ioctl(fb.fd, FBIOGET_FSCREENINFO, &fb.finfo);
|
||||
ioctl(fb.fd, FBIOGET_VSCREENINFO, &fb.vinfo);
|
||||
|
||||
if( !(retval = VID_SetMode()) )
|
||||
qboolean retval = VID_SetMode();
|
||||
if( !retval )
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
@@ -124,12 +125,10 @@ qboolean VID_SetMode( void )
|
||||
|
||||
rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mode )
|
||||
{
|
||||
int render_w, render_h;
|
||||
|
||||
FB_GetScreenRes( &width, &height );
|
||||
|
||||
render_w = width;
|
||||
render_h = height;
|
||||
int render_w = width;
|
||||
int render_h = height;
|
||||
|
||||
Con_Reportf( "%s: forced resolution to %dx%d)\n", __func__, width, height );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user