Clean shutdown

rather boring commit, but needed to be done
This commit is contained in:
Simon 2020-09-27 22:35:37 +01:00
parent 52b6370103
commit a77ed55dc0
4 changed files with 22 additions and 4 deletions

View File

@ -2397,6 +2397,7 @@ void idCommonLocal::Vibrate(int duration, int channel, float intensity )
idCommonLocal::Frame
=================
*/
extern bool running;
void idCommonLocal::Frame( void ) {
try {
@ -2437,6 +2438,10 @@ void idCommonLocal::Frame( void ) {
} else {
session->Frame();
//if we set the running to false then just return;
if (!running)
return;
// normal, in-sequence screen update
session->UpdateScreen( false );
}
@ -3052,6 +3057,7 @@ void idCommonLocal::Init( int argc, char **argv ) {
Sys_Error("Error while starting the async timer: %s", SDL_GetError());
}
void GLimp_WindowActive(bool active);
/*
=================
@ -3059,6 +3065,11 @@ idCommonLocal::Shutdown
=================
*/
void idCommonLocal::Shutdown( void ) {
//Will stop the render thread
GLimp_WindowActive(false);
usleep(100 * 1000);
if (async_timer) {
SDL_RemoveTimer(async_timer);
async_timer = 0;

View File

@ -6409,12 +6409,12 @@ void idPlayer::UpdateFlashlightHolster()
idAngles a(0, viewAngles.yaw - pVRClientInfo->hmdorientation[YAW], 0);
holsterOffset *= a.ToMat3();
holsterOffset *= cvarSystem->GetCVarFloat( "vr_worldscale" );
holsterOffset *= vr_worldscale.GetFloat();
flashlightRenderEntity.origin = firstPersonViewOrigin + holsterOffset;
flashlightRenderEntity.entityNum = ENTITYNUM_NONE;
flashlightRenderEntity.axis = idAngles(-60, 90, 0).ToMat3() * firstPersonViewAxis;
flashlightRenderEntity.axis = idAngles(-60, 90, 0).ToMat3() * firstPersonViewAxis * 0.8f;
flashlightRenderEntity.allowSurfaceInViewID = entityNumber + 1;
flashlightRenderEntity.weaponDepthHack = true;

View File

@ -292,7 +292,10 @@ void idSysLocal::OpenURL( const char *url, bool quit ) {
main
===============
*/
#ifdef __ANDROID__
bool running = true;
int main_android(int argc, char **argv) {
#else
int main(int argc, char **argv) {
@ -322,7 +325,7 @@ int main(int argc, char **argv) {
common->Init( 0, NULL );
}
while (1) {
while (running) {
common->Frame();
}

View File

@ -81,8 +81,9 @@ static char exit_spawn[ 1024 ] = { 0 };
Posix_Exit
================
*/
extern bool running;
void Posix_Exit(int ret) {
if ( tty_enabled ) {
/* if ( tty_enabled ) {
Sys_Printf( "shutdown terminal support\n" );
if ( tcsetattr( 0, TCSADRAIN, &tty_tc ) == -1 ) {
Sys_Printf( "tcsetattr failed: %s\n", strerror( errno ) );
@ -99,6 +100,9 @@ void Posix_Exit(int ret) {
exit( set_exit );
}
exit( ret );
*/
running = false;
}
/*