Friday, November 8, 2013

AT LP120-USB Turntable Mod

I got a sweet deal on an Audio Technica LP120-USB turntable from Essex, a place that sells factory rejects, refurbs, and other "almost new" products at a steep discount. The dust cover was busted up*, so I assumed that was why it was there. Unfortunately, it also exhibited some infuriating behavior whereby the left channel would randomly cut out, though I didn't discover this until much later. :(

I suspected the internal preamp was the most likely culprit, so I followed this tutorial describing how to bypass the preamp entirely and push the untouched phono signal straight out to the RCA cables (which I may replace with jacks soon, instead). Honestly, there's not much too it. You just cut out the board and splice up the RCA cables directly to the red/white/ground wires.
The removed preamp board.

I was pleasantly surprised when, in addition to fixing my channel dropout problem, the sound quality seems considerably better in the high frequency range. This improvement is why most people do the mod in the first place, and the above link contains some pre-mod and post-mod recordings to help potential modders decide if the improvement is worth their time and effort. I could not distinguish between the two recordings in ABX testing, but the difference in person is easily noticeable. For example, the natural crackles and pops on the records were very subtle and difficult to hear pre-mod but are easily audible post-mod. This may not sound like a particularly positive development, but it's unsettling to think that I was losing that much sound off the top before.

*I was able to piece everything back together with some super glue, but you can also purchase them new from Audio Technica (you can email their customer service) for around $30.

Wednesday, November 6, 2013

Quark Shaders for Higan/bsnes v093+

As of v093, Higan (previously known as bsnes) includes a new shader format based on OpenGL 3.3 / GLSL 1.5. This format is nice, powerful and roughly as flexible as RetroArch's Cg support. Hyllian, aliaspider and I set to work converting many of the most popular shaders to the new format, available from the Quark Shader Github repo.

If you're not familiar with git, you can download the full repo by clicking on the 'Download ZIP' button in the right-hand margin.

To use these shaders, place the entire *.shader directory into your Video Shaders directory. One caveat: the handful of shaders that utilize motion blur won't work with v093, but should be functional with v094+.

Monday, October 14, 2013

RetroArch Overlay Borders

RetroArch has long had support for fun borders/backgrounds that can fill the unused black space on HDTVs using a specially crafted shader combined with an image, as described in a previous post. However, this system can be finicky and it isn't very forgiving of different screen sizes and aspect ratios. There is another way to achieve a similar outcome, though, using RetroArch's built-in overlay system.
Gameboy border pictured with Harlequin's Gameboy shader
This system was designed to provide onscreen touch controls for the Android and iOS ports of RetroArch, but we can use the same hooks on PC to display our borders. All you have to do is add this to the bottom of your retroarch.cfg:
input_overlay = "/path/to/overlay.cfg"
You can also load overlays directly from the in-game RGUI menu under Settings > Overlay Options.

The overlay.cfg file is extremely simple, containing only 4 short lines (you can either copy these into a blank text file yourself or use the one I include in the download at the bottom of the post):
overlays = 1
overlay0_overlay = border.png
overlay0_descs = 0
overlay0_fullscreen = true
 
This file tells RetroArch that there will only be 1 overlay, which image to load as the border (in this case, border.png, located in the same directory as the overlay.cfg), that there will be no buttons attached to the overlay (that is, for touchscreen controls) and that it will take up the full screen, including any black space.

In addition to these border effects, you can also use this system to apply semi-transparent overlay effects, such as scanlines, which can be useful in very low-power settings, such as on Raspberry Pis, homebrew-capable Nintendo Wiis or older cell phones that can't handle even lightweight scanline shaders. Even some MAME "rgb" effects can be used with this system with minor modification.

This system will work fine with the borders from my previous post, and here's a bunch more (formatted for 1920x1200 displays) from NeoGaf user richisawesome.

Here is the download (contains border.cfg, two example borders and an integer scale Cg shader, though the shader should not be necessary now that you can force integer scaling through RGUI):

