lxGameMode can now trap UE_LOG Error into the debugger

This commit is contained in:
2024-11-22 23:01:05 -05:00
parent c1f2d74351
commit 75dcdf54cc
11 changed files with 348 additions and 223 deletions

View File

@@ -7,21 +7,11 @@
#define LOCTEXT_NAMESPACE "Luprex Utility"
void UlxUtilityLibrary::Assert(bool condition, const FString &message) {
if (!condition) {
FBlueprintExceptionInfo ExceptionInfo(EBlueprintExceptionType::FatalError, FText::FromString(message));
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
}
}
void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namepart1, const FString &namepart2, const FString &fallback, bool bFailIfNotFound) {
FString fullname = namepart1 + namepart2;
if (!IsValid(object)) {
const FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::FatalError,
LOCTEXT("CallFunctionByName_ObjectIsNotValid", "In CallFunctionByName, object passed in is not valid.")
);
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
UE_LOG(LogBlueprint, Error, TEXT("In CallFunctionByName, object passed in is not valid."));
return;
}
UFunction* function = object->FindFunction(FName(*fullname));
@@ -31,20 +21,12 @@ void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namep
if (!bFailIfNotFound) {
return;
}
const FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::FatalError,
LOCTEXT("CallFunctionByName_NoSuchFunction", "In CallFunctionByName, cannot find the named function or the fallback function.")
);
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
UE_LOG(LogBlueprint, Error, TEXT("In CallFunctionByName, cannot find the named function or the fallback function"));
return;
}
}
if (function->ParmsSize != 0) {
const FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::FatalError,
LOCTEXT("CallFunctionByName_FunctionHasParameters", "CallFunctionByName can only call functions that have no parameters and no return values.")
);
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
UE_LOG(LogBlueprint, Error, TEXT("CallFunctionByName can only call functions that have no parameters and no return values"));
return;
}
object->ProcessEvent(function, nullptr);