Skip to content

Commit

Permalink
Fix building against newer version of Cg; add patch for WiiMotion Plu…
Browse files Browse the repository at this point in the history
…s (yes it works; thanks to Thomas Scheiblauer for the patch)
  • Loading branch information
Tatsh committed Jan 1, 2013
1 parent 869bfdc commit 31cd845
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 4 deletions.
3 changes: 2 additions & 1 deletion games-emulation/dolphin-emu/Manifest
@@ -1 +1,2 @@
EBUILD dolphin-emu-9999.ebuild 2809 RMD160 652cf6c729986a038131e7f2713a7245b2676602 SHA1 c2f021d62bf8b0bd034e86e6a58ab8751b16f114 SHA256 54dcfd902f664f1aaa108701ef70eee320088e80df63727c1e47d064b6e9d9ab
AUX RVL-CNT-01-TR.patch 5901 SHA256 b5ac548ee4fba5fa21dad8c9e9de622c086d2afafa61bb70d913b2c90921d496 SHA512 050e8877d882f8fcdd3c45b3203e084e17463e6fe17916ce0c770d64644e9a3d766757aed976d263ecf45f5b0c62744a3cbe2e2069c7a3d596eb1ce2cbd46c55 WHIRLPOOL 2913e7048a5322f14a5c6f941e22f13c41814cee95e7c20a2d111505aa618899601a7019531cf84a4b34eb2db8db4928732b3f45ef1f778f28cad8ef805ecef0
EBUILD dolphin-emu-9999.ebuild 3274 SHA256 edd5cb8d8854313f7c5abf40e95a7385f8a7980ca98e4d2bd0de3846aec7c86b SHA512 86b8de4019cd6d21d73c348c4dd18f150a110506acf4c1a2a3d8a045b41f6dd9bf27c8674e99b0551d65b8b9b6cadd6f4e34d98172754fef4d86c09a4a269ff6 WHIRLPOOL b868a6b0ffecd036519c5e002908426e5bf3e1b272ed0731f8c2ab5307c29e6d7983f0d6deffd3ab03e7a403bc3a012d75d91d26e1e4919943630ac8b4fa6ed0
18 changes: 15 additions & 3 deletions games-emulation/dolphin-emu/dolphin-emu-9999.ebuild
@@ -1,4 +1,3 @@
# kate: replace-tabs false;
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
Expand All @@ -15,7 +14,7 @@ EGIT_REPO_URI="https://code.google.com/p/dolphin-emu/"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="alsa ao bluetooth doc encode +lzo openal opencl opengl portaudio pulseaudio +wxwidgets +xrandr"
IUSE="alsa ao bluetooth doc encode +lzo openal opencl opengl portaudio pulseaudio +wxwidgets +xrandr +wiimote-plus-patch"
RESTRICT=""

RDEPEND=">=media-libs/glew-1.5
Expand Down Expand Up @@ -45,6 +44,12 @@ DEPEND="${RDEPEND}
dev-util/pkgconfig
media-gfx/nvidia-cg-toolkit"

src_prepare() {
if use wiimote-plus-patch; then
epatch "${FILESDIR}"/RVL-CNT-01-TR.patch
fi
}