Tuesday, July 16, 2013

Fix for "Failed to start game (app already running)" error - Steam

I got a fancy new 144 hz monitor the other day and was messing with some settings on Borderlands 2 to push it up past 60 fps but after poking around a bit, I couldn't load the game and instead got this error:
Failed to start game (app already running)...
I looked online and found a number of potential fixes, none of which worked for me, including the ill-advised "run Steam as an administrator." -_-

Thankfully, someone mentioned that they had also been using the graphics enhancement program SweetFX before getting the error. Removing all of the SweetFX files cleared it up for me, as well.

Here is a list of all of the files used by SweetFX (found in the Borderlands 2 Binaries\Win32 directory, in my case):
d3d9.dll
d3d9.fx
dxgi.dll
dxgi.fx
injector.ini
SweetFX readme.txt
SweetFX_preset.txt
SweetFX_settings.txt
and the SweetFX folder
Move/delete these files/folders from your executable's folder and you should be set.

Saturday, June 29, 2013

Fix for Youtube error: 'This video is currently unavailable' - Ubuntu Chromium

Thankfully, this one's an easy fix and will presumably apply to other browsers and operating systems, as well.

I've been using Chromium as my browser for a while and everything has been great until recently, when some youtube videos wouldn't play reliably and instead would show the error:
This video is currently unavailable.
Learn more
This is apparently caused by being enrolled in Youtube's HTML5 video trial. You can enroll/unenroll from the program by visiting this link.

I had forgotten I was even using HTML5 video, so I never even considered this could be the problem. Once I unenrolled, everything works fine again. Of course, YMMV.

Monday, June 24, 2013

Dedithering Pixel Shaders

Dithering, as it applies to pixel art, is a pattern made up of two or more colors of pixels arranged in a pattern (usually a checkerboard or dotted line) that, when viewed on a CRT television, will blend together, resulting in an average of the adjacent colors. This allows an image to display more colors, perceptually, than may be technically possible to show otherwise, and was also frequently used to produce a transparency effect. Unfortunately, when such dithering is viewed on a modern LCD monitor or TV, the color blending never happens and we're left with ugly checkerboards all over the place. Even worse, pixel art upscaling-interpolation algorithms such as HQx and xBR tend to have a really rough time with dithering.

Recently, though, several different folks all independently developed their own solutions to the dithering problem using pixel shaders. Here are the raw images to which we'll be applying the shaders:



Three of these games are for Sega Genesis, which relied on dithering extensively, and the other is from an SNES game that uses "pseudo-hires transparency," which functioned similar to dithering insofar as the artists expected the vertical lines to be blended together by a CRT TV.

CBOD
First off, we'll look at coastkid's CBOD shader, which uses three shader passes of 4-pixel blur using various threshold values. It can be a bit blurry but does an impressive job of smoothing out the dithering, particularly with regards to vertical dithering patterns, with which the other shaders often have trouble:



GTU
Next up, we have aliaspider's GTU shader, which uses a "pixel bandwidth" variable to determine how much horizontal blurring should occur. This shader also includes light scanlines (which can be lightened or eliminated entirely by manipulating variables within the shader) and gamma correction, making it a one-stop option for people who want the benefits of CRT blending, color and scanlines without any heavy-handed phosphor emulation, etc. Its handling of pseudo-hires transparency is particularly nice:



For reference, the SNES shot used a bandwidth of 512 while the Genesis shots used a bandwidth of 320.

MDAPT
The last shader is Sp00kyFox's MDAPT, which stands for 'merge dithering and pseudo transparency.' This shader uses a modified version of Hyllian's DDT shader's detection code to identify identifies dithering patterns and then replaces them with an average of the component colors (I was mistaken; the algorithm is all Sp00kyFox's) . MDAPT is especially interesting because it is intended to run at 1x to smooth out dithering silently--so to speak--followed by another upscaling shader. On its own, here's how it handles our dithering example images:



