a LOT of time wasted fighting with dlls again
This commit is contained in:
BIN
Content/LinacLab/MyMyUserWidget.uasset
(Stored with Git LFS)
BIN
Content/LinacLab/MyMyUserWidget.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/LinacLab/vt100_Blueprint.uasset
(Stored with Git LFS)
BIN
Content/LinacLab/vt100_Blueprint.uasset
(Stored with Git LFS)
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
|
||||||
#include <HsFFI.h>
|
#include <HsFFI.h>
|
||||||
|
|
||||||
typedef enum ExtCallType {
|
typedef enum ExtCallType {
|
||||||
|
@ -7,12 +7,9 @@
|
|||||||
#include <Internationalization/Internationalization.h>
|
#include <Internationalization/Internationalization.h>
|
||||||
#include <Internationalization/Text.h>
|
#include <Internationalization/Text.h>
|
||||||
#include <Misc/MessageDialog.h>
|
#include <Misc/MessageDialog.h>
|
||||||
#include <Therac.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <Logging/StructuredLog.h>
|
#include <Logging/StructuredLog.h>
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "TheracAdapter"
|
|
||||||
|
|
||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
UTheracAdapterComponent::UTheracAdapterComponent() {
|
UTheracAdapterComponent::UTheracAdapterComponent() {
|
||||||
// Set this component to be initialized when the game starts, and to be ticked
|
// Set this component to be initialized when the game starts, and to be ticked
|
||||||
@ -41,18 +38,25 @@ void UTheracAdapterComponent::UpdateSimulator(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UTheracAdapterComponent::WrapSimulatorCall(
|
||||||
|
EExtCallType ext_call_type,
|
||||||
|
EBeamType beam_type,
|
||||||
|
ECollimatorPosition collimator_position,
|
||||||
|
int32 beam_energy
|
||||||
|
) {}
|
||||||
|
|
||||||
// Called when the game starts
|
// Called when the game starts
|
||||||
void UTheracAdapterComponent::BeginPlay() {
|
void UTheracAdapterComponent::BeginPlay() {
|
||||||
/*
|
|
||||||
FString BaseDir =
|
FString BaseDir =
|
||||||
IPluginManager::Get().FindPlugin("hstherac25")->GetBaseDir();
|
IPluginManager::Get().FindPlugin("hstherac25")->GetBaseDir();
|
||||||
FString LibraryPath =
|
FString LibraryPath =
|
||||||
FPaths::Combine(*BaseDir, TEXT("Source/hstherac-hs/HSdll.dll"));
|
FPaths::Combine(*BaseDir, TEXT("Source/hstherac-hs/hstherac25.dll"));
|
||||||
|
|
||||||
|
simulatorLibraryHandle = !LibraryPath.IsEmpty()
|
||||||
|
? FPlatformProcess::GetDllHandle(*LibraryPath)
|
||||||
|
: nullptr;
|
||||||
|
|
||||||
auto simulatorLibraryHandle =
|
|
||||||
!LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath)
|
|
||||||
: nullptr;
|
|
||||||
*/
|
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
wrappedComms = start_machine();
|
wrappedComms = start_machine();
|
||||||
std::map<FText *, StateInfoRequest> hng = {
|
std::map<FText *, StateInfoRequest> hng = {
|
||||||
@ -66,9 +70,27 @@ void UTheracAdapterComponent::BeginPlay() {
|
|||||||
for (auto & [hnng, hnnng] : hng) {
|
for (auto & [hnng, hnnng] : hng) {
|
||||||
compMap.Add(hnng, hnnng);
|
compMap.Add(hnng, hnnng);
|
||||||
}
|
}
|
||||||
|
ExtCallTypeMap.Add("R", EExtCallType::ExtCallReset);
|
||||||
|
ExtCallTypeMap.Add("P", EExtCallType::ExtCallProceed);
|
||||||
|
|
||||||
|
BeamTypeMap.Add("X", EBeamType::BeamTypeXRay);
|
||||||
|
BeamTypeMap.Add("E", EBeamType::BeamTypeElectron);
|
||||||
|
|
||||||
|
CollimatorPositionMap.Add("X", ECollimatorPosition::CollimatorPositionXRay);
|
||||||
|
CollimatorPositionMap.Add(
|
||||||
|
"E",
|
||||||
|
ECollimatorPosition::CollimatorPositionElectronBeam
|
||||||
|
);
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UTheracAdapterComponent::shutdownSimulator() {
|
||||||
|
kill_machine();
|
||||||
|
FPlatformProcess::FreeDllHandle(simulatorLibraryHandle);
|
||||||
|
simulatorLibraryHandle = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Called every frame
|
// Called every frame
|
||||||
void UTheracAdapterComponent::TickComponent(
|
void UTheracAdapterComponent::TickComponent(
|
||||||
float DeltaTime,
|
float DeltaTime,
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
void Fhstherac25Module::StartupModule() {
|
void Fhstherac25Module::StartupModule() {
|
||||||
// This code will execute after your module is loaded into memory; the exact
|
// This code will execute after your module is loaded into memory; the exact
|
||||||
// timing is specified in the .uplugin file per-module
|
// timing is specified in the .uplugin file per-module
|
||||||
|
/*
|
||||||
// Get the base directory of this plugin
|
// Get the base directory of this plugin
|
||||||
FString BaseDir =
|
FString BaseDir =
|
||||||
IPluginManager::Get().FindPlugin("hstherac25")->GetBaseDir();
|
IPluginManager::Get().FindPlugin("hstherac25")->GetBaseDir();
|
||||||
|
|
||||||
// Add on the relative location of the third party dll and load it
|
// Add on the relative location of the third party dll and load it
|
||||||
FString LibraryPath;
|
/ FString LibraryPath;
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_WINDOWS
|
||||||
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/hstherac-hs/HSdll.dll"));
|
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/hstherac-hs/HSdll.dll"));
|
||||||
|
|
||||||
@ -55,6 +55,7 @@ void Fhstherac25Module::StartupModule() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fhstherac25Module::ShutdownModule() {
|
void Fhstherac25Module::ShutdownModule() {
|
||||||
@ -63,8 +64,8 @@ void Fhstherac25Module::ShutdownModule() {
|
|||||||
// unloading the module.
|
// unloading the module.
|
||||||
|
|
||||||
// Free the dll handle
|
// Free the dll handle
|
||||||
FPlatformProcess::FreeDllHandle(simulatorLibraryHandle);
|
// FPlatformProcess::FreeDllHandle(simulatorLibraryHandle);
|
||||||
simulatorLibraryHandle = nullptr;
|
// simulatorLibraryHandle = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef LOCTEXT_NAMESPACE
|
#undef LOCTEXT_NAMESPACE
|
||||||
|
@ -5,10 +5,33 @@
|
|||||||
#include "Components/ActorComponent.h"
|
#include "Components/ActorComponent.h"
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include <HsFFI.h>
|
#include <HsFFI.h>
|
||||||
|
// #include
|
||||||
|
// <hstherac-hs/dist-newstyle/build/x86_64-windows/ghc-9.6.7/hstherac25-0.1.0.0/build/HsTherac25_stub.h>
|
||||||
#include <Therac.h>
|
#include <Therac.h>
|
||||||
#include <Internationalization/Text.h>
|
#include <Internationalization/Text.h>
|
||||||
#include "TheracAdapterComponent.generated.h"
|
#include "TheracAdapterComponent.generated.h"
|
||||||
|
|
||||||
|
UENUM()
|
||||||
|
enum class EBeamType : uint8 {
|
||||||
|
BeamTypeXRay = 1,
|
||||||
|
BeamTypeElectron,
|
||||||
|
};
|
||||||
|
|
||||||
|
UENUM()
|
||||||
|
enum class ECollimatorPosition : uint8 {
|
||||||
|
CollimatorPositionXRay = 1,
|
||||||
|
CollimatorPositionElectronBeam,
|
||||||
|
};
|
||||||
|
|
||||||
|
UENUM()
|
||||||
|
enum class EExtCallType : uint8 {
|
||||||
|
ExtCallSendMEOS = 1,
|
||||||
|
ExtCallToggleDatentComplete,
|
||||||
|
ExtCallToggleEditingTakingPlace,
|
||||||
|
ExtCallReset,
|
||||||
|
ExtCallProceed
|
||||||
|
};
|
||||||
|
|
||||||
UCLASS(
|
UCLASS(
|
||||||
BlueprintType,
|
BlueprintType,
|
||||||
ClassGroup = (Custom),
|
ClassGroup = (Custom),
|
||||||
@ -22,6 +45,16 @@ class HSTHERAC25_API UTheracAdapterComponent : public UActorComponent {
|
|||||||
|
|
||||||
TMap<FText *, StateInfoRequest> compMap;
|
TMap<FText *, StateInfoRequest> compMap;
|
||||||
|
|
||||||
|
void * simulatorLibraryHandle;
|
||||||
|
|
||||||
|
void UpdateSimulator(
|
||||||
|
ExtCallType ect,
|
||||||
|
HsStablePtr wrapped_comms = nullptr,
|
||||||
|
BeamType beam_type = BeamTypeUndefined,
|
||||||
|
CollimatorPosition collimator_position = CollimatorPositionUndefined,
|
||||||
|
HsInt beam_energy = 25000
|
||||||
|
);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
UTheracAdapterComponent();
|
UTheracAdapterComponent();
|
||||||
@ -46,17 +79,28 @@ public:
|
|||||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
FText BeamEnergy;
|
FText BeamEnergy;
|
||||||
|
|
||||||
void UpdateSimulator(
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
ExtCallType ect,
|
TMap<FString, EBeamType> BeamTypeMap;
|
||||||
HsStablePtr wrapped_comms = nullptr,
|
|
||||||
BeamType beam_type = BeamTypeUndefined,
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
CollimatorPosition collimator_position = CollimatorPositionUndefined,
|
TMap<FString, EExtCallType> ExtCallTypeMap;
|
||||||
HsInt beam_energy = 25000
|
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
TMap<FString, ECollimatorPosition> CollimatorPositionMap;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void WrapSimulatorCall(
|
||||||
|
EExtCallType ext_call_type,
|
||||||
|
EBeamType beam_type = EBeamType::BeamTypeXRay,
|
||||||
|
ECollimatorPosition collimator_position =
|
||||||
|
ECollimatorPosition::CollimatorPositionXRay,
|
||||||
|
int32 beam_energy = 25000
|
||||||
);
|
);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called when the game starts
|
// Called when the game starts
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
void shutdownSimulator();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Called every frame
|
// Called every frame
|
||||||
|
@ -12,5 +12,5 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/** Handle to the test dll we will load */
|
/** Handle to the test dll we will load */
|
||||||
void * simulatorLibraryHandle;
|
// void * simulatorLibraryHandle;
|
||||||
};
|
};
|
||||||
|
@ -5,65 +5,65 @@ using System.IO;
|
|||||||
|
|
||||||
public class hstherac25 : ModuleRules
|
public class hstherac25 : ModuleRules
|
||||||
{
|
{
|
||||||
public hstherac25(ReadOnlyTargetRules Target) : base(Target)
|
public hstherac25(ReadOnlyTargetRules Target) : base(Target)
|
||||||
{
|
{
|
||||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicIncludePaths.AddRange(
|
PublicIncludePaths.AddRange(
|
||||||
new string[] {
|
new string[] {
|
||||||
// ... add public include paths required here ...
|
// ... add public include paths required here ...
|
||||||
"C:/ghcup/ghc/9.6.7/include",
|
"C:/ghcup/ghc/9.6.7/include",
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
PrivateIncludePaths.AddRange(
|
PrivateIncludePaths.AddRange(
|
||||||
new string[] {
|
new string[] {
|
||||||
"C:/ghcup/ghc/9.6.7/include",
|
"C:/ghcup/ghc/9.6.7/include",
|
||||||
|
|
||||||
// "C:/ghcup/ghc/9.6.7/include",
|
// "C:/ghcup/ghc/9.6.7/include",
|
||||||
// "${workspaceFolder}/Plugins/hstherac25/Source/hstherac-hs/csrc",
|
// "${workspaceFolder}/Plugins/hstherac25/Source/hstherac-hs/csrc",
|
||||||
// "${workspaceFolder}/Plugins/hstherac25/Source/hstherac-hs/dist-newstyle/build/x86_64-windows/ghc-9.6.7/hstherac25-0.1.0.0/build"
|
// Path.Combine(ModuleDirectory,"../hstherac-hs/dist-newstyle/build/x86_64-windows/ghc-9.6.7/hstherac25-0.1.0.0/build"),
|
||||||
// ... add other private include paths required here ...
|
// ... add other private include paths required here ...
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(
|
PublicDependencyModuleNames.AddRange(
|
||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
"Core",
|
"Core",
|
||||||
"MathCore",
|
"MathCore",
|
||||||
"Projects",
|
"Projects",
|
||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
"Engine",
|
"Engine",
|
||||||
"UMG",
|
"UMG",
|
||||||
"AudioMixerCore",
|
"AudioMixerCore",
|
||||||
"InputCore"
|
"InputCore"
|
||||||
// ... add other public dependencies that you statically link with here ...
|
// ... add other public dependencies that you statically link with here ...
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(
|
PrivateDependencyModuleNames.AddRange(
|
||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
"Slate", "SlateCore"
|
"Slate", "SlateCore"
|
||||||
// ... add private dependencies that you statically link with here ...
|
// ... add private dependencies that you statically link with here ...
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
DynamicallyLoadedModuleNames.AddRange(
|
DynamicallyLoadedModuleNames.AddRange(
|
||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
|
|
||||||
// ... add any modules that your module loads dynamically here ...
|
// ... add any modules that your module loads dynamically here ...
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "../hstherac-hs", "HSdll.dll.a"));
|
PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "../hstherac-hs", "hstherac25.dll.a"));
|
||||||
RuntimeDependencies.Add(Path.Combine(PluginDirectory, "Source/hstherac-hs/HSdll.dll"));
|
RuntimeDependencies.Add(Path.Combine(ModuleDirectory, "../hstherac-hs/hstherac25.dll"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
public class MyProjectTarget : TargetRules
|
public class MyProjectTarget : TargetRules
|
||||||
{
|
{
|
||||||
public MyProjectTarget(TargetInfo Target) : base(Target)
|
public MyProjectTarget(TargetInfo Target) : base(Target)
|
||||||
{
|
{
|
||||||
Type = TargetType.Game;
|
Type = TargetType.Game;
|
||||||
DefaultBuildSettings = BuildSettingsVersion.V5;
|
DefaultBuildSettings = BuildSettingsVersion.V5;
|
||||||
|
|
||||||
ExtraModuleNames.AddRange( new string[] { "MyProject" } );
|
ExtraModuleNames.AddRange(new string[] { "MyProject", "hstherac25" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,20 +4,20 @@ using UnrealBuildTool;
|
|||||||
|
|
||||||
public class MyProject : ModuleRules
|
public class MyProject : ModuleRules
|
||||||
{
|
{
|
||||||
public MyProject(ReadOnlyTargetRules Target) : base(Target)
|
public MyProject(ReadOnlyTargetRules Target) : base(Target)
|
||||||
{
|
{
|
||||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });
|
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });
|
||||||
|
|
||||||
// Uncomment if you are using Slate UI
|
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
|
||||||
|
|
||||||
// Uncomment if you are using online features
|
|
||||||
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
|
|
||||||
|
|
||||||
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
|
// Uncomment if you are using Slate UI
|
||||||
}
|
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore", "hstherac25" });
|
||||||
|
|
||||||
|
// Uncomment if you are using online features
|
||||||
|
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
|
||||||
|
|
||||||
|
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ void UMyUserWidget::NativeOnInitialized() {
|
|||||||
CR_TextBlock,
|
CR_TextBlock,
|
||||||
ColX_TextBlock,
|
ColX_TextBlock,
|
||||||
ColY_TextBlock,
|
ColY_TextBlock,
|
||||||
WR_TextBlock,
|
WN_TextBlock,
|
||||||
AN_TextBlock
|
AN_TextBlock
|
||||||
};
|
};
|
||||||
for (auto * n : arcaneNumbers) {
|
for (auto * n : arcaneNumbers) {
|
||||||
|
@ -40,10 +40,10 @@ class MYPROJECT_API UMyUserWidget : public UUserWidget {
|
|||||||
UTextBlock * ColY_TextBlock;
|
UTextBlock * ColY_TextBlock;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UTextBlock * WR_TextBlock;
|
UTextBlock * WN_TextBlock;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UTextBlock * AN_TextBlock;
|
UTextBlock * AN_TextBlock;
|
||||||
|
|
||||||
void NativeOnInitialized() override;
|
void NativeOnInitialized() override;
|
||||||
};
|
};
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
public class MyProjectEditorTarget : TargetRules
|
public class MyProjectEditorTarget : TargetRules
|
||||||
{
|
{
|
||||||
public MyProjectEditorTarget(TargetInfo Target) : base(Target)
|
public MyProjectEditorTarget(TargetInfo Target) : base(Target)
|
||||||
{
|
{
|
||||||
Type = TargetType.Editor;
|
Type = TargetType.Editor;
|
||||||
DefaultBuildSettings = BuildSettingsVersion.V5;
|
DefaultBuildSettings = BuildSettingsVersion.V5;
|
||||||
|
|
||||||
ExtraModuleNames.AddRange( new string[] { "MyProject" } );
|
ExtraModuleNames.AddRange(new string[] { "MyProject", "hstherac25" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user