Skip to content

Instantly share code, notes, and snippets.

@requeijaum
Last active August 20, 2019 00:14
Show Gist options
  • Save requeijaum/db6a4972735f45e8c97562d225725319 to your computer and use it in GitHub Desktop.
Save requeijaum/db6a4972735f45e8c97562d225725319 to your computer and use it in GitHub Desktop.
Using sixpair on PowerPC Mac for RetroArch gaming. Before that: used sixpair from http://dancingpixelstudios.com/sixaxiscontroller/sixpair on Intel Mac (El Capitan) for injecting PowerPC Mac's BT address.

Notes

The controller almost works wirelessly, but it keeps pressing "D-pad down" button and disconnects. Since there is a warning on my PPC compiling tryout... it must be some bug.

Check this Imgur Gallery for some pics.

I also forked some fork of the original sixpair - that seems to have DualShock4 support.

May RetroArch and it's input drivers help?

May DDHidLib help? (Before the 64-bit commit aka: PPC dropped, heh)

To-Do

[x] Compile sixpair on Intel Mac

[x] Do some testing with the injected BT address from PowerPC Mac

[x] Test with HTML5Gamepad

  • It worked on Firefox Quantum on my Intel Mac; but not on TenFourFox on my PowerPC Mac.
  • May IOKit don't recognize the controller even on USB? Hmm...
  • Compile my forked version with alleged DualShock4 support. It may have some bugfixes...

  • Compile my forked version on PowerPC Mac

  • Play RetroArch with my DualShock3 controller

Tried running an already compiled sixpair for Mac. I only needed pointing out libusb-legacy's dylib from MacPorts.

cce:Dropbox rafaelfrequiao$ ~/Downloads/sixpair
-bash: /Users/rafaelfrequiao/Downloads/sixpair: Permission denied
cce:Dropbox rafaelfrequiao$ chmod +x ~/Downloads/sixpair
cce:Dropbox rafaelfrequiao$ ~/Downloads/sixpair
dyld: Library not loaded: /usr/local/lib/libusb-0.1.4.dylib
  Referenced from: /Users/rafaelfrequiao/Downloads/sixpair
  Reason: image not found
^CTrace/BPT trap: 5
cce:Dropbox rafaelfrequiao$ sudo port install libusb-legacy
Password:
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
--->  Fetching archive for libusb-legacy
--->  Attempting to fetch libusb-legacy-0.1.12_4.darwin_15.x86_64.tbz2 from http://ywg.ca.packages.macports.org/mirror/macports/packages/libusb-legacy
--->  Attempting to fetch libusb-legacy-0.1.12_4.darwin_15.x86_64.tbz2.rmd160 from http://ywg.ca.packages.macports.org/mirror/macports/packages/libusb-legacy
--->  Installing libusb-legacy @0.1.12_4
--->  Activating libusb-legacy @0.1.12_4
--->  Cleaning libusb-legacy
--->  Updating database of binaries
--->  Updating database of C++ stdlib usage
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.
cce:Dropbox rafaelfrequiao$ ~/Downloads/sixpair
dyld: Library not loaded: /usr/local/lib/libusb-0.1.4.dylib
  Referenced from: /Users/rafaelfrequiao/Downloads/sixpair
  Reason: image not found
Trace/BPT trap: 5
cce:Dropbox rafaelfrequiao$ ls /usr/local/lib/lib
libcapstone.3.dylib     libfuse.2.dylib         libfuse_ino64.dylib     libosxfuse.la
libcapstone.a           libfuse.dylib           libfuse_ino64.la        libosxfuse_i64.2.dylib
libcapstone.dylib       libfuse.la              libosxfuse.2.dylib      libosxfuse_i64.dylib
libfuse.0.dylib         libfuse_ino64.2.dylib   libosxfuse.dylib        libosxfuse_i64.la
cce:Dropbox rafaelfrequiao$ ls /usr/local/lib/libusb
cce:Dropbox rafaelfrequiao$ sudo ln -s /opt/local/
Library/ bin/     etc/     include/ lib/     libexec/ man/     sbin/    share/   var/     
cce:Dropbox rafaelfrequiao$ sudo ln -s /opt/local/lib/libusb
libusb-0.1.4.dylib  libusb-1.0.a        libusb-legacy/      libusb.dylib        
libusb-1.0.0.dylib  libusb-1.0.dylib    libusb.a            
cce:Dropbox rafaelfrequiao$ sudo ln -s /opt/local/lib/libusb-0.1.4.dylib /usr/local/lib/libusb-0.1.4.dylib
cce:Dropbox rafaelfrequiao$ ~/Downloads/sixpair
No controller found on USB busses.
cce:Dropbox rafaelfrequiao$ ~/Downloads/sixpair
Current Bluetooth master: 00:00:00:00:00:00
usage: /Users/rafaelfrequiao/Downloads/sixpair [<bd_addr of master>]
cce:Dropbox rafaelfrequiao$ ~/Downloads/sixpair 00:0d:93:0f:57:e1
Current Bluetooth master: 00:00:00:00:00:00
Setting master bd_addr to 00:0d:93:0f:57:e1
cce:Dropbox rafaelfrequiao$ 

[we are done]

Tried compiling sixpair on PowerPC Mac. Even with libusb-legacy include files... all versions of GCC refuses borks at the linking stage.

PowerBook-de-Rafael:Desktop rafaelfrequiao$ ARCH=ppc gcc-mp-6 -v -o sixpair sixpair.c -I /opt/local/include/libusb-legacy/ -L /opt/local/lib/libusb-legacy/ 

