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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
// Copyright Epic Games, Inc. All Rights Reserved. // Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool; using UnrealBuildTool;
using System;
using System.IO; using System.IO;
public class hstherac25 : ModuleRules public class hstherac25 : ModuleRules
@ -36,7 +35,13 @@ public class hstherac25 : ModuleRules
new string[] new string[]
{ {
"Core", "Core",
"Projects" "MathCore",
"Projects",
"CoreUObject",
"Engine",
"UMG",
"AudioMixerCore",
"InputCore"
// ... add other public dependencies that you statically link with here ... // ... add other public dependencies that you statically link with here ...
} }
); );
@ -45,6 +50,7 @@ public class hstherac25 : ModuleRules
PrivateDependencyModuleNames.AddRange( PrivateDependencyModuleNames.AddRange(
new string[] new string[]
{ {
"Slate", "SlateCore"
// ... add private dependencies that you statically link with here ... // ... 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")); 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();
};