src_configure() {
# Configure cmake
mycmakeargs="
Expand All @@ -56,7 +61,7 @@ src_configure() {
$(cmake-utils_use !wxwidgets DISABLE_WX)
$(cmake-utils_use encode ENCODE_FRAMEDUMPS)"
append-cppflags -I/opt/nvidia-cg-toolkit/include
append-ldflags -L/opt/nvidia-cg-toolkit/lib
append-ldflags -L/opt/nvidia-cg-toolkit/$(get_libdir)
cmake-utils_src_configure
}

Expand Down Expand Up @@ -103,5 +108,12 @@ pkg_postinst() {
echo
fi

if use wiimote-plus-patch; then
einfo "Please note this build is patched with a fix for the Wii Remote Plus (RVL-CNT-01-TR). There are still issues, such as after remote auto-disconnection and re-connection, Dolphin may crash. Please see http://code.google.com/p/dolphin-emu/issues/detail?id=5011 for more information."
echo
fi

games_pkg_postinst
}

# kate: replace-tabs false;
157 changes: 157 additions & 0 deletions games-emulation/dolphin-emu/files/RVL-CNT-01-TR.patch
@@ -0,0 +1,157 @@
diff -pur dolphin-emu-9999.orig/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp dolphin-emu-9999/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp
--- dolphin-emu-9999.orig/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp 2012-12-30 01:45:32.817115222 +0100
+++ dolphin-emu-9999/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp 2012-12-30 01:37:18.256687064 +0100
@@ -34,11 +34,6 @@
#include "WiimoteReal.h"
#include "Host.h"

-// Identify the wiimote device by its class
-#define WM_DEV_CLASS_0 0x04
-#define WM_DEV_CLASS_1 0x25
-#define WM_DEV_CLASS_2 0x00
-
namespace WiimoteReal
{

@@ -95,9 +90,15 @@ int FindWiimotes(Wiimote** wm, int max_w
// Display discovered devices
for (i = 0; (i < found_devices) && (found_wiimotes < max_wiimotes); ++i)
{
- if ((scan_info[i].dev_class[0] == WM_DEV_CLASS_0) &&
- (scan_info[i].dev_class[1] == WM_DEV_CLASS_1) &&
- (scan_info[i].dev_class[2] == WM_DEV_CLASS_2))
+ char name[1000];
+ memset(name, 0, sizeof(name));
+ ERROR_LOG(WIIMOTE, "found a device...");
+ if (hci_read_remote_name(device_sock, &scan_info[i].bdaddr, sizeof(name), name, 0) < 0) {
+ ERROR_LOG(WIIMOTE, "name request failed");
+ continue;
+ }
+ ERROR_LOG(WIIMOTE, "device name %s", name);
+ if (IsValidBluetoothName(name))
{
bool new_wiimote = true;
// Determine if this wiimote has already been found.
@@ -146,24 +147,24 @@ bool Wiimote::Connect()

// Output channel
addr.l2_psm = htobs(WM_OUTPUT_CHANNEL);
- if ((out_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
- connect(out_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0)
+ if ((cmd_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
+ connect(cmd_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0)
{
DEBUG_LOG(WIIMOTE, "Unable to open output socket to wiimote.");
- close(out_sock);
- out_sock = -1;
+ close(cmd_sock);
+ cmd_sock = -1;
return false;
}

// Input channel
addr.l2_psm = htobs(WM_INPUT_CHANNEL);
- if ((in_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
- connect(in_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0)
+ if ((int_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
+ connect(int_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0)
{
DEBUG_LOG(WIIMOTE, "Unable to open input socket from wiimote.");
- close(in_sock);
- close(out_sock);
- in_sock = out_sock = -1;
+ close(int_sock);
+ close(cmd_sock);
+ int_sock = cmd_sock = -1;
return false;
}

@@ -197,11 +198,11 @@ void Wiimote::RealDisconnect()

Host_ConnectWiimote(index, false);

- close(out_sock);
- close(in_sock);
+ close(cmd_sock);
+ close(int_sock);

- out_sock = -1;
- in_sock = -1;
+ cmd_sock = -1;
+ int_sock = -1;
}

int Wiimote::IORead(unsigned char *buf)
@@ -218,19 +219,19 @@ int Wiimote::IORead(unsigned char *buf)
tv.tv_usec = WIIMOTE_DEFAULT_TIMEOUT * 1000;

FD_ZERO(&fds);
- FD_SET(in_sock, &fds);
+ FD_SET(int_sock, &fds);

- if (select(in_sock + 1, &fds, NULL, NULL, &tv) == -1)
+ if (select(int_sock + 1, &fds, NULL, NULL, &tv) == -1)
{
ERROR_LOG(WIIMOTE, "Unable to select wiimote %i input socket.", index + 1);
return 0;
}

- if (!FD_ISSET(in_sock, &fds))
+ if (!FD_ISSET(int_sock, &fds))
return 0;

// Read the pending message into the buffer
- r = read(in_sock, buf, MAX_PAYLOAD);
+ r = read(int_sock, buf, MAX_PAYLOAD);
if (r == -1)
{
// Error reading data
@@ -257,7 +258,7 @@ int Wiimote::IORead(unsigned char *buf)

int Wiimote::IOWrite(unsigned char* buf, int len)
{
- return write(out_sock, buf, len);
+ return write(int_sock, buf, len);
}

}; // WiimoteReal
diff -pur dolphin-emu-9999.orig/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp dolphin-emu-9999/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
--- dolphin-emu-9999.orig/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp 2012-12-30 01:45:32.818115248 +0100
+++ dolphin-emu-9999/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp 2012-12-30 01:28:30.482886610 +0100
@@ -44,7 +44,7 @@ Wiimote::Wiimote(const unsigned int _ind
#ifdef __APPLE__
, inputlen(0)
#elif defined(__linux__) && HAVE_BLUEZ
- , out_sock(-1), in_sock(-1)
+ , cmd_sock(-1), int_sock(-1)
#elif defined(_WIN32)
, dev_handle(0), stack(MSBT_STACK_UNKNOWN)
#endif
diff -pur dolphin-emu-9999.orig/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h dolphin-emu-9999/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h
--- dolphin-emu-9999.orig/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h 2012-12-30 01:45:32.818115248 +0100
+++ dolphin-emu-9999/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h 2012-12-30 01:26:58.945420987 +0100
@@ -70,8 +70,8 @@ public:
int inputlen;
#elif defined(__linux__) && HAVE_BLUEZ
bdaddr_t bdaddr; // Bluetooth address
- int out_sock; // Output socket
- int in_sock; // Input socket
+ int cmd_sock; // Command socket
+ int int_sock; // Interrupt socket
#elif defined(_WIN32)
char devicepath[255]; // Unique wiimote reference
//ULONGLONG btaddr; // Bluetooth address
diff -pur dolphin-emu-9999.orig/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h dolphin-emu-9999/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h
--- dolphin-emu-9999.orig/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h 2012-12-30 01:45:32.818115248 +0100
+++ dolphin-emu-9999/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h 2012-12-30 01:23:33.307660093 +0100
@@ -34,8 +34,8 @@

// The 4 most significant bits of the first byte of an outgoing command must be
// 0x50 if sending on the command channel and 0xA0 if sending on the interrupt
-// channel. On Mac we use interrupt channel; on Windows/Linux, command.
-#ifndef __APPLE__
+// channel. On Mac and Linux we use interrupt channel; on Windows, command.
+#ifdef _WIN32
#define WM_SET_REPORT 0x50
#else
#define WM_SET_REPORT 0xA0

0 comments on commit 31cd845

Please sign in to comment.