Add wayland support for DolphinSA

This commit is contained in:
brooksytech 2022-10-31 05:44:39 -07:00
parent cca750aab3
commit 87d8c88b0c
No known key found for this signature in database
GPG key ID: 45B78D3C7B40B188
7 changed files with 1523 additions and 12 deletions

View file

@ -122,7 +122,7 @@ EmulationSpeed = 1.00000000
FrameSkip = 0x00000003
Overclock = 4.00000000
OverclockEnable = False
GFXBackend =
GFXBackend = Vulkan
GPUDeterminismMode = auto
PerfMapDir =
[Movie]

View file

@ -2,11 +2,11 @@
Device = evdev/0/Microsoft X-Box 360 pad
Buttons/A = Button 1
Buttons/B = Button 0
Buttons/Start = Button 7
Buttons/Start = Button 6
Buttons/X = Button 3
Buttons/Y = Button 2
Buttons/Z = Button 5
Buttons/Hotkey = Button 6
Buttons/Hotkey = Button 7
C-Stick/Dead Zone = 25.000000000000000
C-Stick/Down = Axis 4+
C-Stick/Left = Axis 3-

View file

@ -3,15 +3,15 @@
PKG_NAME="dolphinsa"
PKG_LICENSE="GPLv2"
PKG_DEPENDS_TARGET="toolchain libevdev libdrm ffmpeg zlib libpng lzo libusb zstd"
PKG_DEPENDS_TARGET="toolchain libevdev libdrm ffmpeg zlib libpng lzo libusb zstd ecm"
PKG_LONGDESC="Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements. "
case ${DEVICE} in
RG552|handheld)
PKG_SITE="https://github.com/dolphin-emu/dolphin"
PKG_URL="${PKG_SITE}.git"
PKG_VERSION="1d86a48db658e5ba7c65629c984e5ba111656da0"
PKG_PATCH_DIRS+=" new"
PKG_VERSION="d3718b1b81e64db540005f3ced6a0edfde76f411"
PKG_PATCH_DIRS+=" wayland"
;;
*)
PKG_SITE="https://github.com/rtissera/dolphin"
@ -24,26 +24,26 @@ esac
if [ ! "${OPENGL}" = "no" ]; then
PKG_DEPENDS_TARGET+=" ${OPENGL} glu libglvnd"
PKG_CONFIGURE_OPTS_TARGET+=" -DENABLE_X11=OFF \
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_X11=OFF \
-DENABLE_EGL=ON"
fi
if [ "${OPENGLES_SUPPORT}" = yes ]; then
PKG_DEPENDS_TARGET+=" ${OPENGLES}"
PKG_CONFIGURE_OPTS_TARGET+=" -DENABLE_X11=OFF \
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_X11=OFF \
-DENABLE_EGL=ON"
fi
if [ "${DISPLAYSERVER}" = "wl" ]; then
PKG_DEPENDS_TARGET+=" wayland ${WINDOWMANAGER} xorg-server xrandr libXi"
PKG_CONFIGURE_OPTS_TARGET+=" -DENABLE_X11=ON \
-DENABLE_EGL=ON"
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_WAYLAND=ON \
-DENABLE_X11=OFF"
fi
if [ "${VULKAN_SUPPORT}" = "yes" ]
then
PKG_DEPENDS_TARGET+=" vulkan-loader vulkan-headers"
PKG_CONFIGURE_OPTS_TARGET+=" -DENABLE_VULKAN=ON"
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_VULKAN=ON"
fi
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_HEADLESS=ON \
@ -61,6 +61,7 @@ PKG_CMAKE_OPTS_TARGET+=" -DENABLE_HEADLESS=ON \
-DENCODE_FRAMEDUMPS=OFF \
-DENABLE_CLI_TOOL=OFF"
makeinstall_target() {
mkdir -p ${INSTALL}/usr/bin
cp -rf ${PKG_BUILD}/.${TARGET_NAME}/Binaries/dolphin* ${INSTALL}/usr/bin
@ -79,7 +80,7 @@ post_install() {
DOLPHIN_PLATFORM="drm"
;;
*)
DOLPHIN_PLATFORM="x11"
DOLPHIN_PLATFORM="wayland"
;;
esac
sed -e "s/@DOLPHIN_PLATFORM@/${DOLPHIN_PLATFORM}/g" \

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,111 @@
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
index 6df37b4..64ade4a 100644
--- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
@@ -392,6 +392,65 @@ void Init()
StartHotplugThread();
}
+struct joypad_udev_entry
+{
+ const char *devnode;
+ struct udev_device *dev;
+};
+
+int isNumber(const char *s) {
+ int n;
+
+ if(strlen(s) == 0) {
+ return 0;
+ }
+
+ for(n=0; n<strlen(s); n++) {
+ if(!(s[n] == '0' || s[n] == '1' || s[n] == '2' || s[n] == '3' || s[n] == '4' ||
+ s[n] == '5' || s[n] == '6' || s[n] == '7' || s[n] == '8' || s[n] == '9'))
+ return 0;
+ }
+ return 1;
+}
+
+// compare /dev/input/eventX and /dev/input/eventY where X and Y are numbers
+int strcmp_events(const char* x, const char* y) {
+
+ // find a common string
+ int n, common, is_number;
+ int a, b;
+
+ n=0;
+ while(x[n] == y[n] && x[n] != '\0' && y[n] != '\0') {
+ n++;
+ }
+ common = n;
+
+ // check if remaining string is a number
+ is_number = 1;
+ if(isNumber(x+common) == 0) is_number = 0;
+ if(isNumber(y+common) == 0) is_number = 0;
+
+ if(is_number == 1) {
+ a = atoi(x+common);
+ b = atoi(y+common);
+
+ if(a == b) return 0;
+ if(a < b) return -1;
+ return 1;
+ } else {
+ return strcmp(x, y);
+ }
+}
+
+/* Used for sorting devnodes to appear in the correct order */
+static int sort_devnodes(const void *a, const void *b)
+{
+ const struct joypad_udev_entry *aa = (const struct joypad_udev_entry *) a;
+ const struct joypad_udev_entry *bb = (const struct joypad_udev_entry *) b;
+ return strcmp_events(aa->devnode, bb->devnode);
+}
+
// Only call this when ControllerInterface::m_devices_population_mutex is locked
void PopulateDevices()
{
@@ -404,6 +463,10 @@ void PopulateDevices()
// We use udev to iterate over all /dev/input/event* devices.
// Note: the Linux kernel is currently limited to just 32 event devices. If
// this ever changes, hopefully udev will take care of this.
+ unsigned sorted_count = 0;
+ struct joypad_udev_entry sorted[64];
+ const char* devnode;
+ int i;
udev* const udev = udev_new();
ASSERT_MSG(CONTROLLERINTERFACE, udev != nullptr, "Couldn't initialize libudev.");
@@ -422,11 +485,25 @@ void PopulateDevices()
udev_device* dev = udev_device_new_from_syspath(udev, path);
- if (const char* devnode = udev_device_get_devnode(dev))
- AddDeviceNode(devnode);
-
- udev_device_unref(dev);
+ devnode = udev_device_get_devnode(dev);
+ if (devnode != NULL && sorted_count < 64) {
+ sorted[sorted_count].devnode = devnode;
+ sorted[sorted_count].dev = dev;
+ sorted_count++;
+ } else {
+ udev_device_unref(dev);
+ }
}
+
+ /* Sort the udev entries by devnode name so that they are
+ * created in the proper order */
+ qsort(sorted, sorted_count, sizeof(struct joypad_udev_entry), sort_devnodes);
+
+ for (i = 0; i < sorted_count; i++) {
+ AddDeviceNode(sorted[i].devnode);
+ udev_device_unref(sorted[i].dev);
+ }
+
udev_enumerate_unref(enumerate);
udev_unref(udev);
}

View file

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb0f83f..9d41166 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,7 +128,7 @@ endif()
include(CCache)
# for revision info
-find_package(Git)
+#find_package(Git)
if(GIT_FOUND)
# make sure version information gets re-run when the current Git HEAD changes
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD

View file

@ -0,0 +1,13 @@
--- a/Source/Core/VideoBackends/OGL/OGLRender.cpp 2020-12-31 00:27:53.998709857 +0100
+++ b/Source/Core/VideoBackends/OGL/OGLRender.cpp 2020-12-31 00:28:40.414557344 +0100
@@ -736,10 +736,6 @@
g_Config.VerifyValidity();
UpdateActiveConfig();
- OSD::AddMessage(fmt::format("Video Info: {}, {}, {}", g_ogl_config.gl_vendor,
- g_ogl_config.gl_renderer, g_ogl_config.gl_version),
- 5000);
-
if (!g_ogl_config.bSupportsGLBufferStorage && !g_ogl_config.bSupportsGLPinnedMemory)
{
OSD::AddMessage(fmt::format("Your OpenGL driver does not support {}_buffer_storage.",