Unfortunately, it sometimes has a few false-positives (notice the '200' in the next shot), but nothing too terrible:
When paired with some other shaders, aliaspider was able to use MDAPT to produce some pseudo-hires transparency upscaling that is nothing short of magical:

You can check out a couple more shots from aliaspider here.

Of these shaders, MDAPT and CBOD are available in Cg format, while GTU is in XML/GLSL format

Tuesday, June 11, 2013

HTC One Back Template for DIY Case Artwork

I got a super-cheap, clear hardshell case (price seems to have gone up since I bought it...) for my HTC One and was interested in making some custom art to put between the case and the phone. I wasn't able to find any templates readily available online, so I spent a little bit of time with a flatbed scanner and whipped one up myself: EDIT: turns out that Google resamples images -_- so just taking this image will not work as-is. You'll need to keep the same resolution (i.e., pixels by pixels) but set it to 200 DPI. Or, just download this one.

Note: I make no guarantees about the applicability of this template to your own case. It worked for me and I hope you find it useful, as well. The biggest potential issue would be with the cutaways for the power and volume buttons, which are pretty large on my case, but it should be easy to remove them if your case doesn't have them.

Here's how it looks when it's all finished:
Sorry about the weird picture. I didn't have another camera on hand, and there weren't any good mirrors at work, so I had to just use the reflection from an old hard drive platter...

EDIT: Here's a slightly better picture:
I made this BMO design along with a couple of other Adventure Time designs, ready to print:
Best show on television.

Friday, May 31, 2013

Setting up a Cydia Repository

For RetroArch v0.9.9, the new star platform for support is/was iOS via jailbreak, so we needed to set up a Cydia repository for people to pull down the app. I followed this guide, which was helpful, but there were a few important deficiencies that required additional work. I'm going to cover those issues here.

First off, the directory structure described in the guide, with 'apps' and 'uploads' is unnecessary. All you need is a directory that contains your Packages.gz file and a subdirectory named 'deb' that holds your package. If you keep the directory structure from the guide, your Cydia URL will be http://yoursite.com/cydia/upload, which is tacky.

More importantly, if you follow the guide, your app will not install to the /Applications directory of your iOS device, and any *.info files will be broken, which was very bad news for RetroArch. To fix this, I followed this guide, the important parts from which I will summarize here:

First, you'll need to take create a new directory with the same name as your application--in my case, RetroArch. Then, inside that directory, create another new directory named Applications and one named DEBIAN. In the DEBIAN directory, place your 'control' file, which contains information about your application, and in the Applications directory, place your compiled application (in my case RetroArch.app).

At this point, you're ready to bundle your application using dpkg:
dpkg -b [your.app.name]
Once your deb is created, you can delete the directory structure and then create your Packages.gz:
dpkg-scanpackages -m . /dev/null | gzip -9c >Packages.gz
Create a directory called 'deb' and drop your deb bundle into it and you should be all set.

Wednesday, May 15, 2013

Fix for: Google Voice Search force closes immediately

This is just a quick post and it may or may not work in your case: I installed a nightly of Cyanogenmod 10.1 on my HTC One and the Google Voice Search app force closed every time I clicked on the little microphone icon. Everything else worked fine, including Google Now and so forth.

The fix for it, in my case, was just to go to the Play Store and update the Google Search app. If that doesn't fix it for you, I would recommend uninstalling the Google Search app entirely and then reinstalling. If that doesn't help either, you probably have something more serious amiss.

Thursday, April 25, 2013

Multipass Shaders - NTSC, Motion Blur and More

It's been a while since I've done one of these posts and, in that time, RetroArch's multipass shader implementation has matured quite a bit, paving the way for a lot of really cool effects that simply can't be done in a single pass. At the time of this writing, higan's multipass shader implementation hasn't been released yet, but many of these shaders should be portable to it (with some substantial effort, at least) when it arrives.

