From c6bc250632dec0987c5e71f783be45aae5a8fbf0 Mon Sep 17 00:00:00 2001 From: Wanne Date: Sun, 15 Apr 2012 23:46:44 +0000 Subject: [PATCH] - Make Gameloop exceptions behave more like previous code (by tazpn) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5213 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Standard Gaming Platform/sgp.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Standard Gaming Platform/sgp.cpp b/Standard Gaming Platform/sgp.cpp index f1a47ff04..e9b7bc4d7 100644 --- a/Standard Gaming Platform/sgp.cpp +++ b/Standard Gaming Platform/sgp.cpp @@ -1898,6 +1898,36 @@ static LONG __stdcall SGPExceptionFilter(int exceptionCount, EXCEPTION_POINTERS* return EXCEPTION_EXECUTE_HANDLER; } +static void SGPGameLoop() +{ + try + { + GameLoop(); + } + catch(sgp::Exception &ex) + { + SGP_ERROR(ex.what()); + SHOWEXCEPTION(ex); + } + catch(vfs::Exception &ex) + { + SGP_ERROR(ex.what()); + SHOWEXCEPTION(ex); + } + catch(std::exception &ex) + { + sgp::Exception nex(ex.what()); + SGP_ERROR(nex.what()); + SHOWEXCEPTION(nex); + } + catch(const char* msg) + { + sgp::Exception ex(msg); + SGP_ERROR(ex.what()); + SHOWEXCEPTION(ex); + } +} + static bool CallGameLoop(bool wait) { static int numUnsuccessfulTries = 0; @@ -1915,7 +1945,7 @@ static bool CallGameLoop(bool wait) { __try { - GameLoop(); + SGPGameLoop(); numUnsuccessfulTries = 0; } __except( SGPExceptionFilter(++numUnsuccessfulTries, GetExceptionInformation()) )