This commit is contained in:
wonkyhonky2024
2025-05-15 19:28:04 +01:00
parent 23691e77c2
commit ff30856c60
16 changed files with 109 additions and 33 deletions

Binary file not shown.

BIN
Content/LinacLab/MyMyUserWidget.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/LinacLab/vt100_Blueprint.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -1,4 +1,4 @@
#pragma once
#include <HsFFI.h>
typedef enum ExtCallType {

View File

@ -43,11 +43,19 @@ void UTheracAdapterComponent::WrapSimulatorCall(
EBeamType beam_type,
ECollimatorPosition collimator_position,
int32 beam_energy
) {}
) {
UpdateSimulator(
ExtCallType(ext_call_type),
wrappedComms,
BeamType(beam_type),
CollimatorPosition(collimator_position),
beam_energy
);
}
// Called when the game starts
void UTheracAdapterComponent::BeginPlay() {
/*
FString BaseDir =
IPluginManager::Get().FindPlugin("hstherac25")->GetBaseDir();
FString LibraryPath =
@ -56,7 +64,7 @@ void UTheracAdapterComponent::BeginPlay() {
simulatorLibraryHandle = !LibraryPath.IsEmpty()
? FPlatformProcess::GetDllHandle(*LibraryPath)
: nullptr;
*/
Super::BeginPlay();
wrappedComms = start_machine();
std::map<FText *, StateInfoRequest> hng = {
@ -70,6 +78,7 @@ void UTheracAdapterComponent::BeginPlay() {
for (auto & [hnng, hnnng] : hng) {
compMap.Add(hnng, hnnng);
}
ExtCallTypeMap.Add("T", EExtCallType::ExtCallSendMEOS);
ExtCallTypeMap.Add("R", EExtCallType::ExtCallReset);
ExtCallTypeMap.Add("P", EExtCallType::ExtCallProceed);
@ -84,13 +93,13 @@ void UTheracAdapterComponent::BeginPlay() {
// ...
}
/*
void UTheracAdapterComponent::shutdownSimulator() {
kill_machine();
FPlatformProcess::FreeDllHandle(simulatorLibraryHandle);
simulatorLibraryHandle = nullptr;
}
*/
// Called every frame
void UTheracAdapterComponent::TickComponent(
float DeltaTime,

View File

@ -13,16 +13,17 @@
void Fhstherac25Module::StartupModule() {
// This code will execute after your module is loaded into memory; the exact
// timing is specified in the .uplugin file per-module
/*
// Get the base directory of this plugin
FString BaseDir =
IPluginManager::Get().FindPlugin("hstherac25")->GetBaseDir();
// Add on the relative location of the third party dll and load it
/ FString LibraryPath;
FString LibraryPath;
#if PLATFORM_WINDOWS
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/hstherac-hs/HSdll.dll"));
LibraryPath =
// FPaths::Combine(*BaseDir, TEXT("Binaries/Win64/hstherac25.dll"));
FPaths::Combine(*BaseDir, TEXT("Binaries/Win64/HSdll.dll"));
#elif PLATFORM_MAC
LibraryPath = FPaths::Combine(
*BaseDir,
@ -55,7 +56,6 @@ void Fhstherac25Module::StartupModule() {
)
);
}
*/
}
void Fhstherac25Module::ShutdownModule() {
@ -64,8 +64,9 @@ void Fhstherac25Module::ShutdownModule() {
// unloading the module.
// Free the dll handle
// FPlatformProcess::FreeDllHandle(simulatorLibraryHandle);
// simulatorLibraryHandle = nullptr;
kill_machine();
FPlatformProcess::FreeDllHandle(simulatorLibraryHandle);
simulatorLibraryHandle = nullptr;
}
#undef LOCTEXT_NAMESPACE

View File

@ -45,8 +45,6 @@ class HSTHERAC25_API UTheracAdapterComponent : public UActorComponent {
TMap<FText *, StateInfoRequest> compMap;
void * simulatorLibraryHandle;
void UpdateSimulator(
ExtCallType ect,
HsStablePtr wrapped_comms = nullptr,
@ -100,7 +98,8 @@ public:
protected:
// Called when the game starts
virtual void BeginPlay() override;
void shutdownSimulator();
// void shutdownSimulator();
public:
// Called every frame

View File

@ -12,5 +12,5 @@ public:
private:
/** Handle to the test dll we will load */
// void * simulatorLibraryHandle;
void * simulatorLibraryHandle;
};

View File

@ -63,7 +63,9 @@ public class hstherac25 : ModuleRules
// ... add any modules that your module loads dynamically here ...
}
);
PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "../hstherac-hs", "hstherac25.dll.a"));
RuntimeDependencies.Add(Path.Combine(ModuleDirectory, "../hstherac-hs/hstherac25.dll"));
// PublicAdditionalLibraries.Add(Path.Combine(PluginDirectory, "Source", "hstherac-hs", "hstherac25.dll.a"));
// RuntimeDependencies.Add(Path.Combine(PluginDirectory, "Source", "hstherac-hs", "hstherac25.dll"));
PublicAdditionalLibraries.Add(Path.Combine(PluginDirectory, "Source", "hstherac-hs", "HSdll.dll.a"));
RuntimeDependencies.Add(Path.Combine(PluginDirectory, "Source", "hstherac-hs", "HSdll.dll"));
}
}