As always, images were captured at 4x scale. Click the thumbnails to embiggen.

First up:
Themaister's NTSC Shader
Themaister wrote a sweet new real-time NTSC Composite shader that mimics a lot of the noise, fringing and crosstalk present in the NTSC composite signal:
This shader is a big deal because blargg's CPU-based NTSC filter was previously the only way to get this effect, which was important in some older games' art design. However, the filter had to be hardcoded to the individual consoles' specific resolution, which made it a headache to maintain in a multi-console setting. This shader should work on all of RetroArch's cores, and it is available in GLSL and Cg/cgp flavors.

I mixed it with cgwg's CRT shader and ended up with this (ntsc2-crt.shader):
You can compare that with an earlier version I cobbled together from the old NTSC shader--which tended to be finicky and not everyone liked anyway--and cgwg's CRT (crt-geom-interlaced-flat-ntsc.shader):
Digging through an old thread on byuu's forum, I also found where cgwg had written a similar shader that combined NTSC with CRT in 6 passes with barrel distortion (6-pass-ntsc+crt2.shader):
In the same thread, cgwg had posted this shader, called 'beam-dynamic,' that is essentially the same result as the beam4 shader mentioned in one of my other posts:
Out of all of these variations, I think my favorite is Themaister's NTSC with the addition of scanlines that have been softened with gaussian blur (ntsc2-maister-scanlines.shader):

Harlequin's Gameboy Shader
This shader does for Gameboy emulators what cgwg's CRT does for regular consoles, i.e., recreates the look of the original display with startling verisimilitude:
I'm not going to spend a lot of time talking about this shader here, even though it's completely badassed, since it's covered at length in a previous post. It's available in Cg/cgp format only, though you can use Themaister's handy cg-to-glsl python script to convert it to GLSL if necessary.

Harlequin's LCD Shader
Using some of the same concepts from the Gameboy shader, Harlequin is also working on a more generalized shader that mimics the low-resolution, slow-refreshing color LCD displays from a number of handheld consoles, such as Sega's Game Gear and Nintendo's Gameboy Advance:

Similarly, cgwg posted an LCD shader he's been working on that produces a regular, square pixel grid pattern, paired with some simple motion blur (lcd-cgwg.shader):


Motion Blur
Speaking of motion blur, I wrote a multipass version of this shader a while back and cgwg revised it down to a single pass (refers to previous frames, so still incompatible with higan v092 and earlier). This effect can be good for mimicking the slow response time of crummy LCDs (motion blur.shader):
I also made a version that only adds the blur during rewind, along with a little sepia-tone effect, kinda like the rewind effect in Braid (braid rewind.shader):
This shader can be added before pretty much any other shader (either manually by pasting in the code or by using the new, built-in RGUI shader stacking function and/or glslp shader configuration files) at a scale of 1.0 and the effect will only kick in when the game is rewinding :D

GTU
This shader from aliaspider is an interesting take on the CRT paradigm insofar as he didn't want to focus on phosphor emulation or heavy-handed scanlines or any of that other jazz. He was more interested in the blurring/blending effect of CRTs that enabled tricks like pseudo-hires transparency and color dithering. Later revisions include some sweet gamma correction and the ability to create mild scanlines (if you choose; GTUv031-multipass.shader):
I think this is one of the best ways to get pseudo-hires transparency working properly, and the transparency it creates is smooth and absolutely beautiful:
Aliaspider made a single-pass version of the shader that should work in higan v092 and earlier, along with the multipass version linked above for RetroArch, and a multipass version for higan v093's upcoming shader implementation.

My 4k Phosphor Shader
This is another one that I won't spend much time on, since I cover it at length in another post:
This shader currently doesn't look so hot as it's designed to work at around 10x scale (i.e., on a 4k resolution television or other high-DPI display; it gets wrecked by subpixel behavior at current normal scales [read: 1080p]). However, it brings some nice things to the table, such as easily-edited LUTs that can be created/modified in Photoshop/GIMP rather than a text editor and scale-ability to freaky-huge resolutions. I'll attempt to convert this to byuu's higan v093 format at some point, though it may take some time.

