Thursday, January 31, 2019

RetroArch Wii U Slang Shaders

RetroArch on Wii U has supported slang shaders for a long time, but it's really hard to find them online. I found a pack of them, though, and decided to rehost it here. Hopefully, more people will get to enjoy them now.

Unfortunately, the GPU on the Wii U isn't particularly powerful, so relatively few run full speed, and there seem to be some weird scaling issues going on, leading to slightly uneven scanlines at times and broken xBR/Hqx effects. LUTs are also wonky, apparently, as many of the LUT-based mask effects are just scaled up to fit the screen instead of tiled across it.

EDIT: I thought the scaling issues might have been caused by it rendering at 720p and then upscaling to 1080p, so I changed the Wii U's output res to 720p but it still has a bunch of ugly issues. Mask effects are completely terrible. Currently, I'm just using misc/interlacing at a 2x scale to get even scanlines.

Saturday, December 22, 2018

Retro Console RJ45 Pinouts - PS360+, MC-Cthulhu, Brook Retro Board

I build a lot of arcade sticks and I like to use them on old video game consoles, and the best way to do this is usually to get a control board that is compatible with multiple consoles. There have been a few boards that do this over the years, including Toodles' MC-Cthulhu (mostly discontinued but still available sporadically), Akishop Customs' PS360+ (discontinued) and now (at the time of this writing) Brook's Retro Board.

The preferred way to connect these boards to the consoles is via RJ45 connectors soldered to the board and then a console-specific connector soldered onto the other end of the cable. A few arcade parts stores sell premade cables for some of the more popular consoles at the time of this writing, but that will probably stop at some point, so it's good to know how to put these cables together.

There used to be a huge thread with really great tutorials on making these cables on the Shoryuken forums by user "rtdzign" but when SRK migrated to a different forum software a few years ago, it completely fucked up their post index so you can't get to things from google search results and I think the whole forum is shutting down completely soon, so all of this will be lost (most of it already is, really; I had to go sifting through the Wayback Machine's archives to collect most of this stuff).

Anyway, here goes (note: the pics in this post come from rtdzign's original tutorial on SRK and from Akishop Custom's PS360+ manual, with copyrights for those respective images belonging to them):

If you buy a MC-Cthulhu from somewhere, you may want to make sure you have the latest firmware. Toodles' "Godlike Controls" site has been down for a while, but the Wayback Machine cached the firmware file here.
Mirror

The ethernet connection pinout looks like this:

USB

The first cable you'll probably want to make is a regular USB cable (for PC and PS3). It's pretty simple - ground (pin 4 of the USB cable) goes to pin 1 of the ethernet cable, data+ (USB pin 2) goes to pin 5 of the ethernet cable, data- (USB pin 3) goes to ethernet pin 6 and VCC (USB pin 1) goes to ethernet pin 8.

Color - Purpose - RJ45 Pin - Cthulhu - ETH Color
Black - GND     - 1        - G       - Orange Stripe
---   - ---     - 2        - A       - Orange Solid
---   - ---     - 3        - B       - Green Stripe
---   - ---     - 4        - C       - Blue Solid
White - DATA-   - 5        - D       - Blue Stripe
Green - DATA+   - 6        - E       - Green Solid
---   - ---     - 7        - F       - Brown Stripe
Red   - VCC     - 8        - V       - Brown Solid

Original Xbox

Once you've done USB, OG Xbox is a logical next choice, as it's just USB with a proprietary plug:


OG Xbox also has a yellow wire that is unused and can be ignored, but otherwise it's the same as the regular USB cable.
NOTE: in general, don't trust wire colors blindly. *Always* test continuity with a multimeter to confirm wire-to-pin assignment. Cheap, knockoff extension cables are notorious for using essentially random wire colors (including nonsense like red GNDs, black VCCs, etc.)
If your construction skills aren't great and you would rather buy something, I believe you could also just use a USB-female-to-Xbox-male adapter like this one (or build one) and get the same effect pairing it with your newly constructed RJ45-to-USB cable.

Once you've got the hang of it, the rest of the consoles are just a matter of matching up the gamepad pins with the ethernet wires.

Gamecube