Using built-in specs.
COLLECT_GCC=gcc-mp-6
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/ppc-apple-darwin9/6.5.0/lto-wrapper
Target: ppc-apple-darwin9
Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc6/gcc6/work/gcc-6.5.0/configure --prefix=/opt/local --build=ppc-apple-darwin9 --enable-languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc6 --includedir=/opt/local/include/gcc6 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-6 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-6 --with-gxx-include-dir=/opt/local/include/gcc6/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-tls --with-pkgversion='MacPorts gcc6 6.5.0_4'
Thread model: posix
gcc version 6.5.0 (MacPorts gcc6 6.5.0_4) 
COLLECT_GCC_OPTIONS='-v' '-o' 'sixpair' '-I' '/opt/local/include/libusb-legacy/' '-L/opt/local/lib/libusb-legacy/' '-mmacosx-version-min=10.5.8' '-asm_macosx_version_min=10.5'
 /opt/local/libexec/gcc/ppc-apple-darwin9/6.5.0/cc1 -quiet -v -I /opt/local/include/libusb-legacy/ -D__DYNAMIC__ sixpair.c -fPIC -quiet -dumpbase sixpair.c -mmacosx-version-min=10.5.8 -auxbase sixpair -version -o /var/folders/mW/mWpvRFBZEyeuV1mrjrcE8k+++TI/-Tmp-//cccZCycR.s
GNU C11 (MacPorts gcc6 6.5.0_4) version 6.5.0 (ppc-apple-darwin9)
	compiled by GNU C version 6.5.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version 0.15
GGC heuristics: --param ggc-min-expand=82 --param ggc-min-heapsize=98304
ignoring nonexistent directory "/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0/../../../../../ppc-apple-darwin9/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/local/include/libusb-legacy/
 /opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0/include
 /opt/local/include
 /opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
GNU C11 (MacPorts gcc6 6.5.0_4) version 6.5.0 (ppc-apple-darwin9)
	compiled by GNU C version 6.5.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version 0.15
GGC heuristics: --param ggc-min-expand=82 --param ggc-min-heapsize=98304
Compiler executable checksum: 42c1082229f2bccabf4f5dfb1508940c
sixpair.c: In function 'process_device':
sixpair.c:64:3: warning: implicit declaration of function 'usb_detach_kernel_driver_np' [-Wimplicit-function-declaration]
   usb_detach_kernel_driver_np(devh, itfnum);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
COLLECT_GCC_OPTIONS='-v' '-o' 'sixpair' '-I' '/opt/local/include/libusb-legacy/' '-L/opt/local/lib/libusb-legacy/' '-mmacosx-version-min=10.5.8' 
 /opt/local/bin/as -v -I /opt/local/include/libusb-legacy/ -arch ppc -o /var/folders/mW/mWpvRFBZEyeuV1mrjrcE8k+++TI/-Tmp-//cc4Qh4jd.o /var/folders/mW/mWpvRFBZEyeuV1mrjrcE8k+++TI/-Tmp-//cccZCycR.s
Apple Inc version cctools-921, GNU assembler version 1.38
COMPILER_PATH=/opt/local/libexec/gcc/ppc-apple-darwin9/6.5.0/:/opt/local/libexec/gcc/ppc-apple-darwin9/6.5.0/:/opt/local/libexec/gcc/ppc-apple-darwin9/:/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0/:/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/
LIBRARY_PATH=/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0/:/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0/../../../
COLLECT_GCC_OPTIONS='-v' '-o' 'sixpair' '-I' '/opt/local/include/libusb-legacy/' '-L/opt/local/lib/libusb-legacy/' '-mmacosx-version-min=10.5.8' 
 /opt/local/libexec/gcc/ppc-apple-darwin9/6.5.0/collect2 -dynamic -arch ppc -macosx_version_min 10.5.8 -weak_reference_mismatches non-weak -o sixpair -lcrt1.10.5.o -L/opt/local/lib/libusb-legacy/ -L/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0 -L/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0/../../.. /var/folders/mW/mWpvRFBZEyeuV1mrjrcE8k+++TI/-Tmp-//cc4Qh4jd.o -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -lSystemStubs -lSystem -v
collect2 version 6.5.0
/opt/local/bin/ld -dynamic -arch ppc -macosx_version_min 10.5.8 -weak_reference_mismatches non-weak -o sixpair -lcrt1.10.5.o -L/opt/local/lib/libusb-legacy/ -L/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0 -L/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0/../../.. /var/folders/mW/mWpvRFBZEyeuV1mrjrcE8k+++TI/-Tmp-//cc4Qh4jd.o -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -lSystemStubs -lSystem -v
@(#)PROGRAM:ld  PROJECT:ld64-127.2
configured to support archs: i386 x86_64 ppc ppc64 armv6 armv7
Library search paths:
	/opt/local/lib/libusb-legacy/
	/opt/local/lib/gcc6/gcc/ppc-apple-darwin9/6.5.0
	/opt/local/lib/gcc6
	/usr/lib
	/usr/local/lib
Framework search paths:
	/Library/Frameworks/
	/System/Library/Frameworks/
Undefined symbols for architecture ppc:
  "_usb_control_msg", referenced from:
      _show_master in cc4Qh4jd.o
      _set_master in cc4Qh4jd.o
  "_usb_open", referenced from:
      _process_device in cc4Qh4jd.o
  "_usb_detach_kernel_driver_np", referenced from:
      _process_device in cc4Qh4jd.o
  "_usb_claim_interface", referenced from:
      _process_device in cc4Qh4jd.o
  "_usb_close", referenced from:
      _process_device in cc4Qh4jd.o
  "_usb_init", referenced from:
      _main in cc4Qh4jd.o
  "_usb_find_busses", referenced from:
      _main in cc4Qh4jd.o
  "_usb_find_devices", referenced from:
      _main in cc4Qh4jd.o
  "_usb_get_busses", referenced from:
      _main in cc4Qh4jd.o
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment