#if -> #ifdef

This commit is contained in:
Emma 2026-04-23 16:53:45 +00:00 committed by GitHub
parent e455686590
commit ca3a165114
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 15 additions and 15 deletions

View File

@ -131,9 +131,9 @@ option(ENABLE_SDL "Enables the SDLController backend" ON)
option(ENABLE_LIBUSB "Build with libusb support" ON)
if (ENABLE_LIBUSB)
add_compile_definitions(HAS_LIBUSB=1)
add_compile_definitions(HAS_LIBUSB)
else()
add_compile_definitions(HAS_LIBUSB=0)
add_compile_definitions(HAS_LIBUSB)
endif()
# audio backends

View File

@ -1,7 +1,7 @@
#include "nsyshid.h"
#include "Backend.h"
#include "BackendEmulated.h"
#if HAS_LIBUSB
#ifdef HAS_LIBUSB
#include "BackendLibusb.h"
#endif
@ -9,7 +9,7 @@ namespace nsyshid::backend
{
void AttachDefaultBackends()
{
#if HAS_LIBUSB
#ifdef HAS_LIBUSB
// add libusb backend
{
auto backendLibusb = std::make_shared<backend::libusb::BackendLibusb>();

View File

@ -29,7 +29,7 @@ namespace nsyshid::backend::emulated
auto device = std::make_shared<SkylanderPortalDevice>();
AttachDevice(device);
}
#if HAS_LIBUSB
#ifdef HAS_LIBUSB
else if (auto usb_portal = FindDeviceById(0x1430, 0x1F17))
{
cemuLog_logDebug(LogType::Force, "Attaching Xbox 360 Portal");

View File

@ -2,7 +2,7 @@
namespace nsyshid
{
#if HAS_LIBUSB
#ifdef HAS_LIBUSB
SkylanderXbox360PortalLibusb::SkylanderXbox360PortalLibusb(std::shared_ptr<Device> usbPortal)
: Device(0x1430, 0x0150, 1, 2, 0)
{

View File

@ -1,14 +1,14 @@
#pragma once
#include "nsyshid.h"
#if HAS_LIBUSB
#ifdef HAS_LIBUSB
#include "BackendLibusb.h"
#include "g721/g721.h"
#endif
namespace nsyshid
{
#if HAS_LIBUSB
#ifdef HAS_LIBUSB
class SkylanderXbox360PortalLibusb final : public Device {
public:
SkylanderXbox360PortalLibusb(std::shared_ptr<Device> usbPortal);

View File

@ -83,7 +83,7 @@ ControllerPtr ControllerFactory::CreateController(InputAPI::Type api, std::strin
return std::make_shared<DSUController>(index);
}
#endif
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && HAS_LIBUSB
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && defined(HAS_LIBUSB)
case InputAPI::GameCube:
{
const auto index = uuid.find_first_of('_');
@ -165,7 +165,7 @@ ControllerProviderPtr ControllerFactory::CreateControllerProvider(InputAPI::Type
}
#endif
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && HAS_LIBUSB
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && defined(HAS_LIBUSB)
case InputAPI::GameCube:
return std::make_shared<GameCubeControllerProvider>();
#endif

View File

@ -40,7 +40,7 @@ InputManager::InputManager()
#if HAS_DSU
create_provider<DSUControllerProvider>();
#endif
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && HAS_LIBUSB
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && defined(HAS_LIBUSB)
create_provider<GameCubeControllerProvider>();
#endif
#if HAS_WIIMOTE

View File

@ -1,6 +1,6 @@
#include "input/api/GameCube/GameCubeController.h"
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && HAS_LIBUSB
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && defined(HAS_LIBUSB)
GameCubeController::GameCubeController(uint32 adapter, uint32 index)
: base_type(fmt::format("{}_{}", adapter, index), fmt::format("Controller {}", index + 1)), m_adapter(adapter),

View File

@ -3,7 +3,7 @@
#include "input/api/Controller.h"
#include "input/api/GameCube/GameCubeControllerProvider.h"
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && HAS_LIBUSB
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && defined(HAS_LIBUSB)
class GameCubeController : public Controller<GameCubeControllerProvider>
{

View File

@ -2,7 +2,7 @@
#include "input/api/GameCube/GameCubeController.h"
#include "util/libusbWrapper/libusbWrapper.h"
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && HAS_LIBUSB
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && defined(HAS_LIBUSB)
constexpr uint16_t kVendorId = 0x57e, kProductId = 0x337;

View File

@ -2,7 +2,7 @@
#include "input/api/ControllerProvider.h"
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && HAS_LIBUSB
#if defined(HAS_GAMECUBE) && HAS_GAMECUBE && defined(HAS_LIBUSB)
#include "util/libusbWrapper/libusbWrapper.h"