GithubHelp home page GithubHelp logo

petrockblog / snesdev-rpi Goto Github PK

View Code? Open in Web Editor NEW
52.0 10.0 23.0 1.86 MB

Simulates a virtual keyboard for two SNES controllers that are connected to the GPIO pins of the Raspberry Pi (TM)

Makefile 18.77% C 17.77% Shell 46.97% XSLT 0.03% HTML 3.15% CSS 0.53% M4 7.42% Roff 4.53% Lex 0.64% C++ 0.16% sed 0.03%

snesdev-rpi's People

Contributors

5stringsofdoom avatar petrockblog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snesdev-rpi's Issues

Improvements

Check out my branch.
https://github.com/axle-h/SNESDev-RPi

I haven't made a pull request because I've changed so much.
Instead, here's where I think you can improve this.

Performance:

  • Assume that the latch and clock signals are tied so only need to run the poll sequences once per frame. Data signals can be read for all controllers fast enough between clock pulses.
  • Retain last frame state so that we don't need to write button state to uinput every frame. We can instead only write when state changes.
  • Don't need to run all 16 SNES clock pulses. 12 works fine.
  • uinput sync is only required once per frame, not per button and no need to write the button press time.
  • Button polling doesn't need to be done every frame.

Accuracy:

  • The latch pulse should be 12ns. Each clock pulse should be 6ns.
  • The clock signal should be held high and pulsed low.

Some general daemon stuff:

  • Run as daemon using unistd. Don't rely on daemon tools.
  • Log to daemon syslog.
  • Provide command line options e.g. verbose, pid-file, debug.
  • Don't tie this to your snes gpio adapter, e.g. i'm using your circuit but not connected to same gpios.
  • Use an auto build system e.g. CMake instead of building dependencies as part of project.

Improvements

  • Button config seems over complicated. Simplify it like what I've done and providing configurable key values is trivial.

Can't compile on latest raspian

root@raspberrypi:~/SNESDev-RPi# make
gcc -c -Wall -O3 -Iinclude -lbcm2835 -lrt src/main.c -o obj/main.o
src/main.c: In function ‘main’:
src/main.c:216:15: error: ‘RPI_V2_GPIO_P1_11’ undeclared (first use in this function)
src/main.c:216:15: note: each undeclared identifier is reported only once for each function it appears in
src/main.c:271:17: error: ‘RPI_V2_GPIO_P1_19’ undeclared (first use in this function)
src/main.c:272:17: error: ‘RPI_V2_GPIO_P1_23’ undeclared (first use in this function)
src/main.c:273:17: error: ‘RPI_V2_GPIO_P1_07’ undeclared (first use in this function)
src/main.c:274:17: error: ‘RPI_V2_GPIO_P1_05’ undeclared (first use in this function)
make: *** [obj/main.o] Error 1

connection issue

Hi Florian, when i connect the Snes controller to Pi i get an unlimited serie de characters in the command line, It stops if i disconnect the controller. I installed your Snesdv trough the lastest RetroPie-Setup script, and all connections to GPIO ports seem to be ok.

Any ideas? How can i reconfigure or reinstall Snesdv cfg?

Enhance polling of controllers

Suggestion from Fritiof: Since both controllers are using the same clock and strobe signal, the button states coud be read in parallel.

Install Scripts in RetroPie not completeing fully

Ive been futzing with this for a few days on and off, and it seems like the install scripts are not quite getting SNESDev installed all the way as a service. Upon attempting to run the scripts manually my RPi will reboot at the install service portion. I have to Uninstall the service first, then Install it. Not sure if its part of a bad image that may be causing the issue but im burning retropie-4.1-rpi2_rpi3.img from the website last downloaded on Dec 5, 2016. Something about this particular combination makes for an unhappy pi.

SNES Controllers wrong way round? (GPIO Adapter)

The SNES controllers are the wrong way around.

I've double checked my wiring and it's definitely correct.

I'm only using 1 controller and when i run jstest /dev/input/js0 i get nothing, then when i run jstest /dev/input/js1 it works.

How can i reverse this? I'm only using 1 controller so it's not like i can just use them in this way.

Revision : 000e (Model B, Revision 2.0, 512MB)

Feature request - Reset GPIO

For users not using the SNES Dev Shield and just going raw onto the pins having a dedicated GPIO that can be used similar to the button on the Sheild.

The documentation for going without the shield seems to have a few mixed versions eventually found the correct one on reddit - in your documentation in the GIT hub having it spelled out explicitly would be a huge help. Thanks

sudo ~/SNESDev-RPi/bin/SNESDev &

The Command will not work because there is not /bin folder inside the Folder SNESDev-RPi

Something has gone wrong durign make?

Can't install SNESDev-RPI

I am trying to setup another SD card and trying to install SNESDev. I started out with the RetroPie image (1.9.1).

If I try the manual install I get this:

pi@raspberrypi ~/RetroPie/supplementary $ git clone git://github.com/petrockblog/SNESDev-RPi.git Cloning into 'SNESDev-RPi'... remote: Reusing existing pack: 395, done. remote: Total 395 (delta 0), reused 0 (delta 0) Receiving objects: 100% (395/395), 669.38 KiB | 1.15 MiB/s, done. Resolving deltas: 100% (107/107), done. pi@raspberrypi ~/RetroPie/supplementary $ cd SNESDev-RPi/ pi@raspberrypi ~/RetroPie/supplementary/SNESDev-RPi $ sudo ./build.sh

= = = = = = = = = =
Building BCM 2835 library
= = = = = = = = = =

/home/pi/RetroPie/supplementary/SNESDev-RPi/libs/bcm2835-1.14 /home/pi/RetroPie/supplementary/SNESDev-RPi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /home/pi/RetroPie/supplementary/SNESDev-RPi/libs/bcm2835-1.14': configure: error: C compiler cannot create executables Seeconfig.log' for more details
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
/home/pi/RetroPie/supplementary/SNESDev-RPi

= = = = = = = = = =
Building Confuse library
= = = = = = = = = =

/home/pi/RetroPie/supplementary/SNESDev-RPi/libs/confuse-2.7 /home/pi/RetroPie/supplementary/SNESDev-RPi
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /home/pi/RetroPie/supplementary/SNESDev-RPi/libs/confuse-2.7': configure: error: C compiler cannot create executables Seeconfig.log' for more details.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
/home/pi/RetroPie/supplementary/SNESDev-RPi

= = = = = = = = = =
Building SNESDev-Rpi
= = = = = = = = = =

CC src/uinput_gamepad.c
/usr/lib/gcc/arm-linux-gnueabihf/4.6/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: Input/output error
make: *** [build/uinput_gamepad.o] Error 1

If I try from the retropie setup script I get this:

= = = = = = = = = = = = = = = = = = = = =
Installing SNESDev as GPIO interface for SNES controllers
= = = = = = = = = = = = = = = = = = = = =

Cloning into '/home/pi/RetroPie/supplementary/SNESDev-Rpi'...
/home/pi/RetroPie/supplementary/SNESDev-Rpi /home/pi/RetroPie-Setup

= = = = = = = = = =
Building BCM 2835 library
= = = = = = = = = =

/home/pi/RetroPie/supplementary/SNESDev-Rpi/libs/bcm2835-1.14 /home/pi/RetroPie/supplementary/SNESDev-Rpi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /home/pi/RetroPie/supplementary/SNESDev-Rpi/libs/bcm2835-1.14': configure: error: C compiler cannot create executables Seeconfig.log' for more details
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
/home/pi/RetroPie/supplementary/SNESDev-Rpi

= = = = = = = = = =
Building Confuse library
= = = = = = = = = =

/home/pi/RetroPie/supplementary/SNESDev-Rpi/libs/confuse-2.7 /home/pi/RetroPie/supplementary/SNESDev-Rpi
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /home/pi/RetroPie/supplementary/SNESDev-Rpi/libs/confuse-2.7': configure: error: C compiler cannot create executables Seeconfig.log' for more details.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
/home/pi/RetroPie/supplementary/SNESDev-Rpi

= = = = = = = = = =
Building SNESDev-Rpi
= = = = = = = = = =

CC src/uinput_gamepad.c
/usr/lib/gcc/arm-linux-gnueabihf/4.6/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: Input/output error
make: *** [build/uinput_gamepad.o] Error 1
/home/pi/RetroPie-Setup
chgrp: changing group of /home/pi/RetroPie/emulators/mame4all-pi/src/sound/ym2151.h': Input/output error chgrp: changing group of/home/pi/RetroPie/emulators/mame4all-pi/src/sound/c140.h': Input/output error
chgrp: changing group of /home/pi/RetroPie/emulators/fbzx-2.10.0/Z80free.o': Input/output error chgrp: changing group of/home/pi/RetroPie/emulators/gngeo-0.7/installdir/share/gngeo/romrc.d/lresort.rc': Input/output error
chgrp: changing group of /home/pi/RetroPie/emulators/gngeo-0.7/installdir/share/gngeo/romrc.d/samsho5sp.rc': Input/output error chown: changing ownership of/home/pi/RetroPie/emulators/mame4all-pi/src/sound/ym2151.h': Input/output error
chown: changing ownership of /home/pi/RetroPie/emulators/mame4all-pi/src/sound/c140.h': Input/output error chown: changing ownership of/home/pi/RetroPie/emulators/fbzx-2.10.0/Z80free.o': Input/output error
chown: changing ownership of /home/pi/RetroPie/emulators/gngeo-0.7/installdir/share/gngeo/romrc.d/lresort.rc': Input/output error chown: changing ownership of/home/pi/RetroPie/emulators/gngeo-0.7/installdir/share/gngeo/romrc.d/samsho5sp.rc': Input/output error

What am I doing wrong?

link directly with libconfuse or support building against raspbian package

Curently libconfuse is built/installed to /usr/local/lib - perhaps it could just link with it directly after building without installing - keeps everything in one place then. Also on raspbian, it should check if there is a system libconfuse installed - that way we can just add a dependency on RetroPie-Setup for libconfuse which saves building it at all.

Not working with Jessie Beta - Systemd missing

Hey guys,

I'm running the v3.3 BETA Retropie SD Card Image on a RPi2. Manually downloading, compiling and manually starting SNESDev works (also compiling and installing via the retropie setup works fine)

However, there is no start script for the Systemd, so SNESDev isn't loaded automatically everytime retropie starts.

Please fix :)

Thanks!

Gamepad driver

Instead of virtual keyboard, implement gamepad driver(s). This would require less configuration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.