Skip to content

Commit

Permalink
Working in UE4
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordonbc committed May 31, 2024
1 parent f25ca44 commit daa49af
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 73 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ winbuild/

!Compile.sh
!Compile.bat
HarmonyLinkLib/.vscode/
1 change: 0 additions & 1 deletion HarmonyLinkLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ set(COMMON_SOURCES
"src/Platform/IPlatformUtilities.cpp"
"src/HarmonyLinkLib.cpp"
"src/Version.cpp"
"src/dllmain.cpp"
"src/Platform/WineUtilities.cpp"
"src/Utilities.cpp"
)
Expand Down
16 changes: 9 additions & 7 deletions HarmonyLinkLib/include/HarmonyLinkLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@ class IPlatformUtilities;

namespace HarmonyLinkLib
{
extern "C" HARMONYLINKLIB_API bool get_is_wine();
HARMONYLINKLIB_API bool HL_Init();

extern "C" HARMONYLINKLIB_API bool get_is_linux();
HARMONYLINKLIB_API bool get_is_wine();

extern "C" HARMONYLINKLIB_API bool get_is_docked();
HARMONYLINKLIB_API bool get_is_linux();

extern "C" HARMONYLINKLIB_API FCPUInfo* get_cpu_info();
HARMONYLINKLIB_API bool get_is_docked();

extern "C" HARMONYLINKLIB_API FDevice* get_device_info();
HARMONYLINKLIB_API FCPUInfo* get_cpu_info();

extern "C" HARMONYLINKLIB_API FOSVerInfo* get_os_version();
HARMONYLINKLIB_API FDevice* get_device_info();

HARMONYLINKLIB_API FOSVerInfo* get_os_version();

extern "C" HARMONYLINKLIB_API FBattery* get_battery_status();
HARMONYLINKLIB_API FBattery* get_battery_status();
}
13 changes: 10 additions & 3 deletions HarmonyLinkLib/src/HarmonyLinkLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@

#include <iostream>
#include "Platform/IPlatformUtilities.h"
#include "Version.h"

namespace HarmonyLinkLib
{
std::shared_ptr<IPlatformUtilities> PlatformUtilities = IPlatformUtilities::GetInstance();
std::shared_ptr<IPlatformUtilities> PlatformUtilities = nullptr;

bool HL_Init()
{
std::wcout << "HarmonyLink V" << version::ToString().c_str() << " Copyright (C) 2023 Jordon Brooks\n";
PlatformUtilities = IPlatformUtilities::GetInstance();

return PlatformUtilities != nullptr;
}

bool get_is_wine()
{
Expand Down Expand Up @@ -92,8 +101,6 @@ namespace HarmonyLinkLib

FOSVerInfo* get_os_version()
{


if (!PlatformUtilities)
{
std::wcout << "Failed to get platform utilities!\n";
Expand Down
61 changes: 0 additions & 61 deletions HarmonyLinkLib/src/dllmain.cpp

This file was deleted.

10 changes: 9 additions & 1 deletion HarmonyLinkTest/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,18 @@ void checkForQuit() {

int main()
{
std::cout << "Hello, World!" << '\n';
std::cout << "Hello, World!\n";

std::thread inputThread(checkForQuit);

if (!HarmonyLinkLib::HL_Init())
{
std::cout << "Failed to init HarmonyLinkLib\n";
return 1;
}

std::cout << "HarmonyLinkLib successfully initialised!\n";

const bool isWine = HarmonyLinkLib::get_is_wine();
const char* test = isWine ? "is" : "isn't";

Expand Down

0 comments on commit daa49af

Please sign in to comment.