View File

@ -9,6 +9,6 @@ public class MyProjectTarget : TargetRules
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V5;
ExtraModuleNames.AddRange(new string[] { "MyProject", "hstherac25" });
ExtraModuleNames.AddRange(new string[] { "MyProject", });
}
}

View File

@ -13,7 +13,7 @@ public class MyProject : ModuleRules
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore", "hstherac25" });
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");

View File

@ -1,37 +1,53 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ModeInputTextBox.h"
#include <Logging/StructuredLog.h>
void UModeInputTextBox::HandleOnTextChanged(FText const & inText) {
Text = Text.GetEmpty();
auto & s = inText.ToString();
auto lastChar = s.LeftChop(1);
lastChar.ToUpperInline();
// UE_LOGFMT(LogTemp, Warning, "kill me {inText}", s);
auto lastChar = s.ToUpper().Right(1);
// UE_LOGFMT(LogTemp, Warning, "fucking {lastChar}", lastChar);
SetText(FText::FromString(lastChar));
if (!lastChar.IsEmpty()) {
switch (myTarget) {
case THSModeTarget::Energy:
switch (lastChar[0]) {
switch (lastChar[lastChar.Len() - 1]) {
case 'E':
break;
case 'X':
break;
default:
lastChar[lastChar.Len() - 1] = '\0';
break;
}
break;
case THSModeTarget::OpMode:
switch (lastChar[0]) {
switch (lastChar[lastChar.Len() - 1]) {
case 'T':
break;
case 'R':
break;
case 'P':
break;
default:
lastChar = "";
}
break;
default:
break;
}
}
// UE_LOGFMT(LogTemp, Warning, "wat {lastChar}", lastChar);
SetText(FText::FromString(lastChar));
// SetText(FText::FromString(FString::Printf(TEXT("%c"), lastChar)));
}

View File

@ -3,6 +3,25 @@
#include "MyUserWidget.h"
#include <MyPlayerState.h>
bool UMyUserWidget::AllVerified() {
UTextBlock * myVerifiers[9] = {
URM_Verifier,
MU_Verifier,
Time_Verifier,
GR_Verifier,
CR_Verifier,
ColX_Verifier,
ColY_Verifier,
WN_Verifier,
AN_Verifier
};
for (auto & v : myVerifiers) {
if (v->GetText().IsEmpty())
return false;
}
return true;
}
void UMyUserWidget::NativeOnInitialized() {
auto ps = StaticCast<AMyPlayerState *>(GetOwningPlayerState());
if (ps == nullptr)

View File

@ -45,5 +45,35 @@ class MYPROJECT_API UMyUserWidget : public UUserWidget {
UPROPERTY(meta = (BindWidget))
UTextBlock * AN_TextBlock;
UPROPERTY(meta = (BindWidget))
UTextBlock * URM_Verifier;
UPROPERTY(meta = (BindWidget))
UTextBlock * MU_Verifier;
UPROPERTY(meta = (BindWidget))
UTextBlock * Time_Verifier;
UPROPERTY(meta = (BindWidget))
UTextBlock * GR_Verifier;
UPROPERTY(meta = (BindWidget))
UTextBlock * CR_Verifier;
UPROPERTY(meta = (BindWidget))
UTextBlock * ColX_Verifier;
UPROPERTY(meta = (BindWidget))
UTextBlock * ColY_Verifier;
UPROPERTY(meta = (BindWidget))
UTextBlock * WN_Verifier;
UPROPERTY(meta = (BindWidget))
UTextBlock * AN_Verifier;
UFUNCTION(BlueprintCallable, BluePrintPure)
bool AllVerified();
void NativeOnInitialized() override;
};

View File

@ -9,6 +9,6 @@ public class MyProjectEditorTarget : TargetRules
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V5;
ExtraModuleNames.AddRange(new string[] { "MyProject", "hstherac25" });
ExtraModuleNames.AddRange(new string[] { "MyProject", });
}
}