mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Rename architecture related functions and structs
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
PluginArchitecture find_vst_architecture(fs::path plugin_path) {
|
||||
LibArchitecture find_dll_architecture(fs::path plugin_path) {
|
||||
std::ifstream file(plugin_path, std::ifstream::binary | std::ifstream::in);
|
||||
|
||||
// The linker will place the offset where the PE signature is placed at the
|
||||
@@ -34,11 +34,11 @@ PluginArchitecture find_vst_architecture(fs::path plugin_path) {
|
||||
// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types
|
||||
switch (machine_type) {
|
||||
case 0x014c: // IMAGE_FILE_MACHINE_I386
|
||||
return PluginArchitecture::vst_32;
|
||||
return LibArchitecture::dll_32;
|
||||
break;
|
||||
case 0x8664: // IMAGE_FILE_MACHINE_AMD64
|
||||
case 0x0000: // IMAGE_FILE_MACHINE_UNKNOWN
|
||||
return PluginArchitecture::vst_64;
|
||||
return LibArchitecture::dll_64;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,21 +24,20 @@
|
||||
// Utilities and tags for plugin types and architectures
|
||||
|
||||
/**
|
||||
* A tag to differentiate between 32 and 64-bit plugins, used to determine which
|
||||
* host application to use.
|
||||
* A tag to differentiate between 32 and 64-bit `.dll` files, used to determine
|
||||
* which host application to use.
|
||||
*/
|
||||
enum class PluginArchitecture { vst_32, vst_64 };
|
||||
enum class LibArchitecture { dll_32, dll_64 };
|
||||
|
||||
/**
|
||||
* Determine the architecture of a VST plugin (or rather, a .dll file) based on
|
||||
* it's header values.
|
||||
* Determine the architecture of a `.dll` file based on the file header.
|
||||
*
|
||||
* See https://docs.microsoft.com/en-us/windows/win32/debug/pe-format for more
|
||||
* information on the PE32 format.
|
||||
*
|
||||
* @param plugin_path The path to the .dll file we're going to check.
|
||||
* @param path The path to the .dll file we're going to check.
|
||||
*
|
||||
* @return The detected architecture.
|
||||
* @throw std::runtime_error If the file is not a .dll file.
|
||||
*/
|
||||
PluginArchitecture find_vst_architecture(boost::filesystem::path);
|
||||
LibArchitecture find_dll_architecture(boost::filesystem::path);
|
||||
|
||||
@@ -656,7 +656,7 @@ void Vst2PluginBridge::log_init_message() {
|
||||
} else {
|
||||
init_msg << "individually";
|
||||
}
|
||||
if (vst_host->architecture() == PluginArchitecture::vst_32) {
|
||||
if (vst_host->architecture() == LibArchitecture::dll_32) {
|
||||
init_msg << ", 32-bit";
|
||||
} else {
|
||||
init_msg << ", 64-bit";
|
||||
|
||||
@@ -89,7 +89,7 @@ IndividualHost::IndividualHost(boost::asio::io_context& io_context,
|
||||
fs::path plugin_path,
|
||||
const Sockets& sockets)
|
||||
: HostProcess(io_context, logger),
|
||||
plugin_arch(find_vst_architecture(plugin_path)),
|
||||
plugin_arch(find_dll_architecture(plugin_path)),
|
||||
host_path(find_vst_host(plugin_arch, false)),
|
||||
host(launch_host(host_path,
|
||||
#ifdef WITH_WINEDBG
|
||||
@@ -114,7 +114,7 @@ IndividualHost::IndividualHost(boost::asio::io_context& io_context,
|
||||
#endif
|
||||
}
|
||||
|
||||
PluginArchitecture IndividualHost::architecture() {
|
||||
LibArchitecture IndividualHost::architecture() {
|
||||
return plugin_arch;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ GroupHost::GroupHost(boost::asio::io_context& io_context,
|
||||
Sockets& sockets,
|
||||
std::string group_name)
|
||||
: HostProcess(io_context, logger),
|
||||
plugin_arch(find_vst_architecture(plugin_path)),
|
||||
plugin_arch(find_dll_architecture(plugin_path)),
|
||||
host_path(find_vst_host(plugin_arch, true)),
|
||||
sockets(sockets) {
|
||||
#ifdef WITH_WINEDBG
|
||||
@@ -233,7 +233,7 @@ GroupHost::GroupHost(boost::asio::io_context& io_context,
|
||||
}
|
||||
}
|
||||
|
||||
PluginArchitecture GroupHost::architecture() {
|
||||
LibArchitecture GroupHost::architecture() {
|
||||
return plugin_arch;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class HostProcess {
|
||||
* Return the architecture of the plugin we are loading, i.e. whether it is
|
||||
* 32-bit or 64-bit.
|
||||
*/
|
||||
virtual PluginArchitecture architecture() = 0;
|
||||
virtual LibArchitecture architecture() = 0;
|
||||
|
||||
/**
|
||||
* Return the full path to the host application in use. The host application
|
||||
@@ -130,13 +130,13 @@ class IndividualHost : public HostProcess {
|
||||
boost::filesystem::path plugin_path,
|
||||
const Sockets& sockets);
|
||||
|
||||
PluginArchitecture architecture() override;
|
||||
LibArchitecture architecture() override;
|
||||
boost::filesystem::path path() override;
|
||||
bool running() override;
|
||||
void terminate() override;
|
||||
|
||||
private:
|
||||
PluginArchitecture plugin_arch;
|
||||
LibArchitecture plugin_arch;
|
||||
boost::filesystem::path host_path;
|
||||
boost::process::child host;
|
||||
};
|
||||
@@ -173,13 +173,13 @@ class GroupHost : public HostProcess {
|
||||
Sockets& socket_endpoint,
|
||||
std::string group_name);
|
||||
|
||||
PluginArchitecture architecture() override;
|
||||
LibArchitecture architecture() override;
|
||||
boost::filesystem::path path() override;
|
||||
bool running() override;
|
||||
void terminate() override;
|
||||
|
||||
private:
|
||||
PluginArchitecture plugin_arch;
|
||||
LibArchitecture plugin_arch;
|
||||
boost::filesystem::path host_path;
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,10 +54,10 @@ std::optional<fs::path> find_wineprefix() {
|
||||
return dosdevices_dir->parent_path();
|
||||
}
|
||||
|
||||
fs::path find_vst_host(PluginArchitecture plugin_arch, bool use_plugin_groups) {
|
||||
fs::path find_vst_host(LibArchitecture plugin_arch, bool use_plugin_groups) {
|
||||
auto host_name = use_plugin_groups ? yabridge_group_host_name
|
||||
: yabridge_individual_host_name;
|
||||
if (plugin_arch == PluginArchitecture::vst_32) {
|
||||
if (plugin_arch == LibArchitecture::dll_32) {
|
||||
host_name = use_plugin_groups ? yabridge_group_host_name_32bit
|
||||
: yabridge_individual_host_name_32bit;
|
||||
}
|
||||
@@ -110,17 +110,17 @@ fs::path find_vst_plugin() {
|
||||
boost::filesystem::path generate_group_endpoint(
|
||||
const std::string& group_name,
|
||||
const boost::filesystem::path& wine_prefix,
|
||||
const PluginArchitecture architecture) {
|
||||
const LibArchitecture architecture) {
|
||||
std::ostringstream socket_name;
|
||||
socket_name << "yabridge-group-" << group_name << "-"
|
||||
<< std::to_string(
|
||||
std::hash<std::string>{}(wine_prefix.string()))
|
||||
<< "-";
|
||||
switch (architecture) {
|
||||
case PluginArchitecture::vst_32:
|
||||
case LibArchitecture::dll_32:
|
||||
socket_name << "x32";
|
||||
break;
|
||||
case PluginArchitecture::vst_64:
|
||||
case LibArchitecture::dll_64:
|
||||
socket_name << "x64";
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-2
@@ -71,7 +71,7 @@ std::string create_logger_prefix(
|
||||
* @return The a path to the VST host, if found.
|
||||
* @throw std::runtime_error If the Wine VST host could not be found.
|
||||
*/
|
||||
boost::filesystem::path find_vst_host(PluginArchitecture plugin_arch,
|
||||
boost::filesystem::path find_vst_host(LibArchitecture plugin_arch,
|
||||
bool use_plugin_groups);
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ std::optional<boost::filesystem::path> find_wineprefix();
|
||||
boost::filesystem::path generate_group_endpoint(
|
||||
const std::string& group_name,
|
||||
const boost::filesystem::path& wine_prefix,
|
||||
const PluginArchitecture architecture);
|
||||
const LibArchitecture architecture);
|
||||
|
||||
/**
|
||||
* Return the search path as defined in `$PATH`, with `~/.local/share/yabridge`
|
||||
|
||||
Reference in New Issue
Block a user