From 455145d611e0707fbf4f6fbcaf9cf7b82cf1b94e Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Thu, 2 Jan 2014 00:04:32 +1300 Subject: [PATCH 1/7] Stall testing for interpolation Uncapped framerate never triggered the stall detection code, as it never tried to process a frame to start with. --- src/d_net.cpp | 77 ++++++++++++++++++++++++++++----------------------- src/d_net.h | 3 ++ 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 37e3f589e..c912d29a2 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -1747,6 +1747,8 @@ void TryRunTics (void) if (counts == 0 && !doWait) { + // Check possible stall conditions + Net_CheckLastRecieved(counts); return; } @@ -1824,41 +1826,8 @@ void TryRunTics (void) if (lowtic < gametic) I_Error ("TryRunTics: lowtic < gametic"); - // [Ed850] Check to see the last time a packet was recieved. - // If it's longer then 3 seconds, a node has likely stalled. - if(I_GetTime(false) - lastglobalrecvtime >= TICRATE*3) - { - lastglobalrecvtime = I_GetTime(false); //Bump the count - - if(NetMode == NET_PeerToPeer || consoleplayer == Net_Arbitrator) - { - //Keep the local node in the for loop so we can still log any cases where the local node is /somehow/ late. - //However, we don't send a resend request for sanity reasons. - for (i = 0; i < doomcom.numnodes; i++) - { - if (nodeingame[i] && nettics[i] < gametic + counts) - { - if (debugfile) - fprintf (debugfile, "%i is slow (%i to %i)\n", - i, nettics[i], gametic+counts); - //Send resend request to the late node. Also mark the node as waiting to display it in the hud. - if(i != 0) - remoteresend[i] = players[playerfornode[i]].waiting = hadlate = true; - } - else - players[playerfornode[i]].waiting = false; - } - } - else - { //Send a resend request to the Arbitrator, as it's obvious we are stuck here. - if (debugfile) - fprintf (debugfile, "Arbitrator is slow (%i to %i)\n", - nettics[Net_Arbitrator], gametic+counts); - //Send resend request to the Arbitrator. Also mark the Arbitrator as waiting to display it in the hud. - if(i != 0) - remoteresend[Net_Arbitrator] = players[playerfornode[Net_Arbitrator]].waiting = hadlate = true; - } - } + // Check possible stall conditions + Net_CheckLastRecieved (counts); // don't stay in here forever -- give the menu a chance to work if (I_GetTime (false) - entertic >= TICRATE/3) @@ -1901,6 +1870,44 @@ void TryRunTics (void) } } +void Net_CheckLastRecieved (int counts) +{ + // [Ed850] Check to see the last time a packet was recieved. + // If it's longer then 3 seconds, a node has likely stalled. + if (I_GetTime(false) - lastglobalrecvtime >= TICRATE * 3) + { + lastglobalrecvtime = I_GetTime(false); //Bump the count + + if (NetMode == NET_PeerToPeer || consoleplayer == Net_Arbitrator) + { + //Keep the local node in the for loop so we can still log any cases where the local node is /somehow/ late. + //However, we don't send a resend request for sanity reasons. + for (int i = 0; i < doomcom.numnodes; i++) + { + if (nodeingame[i] && nettics[i] <= gametic + counts) + { + if (debugfile && !players[playerfornode[i]].waiting) + fprintf(debugfile, "%i is slow (%i to %i)\n", + i, nettics[i], gametic + counts); + //Send resend request to the late node. Also mark the node as waiting to display it in the hud. + if (i != 0) + remoteresend[i] = players[playerfornode[i]].waiting = hadlate = true; + } + else + players[playerfornode[i]].waiting = false; + } + } + else + { //Send a resend request to the Arbitrator, as it's obvious we are stuck here. + if (debugfile && !players[playerfornode[Net_Arbitrator]].waiting) + fprintf(debugfile, "Arbitrator is slow (%i to %i)\n", + nettics[Net_Arbitrator], gametic + counts); + //Send resend request to the Arbitrator. Also mark the Arbitrator as waiting to display it in the hud. + remoteresend[Net_Arbitrator] = players[playerfornode[Net_Arbitrator]].waiting = hadlate = true; + } + } +} + void Net_NewMakeTic (void) { specials.NewMakeTic (); diff --git a/src/d_net.h b/src/d_net.h index 507723d53..4cd3e66f5 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -115,6 +115,9 @@ void D_QuitNetGame (void); //? how many ticks to run? void TryRunTics (void); +//Use for checking to see if the netgame has stalled +void Net_CheckLastRecieved(int); + // [RH] Functions for making and using special "ticcmds" void Net_NewMakeTic (); void Net_WriteByte (BYTE); From 49edd7c60c53376a09c385adf841960f71b81662 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Thu, 2 Jan 2014 01:59:04 -0500 Subject: [PATCH 2/7] - Add support for cross compiling so that OS X PowerPC builds can still be made on systems without rosetta (10.7+). (Compiling x86 binaries on ppc should also be possible.) --- CMakeLists.txt | 15 +++++++++++++++ gdtoa/CMakeLists.txt | 9 +++++++-- tools/CMakeLists.txt | 2 ++ tools/fixrtext/CMakeLists.txt | 6 +++++- tools/lemon/CMakeLists.txt | 7 +++++-- tools/re2c/CMakeLists.txt | 7 +++++++ tools/updaterevision/CMakeLists.txt | 5 ++++- tools/zipdir/CMakeLists.txt | 18 +++++++++++------- 8 files changed, 56 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fca2e59b3..28379a377 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,17 @@ else(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7) set( NO_GENERATOR_EXPRESSIONS ON ) endif(${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7) +# Support cross compiling +option( FORCE_CROSSCOMPILE "Turn on cross compiling." NO ) +if( FORCE_CROSSCOMPILE ) + set( CMAKE_CROSSCOMPILING TRUE ) +endif( FORCE_CROSSCOMPILE ) + +if(CMAKE_CROSSCOMPILING) + set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Export file from native build.") + include(${IMPORT_EXECUTABLES}) +endif(CMAKE_CROSSCOMPILING) + # Simplify pk3 building, add_pk3(filename srcdirectory) function( add_pk3 PK3_NAME PK3_DIR ) get_target_property(ZIPDIR_EXE zipdir LOCATION) @@ -208,3 +219,7 @@ add_subdirectory( src ) if( NOT WIN32 AND NOT APPLE ) add_subdirectory( output_sdl ) endif( NOT WIN32 AND NOT APPLE ) + +if( NOT CMAKE_CROSSCOMPILING ) + export(TARGETS ${CROSS_EXPORTS} FILE "${CMAKE_BINARY_DIR}/ImportExecutables.cmake" ) +endif( NOT CMAKE_CROSSCOMPILING ) diff --git a/gdtoa/CMakeLists.txt b/gdtoa/CMakeLists.txt index 91079d94c..9403f1793 100644 --- a/gdtoa/CMakeLists.txt +++ b/gdtoa/CMakeLists.txt @@ -16,13 +16,18 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS ) if( NOT MSVC ) - add_executable( arithchk arithchk.c ) + if( NOT CMAKE_CROSSCOMPILING ) + add_executable( arithchk arithchk.c ) + endif( NOT CMAKE_CROSSCOMPILING ) get_target_property( ARITHCHK_EXE arithchk LOCATION ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h COMMAND ${ARITHCHK_EXE} >${CMAKE_CURRENT_BINARY_DIR}/arith.h DEPENDS arithchk ) - add_executable( qnan qnan.c arith.h ) + if( NOT CMAKE_CROSSCOMPILING ) + add_executable( qnan qnan.c arith.h ) + set( CROSS_EXPORTS ${CROSS_EXPORTS} arithchk qnan PARENT_SCOPE ) + endif( NOT CMAKE_CROSSCOMPILING ) get_target_property( QNAN_EXE qnan LOCATION ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h COMMAND ${QNAN_EXE} >${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 1d1de65e5..08a1c4f4b 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -7,3 +7,5 @@ if( WIN32 ) endif( WIN32 ) add_subdirectory( updaterevision ) add_subdirectory( zipdir ) + +set( CROSS_EXPORTS ${CROSS_EXPORTS} PARENT_SCOPE ) diff --git a/tools/fixrtext/CMakeLists.txt b/tools/fixrtext/CMakeLists.txt index 9af8eb7f4..2b0ab2cda 100644 --- a/tools/fixrtext/CMakeLists.txt +++ b/tools/fixrtext/CMakeLists.txt @@ -1,2 +1,6 @@ cmake_minimum_required( VERSION 2.4 ) -add_executable( fixrtext fixrtext.c ) + +if( NOT CMAKE_CROSSCOMPILING ) + add_executable( fixrtext fixrtext.c ) + set( CROSS_EXPORTS ${CROSS_EXPORTS} fixrtext PARENT_SCOPE ) +endif( NOT CMAKE_CROSSCOMPILING ) diff --git a/tools/lemon/CMakeLists.txt b/tools/lemon/CMakeLists.txt index f3b07a72f..0a9b558ee 100644 --- a/tools/lemon/CMakeLists.txt +++ b/tools/lemon/CMakeLists.txt @@ -1,8 +1,11 @@ cmake_minimum_required( VERSION 2.4 ) -set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" ) +if( NOT CMAKE_CROSSCOMPILING ) + set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" ) -add_executable( lemon lemon.c ) + add_executable( lemon lemon.c ) + set( CROSS_EXPORTS ${CROSS_EXPORTS} lemon PARENT_SCOPE ) +endif( NOT CMAKE_CROSSCOMPILING ) # Lemon wants lempar.c in its directory if( NOT NO_GENERATOR_EXPRESSIONS ) diff --git a/tools/re2c/CMakeLists.txt b/tools/re2c/CMakeLists.txt index e6068a28d..1284f3506 100644 --- a/tools/re2c/CMakeLists.txt +++ b/tools/re2c/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required( VERSION 2.4 ) + +if( NOT CMAKE_CROSSCOMPILING ) + include( CheckFunctionExists ) include( CheckTypeSize ) @@ -30,3 +33,7 @@ add_executable( re2c scanner.cc substr.cc translate.cc ) + +set( CROSS_EXPORTS ${CROSS_EXPORTS} re2c PARENT_SCOPE ) + +endif( NOT CMAKE_CROSSCOMPILING ) diff --git a/tools/updaterevision/CMakeLists.txt b/tools/updaterevision/CMakeLists.txt index d985b9e3f..b857ffbe7 100644 --- a/tools/updaterevision/CMakeLists.txt +++ b/tools/updaterevision/CMakeLists.txt @@ -17,7 +17,10 @@ if( WIN32 ) endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( WIN32 ) -add_executable( updaterevision updaterevision.c ${TRUSTINFO} ) +if( NOT CMAKE_CROSSCOMPILING ) + add_executable( updaterevision updaterevision.c ${TRUSTINFO} ) + set( CROSS_EXPORTS ${CROSS_EXPORTS} updaterevision PARENT_SCOPE ) +endif( NOT CMAKE_CROSSCOMPILING ) if( MT_MERGE ) get_target_property( UPDATEREVISION_EXE updaterevision LOCATION ) diff --git a/tools/zipdir/CMakeLists.txt b/tools/zipdir/CMakeLists.txt index 40c4042b9..3ee22ddc3 100644 --- a/tools/zipdir/CMakeLists.txt +++ b/tools/zipdir/CMakeLists.txt @@ -1,8 +1,12 @@ cmake_minimum_required( VERSION 2.4 ) -message(STATUS "${ZLIB_INCLUDE_DIR}" ) -message(STATUS "${BZIP2_INCLUDE_DIR}" ) -message(STATUS "${LZMA_INCLUDE_DIR}" ) -include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" ) -add_executable( zipdir - zipdir.c ) -target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma ) + +if(NOT CMAKE_CROSSCOMPILING) + message(STATUS "${ZLIB_INCLUDE_DIR}" ) + message(STATUS "${BZIP2_INCLUDE_DIR}" ) + message(STATUS "${LZMA_INCLUDE_DIR}" ) + include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" ) + add_executable( zipdir + zipdir.c ) + target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma ) + set( CROSS_EXPORTS ${CROSS_EXPORTS} zipdir PARENT_SCOPE ) +endif(NOT CMAKE_CROSSCOMPILING) From 1e50a0af9ea70967bb4e2d5f343eb23e31e979df Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Thu, 2 Jan 2014 03:06:06 -0500 Subject: [PATCH 3/7] =?UTF-8?q?-=20Hard=20code=20gdtoa=20constants=20for?= =?UTF-8?q?=20OS=20X=20since=20the=20programs=20can=E2=80=99t=20always=20b?= =?UTF-8?q?e=20run=20on=20the=20target.=20=20(The=20values=20are=20the=20s?= =?UTF-8?q?ame=20for=20GCC=20and=20Clang.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gdtoa/CMakeLists.txt | 4 ++-- gdtoa/gdtoa.h | 22 +++++++++++++++++++++- gdtoa/gdtoaimp.h | 30 +++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/gdtoa/CMakeLists.txt b/gdtoa/CMakeLists.txt index 9403f1793..7a1304d0f 100644 --- a/gdtoa/CMakeLists.txt +++ b/gdtoa/CMakeLists.txt @@ -15,7 +15,7 @@ endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" S include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS ) -if( NOT MSVC ) +if( NOT MSVC AND NOT APPLE ) if( NOT CMAKE_CROSSCOMPILING ) add_executable( arithchk arithchk.c ) endif( NOT CMAKE_CROSSCOMPILING ) @@ -35,7 +35,7 @@ if( NOT MSVC ) set( GEN_FP_FILES arith.h gd_qnan.h ) set( GEN_FP_DEPS ${CMAKE_CURRENT_BINARY_DIR}/arith.h ${CMAKE_CURRENTY_BINARY_DIR}/gd_qnan.h ) -endif( NOT MSVC ) +endif( NOT MSVC AND NOT APPLE ) add_library( gdtoa ${GEN_FP_FILES} diff --git a/gdtoa/gdtoa.h b/gdtoa/gdtoa.h index 95132294e..2707ff7df 100644 --- a/gdtoa/gdtoa.h +++ b/gdtoa/gdtoa.h @@ -32,7 +32,7 @@ THIS SOFTWARE. #ifndef GDTOA_H_INCLUDED #define GDTOA_H_INCLUDED -#ifdef _MSC_VER +#if defined(_MSC_VER) /* [RH] Generating arith.h strikes me as too cumbersome under Visual * Studio, so here's the equivalent, given the limited number of * architectures that MSC can target. (Itanium? Who cares about that?) @@ -43,6 +43,26 @@ THIS SOFTWARE. #ifdef _M_X64 #define X64_bit_pointers #endif +#elif defined(__APPLE__) +/* [BL] While generating the files may be easy, on OS X we have cross + * compiling to deal with, which means we can't run the generation + * program on the target. + */ +#if defined(__x86_64__) +#define IEEE_8087 +#define Arith_Kind_ASL 1 +#define Long int +#define Intcast (int)(long) +#define Double_Align +#define X64_bit_pointers +#elif defined(__i386__) +#define IEEE_8087 +#define Arith_Kind_ASL 1 +#else +#define IEEE_MC68k +#define Arith_Kind_ASL 2 +#define Double_Align +#endif #else #include "arith.h" #endif diff --git a/gdtoa/gdtoaimp.h b/gdtoa/gdtoaimp.h index 023d97062..f93e03ef5 100644 --- a/gdtoa/gdtoaimp.h +++ b/gdtoa/gdtoaimp.h @@ -167,7 +167,7 @@ THIS SOFTWARE. #define GDTOAIMP_H_INCLUDED #include "gdtoa.h" -#ifdef _MSC_VER +#if defined(_MSC_VER) /* [RH] Generating gd_qnan.h strikes me as too cumbersome under Visual * Studio, so here's the equivalent, given the limited number of * architectures that MSC can target. (Itanium? Who cares about that?) @@ -188,6 +188,34 @@ THIS SOFTWARE. * it turns out that it has a true long double type. I thought that * all ia32 compilers had phased out extended precision. */ +#elif defined(__APPLE__) +#if defined(__x86_64__) || defined(__i386__) +#define f_QNAN 0xffc00000 +#define d_QNAN0 0x0 +#define d_QNAN1 0xfff80000 +#define ld_QNAN0 0x0 +#define ld_QNAN1 0xc0000000 +#define ld_QNAN2 0xffff +#define ld_QNAN3 0x0 +#define ldus_QNAN0 0x0 +#define ldus_QNAN1 0x0 +#define ldus_QNAN2 0x0 +#define ldus_QNAN3 0xc000 +#define ldus_QNAN4 0xffff +#else +#define f_QNAN 0xffc00000 +#define d_QNAN0 0xfff80000 +#define d_QNAN1 0x0 +#define ld_QNAN0 0xfff80000 +#define ld_QNAN1 0x0 +#define ld_QNAN2 0x0 +#define ld_QNAN3 0x0 +#define ldus_QNAN0 0xfff8 +#define ldus_QNAN1 0x0 +#define ldus_QNAN2 0x0 +#define ldus_QNAN3 0x0 +#define ldus_QNAN4 0x0 +#endif #else #include "gd_qnan.h" #endif From 50cec119a08d048fc61a38f639a0acbdc1f8f0f3 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Thu, 2 Jan 2014 19:12:03 -0500 Subject: [PATCH 4/7] - Work around GCC 4.8 bug 54570 --- src/parsecontext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parsecontext.cpp b/src/parsecontext.cpp index 6fa36b2a8..21b7a0ea6 100644 --- a/src/parsecontext.cpp +++ b/src/parsecontext.cpp @@ -157,6 +157,10 @@ loop: { return TokenTrans[NUM]; } +#if __GNUC__ == 4 && __GNUC_MINOR__ == 8 + // Work around GCC 4.8 bug 54570 causing release build crashes. + asm("" : "+g" (yylval)); +#endif strcpy (yylval->sym, token); return TokenTrans[SYM]; } From 511bdc7208ea0589b059a49b2b43c5f761a53e7b Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Thu, 2 Jan 2014 19:12:03 -0500 Subject: [PATCH 5/7] - Work around GCC 4.8 bug 54570 --- src/parsecontext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parsecontext.cpp b/src/parsecontext.cpp index 6fa36b2a8..21b7a0ea6 100644 --- a/src/parsecontext.cpp +++ b/src/parsecontext.cpp @@ -157,6 +157,10 @@ loop: { return TokenTrans[NUM]; } +#if __GNUC__ == 4 && __GNUC_MINOR__ == 8 + // Work around GCC 4.8 bug 54570 causing release build crashes. + asm("" : "+g" (yylval)); +#endif strcpy (yylval->sym, token); return TokenTrans[SYM]; } From 4770b9b27b0aebf29117ca1345db0cf0d0ea04fc Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Fri, 3 Jan 2014 01:21:21 -0500 Subject: [PATCH 6/7] - Fixed: Rampage timer should only reset when the weapon is ready to be fired. --- src/g_shared/sbar_mugshot.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index 0849fd354..aa0f9302a 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -270,7 +270,8 @@ void FMugShot::Tick(player_t *player) RampageTimer++; } } - else + // Only reset the rampage timer if the weapon becomes ready to fire. + else if((player->WeaponState & (WF_WEAPONREADY|WF_WEAPONREADYALT))) { RampageTimer = 0; } From b0f40c07338cea851f03720e7355b4ed71d55705 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Sat, 4 Jan 2014 00:37:15 -0500 Subject: [PATCH 7/7] - So we did end up restoring the variable that the last commit was compensating for. --- src/g_shared/sbar_mugshot.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index aa0f9302a..96dd07265 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -263,15 +263,14 @@ void FMugShot::Tick(player_t *player) CurrentState = NULL; } } - if ((player->cmd.ucmd.buttons & (BT_ATTACK|BT_ALTATTACK)) && !(player->cheats & (CF_FROZEN | CF_TOTALLYFROZEN)) && player->ReadyWeapon) + if (player->attackdown && !(player->cheats & (CF_FROZEN | CF_TOTALLYFROZEN)) && player->ReadyWeapon) { if (RampageTimer != ST_RAMPAGEDELAY) { RampageTimer++; } } - // Only reset the rampage timer if the weapon becomes ready to fire. - else if((player->WeaponState & (WF_WEAPONREADY|WF_WEAPONREADYALT))) + else { RampageTimer = 0; }