Wednesday, April 24, 2013

Customizing Harlequin's Gameboy Cg Pixel Shader

CRT shaders are great, but they're not always appropriate for every console, seeing as handhelds' tiny LCD screens have very different characteristics, which in turn shaped the way the games for those consoles were designed. The original Gameboy handheld had these characteristics in spades, including a slow response time (manifesting as motion blur), very low resolution and a distinctive 2-color palette that ranged from yellow to green. Emulators typically represent this color palette as black and white, which can be jarring for people who spent a lot of time with the system.

Thankfully, a nice fellow named Harlequin has come to the rescue with a really great pixel shader for RetroArch that does for Gameboy displays what cgwg's CRT shader did for those displays. Like cgwg's CRT shader, Harlequin's Gameboy shader reproduces a lot of different aspects of the Gameboy display and presents a number of options to the user that are easy to modify with just a simple text editor (I use/prefer Notepad++ but almost anything will work). Unlike cgwg's, though, the Gameboy shader also uses some lookup textures (LUT) that require no text editing and can be modified using an image editor such as Photoshop or GIMP. Harlequin has included several example LUTs and I'll cover a few in screenshots.

As usual, all shots are at 4x (which is a bit small for Gameboy resolution, but oh well) and you can click the thumbnails to embiggen. All shots were taken via RetroArch with the Gambatte core unless stated otherwise.

First, here's an unfiltered shot for comparison:
And here's one of Harlequin's Gameboy shader with default parameters:
First, I'll cover the LUTs, which can be edited with an image editor. The palette files are found in the 'resources' folder and they're just two 64x64 squares of color that the shader pulls from to get the appropriate colors (i.e., to replace white and black in the emulator). One of the included samples is yellower and resembles the display in strong light, such as daylight:
Another sample mimics the higher contrast of the Gameboy Pocket revision:
Also in the resources folder, you'll find some sample backgrounds, which apply a texture to the image. The default has some angled hatching, while the included samples show some different types of texture that are possible, like this noisy bit:
Next up, we have the shader variables that are easily modified by users with a simple text editor. These are enumerated in the shader's enclosed README file and I'll include some shots here for reference.

The first one is the 'alpha' setting, which determines how dark a 'white' pixel should be. If you raise the value,  everything becomes darker:
While lowering the value will make the pixel grid less visible in white areas:
The next option, response time, determines how long it takes a pixel to go from white to black and vice versa. It doesn't really translate very well into static screenshots so I didn't bother showing it here. The next option after that, though--blending mode--determines whether just the space between dots is blended (mode 0) or all texels (mode 1), which, in practical terms, is how sharp/blurry the edges of the individual pixels are:
The next option--texel alpha blending--effectively controls how defined the grid pattern is. Higher values result in round/fat-looking pixels:
While lower values give you a sharp, well-defined grid:
After that, we have 'contrast,' which works just like the slider on the side of the Gameboy. Lower values can simulate the look of low batteries:
'Background smoothing' lessens the effect of the background LUT. Higher values make the background less visible, lower values make it more visible:
'Shadow opacity' controls how dark the drop-shadows from the pixels are. Higher values mean darker shadows:
Finally, 'shadow offset' determines which direction the drop-shadows appear (i.e., for simulating a light source that isn't directly above the display). Setting both the X- and Y- values to 2.0 will offset it more:
While setting them both to 0 puts the shadows directly underneath the pixels:
Just so you know: you can use this shader with other RetroArch cores, as well, and see what your favorite games would look like in an alternate, Gameboy-centric universe:

Harlequin has made some major changes to the way the shader looks and works since he first started working on it. While the current iteration is extremely convincing, I also liked an earlier version that looked more stylized. Here's a couple of shots:

You can download it from my Mediafire.

Analytics Tracking Footer