Revamp: Transition HarmonyLink to C++ with DLL support
This transformative commit marks the evolution of HarmonyLink from a Rust-based server-side application to a C++ implemented, C-compatible dynamic link library (DLL). We've restructured the codebase to streamline integration into games, eliminating the need for a server setup by end-users. Key Changes: - Introduced .gitattributes and .gitmodules to manage new dependencies and collaborations. - Replaced the GitHub workflow files with CMake configurations to support the new C++ build system. - Introduced a comprehensive set of header and implementation files defining the core functionality, platform-specific utilities, and cross-platform compatibility layers. - Removed all Rust-specific files (Cargo.toml, Cargo.lock, etc.) and references to ensure a clean transition to the C++ environment. - Implemented new testing mechanisms within HarmonyLinkTest to ensure robustness and reliability of the DLL. - Excised previous server-side components and models to focus on the DLL's direct integration into consumer applications. This update is a direct response to community feedback, showcasing our commitment to adaptability and innovation. HarmonyLink 2.0 is now more accessible, efficient, and tailored for diverse gaming environments, providing developers with an unparalleled level of hardware-software harmony. Please refer to the updated README for more details on the new structure and how to integrate HarmonyLink 2.0 into your projects.
This commit is contained in:
parent
d13fc728df
commit
6bf68eb298
60 changed files with 1629 additions and 2389 deletions
94
HarmonyLinkLib/src/HarmonyLinkLib.cpp
Normal file
94
HarmonyLinkLib/src/HarmonyLinkLib.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
#include "HarmonyLinkLib.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "Platform/IPlatformUtilities.h"
|
||||
|
||||
namespace HarmonyLinkLib
|
||||
{
|
||||
std::shared_ptr<IPlatformUtilities> PlatformUtilities = IPlatformUtilities::GetInstance();
|
||||
|
||||
bool get_is_wine()
|
||||
{
|
||||
if (!PlatformUtilities)
|
||||
{
|
||||
std::wcout << "Failed to get platform utilities!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
return PlatformUtilities->is_running_under_wine();
|
||||
}
|
||||
|
||||
FCPUInfo* get_cpu_info()
|
||||
{
|
||||
if (!PlatformUtilities)
|
||||
{
|
||||
std::wcout << "Failed to get platform utilities!\n";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::shared_ptr<FCPUInfo> cpu_info = PlatformUtilities->get_cpu_info();
|
||||
if (!cpu_info)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FCPUInfo* new_cpu_info = new FCPUInfo(*cpu_info);
|
||||
return new_cpu_info;
|
||||
}
|
||||
|
||||
FDevice* get_device_info()
|
||||
{
|
||||
if (!PlatformUtilities)
|
||||
{
|
||||
std::wcout << "Failed to get platform utilities!\n";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::shared_ptr<FDevice> device = PlatformUtilities->get_device();
|
||||
if (!device)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FDevice* new_device = new FDevice(*device);
|
||||
return new_device;
|
||||
}
|
||||
|
||||
FOSVerInfo* get_os_version()
|
||||
{
|
||||
|
||||
|
||||
if (!PlatformUtilities)
|
||||
{
|
||||
std::wcout << "Failed to get platform utilities!\n";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::shared_ptr<FOSVerInfo> os_version_info = PlatformUtilities->get_os_version();
|
||||
if (!os_version_info)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FOSVerInfo* new_os_info = new FOSVerInfo(*os_version_info);
|
||||
return new_os_info;
|
||||
}
|
||||
|
||||
FBattery* get_battery_status()
|
||||
{
|
||||
if (!PlatformUtilities)
|
||||
{
|
||||
std::wcout << "Failed to get platform utilities!\n";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::shared_ptr<FBattery> new_battery = PlatformUtilities->get_battery_status();
|
||||
if (!new_battery)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FBattery* battery = new FBattery(*new_battery);
|
||||
return battery;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue