USB: initial merge finally complete

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-11-02 21:30:13 +01:00 committed by refractionpcsx2
parent d33eff635b
commit e2a72b2798
22 changed files with 119 additions and 56 deletions

View File

@ -0,0 +1,43 @@
# - Find PulseAudio includes and libraries
#
# PULSEAUDIO_FOUND - True if PULSEAUDIO_INCLUDE_DIR &
# PULSEAUDIO_LIBRARY are found
# PULSEAUDIO_LIBRARIES - Set when PULSEAUDIO_LIBRARY is found
# PULSEAUDIO_INCLUDE_DIRS - Set when PULSEAUDIO_INCLUDE_DIR is found
#
# PULSEAUDIO_INCLUDE_DIR - where to find pulse/pulseaudio.h, etc.
# PULSEAUDIO_LIBRARY - the pulse library
# PULSEAUDIO_VERSION_STRING - the version of PulseAudio found
#
find_path(PULSEAUDIO_INCLUDE_DIR
NAMES pulse/pulseaudio.h
DOC "The PulseAudio include directory"
)
find_library(PULSEAUDIO_LIBRARY
NAMES pulse
DOC "The PulseAudio library"
)
if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str
REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)")
string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1"
PULSEAUDIO_VERSION_STRING "${pulse_version_str}")
unset(pulse_version_str)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PulseAudio
REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR
VERSION_VAR PULSEAUDIO_VERSION_STRING
)
if(PULSEAUDIO_FOUND)
set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY})
set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR})
endif()
mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY)

View File

@ -96,6 +96,9 @@ include(FindLibc)
## Use pcsx2 package to find module
include(Findlibsamplerate)
## Use pcsx2 package to find module
include(FindPulseAudio)
## Use CheckLib package to find module
include(CheckLib)
if(Linux)
@ -196,6 +199,11 @@ if(LIBSAMPLERATE_FOUND)
include_directories(${LIBSAMPLERATE_INCLUDE_DIR})
endif()
if(PULSEAUDIO_FOUND)
include_directories(${PULSEAUDIO_INCLUDE_DIR})
endif()
if(LIBXML2_FOUND)
include_directories(${LIBXML2_INCLUDE_DIRS})
endif()

View File

@ -356,6 +356,25 @@ set(pcsx2USBSources
USB/shared/shared.cpp
USB/shared/inifile.cpp
USB/shared/ringbuffer.cpp
USB/icon_buzz_24.cpp
USB/usb-msd/usb-msd-gtk.cpp
USB/usb-pad/joydev/joydev.cpp
USB/usb-pad/joydev/joydev-gtk.cpp
USB/usb-pad/evdev/shared-gtk.cpp
USB/usb-pad/evdev/evdev-ff.cpp
USB/usb-pad/evdev/evdev.cpp
USB/usb-pad/evdev/evdev-gtk.cpp
USB/usb-hid/evdev/evdev-gtk.cpp
USB/usb-eyetoy/cam-linux.cpp
USB/linux/config.cpp
USB/linux/config-gtk.cpp
USB/linux/util.cpp
USB/qemu-usb/input-keymap-linux-to-qcode.cpp
USB/usb-mic/audiodev-pulse.cpp
USB/usb-pad/api_init_linux.cpp
USB/usb-eyetoy/api_init_linux.cpp
USB/usb-hid/api_init_linux.cpp
USB/usb-mic/api_init_linux.cpp
)
# USB headers
@ -400,6 +419,21 @@ set(pcsx2USBHeaders
USB/shared/shared.h
USB/shared/inifile.h
USB/shared/ringbuffer.h
USB/linux/ini.h
USB/linux/actualfile.h
USB/linux/config.h
USB/linux/util.h
USB/gtk.h
USB/icon_buzz_24.h
USB/usb-pad/joydev/joydev.h
USB/usb-pad/evdev/shared.h
USB/usb-pad/evdev/evdev.h
USB/usb-pad/evdev/evdev-ff.h
USB/usb-hid/evdev/evdev.h
USB/usb-hid/evdev/evdev.cpp
USB/usb-eyetoy/cam-linux.h
USB/qemu-usb/input-keymap-linux-to-qcode.h
USB/usb-mic/audiodev-pulse.h
)
@ -903,7 +937,6 @@ set(pcsx2FinalLibs
Utilities
x86emitter
fmt::fmt
libsamplerate
${wxWidgets_LIBRARIES}
${GTK2_LIBRARIES}
${ZLIB_LIBRARIES}
@ -914,6 +947,7 @@ set(pcsx2FinalLibs
${SDL2_LIBRARIES}
${PCAP_LIBRARY}
${LIBSAMPLERATE_LIBRARIES}
${PULSEAUDIO_LIBRARIES}
${LIBXML2_LIBRARIES}
${Platform_Libs}
)

View File

@ -5,7 +5,7 @@
#include <map>
#include <vector>
#include <string>
#include "gtk.h"
#include "../gtk.h"
#include "../osdebugout.h"
#include "../configuration.h"
@ -35,28 +35,6 @@ gboolean run_msg_dialog(gpointer data)
return FALSE;
}
void SysMessage(const char *fmt, ...)
{
va_list list;
char msg[1024];
va_start (list, fmt);
vsnprintf (msg, sizeof(msg), fmt, list);
va_end (list);
if (msg[strlen(msg) - 1] == '\n')
msg[strlen(msg) - 1] = 0;
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"%s", msg);
// run on main thread, a bit iffy
g_idle_add (run_msg_dialog, (gpointer)dialog);
}
static void wheeltypeChanged (GtkComboBox *widget, gpointer data)
{
gint idx = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));

View File

@ -2,6 +2,6 @@
#define LINUXCONFIG_H
#include <sstream>
#include <string>
#include "osdebugout.h"
#include "../osdebugout.h"
#endif

View File

@ -40,9 +40,9 @@
int64_t last_cycle = 0;
#define MIN_IRQ_INTERVAL 64 /* hack */
extern void USBirq(int);
extern int64_t get_clock();
extern int get_ticks_per_second();
extern void usbIrq(int);
//#define DEBUG_PACKET
//#define DEBUG_OHCI
@ -64,7 +64,7 @@ static inline void ohci_intr_update(OHCIState *ohci)
//if ((get_clock() - last_cycle) > MIN_IRQ_INTERVAL)
if (ohci->intr_status != OHCI_INTR_WD) //HACK skip first intr with _WD, _SF should follow shortly
{
USBirq(1);
usbIrq(1);
last_cycle = get_clock();
}
}

View File

@ -13,7 +13,7 @@
#include <linux/videodev2.h>
#include "gtk.h"
#include "../gtk.h"
#include "cam-linux.h"
#include "usb-eyetoy-webcam.h"

View File

@ -2,7 +2,7 @@
#include "../usb-hid.h"
#include "evdev.h"
#include <linux/input.h>
#include "gtk.h"
#include "../../gtk.h"
#include <cstdio>
#include <sstream>
@ -171,4 +171,4 @@ int EvDev::Configure(int port, const char* dev_type, HIDType hid_type, void *dat
}
#undef EVDEV_DIR
}} //namespace
}} //namespace

View File

@ -1,9 +1,9 @@
#include "evdev.h"
#include "osdebugout.h"
#include "../../osdebugout.h"
#include <cassert>
#include <sstream>
#include "../hidproxy.h"
#include "qemu-usb/input-keymap-linux-to-qcode.h"
#include "../../qemu-usb/input-keymap-linux-to-qcode.h"
#ifdef USING_X11
#include <X11/Xlib.h>
@ -324,4 +324,4 @@ void EvDev::ReaderThread(void *ptr)
dev->mReaderThreadIsRunning = false;
}
}} //namespace
}} //namespace

View File

@ -1,5 +1,5 @@
#pragma once
#include "linux/util.h"
#include "../../linux/util.h"
#include <linux/input.h>
#include <unistd.h>
#include <dirent.h>
@ -68,4 +68,4 @@ bool GetEvdevName(const std::string& path, char (&name)[_Size])
return false;
}
}} //namespace
}} //namespace

