mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
AGS: Fixed sending non-error messages to debugger
From upstream 3b43353986ca91ecad9c5270e362c8716effaf37
This commit is contained in:
parent
540a92a6c5
commit
faa858a55b
@ -22,13 +22,6 @@
|
||||
#include "ags/lib/std/memory.h"
|
||||
#include "ags/lib/std/limits.h"
|
||||
#include "ags/shared/core/platform.h"
|
||||
#if AGS_PLATFORM_OS_WINDOWS
|
||||
#define NOMINMAX
|
||||
#define BITMAP WINDOWS_BITMAP
|
||||
//include <windows.h>
|
||||
#undef BITMAP
|
||||
#endif
|
||||
//include <SDL.h>
|
||||
#include "ags/lib/std/initializer_list.h"
|
||||
#include "ags/shared/ac/common.h"
|
||||
#include "ags/shared/ac/game_setup_struct.h"
|
||||
@ -321,23 +314,24 @@ struct Breakpoint {
|
||||
};
|
||||
|
||||
bool send_message_to_editor(const char *msg, const char *errorMsg) {
|
||||
String callStack = cc_get_error().CallStack;
|
||||
// Get either saved callstack from a script error, or current execution point
|
||||
String callStack = (errorMsg && cc_has_error()) ?
|
||||
cc_get_error().CallStack : cc_get_callstack();
|
||||
if (callStack.IsEmpty())
|
||||
return false;
|
||||
|
||||
char messageToSend[STD_BUFFER_SIZE];
|
||||
sprintf(messageToSend, "<?xml version=\"1.0\" encoding=\"Windows-1252\"?><Debugger Command=\"%s\">", msg);
|
||||
String message;
|
||||
message.AppendFmt("<?xml version=\"1.0\" encoding=\"Windows-1252\"?><Debugger Command=\"%s\">", msg);
|
||||
#if AGS_PLATFORM_OS_WINDOWS
|
||||
sprintf(&messageToSend[strlen(messageToSend)], " <EngineWindow>%d</EngineWindow> ", (int)sys_win_get_window());
|
||||
message.AppendFmt(" <EngineWindow>%d</EngineWindow> ", (int)sys_win_get_window());
|
||||
#endif
|
||||
sprintf(&messageToSend[strlen(messageToSend)], " <ScriptState><![CDATA[%s]]></ScriptState> ", callStack.GetCStr());
|
||||
message.AppendFmt(" <ScriptState><![CDATA[%s]]></ScriptState> ", callStack.GetCStr());
|
||||
if (errorMsg != nullptr) {
|
||||
sprintf(&messageToSend[strlen(messageToSend)], " <ErrorMessage><![CDATA[%s]]></ErrorMessage> ", errorMsg);
|
||||
message.AppendFmt(" <ErrorMessage><![CDATA[%s]]></ErrorMessage> ", errorMsg);
|
||||
}
|
||||
strcat(messageToSend, "</Debugger>");
|
||||
|
||||
_G(editor_debugger)->SendMessageToEditor(messageToSend);
|
||||
message.Append("</Debugger>");
|
||||
|
||||
_G(editor_debugger)->SendMessageToEditor(message.GetCStr());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,7 @@ void can_run_delayed_command();
|
||||
|
||||
// Gets current running script position
|
||||
bool get_script_position(ScriptPosition &script_pos);
|
||||
AGS::Shared::String cc_get_callstack(int max_lines = INT_MAX);
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
|
@ -42,9 +42,6 @@ int ccGetOption(int optbit) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Returns current running script callstack as a human-readable text
|
||||
extern String cc_get_callstack(int max_lines = INT_MAX);
|
||||
|
||||
void cc_clear_error() {
|
||||
_GP(ccError) = ScriptError();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user