From ebb77544aa8312b02cad3eb3a29ea08d56fb411c Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Tue, 2 Dec 2014 02:08:50 -0800 Subject: [PATCH 1/2] reenable Int3 debugging --- common/include/dxxerror.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/include/dxxerror.h b/common/include/dxxerror.h index d84bfefd7..0f878f64f 100644 --- a/common/include/dxxerror.h +++ b/common/include/dxxerror.h @@ -51,14 +51,18 @@ void Error_puts(const char *func, unsigned line, const char *str) __noreturn __a void Error(const char *func, unsigned line, const char *fmt,...) __noreturn __attribute_format_printf(3, 4); //exit with error code=1, print message #define Error(F,...) dxx_call_printf_checked(Error,(Error_puts),(__func__, __LINE__),(F),##__VA_ARGS__) #define Assert assert + #ifndef NDEBUG //macros for debugging -# if defined(__APPLE__) || defined(macintosh) -extern void Debugger(void); // Avoids some name clashes -# define Int3 Debugger -# else -# define Int3() ((void)0) -# endif // Macintosh +#if defined(__clang__) +#define Int3() __builtin_debugtrap() +#elif defined(__GNUC__) && (defined(__i386__) || defined(__amd64__)) +#define Int3() ({ asm volatile ("int $3") }) +#elif defined _MSC_VER +#define Int3() __debugbreak() +#else +#error Debug break not defined for your compiler or platform. +#endif #else //macros for real game From 5d6e6dc2e4cef65805183fb49956b037854beef4 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Tue, 2 Dec 2014 19:14:11 -0800 Subject: [PATCH 2/2] check for GM_MULTI before trying to do network jobs --- similar/arch/sdl/timer.cpp | 3 ++- similar/main/automap.cpp | 3 ++- similar/main/game.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/similar/arch/sdl/timer.cpp b/similar/arch/sdl/timer.cpp index d2e739b3b..622bdeb99 100644 --- a/similar/arch/sdl/timer.cpp +++ b/similar/arch/sdl/timer.cpp @@ -55,7 +55,8 @@ void timer_delay2(int fps) while (FrameLoop < 1000u/(GameCfg.VSync?MAXIMUM_FPS:fps)) { u_int32_t tv_now = SDL_GetTicks(); - multi_do_frame(); // during long wait, keep packets flowing + if (Game_mode & GM_MULTI) + multi_do_frame(); // during long wait, keep packets flowing if (FrameStart > tv_now) FrameStart = tv_now; if (!GameCfg.VSync) diff --git a/similar/main/automap.cpp b/similar/main/automap.cpp index 5ebe2c4a9..e988debeb 100644 --- a/similar/main/automap.cpp +++ b/similar/main/automap.cpp @@ -611,7 +611,8 @@ static void draw_automap(automap *am) am->t2 = timer_query(); while (am->t2 - am->t1 < F1_0 / (GameCfg.VSync?MAXIMUM_FPS:GameArg.SysMaxFPS)) // ogl is fast enough that the automap can read the input too fast and you start to turn really slow. So delay a bit (and free up some cpu :) { - multi_do_frame(); // during long wait, keep packets flowing + if (Game_mode & GM_MULTI) + multi_do_frame(); // during long wait, keep packets flowing if (!GameArg.SysNoNiceFPS && !GameCfg.VSync) timer_delay(F1_0>>8); timer_update(); diff --git a/similar/main/game.cpp b/similar/main/game.cpp index 1d067def3..f1acb369b 100644 --- a/similar/main/game.cpp +++ b/similar/main/game.cpp @@ -404,7 +404,8 @@ void calc_frame_time() while (FrameTime < f1_0 / (GameCfg.VSync?MAXIMUM_FPS:GameArg.SysMaxFPS)) { - multi_do_frame(); // during long wait, keep packets flowing + if (Game_mode & GM_MULTI) + multi_do_frame(); // during long wait, keep packets flowing if (!GameArg.SysNoNiceFPS && !GameCfg.VSync) timer_delay(F1_0>>8); timer_update();