Gamecube (not compatible with PS360+) only uses the first 3 pins of the controller, which makes it pretty easy: controller pin 1 is VCC, which goes to ethernet pin 8, controller pin 3 is GND, which goes to ethernet pin 1 and controller pin 2 is DATA, which goes to ethernet pin 7. Easy-peasy.

Here's the diagram:

GC Pin - Purpose - RJ45 Pin - Cthulhu - ETH Color
1      - +5v     - 8        - V       - Brown Solid
2      - DATA    - 7        - F       - Brown Stripe
3      - Ground  - 1        - G       - Orange Stripe
And the same info in order of RJ45/Cthulhu pins:
GC Pin - Purpose - RJ45 Pin - Cthulhu - ETH Color
3      - Ground  - 1        - G       - Orange Stripe
---    - ---     - 2        - A       - Orange Solid
---    - ---     - 3        - B       - Green Stripe
---    - ---     - 4        - C       - Blue Solid
---    - ---     - 5        - D       - Blue Stripe
---    - ---     - 6        - E       - Green Solid
2      - DATA    - 7        - F       - Brown Stripe
1      - +5v     - 8        - V       - Brown Solid

PS1 and PS2

PSX is another good one, since it covers both PS1 and PS2 and was considered the "standard" connector for sticks prior to the adoption of USB, so you can find PSX-to-whatever adapters fairly easily from companies like Raphnet. In fact, Akishop Customs recommends using a PSX cable with a PSX-to-Gamecube adapter to cover Gamecube and Wii inputs with PS360+ boards.

Note: the 'RUMBLE' pin carries 7.2v-9v for use by the rumble motors. We don't need to mess with it.


PSX Pin - Purpose - RJ45 Pin - Cthulhu - ETH Color
1         DATA    - 4        - C       - Blue Solid
2         CMD     - 3        - B       - Green Stripe
3         RUMBLE  - ---      - ---    
4         GND     - 1        - G       - Orange Stripe
5         +3.3v   - 8        - V       - Brown Solid
6         ATTN    - 5        - D       - Blue Stripe
7         CLK     - 2        - A       - Orange Solid
8         UNUSED  - ---      - ---
9         ACK     - 7        - F       - Brown Stripe
and here's that same data shuffled around to use the order of the RJ45/Cthulhu pins, in case that is easier to understand:
PSX Pin - Purpose - RJ45 Pin - Cthulhu - ETH Color
4       - GND     - 1        - G       - Orange Stripe
7       - CLK     - 2        - A       - Orange Solid
2       - CMD     - 3        - B       - Green Stripe
1       - DATA    - 4        - C       - Blue Solid
6       - ATTN    - 5        - D       - Blue Stripe
---     - ---     - 6        - E       - Green Solid
9       - ACK     - 7        - F       - Brown Stripe
5       - +3.3v   - 8        - V       - Brown Solid

NES and SNES

