Compare commits

..

1 commit

Author SHA1 Message Date
lizzie
05c721bb41
[compat] fix libusb when disabled error (solaris, fbsd, etc) (#2649)
This fixes an issue in builds where libusb is disabled, it also uses and prioritizes system dependencies over vendored ones (so ports is easier)

Signed-off-by: lizzie <lizzie@eden-emu.dev>

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2649
Reviewed-by: crueter <crueter@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-10-22 19:12:33 +02:00
4 changed files with 33 additions and 25 deletions

View file

@ -183,7 +183,8 @@ option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
set(YUZU_QT_MIRROR "" CACHE STRING "What mirror to use for downloading the bundled Qt libraries")
option(ENABLE_CUBEB "Enables the cubeb audio backend" ON)
# FreeBSD doesn't have a cubeb port yet, vendoring it isn't required (it's optional anyways)
cmake_dependent_option(ENABLE_CUBEB "Enables the cubeb audio backend" ON "NOT PLATFORM_FREEBSD" OFF)
set(EXT_DEFAULT OFF)
if (MSVC OR ANDROID)
@ -198,7 +199,8 @@ cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from source" "${PL
# sirit
option(YUZU_USE_BUNDLED_SIRIT "Download bundled sirit" ${EXT_DEFAULT})
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "NOT ANDROID" OFF)
# Re-allow on FreeBSD once its on mainline ports
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "WIN32 OR PLATFORM_LINUX OR APPLE" OFF)
cmake_dependent_option(ENABLE_OPENGL "Enable OpenGL" ON "NOT WIN32 OR NOT ARCHITECTURE_arm64" OFF)
mark_as_advanced(FORCE ENABLE_OPENGL)

View file

@ -743,8 +743,11 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_initializeEmptyUserDirectory(JNIEnv*
void Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerInit(JNIEnv* env, jobject obj) {
// for some reason the full user directory isnt initialized in Android, so we need to create it
const auto play_time_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::PlayTimeDir);
if (!Common::FS::IsDir(play_time_dir) && !Common::FS::CreateDir(play_time_dir))
LOG_WARNING(Frontend, "Failed to create play time directory");
if (!Common::FS::IsDir(play_time_dir)) {
if (!Common::FS::CreateDir(play_time_dir)) {
LOG_WARNING(Frontend, "Failed to create play time directory");
}
}
play_time_manager = std::make_unique<PlayTime::PlayTimeManager>();
}
@ -757,16 +760,13 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerStart(JNIEnv* env, job
}
void Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerStop(JNIEnv* env, jobject obj) {
if (play_time_manager)
play_time_manager->Stop();
play_time_manager->Stop();
}
jlong Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerGetPlayTime(JNIEnv* env, jobject obj, jstring jprogramId) {
if (play_time_manager) {
u64 program_id = EmulationSession::GetProgramId(env, jprogramId);
return play_time_manager->GetPlayTime(program_id);
}
return 0UL;
jlong Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerGetPlayTime(JNIEnv* env, jobject obj,
jstring jprogramId) {
u64 program_id = EmulationSession::GetProgramId(env, jprogramId);
return play_time_manager->GetPlayTime(program_id);
}
jlong Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerGetCurrentTitleId(JNIEnv* env,
@ -776,17 +776,17 @@ jlong Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerGetCurrentTitleId(JNI
void Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerResetProgramPlayTime(JNIEnv* env, jobject obj,
jstring jprogramId) {
u64 program_id = EmulationSession::GetProgramId(env, jprogramId);
if (play_time_manager) {
u64 program_id = EmulationSession::GetProgramId(env, jprogramId);
play_time_manager->ResetProgramPlayTime(program_id);
}
}
void Java_org_yuzu_yuzu_1emu_NativeLibrary_playTimeManagerSetPlayTime(JNIEnv* env, jobject obj,
jstring jprogramId, jlong playTimeSeconds) {
u64 program_id = EmulationSession::GetProgramId(env, jprogramId);
if (play_time_manager) {
u64 program_id = EmulationSession::GetProgramId(env, jprogramId);
play_time_manager->SetPlayTime(program_id, u64(playTimeSeconds));
play_time_manager->SetPlayTime(program_id, static_cast<u64>(playTimeSeconds));
}
}

View file

@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
@ -83,7 +86,7 @@ if (ENABLE_LIBUSB)
drivers/gc_adapter.h
)
target_link_libraries(input_common PRIVATE libusb::usb)
target_compile_definitions(input_common PRIVATE HAVE_LIBUSB)
target_compile_definitions(input_common PRIVATE ENABLE_LIBUSB)
endif()
create_target_directory_groups(input_common)

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2017 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -19,7 +22,7 @@
#include "input_common/input_poller.h"
#include "input_common/main.h"
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
#include "input_common/drivers/gc_adapter.h"
#endif
#ifdef HAVE_SDL2
@ -76,7 +79,7 @@ struct InputSubsystem::Impl {
RegisterEngine("keyboard", keyboard);
RegisterEngine("mouse", mouse);
RegisterEngine("touch", touch_screen);
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
RegisterEngine("gcpad", gcadapter);
#endif
RegisterEngine("cemuhookudp", udp_client);
@ -110,7 +113,7 @@ struct InputSubsystem::Impl {
UnregisterEngine(keyboard);
UnregisterEngine(mouse);
UnregisterEngine(touch_screen);
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
UnregisterEngine(gcadapter);
#endif
UnregisterEngine(udp_client);
@ -145,7 +148,7 @@ struct InputSubsystem::Impl {
auto android_devices = android->GetInputDevices();
devices.insert(devices.end(), android_devices.begin(), android_devices.end());
#endif
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
auto gcadapter_devices = gcadapter->GetInputDevices();
devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end());
#endif
@ -178,7 +181,7 @@ struct InputSubsystem::Impl {
return android;
}
#endif
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
if (engine == gcadapter->GetEngineName()) {
return gcadapter;
}
@ -263,7 +266,7 @@ struct InputSubsystem::Impl {
return true;
}
#endif
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
if (engine == gcadapter->GetEngineName()) {
return true;
}
@ -294,7 +297,7 @@ struct InputSubsystem::Impl {
#ifdef ANDROID
android->BeginConfiguration();
#endif
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
gcadapter->BeginConfiguration();
#endif
udp_client->BeginConfiguration();
@ -310,7 +313,7 @@ struct InputSubsystem::Impl {
#ifdef ANDROID
android->EndConfiguration();
#endif
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
gcadapter->EndConfiguration();
#endif
udp_client->EndConfiguration();
@ -343,7 +346,7 @@ struct InputSubsystem::Impl {
std::shared_ptr<VirtualAmiibo> virtual_amiibo;
std::shared_ptr<VirtualGamepad> virtual_gamepad;
#ifdef HAVE_LIBUSB
#ifdef ENABLE_LIBUSB
std::shared_ptr<GCAdapter> gcadapter;
#endif