0.1x developer

This commit is contained in:
wonkyhonky2024
2025-05-12 21:39:32 +01:00
parent 68dbce9607
commit 042fa652b7
9 changed files with 95 additions and 91 deletions

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

Binary file not shown.

View File

@ -0,0 +1,55 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "TheracAdapterComponent.h"
#include "HAL/PlatformProcess.h"
#include "Interfaces/IPluginManager.h"
#include "Misc/Paths.h"
#include <Internationalization/Internationalization.h>
#include <Internationalization/Text.h>
#include <Misc/MessageDialog.h>
#include <Therac.h>
#define LOCTEXT_NAMESPACE "TheracAdapter"
// Sets default values for this component's properties
UTheracAdapterComponent::UTheracAdapterComponent() {
// Set this component to be initialized when the game starts, and to be ticked
// every frame. You can turn these features off to improve performance if you
// don't need them.
// PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UTheracAdapterComponent::BeginPlay() {
/*
FString BaseDir =
IPluginManager::Get().FindPlugin("hstherac25")->GetBaseDir();
FString LibraryPath =
FPaths::Combine(*BaseDir, TEXT("Source/hstherac-hs/HSdll.dll"));
auto simulatorLibraryHandle =
!LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath)
: nullptr;
*/
Super::BeginPlay();
wrappedComms = start_machine();
auto si = FText::FromString(StaticCast<char *>(
request_state_info(wrappedComms, RequestActiveSubsystem)
));
FMessageDialog::Open(EAppMsgType::Ok, si);
// ...
}
// Called every frame
void UTheracAdapterComponent::TickComponent(
float DeltaTime,
ELevelTick TickType,
FActorComponentTickFunction * ThisTickFunction
) {
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}

View File

@ -1,11 +1,11 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "hstherac25.h"
#include "Misc/MessageDialog.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "Misc/Paths.h"
#include "HAL/PlatformProcess.h"
#include "Interfaces/IPluginManager.h"
#include "Misc/MessageDialog.h"
#include "Misc/Paths.h"
#include "Modules/ModuleManager.h"
#include "Therac.h"
#define LOCTEXT_NAMESPACE "Fhstherac25Module"
@ -26,30 +26,26 @@ void Fhstherac25Module::StartupModule() {
#elif PLATFORM_MAC
LibraryPath = FPaths::Combine(
*BaseDir,
TEXT(
"Source/ThirdParty/hstherac25Library/Mac/Release/"
"libExampleLibrary.dylib"
)
TEXT("Source/ThirdParty/hstherac25Library/Mac/Release/"
"libExampleLibrary.dylib")
);
#elif PLATFORM_LINUX
LibraryPath = FPaths::Combine(
*BaseDir,
TEXT(
"Binaries/ThirdParty/hstherac25Library/Linux/"
"x86_64-unknown-linux-gnu/libExampleLibrary.so"
)
TEXT("Binaries/ThirdParty/hstherac25Library/Linux/"
"x86_64-unknown-linux-gnu/libExampleLibrary.so")
);
#endif // PLATFORM_WINDOWS
ExampleLibraryHandle = !LibraryPath.IsEmpty()
? FPlatformProcess::GetDllHandle(*LibraryPath)
: nullptr;
simulatorLibraryHandle = !LibraryPath.IsEmpty()
? FPlatformProcess::GetDllHandle(*LibraryPath)
: nullptr;
if (ExampleLibraryHandle) {
if (simulatorLibraryHandle) {
// Call the test function in the third party library that opens a message
// box
// ExampleLibraryFunction();
HsStablePtr wc = start_machine();
// HsStablePtr wc = start_machine();
} else {
FMessageDialog::Open(
EAppMsgType::Ok,
@ -67,8 +63,8 @@ void Fhstherac25Module::ShutdownModule() {
// unloading the module.
// Free the dll handle
FPlatformProcess::FreeDllHandle(ExampleLibraryHandle);
ExampleLibraryHandle = nullptr;
FPlatformProcess::FreeDllHandle(simulatorLibraryHandle);
simulatorLibraryHandle = nullptr;
}
#undef LOCTEXT_NAMESPACE

View File

@ -4,17 +4,21 @@
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "TheracSimComponent.generated.h"
#include <HsFFI.h>
#include "TheracAdapterComponent.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MYPROJECT_API UTheracSimComponent : public UActorComponent
class HSTHERAC25_API UTheracAdapterComponent : public UActorComponent
{
GENERATED_BODY()
HsStablePtr wrappedComms;
public:
// Sets default values for this component's properties
UTheracSimComponent();
UTheracAdapterComponent();
protected:
// Called when the game starts

View File

@ -4,15 +4,13 @@
#include "Modules/ModuleManager.h"
class Fhstherac25Module : public IModuleInterface
{
class Fhstherac25Module : public IModuleInterface {
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
private:
/** Handle to the test dll we will load */
void* ExampleLibraryHandle;
/** Handle to the test dll we will load */
void * simulatorLibraryHandle;
};

View File

@ -1,7 +1,6 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System;
using System.IO;
public class hstherac25 : ModuleRules
@ -36,7 +35,13 @@ public class hstherac25 : ModuleRules
new string[]
{
"Core",
"Projects"
"MathCore",
"Projects",
"CoreUObject",
"Engine",
"UMG",
"AudioMixerCore",
"InputCore"
// ... add other public dependencies that you statically link with here ...
}
);
@ -45,6 +50,7 @@ public class hstherac25 : ModuleRules
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Slate", "SlateCore"
// ... add private dependencies that you statically link with here ...
}
);
@ -58,5 +64,6 @@ public class hstherac25 : ModuleRules
}
);
PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "../hstherac-hs", "HSdll.dll.a"));
}
RuntimeDependencies.Add(Path.Combine(PluginDirectory, "Source/hstherac-hs/HSdll.dll"));
}
}

View File

@ -1,7 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "TheracAdapter.h"
TheracAdapter::TheracAdapter() {}
TheracAdapter::~TheracAdapter() {}

View File

@ -1,34 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "TheracSimComponent.h"
// Sets default values for this component's properties
UTheracSimComponent::UTheracSimComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UTheracSimComponent::BeginPlay()
{
Super::BeginPlay();
// ...
}
// Called every frame
void UTheracSimComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}

View File

@ -1,15 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
/**
*
*/
class MYPROJECT_API TheracAdapter
{
public:
TheracAdapter();
~TheracAdapter();
};