SNES / NES is another interesting case insofar as they use the same protocol, just with a different connector. Rather than making/storing/transporting 2 separate ethernet cables, I made one ethernet-to-SNES cable and use a self-made SNES-to-NES adapter for NES (also useful for using the more ergonomic SNES pad on an NES). I also have a cheap SNES-to-Wiimote-expansion adapter (this one from Hyperkin https://www.amazon.com/Hyperkin-Controller-Adapter-Classic-super-nintendo/dp/B075RMYMNH) but neither my PS360+ nor my MC-Cthulhu work with my SNES Classic/Mini through it, so YMMV (worth noting: MC-Cthulhu and PS360+ don't work with my Analogue Super Nt using the normal SNES cable, either, though they both work with an actual SNES console, so clearly something fucky is going on that probably won't ever be resolved for either of the essentially dead products). I haven't tried either of them running through a Wiimote's Bluetooth connection (to, for example, use an arcade stick wirelessly with emulators on a softmodded Wii), so if you try that, please let me know your results in the comments.

To be verbose, here are both the NES and SNES pinouts and pics, respectively (the "unused" pins are reserved for special controllers and serve no purpose for us):

NES




NES pin - Purpose - RJ45 pin - Cthulhu - ETH Color
1       - GND     - 1        - G       - Orange Stripe
2       - CLK     - 2        - A       - Orange Solid
3       - LATCH   - 7        - F       - Brown Stripe
4       - DATA    - 4        - C       - Blue Solid
5       - UNUSED  - ---      - ---     - ---
6       - UNUSED  - ---      - ---     - ---
7       - VCC     - 8        - V       - Brown Solid
And here it is sorted by RJ45 pin:
NES pin - Purpose - RJ45 pin - Cthulhu - ETH Color
1       - GND     - 1        - G       - Orange Stripe
2       - CLK     - 2        - A       - Orange Solid
5       - UNUSED  - 3        - B       - Green Stripe
4       - DATA    - 4        - C       - Blue Solid
6       - UNUSED  - 5        - D       - Blue Stripe
---     - ---     - 6        - E       - Green Solid
3       - LATCH   - 7        - F       - Brown Stripe
7       - VCC     - 8        - V       - Brown Solid

SNES



SNES pin - Purpose - RJ45 pin - Cthulhu - ETH Color
1        - GND     - 1        - G       - Orange Stripe
2        - UNUSED  - ---      - ---     - ---
3        - UNUSED  - ---      - ---     - ---
4        - DATA    - 4        - C       - Blue Solid
5        - LATCH   - 7        - F       - Brown Stripe
6        - CLK     - 2        - A       - Orange Solid
7        - +5v     - 8        - V       - Brown Solid
And sorted by RJ45 pin:
SNES pin - Purpose - RJ45 pin - Cthulhu - ETH Color
1        - GND     - 1        - G       - Orange Stripe
6        - CLK     - 2        - A       - Orange Solid
2        - UNUSED  - 3        - B       - Green Stripe
4        - DATA    - 4        - C       - Blue Solid
3        - UNUSED  - 5        - D       - Blue Stripe
---      - ---     - 6        - E       - Green Solid
5        - LATCH   - 7        - F       - Brown Stripe
7        - +5v     - 8        - V       - Brown Solid

TurboGrafx-16 / PC-Engine

TG16/PCE is kinda weird insofar as it has 2 functions on each pin (e.g. D-pad up and the I button) and then it uses the DATA SELECT pin to select which set of functions to poll.

I don't have a TG16/PCE, but from rtdzign:
The American TurboGrafx-16 uses has a female Din 8 port on the system while the Turbo Duo and all the Japanese systems use a Mini Din 8. I recommend that you buy a number of 6 ft monoprice Mini Din 8 cables. For an TG-16 you can buy a male Din 8 connector and solder that to an ethernet cable.

And here's the diagram sorted by DIN pin:
DIN Pin  - RJ45 pin - Cthulhu - ETH Color
1 +5v    - 8        - V       - Brown Solid
2 UP/I   - 2        - A       - Orange Solid
3 RT/II  - 3        - B       - Green Stripe
4 DN/Sel - 4        - C       - Blue Solid
5 LF/Run - 7        - F       - Brown Stripe
6 SELECT - 6        - E       - Green Solid
7 OE     - 5        - D       - Blue Stripe
8 GND    - 1        - G       - Orange Stripe
And sorted by RJ45 pin:
DIN Pin  - RJ45 pin - Cthulhu - ETH Color
8 GND    - 1        - G       - Orange Stripe
2 UP/I   - 2        - A       - Orange Solid
3 RT/II  - 3        - B       - Green Stripe
4 DN/Sel - 4        - C       - Blue Solid
7 OE     - 5        - D       - Blue Stripe
6 SELECT - 6        - E       - Green Solid
5 LF/Run - 7        - F       - Brown Stripe
1 +5v    - 8        - V       - Brown Solid

Saturn

Saturn pads have voltage lines running in and out of the gamepad. When you see diagrams online, they are typically named according to the console's perspective, rather than the controller's, so keep in mind that these names are basically backward.

Sorted by Saturn pin:

Sat Pin   - RJ45 pin - Cthulhu - ETH Color
1 +5v-OUT - 8        - V       - Brown Solid
2 DATA1   - 3        - B       - Green Stripe
3 DATA0   - 2        - A       - Orange Solid
4 SELECT0 - 5        - D       - Blue Stripe
5 SELECT1 - 6        - E       - Green Solid
6 +5v-IN  - ---      - ---     - ---
7 DATA3   - 7        - F       - Brown Stripe
8 DATA2   - 4        - C       - Blue Solid
9 GND     - 1        - G       - Orange Stripe
Sorted by RJ45 pin:
Sat Pin   - RJ45 pin - Cthulhu - ETH Color
9 GND     - 1        - G       - Orange Stripe
3 DATA0   - 2        - A       - Orange Solid
2 DATA1   - 3        - B       - Green Stripe
8 DATA2   - 4        - C       - Blue Solid
4 SELECT0 - 5        - D       - Blue Stripe
5 SELECT1 - 6        - E       - Green Solid
7 DATA3   - 7        - F       - Brown Stripe
1 +5v-OUT - 8        - V       - Brown Solid

3DO

3DO pads have headphone jacks on them, so 2 of the pins are dedicated to carrying audio signals, and there's a second VCC line. I would assume you can use either of them but haven't tested it, since I don't have a 3DO. Neither did rtdzign, it seems, as here's what he had to say about it:
(I don't have a 3DO and am assuming the D-sub follows normal pinout convention Picture is from a 3rd party genesis extension cable.)

3do will currently only work as the only controller, plugged directly into the system; trying to daisy chain off of it or use it through a daisy chain isn't going to work.

Here's the diagram sorted by Dsub pin:
Dsub Pin - Purpose - RJ45 pin - Cthulhu - ETH Color
1        - GND     - 1        - G       - Orange Stripe
2        - VCC+5v  - 8        - V       - Brown Solid
3        - AUDIO1  - ---      - ---
4        - AUDIO2  - ---      - ---
5        - VCC+5v  - ---      - ---
6        - P/S     - 7        - F       - Brown Stripe
7        - CLOCK   - 2        - A       - Orange Solid
8        - GND     - ---      - ---
9        - DATA    - 4        - C       - Blue Solid
And sorted by RJ45:
Dsub Pin - Purpose - RJ45 pin - Cthulhu - ETH Color
1        - GND     - 1        - G       - Orange Stripe
7        - CLOCK   - 2        - A       - Orange Solid
---      - ---     - 3        - B       - Green Stripe
9        - DATA    - 4        - C       - Blue Solid
---      - ---     - 5        - D       - Blue Stripe
---      - ---     - 6        - E       - Green Solid
6        - P/S     - 7        - F       - Brown Stripe
2        - VCC+5v  - 8        - V       - Brown Solid

Dreamcast

No VMU support and only works with games that can be played solely with an arcade stick.

Here's the diagram sorted by DC pin:
DC Pin   - RJ45 Pin - Cthulhu - ETH Color
1 DATA1  - 7        - F       - Brown Stripe
2 VCC+5v - 8        - V       - Brown Solid
3 GND    - 1        - G       - Orange Stripe
4 SENSE  - 3        - B       - Green Stripe
5 DATA5  - 4        - C       - Blue Solid
And sorted by RJ45 pin:
DC Pin   - RJ45 Pin - Cthulhu - ETH Color
3 GND    - 1        - G       - Orange Stripe
---      - 2        - A       - Orange Solid
4 SENSE  - 3        - B       - Green Stripe
5 DATA5  - 4        - C       - Blue Solid
---      - 5        - D       - Blue Stripe
---      - 6        - E       - Green Solid
1 DATA1  - 7        - F       - Brown Stripe
2 VCC+5v - 8        - V       - Brown Solid

Sega Genesis / Mega Drive

None of these boards work with Genesis / MD because it does its own crazy thing that's very difficult to reproduce without spending a ton of money on dedicated parts. The best thing to do for these is to padhack a crappy 6-button pad, which can be purchased online for peanuts. See my post here for a look at that process.

MC-Cthulhu Secondary Solder Point Pinout

The Cthulhu boards include a double-row of unlabeled solder points on the side of the board opposite the RJ45 solder points. These are intended for attaching a 360 padhack for adding 360 support, but they're just additional hard-lines tied to the screw-terminals, so they can technically be used to add any additional PCB, so long as you tie the VCC and Grounds together.

Since they're unlabeled, it can be a hassle to use them, but you can easily identify by testing continuity between the solder points and the screw-terms. Nevertheless, I'll include the pinout here to make it easier (the labeling scheme assumes right-alignment; that is, H and 9 are on the far right, lined up, while A and 1 are staggered on the left side):

    [A] [B] [C] [D] [E] [F] [G] [H]
[1] [2] [3] [4] [5] [6] [7] [8] [9]

A = VCC
B = Down
C = Ground
D = Select
E = Right
F = 3K ('Roundhouse' in Street Fighter nomenclature)
G = 3P (Fierce)
H = 1P (Jab)

1 = Up
2 = 4P (PPP)
3 = Left
4 = 4K (KKK)
5 = Start
6 = 2K (Forward)
7 = 1K (Short)
8 = 2P (Strong)
9 = Home/Guide

Thursday, July 26, 2018

240p GBA via Gamecube Game Boy Player on Unmodified Console

I recently bought a Game Boy Player without the start-up disc and went through this process with frustratingly little guidance available online, so I figured I'd lay it all out to save anyone else the pain and hassle:

The Game Boy Player add-on for Nintendo's Gamecube console requires a special launcher disc (Game Boy Player Start-up Disc) to function, normally, and it costs a fair bit (somewhere around $75 at the time of this writing) to get a complete package including the hardware and software disc. However, you can buy the hardware without the disc for substantially less (more like $25 at the time of this writing), since it's thought to be useless on its own. There is homebrew--known as Game Boy Interface (GBI)--that can replace the functionality of the launcher disc, but most of the ways to launch the homebrew are fairly costly ($30-50), require hardware modifications to the console itself and/or require a launcher disc of their own that can get scratched/damaged/lost and then you're SOL again.

However, there are a number of exploits available for common games, including Wind Waker, Twilight Princess and Smash Bros, among others, which allow you to launch homebrew on an unmodified console, and these are easy to utilize if you have a softmodded Wii. Just fire up GCMM (GameCube Memory Manager) on the Wii's Homebrew Channel and flash one of the exploits to your memory card. Then, perform the exploit on the Gamecube to launch an unsigned application named 'boot.dol' from the memory card. I have a copy of Smash Bros Melee, so I used the appropriate Home Bros exploit for my disc revision. Once it's loaded on the Gamecube memory card, I just start the game, go to 'VS Mode' and then choose 'Name Entry' and it loads the homebrew application.

OK, great so far. If I flash the default GBI application to my memory card, it fires right up and I can see the Game Boy Advance BIOS animation. There are some nice video options I can change, like zoom, etc. but it's stuck in nasty, flickery, line-doubled 480i. If you want the nicest, cleanest, most stable image, everybody knows you want "240p"/non-interlaced mode.

Now, this is where most of the other guides online stop being helpful. They typically expect you to have an SD card interface or modchip and they recommend using Swiss to change/set your video mode to 240p. This causes a couple of problems, though: 1.) only one homebrew application named boot.dol can live on your memory card at any time (i.e., so you can't have Swiss and GBI on the same card, typically), and 2.) even if you somehow get another homebrew application onto your memory card (more on this in a bit), Swiss can't launch another homebrew application from the memory card and then adjust the video mode on-the-fly the way it can with programs launched from disc, SD card, etc.

The simplest solution is to just use the speedrunning variant of GBI (known as GBI-SR; gbi-sr.gci in the GBI package), which forces 240p (yay!) but doesn't expose the other handy video options available with the standard GBI (booo!). This lets us drop Swiss entirely from the equation for this task, but you might/should still want to have it available in your homebrew toolkit for other purposes, and we can accomplish this with a little hex editing.

Just open the gbi-sr.gci in your hex editor and right at the top you'll see 2 instances of the word 'boot.dol' (you might have to scroll down a bit to see the second instance, depending on how many lines your hex editor shows). You can change that name to anything else--I changed mine to 'boob.dol' because it's a simple change that keeps the same length. Save and exit, and you should now be able to flash both Swiss and GBI-SR to your memory card without conflicts. Now, when you fire the exploit, it will boot into Swiss and you can choose your 'boob.dol' or whatever from Swiss' list of launchable content on the memory card to play GBA games in glorious, stable 240p or you can use any of Swiss' other awesome/handy features on your native Gamecube disc-based games.

Thursday, June 7, 2018

Trading Moire for Noise in Shaders

Note: the ugly artifacts we're trying to deal with in this post also happen whenever you up/downscale images, so be sure to click the thumbnails to view at full resolution.

A lot of folks like to apply a pincushion/curvature effect to their emulator image to try and capture a bit of the old CRT TV curved tube effect. This can be a problem, though, when paired with a scanline effect, since the curvature introduces an aliasing artifact on the scanlines known as a "moire pattern":
This is a worst-case scenario, used for illustrative purposes.
Notice the ugly pattern fanning out from the middle of the outside edges of the screen
This problem comes up a lot in virtual reality applications, where content often runs through a pincushion effect to compensate for the lens distortion of head-mounted displays, which then leads these same ugly patterns to crop up on any design with parallel/converging lines.

Graphics programmer Timothy Lottes (author of the popular FXAA algorithm and a lovely public domain CRT shader, among others) was working on ways of dealing with the aliasing/moire problem for VR and published this shadertoy showing how to hide it by introducing jitter/noise in where the texture is sampled. Turns out that same strategy can be used to mitigate our scanline moire.

When applied to an actual game image, this:
becomes this (caution, big animated gif; the noise effect doesn't really work in still images):
You can see that the noise is concentrated along the same areas where the moire pattern was visible before, but it's much less obtrusive and sort of melts away when viewed at a distance.

When curvature is added to an existing, normally flat CRT shader (Themaister's crtglow-gaussian shader, one of my favorites), we go from this:
to this, with the noise/jitter-based mitigation:
In this example, the noise also adds a touch of analog warmth/sparkle to the CRT effect, which I like.

Here's the code snippet that does it (all copyrights belong to Mr. Lottes):
This code can be added to many CRT shaders by wrapping the shader's fragment texcoord declaration with the moire_resolve() function to add the jitter/noise and then wrapping that with the Warp() function to add the curvature. You can see an example of where I've done exactly that in the crtglow-gaussian shader here to create the screenshots above.

Update 12/1/2018: A more traditional--and highly effective--method of moire removal is through elliptical weighted average (EWA) filtering, as described here. Fellow shader enthusiast torridgristle whipped up a GLSL version with curvature, which can be added after CRT/scanline shaders to look like this:
It's quite fast, too, making it a very good, flexible choice for curvature plus moire-mitigation.

Wednesday, May 30, 2018

RetroArch Mirror Mode

Sega recently updated their Mega Drive & Genesis Classics emulator collecdtion on Steam to include a fun little feature known as "mirror mode," which flips the game image and controls to be a mirror image of what we're used to. This adds a really surprising challenge, since it breaks all of our muscle memory (including the deeply ingrained "run to the right!" imperative).

This has been possible in RetroArch for a very long time, but it requires twiddling a few esoteric options that may not be familiar to a majority of users, so I figured I'd run through the process briefly.

Step 1: Flip the screen

As with most of the fun video tweaks in RetroArch, we accomplish this through a shader. So, with some content loaded, bring up the 'quick menu' and scroll down to 'shader settings'. On that screen, increment the number of shader passes from 0 to 1 and where it says 'shader #0 N/A,' navigate to the image-adjustment shader located in the 'misc' subdirectory of your shader flavor of choice. I'm using slang shaders here, which are compatible with the Vulkan and D3D11/12 video backends. You can add additional shader passes after the image-adjustment shader, if you like.
Once the shader is selected, go up to the top of the shader menu and hit 'apply changes', then skip down to the 'shader parameters' submenu and you should see a ton of options for tweaking the image. Down at the very bottom, you should see 'flip horiz axis' as the second-to-last option. Set it '1.0' and you should see the screen mirror.

Step 2: Flip the controls

From the shader menu, hit backspace or 'cancel' to return to the 'quick menu' and look for the 'controls' submenu. Here, you can change which of your physical or retropad buttons trigger which core functions. So, scroll down until you see entries for the D-pad. In my case, we have 'Left D-pad (key: left)', to which is assigned D-pad Left, and 'Right D-pad (key: right)', to which is assigned D-pad Right. Simply swap those (as pictured) and you're all set.
Now, we could save a remap file to be automatically loaded whenever this core or game is loaded, but I don't want my controls to be mirrored indefinitely, so I'm not going to do that, and this setting will simply get wiped out when I 'close content' or 'quit RetroArch'.

Bonus Step 3: Flip the audio channels

This is not vital, but if you want to get the full mirror effect, we'll need to swap the audio channels so that the sound effects follow our mirrored video and controls. This is achieved using RetroArch's fun, powerful and oft-overlooked audio DSP system. The pre-installed 'panning' DSP has the ability to swap the channels, we just need to create a preset file that tells it how to do it. So, open up a text editor and paste in these contents:
filters = 1
filter0 = panning

# Swap left and right channels:
 panning_left_mix = "0.0 1.0"
 panning_right_mix = "1.0 0.0"
Save this file as something descriptive and change the file extension to 'dsp' (mine is named Mirror.dsp) and then move it into your RetroArch installation directory, under [RA dir]/filters/audio. Then, back out of the 'quick menu' and go to 'settings' -> 'audio' and scroll down to the 'Audio DSP Plugin' option, where you can select your newly made DSP preset:
 

Getting back to normal

Ok, that was fun, but I don't want to play like that forever, so it's time to put things back to normal. For the shader, go back to the shader options menu and navigate to the number of shader passes. Decrement it down to 0 (or hit the spacebar on your keyboard or 'start' on your gamepad) and then go up and 'apply changes' and you should be un-mirrored. Now, for the audio, go back into 'settings' -> 'audio' and navigate to the 'Audio DSP Plugin' option and press spacebar on your keyboard or 'start' on your gamepad to remove the plugin. As long as you didn't save the input remapping in the 'controls' menu, they should return to normal as soon as you 'close content' or 'quit RetroArch'.

Wednesday, May 9, 2018

Building an SNES Controller

This was a fun little project that I intended to log in great detail but I just didn't really take enough pictures, so I realized too late that it's more of a "draw the rest of the fucking owl" situation. Oh well, here's what I ended up with, and I'll follow up with some info on how I got there:
My giant SNES pad with original pad for scale reference
It's a 6:1 scale SNES/SFC gamepad built from scratch. Unlike the other oversized gamepad projects floating around online, I don't have a 6-figure woodworking shop (and I'm not a good carpenter anyway), so I used manufactured arcade buttons instead of rigging up funky homegrown button/dpad mechanisms, and I built the internals using a breadboard and a couple of shift registers instead of padhacking an original SNES pad (those things are getting expensive these days).

I had originally planned to make the size an even 10:1 scale but after doing the math, I realized the resulting pad would be over 6 feet across and wouldn't be practical to actually use (i.e., like most of the other oversized gamepad projects floating around online). I had chosen 10:1 because SNES pad buttons are right at 10 mm in diameter and you can purchase humongous 100 mm arcade buttons on Amazon/eBay, but they also sell 60 mm buttons, which results in a much more reasonable 6:1 scale.
I found this dimensioned image online but it seems to have disappeared so I'll rehost it for others to benefit from.
Once I got the scale figured out, I cut the outline of the pad shape out of a piece of particle board I had left over from a previous project. I don't have a router and a circle jig, so I used a jigsaw and fashioned a compass out of a pencil and some string to draw the round parts:
For the internals, S/NES controllers are exceedingly simple, consisting of nothing but a couple of 8-bit shift registers. I happened to have 2 CD4021Bs lying around from a previous project and figured I'd give it a shot. This schematic shows up various places online and was very useful for getting everything wired up to my breadboard:
And here's what it looks like all wired up:
The only part I didn't make myself is the actual controller port plug, which I took from a newly manufactured SNES extension cable.

I used terminal blocks to make it easier to swap things out in the future and to reduce strain on the breadboard connections, which are the weakest link in the chain. The terminal blocks also came with bridges (the red-rubber thing on the one at the bottom-left of the image) that were useful when running voltage lines out to the button LEDs.

I left the back open and just built a little frame around the wiring. I may go back and put acrylic or another piece of wood over it, but I'm okay with it as is for now:
You can also see the L and R shoulder buttons, which are just the same 60 mm buttons used for the face buttons (the button sets come with 5 buttons and I ordered one additional one for a couple of extra bucks on eBay). The dpad buttons are also 60 mm buttons, but they're flat instead of convex:
Testing the button LEDs. You can get a good look at the flat dpad buttons. Still lacking some of the paint, as well.
It controls surprisingly well and is sort of like a Playstation controller with the separate directional pads. The start and select buttons are just regular ol' 30 mm arcade buttons. I would have liked to do something that looks a little more authentic but there just aren't any off-the-shelf long, skinny buttons.

Some day, I may go back and fabricate a small dpad to lay over the individual buttons and/or rig up something over the start/select buttons, but I doubt it, since they work fine already.

Anyway, here's my 3-yr old daughter and me playing some Donkey Kong Country on it:
She still doesn't really get video games, and her fine motor skills aren't really good enough for a standard-sized gamepad (which isn't really designed for her toddler-hands anyway), but she likes pushing the buttons on the oversized pad and having me control movement lets her focus on a single action, like jumping. I can also call out the color of the button she needs to press, which helps her work on her color mastery.

Anyway, that's it. If you have any questions, hit me up in the comments.

Friday, May 4, 2018

More New Shaders

This post is a companion piece to yesterday's post, which focused on shaders for low-power devices. This post doesn't have any particular focus but showcases a few recently added shaders.

As always, click the thumbnails to embiggen.

PAL-r57shell

The PAL video standard used throughout Europe typically doesn't get the attention from retro-gaming enthusiasts that NTSC--the standard used in both Japan and the U.S.--enjoys. That is, no games (that I know of) depend on PAL video artifacts for any effects, and as a result, few people have shown interest in reproducing the characteristics of the PAL standard.

One of those few, who goes by the handle r57shell, made a PAL shader a few years back that captured some of the effects, but they recently updated it to make it much more complete and comprehensive. This new version is more comparable to the NTSC simulations by blargg and Themaister in quality and accuracy, and it includes some nice NES-specific options, as well. For example, by uncommenting a line in the shader, it can be used to bypass traditional emulator palettes and generate its own from the raw color and emphasis data (in emulators that expose the 'raw' palette).

By default, it doesn't do that, though, so it can be compatible with non-NES cores:
r57shell also made a preset that puts his shader in front of CRT-Royale to get the full retro effect:

MMJ_Cel

This shader has been available for Pete's OpenGL 2.0 plugin for ages, but its author, MMJuno, recently ported it to RetroArch's shader format(s). The shader applies a cartoony black border on edges and changes smooth gradients to chunky steps. It doesn't look very good on simple 2D content, so I dropped my normal Super Mario World screenshot for this image from Super Mario 64 that can better illustrate the effect:

VHS

This is one I made that combines some shadertoy effects to mimic the look of a crappy VHS recording:
The OSD 'play' message blinks on and off for a few seconds after the game loads and then goes away. The GLSL version of the shader also supports a fun effect whereby using RetroArch's rewind function creates a static-y tracking effect and prints another OSD message while rewinding. Setting the rewind granularity to 2x or 3x really clinches the effect (looks better in motion, of course):

Technicolor

After playing Cuphead, I wanted to try and make something similar, so I used a lossy CMYK conversion paired with film grain, simulated misalignment of the different color layers and vignetting/hotspotting to try and mimic an old-timey projector setup:
It doesn't translate well to still pictures, but it also blips single frames of film noise (scratches and hairs) onscreen pseudo-randomly:

xBRZ-Freescale

I mentioned this already in the low-power shader post, but I feel like it's worth mentioning here, too, because it's kind of a big deal. It's not often you get to say "welp, don't need those shaders anymore," but that's exactly the case here. Due to its superior speed and sharpness at any scale, there's no real reason to use the other xBRZ shaders:
Of course, other xBR permutations, like the various 'super' versions and mlv4-multipass, etc. still have their own characteristics and reasons for use, so don't misunderstand this as obsoleting those, as well. It also doesn't have quite the search range of ScaleFx, so some of the shallow slopes that shader catches (like the one under the dragon coin) are only partially smoothed by this one.

simpletex_LCD

I mentioned this one in my last post, as well, since it's also quite fast, but I wanted to include it here because it's such a pleasant effect:
There are several permutations of this shader that combine that same nice paper texture and light (instead of the more typical dark) grid-lines with Game Boy Color or Game Boy Advance color simulation.

Analytics Tracking Footer