GithubHelp home page GithubHelp logo

jaburns / nintendospy Goto Github PK

View Code? Open in Web Editor NEW
252.0 20.0 83.0 121.42 MB

Live controller viewer for Nintendo consoles. Includes viewer application for Windows, and Arduino sketch for hardware interface.

License: MIT License

C# 90.47% Batchfile 0.73% C++ 8.80%

nintendospy's Introduction

NintendoSpy

This project is not being actively developed by the owner, however PRs are more than welcome!

Download the latest NintendoSpy release here. (x64 and experimental x86 Windows binary)

This project provides a general solution for live-streaming your controller inputs while speedrunning, or recording inputs for tutorials on how to perform tricks. It supports tying in to NES, SNES, Nintendo 64, and GameCube controller signals to get a live view of them, as well as any gamepad connected to your PC for use with emulators. XBox 360 controllers are supported with a skin out of the box, but other gamepads will require creating a skin.

NintendoSpy supports custom skins using a straight-forward XML-based skin format. You can also bind controller input combinations to trigger keypresses for hitting checkpoints on your splits. If you create your own skins, feel free to submit them as pull requests to this repository.

Some extra skins for NES and SNES can be found here.

There's also a fork available here which supports Atari/Commodore joysticks, Sega Genesis controllers, SMS controllers and the Atari 2600 Omega Race Booster Grip.

Documentation

Wiring and hardware

The general design of NintendoSpy involves splicing the controller wire, and attaching the appropriate signal wires to an Arduino. Then you just need to install the Arduino firmware packaged in the NintendoSpy release, and run the viewer software. For more in-depth tutorials on how to do this, check out some of the links below.

EvilAsh25's SNES hardware building guide

Gamecube hardware tutorial

N64 hardware tutorial

Using the viewer software

Once you've unzipped the NintendoSpy release, run NintendoSpy.exe to open the controller viewer. You'll be greeted by the input source configuration screen, which is fairly straightforward to configure. First select the console your NintendoSpy hardware is set up to view, "PC 360", or "Generic PC Gamepad". For the latter 2 choices, COM port is irrelevant since the device is expected to simply interface over standard USB. If you select a Nintendo console however, you'll have to select the COM port the Arduino is communicating over. Honestly, the easiest way to figure this out is to just try each port. There are never many in the list, and it does no harm to pick the wrong one other than you won't see any inputs.

Once you've selected the input source, you'll have to pick a skin. Each skin can have multiple backgrounds, which are generally used to provide various colors for the controller itself. After picked a skin, hit Go! and you should see the viewer screen.

Creating your own skins

Each skin consists of a subfolder in the "skins" directory, which is expected to contain a file called skin.xml along with all the PNG image assets required by the skin. The easiest way to create a skin for your target console is probably just to copy+paste the default skin and modify it according to your needs. What follows is a thorough documentation of the skin.xml format for reference if you'd like to create more complex skins.

The root node of the skin.xml file must define the following 3 attributes:

<skin
    name="Default PC 360" # This is the name of the skin as it will appear in the selection list.
    author="jaburns"      # Your name or handle.
    type="pc360">         # The input type this skin is used for.

Valid values for the type attribute are as follows: nes, snes, n64, gamecube, pc360, generic.

Each skin must define at least one <background> element. Each background entry will be listed in the skin selector as a separate entry. Every background for your skin must have the same dimensions.

<background
    name="Default"     # The name which will appear in the selection list.
    image="pad.png"    # Optional PNG file to use for this background selection.
    color="red"        # Optional Color to use as background, either a text or a hex (#123DEF) style
    /> 

The rest of the skin.xml file defines how to render button and analog inputs. Each type exposes a variety of buttons and analog values. Button inputs are mapped to images at specific locations using the <button> tag, and there is a small variety of possible ways to map analog inputs.

<detail
    name="Static Image"                  # Name of the source input button to map this image to.
    image="Dropshadow.png"               # Image file to display when this input is pressed.
    x="101" y="71"                       # Location in pixels where the top/left corner of the image should sit.
    width="16"                           # Width and height specification can OPTIONALLY be used to scale
    height="16" 
    target="Background A;Background C"   # Optional. Only show for this background. Available for all elements.
    ignore="Background B"                # Optional. Do not show for this background (not required when target is defined)
    />     #   an image to a specific size.  The default size is the orignal image size.

A static image to show, works great with ignore and targets to add more variety with ease to skins.

<button
    name="up"          # Name of the source input button to map this image to.
    image="circle.png" # Image file to display when this input is pressed.
    x="101" y="71"     # Location in pixels where the top/left corner of the image should sit.
    width="16"         # Width and height specification can OPTIONALLY be used to scale
    height="16" />     #   an image to a specific size.  The default size is the orignal image size.

Analog values can be mapping as sticks, ranges, or range-based buttons. Ranges are used for things like analog shoulder buttons and render by filling an image by the amount the range is pressed. Range buttons are useful for creating a button-like display when an analog value is in a certain ranage. An example of this use case is if you are streaming a SNES game, but playing using a 360 controller, you can bind the analog stick to appear as if you are pressing the d-pad buttons.

<stick
    xname="lstick_x"  # Analogs values to bind the image's x 
    yname="lstick_y"  #   and y displacements to.
    image="stick.png" # Image file to use for the stick.
    x="53" y="31"     # Location in pixels where the top/left corner of the image should sit. 
    width="34"        # Width and height specification can OPTIONALLY be used to scale 
    height="35"       #   an image to a specific size.  The default size is the orignal image size.
    xrange="9"        # xrange and yrange specify how much to move the stick image in either axis
    yrange="9"        #   when the stick is deplaced.
    xreverse="false"  # Settings xreverse or yreverse to true will reverse the direction
    yreverse="true"   #   that the stick moves along that axis
    />     
<analog
    name="trig_l"      # Analog value to bind the display to.
    image="trig-l.png" # Image file to mask over the background as the input changes.
    x="15" y="18"      # Location in pixels where the top/left corner of the image should sit. 
    direction="up"     # The direction to sweep the image.
                         Valid options are 'up', 'down', 'left', 'right'.
    reverse="true"     # 'true' or 'false'. Setting to true will cause the image to clear instead
                         of fill as the analog value is further engaged.
    usenegative="true" # 'true' or 'false'. If set to true, then the image will change when the analog
                         value ranges from 0 to -1 instead of 0 to 1.  Useful for generic gamepad skins
                         who use a single axis for analog L/R buttons.
    />
<rangebutton
    name="lstick_x"    # Analog value to bind the display to.
    image="d-left.png" # Image file to mask over the background as the input changes.
    x="15" y="18"      # Location in pixels where the top/left corner of the image should sit. 
    from="-1.0"        # From and to attributes specify the range which the specified analog
    to="-0.5"          #   input must be in to display the image.
/>

Binding controller inputs to keyboard key presses

Binding controller inputs to keyboard key presses is achieved by placing <binding> definitions in the keybindings.xml file. The output-key attribute on the binding specifies which keyboard key to press when the provided gamepad buttons are pressed. Values of output-key can simply be letters, or see here other for valid key bindings (the text in red are the acceptable values for output-key). Each binding must contain at least one child <input> element. The input elements specify which buttons on the controller must be depressed in order to send the key press signal. See below for an example keybindings.xml file which makes pressing L and R together trigger a home key press on the keyboard.

<?xml version="1.0" encoding="UTF-8"?>
<keybindings>
    <binding output-key="home">
        <input button="r" />
        <input button="l" />
    </binding>
</keybindings>

nintendospy's People

Contributors

abductedplatypus avatar clydepowers avatar clysmic avatar cryze avatar jaburns avatar karl-parris avatar kelbi-org avatar nickcat03 avatar pkpktech avatar quantum-cross avatar robertvanderaarde avatar shiek avatar skuzee avatar starknebula avatar tomg404 avatar zas32x 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nintendospy's Issues

com port list is empty

I have a USB N64 controller plugged in which I have been using for Mupen64 and Retroarch. When I try to crreate a button press display for it the com port list on the program is empty.
image

Button Counter support

Hiya. It would be a good idea to add a Button Counter label for each buttons comparing to NintendoWiSpy.

Classic Controller Support?

Will your arduino build work for intercepting inputs from a Wii Classic(Pro), NES Classic, or SNES Classic controller?

If not, would you be willing to add this functionality? I would gladly donate to help support this development.

Edit: I'm personally most interested in the Wii Classic Pro controller, for the record

NintendoSpy and Raphnet Adapters

I have a Gamecube controller hooked up to a Raphnet GC to N64 adapter which is hooked up to my N64 - https://www.raphnet-tech.com/products/gc_to_n64_adapter_v3_with_builtin_controller_pak/index.php

When using GC->GC NintendoSpy->Raphnet Adapter->N64, I get absolutely no response from the input tracker.
Surely this should work, since we're still dealing with a GC controller signal at this point? It's not yet been translated into the N64 signal.

Using an N64 NintendoSpy between the Raphnet Adapter and the N64 works absolutely fine, and the GC adapter works absolutely fine if it's plugged directly into a Gamecube.

Surely since we're splicing into the output of a GC controller we should have exactly the same data regardless of whether or not it's plugged into a Gamecube, an Adapter, the Wii, the WiiU adapter, etc etc.

Some games cause "fake" inputs to appear

I've ran into an issue where some games, like Banjo-Kazooie and Banjo-Tooie, cause "fake" inputs to appear on NintendoSpy. In the case of the BK games, the left and right C buttons will flash every second or so, without them being pressed.

I've also seen cases where the controller on NintendoSpy will just go crazy during loading zones, like in Chameleon Twist 2 (You can see an example here, around the beginning of the video: http://www.twitch.tv/forstride/c/4147837. This doesn't happen in Chameleon Twist 1 though).

I'm not sure what could be causing this, as it only happens with certain games, and I'm hoping this is just something caused by the program itself...

Button as stick?

Hi, I may be ignorant but I'm trying to make a skin for my Qanba Q1 arcade stick and thought it would be cool to have the stick waggle... however since it's interpreted as a POV-hat I seem to be only able to map it as a button which means overlays seem to be the only option. If it's not already something doable that I'm missing I'd like to request a new field something like buttonstick which acts kinda like the rangebutton only the other way around.

v1.10.1 input delay

Hey!

I made a Nintendospy recently. I didn't use the original arduino uno but a third party version. Do you think that might be the cause of "input delay"? Or is there any option in v1.10.1 that can add or remove input delay?

Thank you for answering!

Where is the .exe file?

I'm new, and in your read me, it says to open the .exe file, but there isn't one. Can anybody help me?
screenshot_25

Short button presses not registering on input display

I'm having an issue where button presses that last for about 1 frame don't always show up on the input display. So if I'm playing a game that requires 1 frame B presses or something, then if I do the 1 frame B press then sometimes my inputs won't show up on the input display but they will always show up ingame.

Not certain if this is related or not, but the control stick seems to be stuck in 30 frames per second on the input display most of the time. Sometime it kicks up to 60 for like 3 or 4 frames, while other times it completely freezes for like 3 or 4 frames. Again, I'm not sure if this is the same issue or not.

In case it's relevant, I'm using a Gamecube controller and an official Arduino Uno R3.

Implement attribute negate="true" for analog skin elements

Need this to capture triggers which for instance range L from 0 to -1 and R from 0 to 1 on the same axis. Analog element now only deals with axes which range from 0 to 1. Need to be able to tell the analog skin element to capture from 0 to -1 instead.
Soemthing like <analog ... usenegative="true" />

Question about a skin feature

Is there any way to make a transparent skin for the overlay, by not using a chroma key?

I'd like to have the input display on a top window above my dolphin window so I can actually see my inputs in real time without the input window blocking too much screen space.

Is this possible?

I already tried making the default background Tron skin transparent in CS6 but then the transparent .png is rendered as pure white in the application.

Basically is there any way for the window to be opaque or transparent so I can put it on top of my actual dolphin window and see through it to the game? Obviously the windows window will still be seen but trying to make it as 'see through' as possible?

Firmware for Classic controler and pin on arduino

Hey Guys = )

I just finished the hardware part with dupont wires and extension cable for a classic controler.

Firslty i had problem to compile the master version of this project to have the classic controler part. (I asked some help lol)

Then i opened the ino firmware and it looks like the classic controler is not supported yet, isn't it ?

If it is supported, on what pin i should link on my arduino ?

Thanks for all the good work

PedrOwl

USB controllers

So I have been having a problem with NintendoSpy recently I have just recently encountered this problem and don't know how to resolve it, I've looked through all the xml files and haven't seen any problems. I am currently using a PS4 controller, It identifies well on joy.cpl but Any help is appreciated, Thanks.

New release?

I ran into the issue of not getting my generic controller detected, because NintendoSpy always looks only for the first plugged in controller. I saw this commit but realized the latest build is quite older then that.

Is it possible to get a new release with the latest features out? Or am I missing here something?

Gamecube Gameboy Player does bizarre things

I am trying to debug why starting up the gameboy player disk makes Nintendospy completely spaz out (all buttons and sticks randomly jumping around), but I am not familiar enough with the code (yet) to sort it out. Any ideas or at least tips for debugging the issue.

MODE_DETECT is not working

Could someone explain to me please how MODE_DETECT is supposed to work? It's documented nowhere. I thought it works when I put +5V or +3.3V into analog input 2 (for loop_GC) - but it doesn't work :/

Device can be seen as gamepad for some people and not others

For some people, the device can be seen as a game pad by other applications while functioning as an input viewer, but for others it can't.

In particular, I am trying to get the device to register button presses as hotkey presses in livesplit (http://livesplit.org/).This works for one of my friends (who I made a device, and I am sure I used the same firmware, programs etc), but it doesn't work for mine or another friend who I also made one for. I also know of one other person who it works for (who built their own), so it works for 2 people, doesn't work for 2 others.

Do you have any ideas as to why this might be happening?

Thanks,
Karl

Causing Wii to turn off and not turn back on until power cable is unplugged

This is probably something I have messed up, but I have been trying to get this to work to see my gamecube inputs on wii and as soon as I plug the gc extension cable into my wii, the console turns off. I'm thinking I probably have the wrong wires going into the arduino, because the gc extension cable that I used has some odd coloured wires. From what I have seen on the internet, red is the data line and green and white are both ground. But I don't have a green cable, instead I have a brown, which I plugged into ground on the arduino.

Edit: It was my wiring. red was data and black was ground. All working great now :)

Multiple Gamecube controllers at once

I would like to have 2 controllers or even 4 visible at the same time for multiplayer games such as Super Smash Bros Melee. Is this already a feature or is it planned for a future release? Or is it not possible at all?

No inputs recognized

So I managed to compile the .ino file and load it into arduino. I also uncommented the following line
#define MODE_GC
but then when paring it with Wii U Adapter and opening the program on PC nothing happens. Not any input got recognized.

Someones has an idea why? The hardware itself works properly (i used the Enhanced Training Mode before).

Shadow presses and flickering?

I just wired up my super Nintendo controller and it works quite well.

I noticed two problems:

Some buttons when pressed cause other buttons to flicker.
Those other buttons also flicker when they're held down themselves.

D-pad: works normal
L/R: flicker
Select: works fine causes L to flicker
Start: works fine causes R to flicker
Y/B: cause X/A to flicker respectively
X/A flicker when held down.

This seems pretty consistent so I wonder if it means I wired something wrong or if there's something else I should debug.

Thanks!

Frequent crashing

The program crashes for me after a varying amount of time after opening the viewwindow (usually around 20 seconds I would say). I get the error message of:

An unhandled exception of type 'System.NullReferenceException' occurred in PresentationFramework.dll

Additional information: Object reference not set to an instance of an object.

Also, in your ViewWindow.xaml the "Blink Reduction" menu item's click event is BlinkReductionEnabledEnabled_Click, whereas the function in ViewWindow.xaml.cs is BlinkReductionEnabled_Click. The crash that I get happens after fixing this problem though.

Request: Mash meter

Hey!

Since the software read inputs. Would it be possible to have a running counter that shows the number of clicks per secound? It would be awesome if I could set it up to show clicks/minute with B button!

Love the program, it's so convinient! I hope you'll keep working with it!

Dolphin Compatibility

Is there a possibility or any future plans in order to make this compatible with the wii u adapter so we can display the controller inputs on the dolphin emulator?

Controller adapting

Is it possible to send output signals that mimic the controller of another console?

Example: I want to use a Gamecube controller for Sega Genesis, having the same trigger points for the control stick as Sonic Mega Collection. Is it possible to have the NintendoSpy read inputs from the controller and then send signals that the Genesis can use? Would this introduce any input lag?

chroma key

any way to change the background color of the viewer?

No 32-bit pre-compiled binary package.

Gives this error in Windows 7 Ulitmate x86:

"The version of this file is not compatible with the version of windows you're running. Check your computers system information to see weather you need an x86 (32bit) or x64 (64bit) version of the program, and then contact the software publisher"

Color interpolation instead of sweeping an image

I am creating a skin for the gamecube and I noticed there is no changing of color through the use of pressure for the triggers. I don't really want to sweep an image as I think using a gradient would make for a cleaner layout. I was looking around and saw taking your hex code and linking it with a floating point, but I'm really new to this stuff. :(
(edit) Here's the link I was given:
https://stackoverflow.com/questions/13488957/interpolate-from-one-color-to-another

[Bug] Float.TryParse little overview for other CultureInfo system

In the function static float readFloatConfig(XElement elem, string attrName) in Skin.cs [line 275 actually], there is a little oversight in the usage of Float.TryParse

My locale says that a floating point number should be written with a comma instead of a dot. Of course, as a dev, I always use a dot, but my computer didn't hear it from that ear, and so did NintendoSpy when reading from && to attributes in some rangebutton configuration in skins.

Thus, there is a little portability issue, as I initially downloaded the skin.xml from whom it worked just fine.

The solutions are simple :

  • Decide to let it be, warn users in documentation and lose a little bit of portability over consistency for different locale
  • Use the form float.TryParse (readStringAttr(elem, attrName), System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out ret) forcing the North American style redaction for floating point number.
  • Use a middle term solution where 3 Float.TryParse are done in order to try different solutions, and report a fail if all of that didn't work

I've tried the third one, it has allow me to mix a dot-style number with a comma-style number, but it isn't a one line solution.
The functions become :

        static float readFloatConfig (XElement elem, string attrName)
        {
            float ret;
            string attrValue = readStringAttr(elem, attrName);
            if (! float.TryParse (attrValue, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.CurrentCulture, out ret) &&
                ! float.TryParse(attrValue, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out ret) &&
                ! float.TryParse(attrValue, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out ret)){
                throw new ConfigParseException ("Failed to parse number for property '"+attrName+"' in element '"+elem.Name+"'.");
            }
            return ret;
        }

Major Flickering

Hello, I just followed the tutorial for building your own input device using an arduino uno, however I am getting some major flickering in NintendoSpy, even with blink reduction turned on. Any ideas?

Poor image quality/aesthetics

Right now, NintendoSpy uses really small images that aren't exactly ideal for use on a live stream. I'm not sure if that was the intended purpose of NintendoSpy, but that's what most people seem to use it for.

The button highlights also aren't that customizable without dealing with code, so maybe there could be individual button highlight files that match the size/shape of the controller, for easier editing and customization.

But yeah, it'd be nice to see NintendoSpy improve aesthetically, as myself and a few other streamers (Including popular ones like Siglemic and Stivitybobo) use it, and I'm sure even more people would be willing to use it if it was more user-friendly and customizable.

I do graphic design myself, so if you need help with that side of things, I'd be more than happy to lend a hand.

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.