View File

@ -1,4 +1,4 @@
#include "gtk.h"
#include "../gtk.h"
#include "audiodev-pulse.h"
#ifdef DYNLINK_PULSE
#include "../dynlink/pulse.h"
@ -909,4 +909,4 @@ exit:
return;
}
}}
}}

View File

@ -1,10 +1,10 @@
#include <cstdint>
#include <cstring>
#include <pulse/pulseaudio.h>
#include "shared/ringbuffer.h"
#include "../shared/ringbuffer.h"
#include "../osdebugout.h"
#include "audiodeviceproxy.h"
#include "../libsamplerate/samplerate.h"
#include <samplerate.h>
//#include <typeinfo>
//#include <thread>
#include <mutex>

View File

@ -1,7 +1,7 @@
#include "usb-msd.h"
#include "../linux/ini.h"
#include "../configuration.h"
#include "gtk.h"
#include "../gtk.h"
namespace usb_msd {
@ -103,4 +103,4 @@ int MsdDevice::Configure(int port, const std::string& api, void *data)
return RESULT_CANCELED;
}
} //namespace
} //namespace

View File

@ -1,6 +1,6 @@
#include "evdev-ff.h"
#include "osdebugout.h"
#include "usb-pad/lg/lg_ff.h"
#include "../../osdebugout.h"
#include "../../usb-pad/lg/lg_ff.h"
#include <unistd.h>
#include <cerrno>
#include <cstring>

View File

@ -1,11 +1,11 @@
#include "evdev.h"
#include "osdebugout.h"
#include "../../osdebugout.h"
#include <chrono>
#include <thread>
#include <stdio.h>
#include <sstream>
#include "gtk.h"
#include "../../gtk.h"
namespace usb_pad { namespace evdev {

View File

@ -1,9 +1,9 @@
#include "evdev.h"
#include "osdebugout.h"
#include "../../osdebugout.h"
#include <cassert>
#include <sstream>
#include <linux/hidraw.h>
#include "linux/util.h"
#include "../../linux/util.h"
namespace usb_pad { namespace evdev {

View File

@ -1,12 +1,12 @@
#pragma once
#include "linux/util.h"
#include "../../linux/util.h"
//#include <dirent.h> //gtk.h pulls in?
#include <thread>
#include <array>
#include <atomic>
#include "evdev-ff.h"
#include "shared.h"
#include "readerwriterqueue/readerwriterqueue.h"
#include "../../readerwriterqueue/readerwriterqueue.h"
namespace usb_pad { namespace evdev {

View File

@ -1,6 +1,6 @@
#include "shared.h"
#include "../../osdebugout.h"
#include "icon_buzz_24.h"
#include "../../icon_buzz_24.h"
#include <chrono>
#include <thread>

View File

@ -1,7 +1,7 @@
#pragma once
#include <linux/joystick.h>
#include <unistd.h>
#include "gtk.h"
#include "../../gtk.h"
#include "../padproxy.h"
#include "../../configuration.h"

View File

@ -5,7 +5,7 @@
#include <thread>
#include <stdio.h>
#include <sstream>
#include "gtk.h"
#include "../../gtk.h"
namespace usb_pad { namespace joydev {
@ -143,4 +143,4 @@ int JoyDevPad::Configure(int port, const char* dev_type, void *data)
return ret;
}
}} //namespace
}} //namespace

View File

@ -2,7 +2,7 @@
#include "../../osdebugout.h"
#include <cassert>
#include <sstream>
#include "linux/util.h"
#include "../../linux/util.h"
namespace usb_pad { namespace joydev {

View File

@ -1,5 +1,5 @@
#pragma once
#include "linux/util.h"
#include "../../linux/util.h"
#include "../evdev/evdev-ff.h"
#include "../evdev/shared.h"
@ -57,4 +57,4 @@ bool GetJoystickName(const std::string& path, char (&name)[_Size])
return false;
}
}} //namespace
}} //namespace