mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
Core/Misc: update g3dlite lib (#2904)
* Core/Misc: update g3dlite lib * update Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
32
deps/g3dlite/source/debugAssert.cpp
vendored
32
deps/g3dlite/source/debugAssert.cpp
vendored
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "G3D/debugAssert.h"
|
||||
#include "G3D/platform.h"
|
||||
#ifdef G3D_WIN32
|
||||
#ifdef G3D_WINDOWS
|
||||
#include <tchar.h>
|
||||
#endif
|
||||
#include "G3D/format.h"
|
||||
@@ -44,7 +44,7 @@ AssertionHook _failureHook = _handleErrorCheck_;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef G3D_WIN32
|
||||
#ifdef G3D_WINDOWS
|
||||
static void postToClipboard(const char *text) {
|
||||
if (OpenClipboard(NULL)) {
|
||||
HGLOBAL hMem = GlobalAlloc(GHND | GMEM_DDESHARE, strlen(text) + 1);
|
||||
@@ -77,7 +77,7 @@ static void createErrorMessage(
|
||||
std::string le = "";
|
||||
const char* newline = "\n";
|
||||
|
||||
#ifdef G3D_WIN32
|
||||
#ifdef G3D_WINDOWS
|
||||
newline = "\r\n";
|
||||
|
||||
// The last error value. (Which is preserved across the call).
|
||||
@@ -106,9 +106,9 @@ static void createErrorMessage(
|
||||
realLastErr = _T("Last error code does not exist.");
|
||||
}
|
||||
|
||||
if (lastErr != 0) {
|
||||
le = G3D::format("Last Error (0x%08X): %s\r\n\r\n", lastErr, (LPCSTR)realLastErr);
|
||||
}
|
||||
if (lastErr != 0) {
|
||||
le = G3D::format("Last Error (0x%08X): %s\r\n\r\n", lastErr, (LPCSTR)realLastErr);
|
||||
}
|
||||
|
||||
// Get rid of the allocated memory from FormatMessage.
|
||||
if (NULL != formatMsg) {
|
||||
@@ -121,6 +121,8 @@ static void createErrorMessage(
|
||||
const char* moduleName = strrchr(modulePath, '\\');
|
||||
outTitle = outTitle + string(" - ") + string(moduleName ? (moduleName + 1) : modulePath);
|
||||
|
||||
#else
|
||||
(void)outTitle;
|
||||
#endif
|
||||
|
||||
// Build the message.
|
||||
@@ -142,7 +144,7 @@ bool _handleDebugAssert_(
|
||||
std::string dialogText = "";
|
||||
createErrorMessage(expression, message, filename, lineNumber, dialogTitle, dialogText);
|
||||
|
||||
#ifdef G3D_WIN32
|
||||
#ifdef G3D_WINDOWS
|
||||
DWORD lastErr = GetLastError();
|
||||
postToClipboard(dialogText.c_str());
|
||||
debugPrintf("\n%s\n", dialogText.c_str());
|
||||
@@ -159,7 +161,7 @@ bool _handleDebugAssert_(
|
||||
|
||||
int result = G3D::prompt(dialogTitle.c_str(), dialogText.c_str(), (const char**)choices, 3, useGuiPrompt);
|
||||
|
||||
# ifdef G3D_WIN32
|
||||
# ifdef G3D_WINDOWS
|
||||
// Put the incoming last error back.
|
||||
SetLastError(lastErr);
|
||||
# endif
|
||||
@@ -200,7 +202,7 @@ bool _handleErrorCheck_(
|
||||
|
||||
// Log the error
|
||||
Log::common()->print(std::string("\n**************************\n\n") + dialogTitle + "\n" + dialogText);
|
||||
#ifdef G3D_WIN32
|
||||
#ifdef G3D_WINDOWS
|
||||
DWORD lastErr = GetLastError();
|
||||
(void)lastErr;
|
||||
postToClipboard(dialogText.c_str());
|
||||
@@ -212,7 +214,7 @@ bool _handleErrorCheck_(
|
||||
const std::string& m =
|
||||
std::string("An internal error has occured in this program and it will now close. "
|
||||
"The specific error is below. More information has been saved in \"") +
|
||||
Log::getCommonLogFilename() + "\".\n" + dialogText;
|
||||
Log::getCommonLogFilename() + "\".\n\n" + dialogText;
|
||||
|
||||
int result = G3D::prompt("Error", m.c_str(), (const char**)choices, 1, useGuiPrompt);
|
||||
(void)result;
|
||||
@@ -221,7 +223,7 @@ bool _handleErrorCheck_(
|
||||
}
|
||||
|
||||
|
||||
#ifdef G3D_WIN32
|
||||
#ifdef G3D_WINDOWS
|
||||
static HCURSOR oldCursor;
|
||||
static RECT oldCursorRect;
|
||||
static POINT oldCursorPos;
|
||||
@@ -229,7 +231,7 @@ static int oldShowCursorCount;
|
||||
#endif
|
||||
|
||||
void _releaseInputGrab_() {
|
||||
#ifdef G3D_WIN32
|
||||
#ifdef G3D_WINDOWS
|
||||
|
||||
GetCursorPos(&oldCursorPos);
|
||||
|
||||
@@ -275,7 +277,7 @@ void _releaseInputGrab_() {
|
||||
|
||||
|
||||
void _restoreInputGrab_() {
|
||||
#ifdef G3D_WIN32
|
||||
#ifdef G3D_WINDOWS
|
||||
|
||||
// Restore the old clipping region
|
||||
ClipCursor(&oldCursorRect);
|
||||
@@ -307,7 +309,7 @@ void setAssertionHook(AssertionHook hook) {
|
||||
}
|
||||
|
||||
AssertionHook assertionHook() {
|
||||
return G3D::_internal::_debugHook;
|
||||
return G3D::_internal::_debugHook;
|
||||
}
|
||||
|
||||
void setFailureHook(AssertionHook hook) {
|
||||
@@ -329,7 +331,7 @@ ConsolePrintHook consolePrintHook() {
|
||||
|
||||
|
||||
std::string __cdecl debugPrint(const std::string& s) {
|
||||
# ifdef G3D_WIN32
|
||||
# ifdef G3D_WINDOWS
|
||||
const int MAX_STRING_LEN = 1024;
|
||||
|
||||
// Windows can't handle really long strings sent to
|
||||
|
||||
Reference in New Issue
Block a user