защита, подвижки всякие

This commit is contained in:
Andron666
2021-12-17 21:41:07 +05:00
parent d2d7174e54
commit 0d8781d6aa
714 changed files with 21464 additions and 23 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,56 @@
/*
* Unreal Engine .NET 5 integration
* Copyright (c) 2021 Stanislav Denisov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "UnrealCLRLibrary.h"
FManagedFunction::FManagedFunction() : Pointer() { }
UUnrealCLRLibrary::UUnrealCLRLibrary(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { }
void UUnrealCLRLibrary::ExecuteManagedFunction(FManagedFunction ManagedFunction, UObject* Object = nullptr) {
if (UnrealCLR::Status == UnrealCLR::StatusType::Running && ManagedFunction.Pointer)
UnrealCLR::ManagedCommand(UnrealCLR::Command(ManagedFunction.Pointer, Object));
}
FManagedFunction UUnrealCLRLibrary::FindManagedFunction(FString Method, bool Optional, bool& Result) {
FManagedFunction managedFunction;
if (UnrealCLR::Status == UnrealCLR::StatusType::Running && !Method.IsEmpty())
managedFunction.Pointer = UnrealCLR::ManagedCommand(UnrealCLR::Command(TCHAR_TO_ANSI(*Method), Optional));
Result = managedFunction.Pointer != nullptr;
return managedFunction;
}
UUnrealCLRCharacter::UUnrealCLRCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { }
void UUnrealCLRCharacter::Landed(const FHitResult& Hit) {
UnrealCLRFramework::Hit hit(Hit);
void* parameters[1] = {
&hit
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(LandedCallback, UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::CharacterLandedDelegate)));
}
@@ -0,0 +1,192 @@
/*
* Unreal Engine .NET 5 integration
* Copyright (c) 2021 Stanislav Denisov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "UnrealCLRManager.h"
void UUnrealCLRManager::ActorBeginOverlap(AActor* OverlapActor, AActor* OtherActor) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnActorBeginOverlap]) {
void* parameters[2] = {
OverlapActor,
OtherActor
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnActorBeginOverlap], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ActorOverlapDelegate)));
}
}
void UUnrealCLRManager::ActorEndOverlap(AActor* OverlapActor, AActor* OtherActor) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnActorEndOverlap]) {
void* parameters[2] = {
OverlapActor,
OtherActor
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnActorEndOverlap], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ActorOverlapDelegate)));
}
}
void UUnrealCLRManager::ActorHit(AActor* HitActor, AActor* OtherActor, FVector NormalImpulse, const FHitResult& Hit) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnActorHit]) {
UnrealCLRFramework::Vector3 normalImpulse(NormalImpulse);
UnrealCLRFramework::Hit hit(Hit);
void* parameters[4] = {
HitActor,
OtherActor,
&normalImpulse,
&hit
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnActorHit], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ActorHitDelegate)));
}
}
void UUnrealCLRManager::ActorBeginCursorOver(AActor* Actor) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnActorBeginCursorOver]) {
void* parameters[1] = {
Actor
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnActorBeginCursorOver], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ActorCursorDelegate)));
}
}
void UUnrealCLRManager::ActorEndCursorOver(AActor* Actor) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnActorEndCursorOver]) {
void* parameters[1] = {
Actor
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnActorEndCursorOver], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ActorCursorDelegate)));
}
}
void UUnrealCLRManager::ActorClicked(AActor* Actor, FKey Key) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnActorClicked]) {
FString key = Key.ToString();
void* parameters[2] = {
Actor,
TCHAR_TO_ANSI(*key)
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnActorClicked], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ActorKeyDelegate)));
}
}
void UUnrealCLRManager::ActorReleased(AActor* Actor, FKey Key) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnActorReleased]) {
FString key = Key.ToString();
void* parameters[2] = {
Actor,
TCHAR_TO_ANSI(*key)
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnActorReleased], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ActorKeyDelegate)));
}
}
void UUnrealCLRManager::ComponentBeginOverlap(UPrimitiveComponent* OverlapComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, int32 OtherBodyIndex, bool FromSweep, const FHitResult& SweepResult) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnComponentBeginOverlap]) {
void* parameters[2] = {
OverlapComponent,
OtherComponent
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnComponentBeginOverlap], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ComponentOverlapDelegate)));
}
}
void UUnrealCLRManager::ComponentEndOverlap(UPrimitiveComponent* OverlapComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, int32 OtherBodyIndex) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnComponentEndOverlap]) {
void* parameters[2] = {
OverlapComponent,
OtherComponent
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnComponentEndOverlap], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ComponentOverlapDelegate)));
}
}
void UUnrealCLRManager::ComponentHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnComponentHit]) {
UnrealCLRFramework::Vector3 normalImpulse(NormalImpulse);
UnrealCLRFramework::Hit hit(Hit);
void* parameters[4] = {
HitComponent,
OtherComponent,
&normalImpulse,
&hit
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnComponentHit], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ComponentHitDelegate)));
}
}
void UUnrealCLRManager::ComponentBeginCursorOver(UPrimitiveComponent* Component) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnActorBeginCursorOver]) {
void* parameters[1] = {
Component
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnComponentBeginCursorOver], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ComponentCursorDelegate)));
}
}
void UUnrealCLRManager::ComponentEndCursorOver(UPrimitiveComponent* Component) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnComponentEndCursorOver]) {
void* parameters[1] = {
Component
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnComponentEndCursorOver], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ComponentCursorDelegate)));
}
}
void UUnrealCLRManager::ComponentClicked(UPrimitiveComponent* Component, FKey Key) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnComponentClicked]) {
FString key = Key.ToString();
void* parameters[2] = {
Component,
TCHAR_TO_ANSI(*key)
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnComponentClicked], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ComponentKeyDelegate)));
}
}
void UUnrealCLRManager::ComponentReleased(UPrimitiveComponent* Component, FKey Key) {
if (UnrealCLR::Shared::Events[UnrealCLR::OnComponentReleased]) {
FString key = Key.ToString();
void* parameters[2] = {
Component,
TCHAR_TO_ANSI(*key)
};
UnrealCLR::ManagedCommand(UnrealCLR::Command(UnrealCLR::Shared::Events[UnrealCLR::OnComponentReleased], UnrealCLR::Callback(parameters, UnrealCLR::CallbackType::ComponentKeyDelegate)));
}
}
@@ -0,0 +1,406 @@
/*
* Unreal Engine .NET 5 integration
* Copyright (c) 2021 Stanislav Denisov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
// @third party code - BEGIN CoreCLR
#include "../../Dependencies/CoreCLR/includes/coreclr_delegates.h"
#include "../../Dependencies/CoreCLR/includes/hostfxr.h"
// @third party code - END CoreCLR
#include "AIController.h"
#include "Animation/AnimInstance.h"
#include "AssetRegistryModule.h"
#include "Camera/CameraActor.h"
#include "Camera/CameraComponent.h"
#include "Components/AudioComponent.h"
#include "Components/BoxComponent.h"
#include "Components/CapsuleComponent.h"
#include "Components/DirectionalLightComponent.h"
#include "Components/HierarchicalInstancedStaticMeshComponent.h"
#include "Components/InputComponent.h"
#include "Components/LightComponent.h"
#include "Components/LightComponentBase.h"
#include "Components/PostProcessComponent.h"
#include "Components/ShapeComponent.h"
#include "Components/SphereComponent.h"
#include "Components/SplineComponent.h"
#include "Components/TextRenderComponent.h"
#include "DrawDebugHelpers.h"
#include "Engine/DirectionalLight.h"
#include "Engine/Font.h"
#include "Engine/GameEngine.h"
#include "Engine/LevelScriptActor.h"
#include "Engine/Light.h"
#include "Engine/Player.h"
#include "Engine/PointLight.h"
#include "Engine/PostProcessVolume.h"
#include "Engine/RectLight.h"
#include "Engine/SpotLight.h"
#include "Engine/TriggerBox.h"
#include "Engine/TriggerCapsule.h"
#include "Engine/TriggerSphere.h"
#include "Engine/TriggerVolume.h"
#include "EngineUtils.h"
#include "GameFramework/Actor.h"
#include "GameFramework/Character.h"
#include "GameFramework/GameModeBase.h"
#include "GameFramework/PlayerController.h"
#include "GameFramework/PlayerInput.h"
#include "GameFramework/SpringArmComponent.h"
#include "HeadMountedDisplayFunctionLibrary.h"
#include "IAssetRegistry.h"
#include "ImageUtils.h"
#include "Materials/MaterialInstanceDynamic.h"
#include "Misc/DefaultValueHelper.h"
#include "Misc/OutputDeviceNull.h"
#include "Modules/ModuleManager.h"
#include "MotionControllerComponent.h"
#include "PhysicsEngine/RadialForceComponent.h"
#include "Sound/AmbientSound.h"
#include "UnrealEngine.h"
#include "UnrealCLRFramework.h"
#include "UnrealCLRLibrary.h"
#include "UnrealCLRManager.h"
#if WITH_EDITOR
#include "Editor.h"
#include "Framework/Notifications/NotificationManager.h"
#include "Widgets/Notifications/SNotificationList.h"
#endif
#ifdef _WIN32
#define UNREALCLR_WINDOWS 1
#elif defined(__unix__)
#define UNREALCLR_UNIX 2
#elif defined(__APPLE__)
#define UNREALCLR_MAC 3
#endif
#define UNREALCLR_NONE
#define UNREALCLR_BRACKET_LEFT (
#define UNREALCLR_BRACKET_RIGHT )
UNREALCLR_API DECLARE_LOG_CATEGORY_EXTERN(LogUnrealCLR, Log, All);
namespace UnrealCLR {
enum struct StatusType : int32 {
Stopped,
Idle,
Running
};
enum struct TickState : int32 {
Stopped,
Registered,
Started
};
enum struct LogLevel : int32 {
Display,
Warning,
Error,
Fatal
};
enum struct CallbackType : int32 {
ActorOverlapDelegate,
ActorHitDelegate,
ActorCursorDelegate,
ActorKeyDelegate,
ComponentOverlapDelegate,
ComponentHitDelegate,
ComponentCursorDelegate,
ComponentKeyDelegate,
CharacterLandedDelegate
};
enum struct ArgumentType : int32 {
None,
Single,
Integer,
Pointer,
Callback
};
enum struct CommandType : int32 {
Initialize = 1,
LoadAssemblies = 2,
UnloadAssemblies = 3,
Find = 4,
Execute = 5
};
enum {
OnWorldBegin,
OnWorldPostBegin,
OnWorldPrePhysicsTick,
OnWorldDuringPhysicsTick,
OnWorldPostPhysicsTick,
OnWorldPostUpdateTick,
OnWorldEnd,
OnActorBeginOverlap,
OnActorEndOverlap,
OnActorHit,
OnActorBeginCursorOver,
OnActorEndCursorOver,
OnActorClicked,
OnActorReleased,
OnComponentBeginOverlap,
OnComponentEndOverlap,
OnComponentHit,
OnComponentBeginCursorOver,
OnComponentEndCursorOver,
OnComponentClicked,
OnComponentReleased
};
struct Callback {
void** Parameters;
CallbackType Type;
FORCEINLINE Callback(void** Parameters, CallbackType Type) {
this->Parameters = Parameters;
this->Type = Type;
}
};
struct Argument {
union {
float Single;
uint32_t Integer;
void* Pointer;
Callback Callback;
};
ArgumentType Type;
FORCEINLINE Argument(float Value) {
this->Single = Value;
this->Type = ArgumentType::Single;
}
FORCEINLINE Argument(uint32_t Value) {
this->Integer = Value;
this->Type = ArgumentType::Integer;
}
FORCEINLINE Argument(void* Value) {
this->Pointer = Value;
this->Type = !Value ? ArgumentType::None : ArgumentType::Pointer;
}
FORCEINLINE Argument(UnrealCLR::Callback Value) {
this->Callback = Value;
this->Type = ArgumentType::Callback;
}
};
struct Command {
union {
struct {
void* Buffer;
int32 Checksum;
};
struct {
char* Method;
int32 Optional;
};
struct {
void* Function;
Argument Value;
};
};
CommandType Type;
FORCEINLINE Command(void* const Functions[3], int32 Checksum) {
this->Buffer = (void*)Functions;
this->Checksum = Checksum;
this->Type = CommandType::Initialize;
}
FORCEINLINE Command(CommandType Type) {
this->Type = Type;
}
FORCEINLINE Command(const char* Method, bool Optional) {
this->Method = (char*)Method;
this->Optional = Optional;
this->Type = CommandType::Find;
}
FORCEINLINE Command(void* Function) {
this->Function = Function;
this->Value = nullptr;
this->Type = CommandType::Execute;
}
FORCEINLINE Command(void* Function, Argument Value) {
this->Function = Function;
this->Value = Value;
this->Type = CommandType::Execute;
}
};
static_assert(sizeof(Callback) == 16, "Invalid size of the [Callback] structure");
static_assert(sizeof(Argument) == 24, "Invalid size of the [Argument] structure");
static_assert(sizeof(Command) == 40, "Invalid size of the [Command] structure");
static void* (*ManagedCommand)(Command);
static FString ProjectPath;
static FString UserAssembliesPath;
static StatusType Status = StatusType::Stopped;
static TickState WorldTickState = TickState::Stopped;
struct PrePhysicsTickFunction : public FTickFunction {
virtual void ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent) override;
virtual FString DiagnosticMessage() override;
};
struct DuringPhysicsTickFunction : public FTickFunction {
virtual void ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent) override;
virtual FString DiagnosticMessage() override;
};
struct PostPhysicsTickFunction : public FTickFunction {
virtual void ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent) override;
virtual FString DiagnosticMessage() override;
};
struct PostUpdateTickFunction : public FTickFunction {
virtual void ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent) override;
virtual FString DiagnosticMessage() override;
};
class Module : public IModuleInterface {
protected:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
private:
void OnWorldPostInitialization(UWorld* World, const UWorld::InitializationValues InitializationValues);
void OnWorldCleanup(UWorld* World, bool SessionEnded, bool CleanupResources);
static void RegisterTickFunction(FTickFunction& TickFunction, ETickingGroup TickGroup, AWorldSettings* LevelActor);
static void HostError(const char_t* Message);
static void Exception(const char* Message);
static void Log(UnrealCLR::LogLevel Level, const char* Message);
FDelegateHandle OnWorldPostInitializationHandle;
FDelegateHandle OnWorldCleanupHandle;
PrePhysicsTickFunction OnPrePhysicsTickFunction;
DuringPhysicsTickFunction OnDuringPhysicsTickFunction;
PostPhysicsTickFunction OnPostPhysicsTickFunction;
PostUpdateTickFunction OnPostUpdateTickFunction;
void* HostfxrLibrary;
};
namespace Engine {
static UUnrealCLRManager* Manager;
static UWorld* World;
}
namespace Shared {
constexpr static int32 storageSize = 128;
// Non-instantiable
static void* AssertFunctions[storageSize];
static void* CommandLineFunctions[storageSize];
static void* DebugFunctions[storageSize];
static void* ObjectFunctions[storageSize];
static void* ApplicationFunctions[storageSize];
static void* ConsoleManagerFunctions[storageSize];
static void* EngineFunctions[storageSize];
static void* WorldFunctions[storageSize];
// Instantiable
static void* AssetFunctions[storageSize];
static void* AssetRegistryFunctions[storageSize];
static void* BlueprintFunctions[storageSize];
static void* ConsoleObjectFunctions[storageSize];
static void* ConsoleVariableFunctions[storageSize];
static void* ActorFunctions[storageSize];
static void* GameModeBaseFunctions[storageSize];
static void* PawnFunctions[storageSize];
static void* CharacterFunctions[storageSize];
static void* ControllerFunctions[storageSize];
static void* AIControllerFunctions[storageSize];
static void* PlayerControllerFunctions[storageSize];
static void* VolumeFunctions[storageSize];
static void* PostProcessVolumeFunctions[storageSize];
static void* SoundBaseFunctions[storageSize];
static void* SoundWaveFunctions[storageSize];
static void* AnimationInstanceFunctions[storageSize];
static void* PlayerFunctions[storageSize];
static void* PlayerInputFunctions[storageSize];
static void* FontFunctions[storageSize];
static void* Texture2DFunctions[storageSize];
static void* ActorComponentFunctions[storageSize];
static void* InputComponentFunctions[storageSize];
static void* SceneComponentFunctions[storageSize];
static void* AudioComponentFunctions[storageSize];
static void* CameraComponentFunctions[storageSize];
static void* ChildActorComponentFunctions[storageSize];
static void* SpringArmComponentFunctions[storageSize];
static void* PostProcessComponentFunctions[storageSize];
static void* PrimitiveComponentFunctions[storageSize];
static void* ShapeComponentFunctions[storageSize];
static void* BoxComponentFunctions[storageSize];
static void* SphereComponentFunctions[storageSize];
static void* CapsuleComponentFunctions[storageSize];
static void* MeshComponentFunctions[storageSize];
static void* TextRenderComponentFunctions[storageSize];
static void* LightComponentBaseFunctions[storageSize];
static void* LightComponentFunctions[storageSize];
static void* MotionControllerComponentFunctions[storageSize];
static void* StaticMeshComponentFunctions[storageSize];
static void* InstancedStaticMeshComponentFunctions[storageSize];
static void* HierarchicalInstancedStaticMeshComponentFunctions[storageSize];
static void* SkinnedMeshComponentFunctions[storageSize];
static void* SkeletalMeshComponentFunctions[storageSize];
static void* SplineComponentFunctions[storageSize];
static void* RadialForceComponentFunctions[storageSize];
static void* MaterialInterfaceFunctions[storageSize];
static void* MaterialFunctions[storageSize];
static void* MaterialInstanceFunctions[storageSize];
static void* MaterialInstanceDynamicFunctions[storageSize];
static void* HeadMountedDisplayFunctions[storageSize];
static void* RuntimeFunctions[2];
static void* Events[128];
static void* Functions[128];
}
namespace Utility {
FORCEINLINE static size_t Strcpy(char* Destination, const char* Source, size_t Length);
FORCEINLINE static size_t Strlen(const char* Source);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,63 @@
/*
* Unreal Engine .NET 5 integration
* Copyright (c) 2021 Stanislav Denisov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#include "Kismet/BlueprintFunctionLibrary.h"
#include "UnrealCLRLibrary.generated.h"
USTRUCT(BlueprintType)
struct UNREALCLR_API FManagedFunction {
GENERATED_BODY()
public:
void* Pointer;
FManagedFunction();
};
UCLASS()
class UNREALCLR_API UUnrealCLRLibrary : public UBlueprintFunctionLibrary {
GENERATED_UCLASS_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = ".NET", meta = (ToolTip = "Executes the managed function with optional object reference argument"))
static void ExecuteManagedFunction(FManagedFunction ManagedFunction, UObject* Object);
UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = ".NET", meta = (ToolTip = "Finds the managed function from loaded assembly, optional parameter suppresses errors if the function was not found"))
static FManagedFunction FindManagedFunction(FString Method, bool Optional, bool& Result);
};
UCLASS()
class UNREALCLR_API UUnrealCLRCharacter : public UObject {
GENERATED_UCLASS_BODY()
public:
void* LandedCallback;
UFUNCTION()
void Landed(const FHitResult& Hit);
};
@@ -0,0 +1,77 @@
/*
* Unreal Engine .NET 5 integration
* Copyright (c) 2021 Stanislav Denisov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "UnrealCLRManager.generated.h"
UCLASS()
class UNREALCLR_API UUnrealCLRManager : public UObject {
GENERATED_BODY()
public:
UFUNCTION()
void ActorBeginOverlap(AActor* OverlapActor, AActor* OtherActor);
UFUNCTION()
void ActorEndOverlap(AActor* OverlapActor, AActor* OtherActor);
UFUNCTION()
void ActorHit(AActor* HitActor, AActor* OtherActor, FVector NormalImpulse, const FHitResult& Hit);
UFUNCTION()
void ActorBeginCursorOver(AActor* Actor);
UFUNCTION()
void ActorEndCursorOver(AActor* Actor);
UFUNCTION()
void ActorClicked(AActor* Actor, FKey Button);
UFUNCTION()
void ActorReleased(AActor* Actor, FKey Button);
UFUNCTION()
void ComponentBeginOverlap(UPrimitiveComponent* OverlapComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, int32 OtherBodyIndex, bool FromSweep, const FHitResult& SweepResult);
UFUNCTION()
void ComponentEndOverlap(UPrimitiveComponent* OverlapComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, int32 OtherBodyIndex);
UFUNCTION()
void ComponentHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit);
UFUNCTION()
void ComponentBeginCursorOver(UPrimitiveComponent* Component);
UFUNCTION()
void ComponentEndCursorOver(UPrimitiveComponent* Component);
UFUNCTION()
void ComponentClicked(UPrimitiveComponent* Component, FKey Key);
UFUNCTION()
void ComponentReleased(UPrimitiveComponent* Component, FKey Key);
};
@@ -0,0 +1,97 @@
/*
* Unreal Engine .NET 5 integration
* Copyright (c) 2021 Stanislav Denisov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.IO;
using UnrealBuildTool;
public class UnrealCLR : ModuleRules {
public UnrealCLR(ReadOnlyTargetRules Target) : base(Target) {
#if UE_4_24_OR_LATER
bLegacyPublicIncludePaths = false;
DefaultBuildSettings = BuildSettingsVersion.V2;
#else
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
#endif
PublicIncludePaths.AddRange(new string[] { });
PrivateIncludePaths.AddRange(new string[] { });
PublicDependencyModuleNames.AddRange(new string[] {
"Core"
});
PrivateDependencyModuleNames.AddRange(new string[] {
"AIModule",
"AssetRegistry",
"CoreUObject",
"Engine",
"HeadMountedDisplay",
"InputCore",
"Slate",
"SlateCore"
});
DynamicallyLoadedModuleNames.AddRange(new string[] { });
if (Target.bBuildEditor) {
PrivateDependencyModuleNames.AddRange(new string[] {
"UnrealEd"
});
} else {
string runtimePath = null;
if (Target.Platform == UnrealTargetPlatform.Win64)
runtimePath = Path.Combine(ModuleDirectory, "../../Runtime/Win64");
else if (Target.Platform == UnrealTargetPlatform.Linux)
runtimePath = Path.Combine(ModuleDirectory, "../../Runtime/Linux");
else if (Target.Platform == UnrealTargetPlatform.Mac)
runtimePath = Path.Combine(ModuleDirectory, "../../Runtime/Mac");
else
throw new Exception("Unknown platform");
string[] files = Directory.GetFiles(runtimePath, "*.*", SearchOption.AllDirectories);
foreach (string file in files) {
RuntimeDependencies.Add(file);
}
files = Directory.GetFiles(Path.Combine(ModuleDirectory, "../../Managed"), "*.*", SearchOption.AllDirectories);
foreach (string file in files) {
RuntimeDependencies.Add(file);
}
string userAssemblies = Path.Combine(PluginDirectory , "../../Managed");
if (Directory.Exists(userAssemblies)) {
files = Directory.GetFiles(userAssemblies, "*.*", SearchOption.AllDirectories);
foreach (string file in files) {
RuntimeDependencies.Add(file);
}
}
}
}
}