Saturday, March 29, 2014

TVs and Retro Gaming / Emulation

INTRODUCTION

Retro gaming is a hobby of mine and, as I started looking into hooking my retro consoles up to modern displays, I found a bunch of incomplete information and dead links scattered among various enthusiast forums, along with misunderstandings and oft-repeated misinformation. So, after diving down the rabbit hole and exploring a bunch of different options, I decided to post my findings in the hopes of saving others from making any costly, avoidable mistakes.

THE ISSUES

I have a big LCD HDTV with a HTPC connected that I use for watching videos and playing emulated games, and I can use various shaders to achieve an aesthetically satisfying approximation of how my retro games looked on CRT TVs. However, there are a number of reasons to use the real hardware instead of emulation, such as emulation accuracy deficiencies--which can render some games unplayable or unenjoyable--and/or latency concerns.

Sadly, modern displays like my HDTV make retro consoles look like absolute crap and can create/exacerbate latency issues, as they recognize the consoles' double-strike/"240p" signal as 480i(nterlaced)--and rightly so, since standard NTSC signals are always 480i regardless of how they're presented; the 240p standard was not created until decades later and even then it wasn't referring to the signal from retro consoles--and attempt to deinterlace them. This adds at least 1-2 frames (16-32 ms) of latency as the deinterlacer tries to combine 2 sets of fields to create a full picture, and that's before the signal even reaches the TV's upscaling circuit, which then adds even more latency (how much is added by the scaler can vary wildly from display to display).

To avoid this whole mess, we have a couple of options:

DIGITAL VS ANALOG

If you really want to use your big, digital HDTV but want to minimize latency, you'll want to sidestep the deinterlacing/slow-scaling issue by plugging your console into an external line-doubler/scaler. The cadillac in this area is the XRGB-Mini Framemeister, which is a Japanese import and costs an arm and a leg (about $475 at the time of this writing). This sexy lady will take your "240p" input, double the lines to a true progressive signal and then upscale it to an HD resolution that gets piped to your HDTV via HDMI, all essentially laglessly (it adds ~1.5 frames of latency according to Fudoh from the shmups forum). It will even add in a scanline effect, if you want. If, like me, you don't have $500 to piss away on this sort of thing--awesome as it may be--there are some cheap Chinese boxes that can handle the upscaling and deinterlacing (but not the scanline effect) at a slightly lower quality and substantially lower price. This seems like a good compromise to me, though the loss of scanlines is unfortunate. However, if your upscaler has a VGA output (like these) and your HDTV also has a VGA input, you can put a separate scanline generator, like the SLG-3000 or Toodles' T-SLG, in between and get close to the same quality as the XRGB-Mini for much cheaper.

Another consideration, though, is that the XRGB-Mini also accepts RGB/SCART signals (see the 'Analog Signals' section below for more details), while the cheaper models like the one linked above only accept composite and S-video. :(

UPDATE: I actually did purchase an XRGB-Mini recently and it's beautiful. I highly recommend it and think it's well-worth the money for an enthusiast.

It's also worth noting that any of these upscalers will give you an extremely sharp picture, similar to what you get from unfiltered emulation with nearest neighbor scaling (i.e., super-sharp/pointy pixel edges), so this option is ideal for the pixel fetishists out there but may not be desirable to old-schoolers who grew up playing on crappy little CRT TVs.

If you chose to go the digital route, congratulations: you're done! Your upscaler is providing you with the finest picture available. However, you might still want to read the rest of the information here, as some of it may be useful to you anyway, particularly the parts about analog signal quality.

Personally, those digital, super-sharp pixels never looked good to me. I'm a big fan of the way CRT TVs look and how they handle those low-res images, so I am/was forced to purchase an analog CRT. Even on an old analog display, though, we still want to keep our picture as nice as possible, which brings us to our next concern:

ANALOG SIGNALS

As far as analog signals are concerned, the top of the heap is RGB, meaning you get an isolated signal for each color, which provides a crisp, clear picture when they're all combined. Just below that is S-video, which separates the luma signal (brightness information only; produces a black and white picture) from the chroma (color; R, G and B all together) signal so they don't interfere with each other. Far below that we have composite--the familiar yellow RCA jacks--which combines chroma and luma into a single signal where interference between the two (known as chroma/luma "crosstalk") significantly degrades the picture. Slightly below composite(!), we have RF, which takes the signal and encodes it into the same format used in over-the-air broadcasts (and you know how good those tend to look...). You can compare how these signals differ in quality by loading up an emulator with Blargg's NTSC filter, which has presets to emulate RGB, S-video, composite and RF.

MATCHING INPUTS TO SIGNALS

In the USA, high-quality inputs, such as component and S-video, are not commonly found outside of large (24" and up), high-priced televisions, such as Sony's Wega line, so if you have a big house and plenty of room (and a strong back), you'll probably want to go for a real hoss of a TV with plenty of inputs. Sadly, most small CRT TVs have only coaxial/RF and *maybe* composite/RCA, which means your picture will always look pretty crummy. I lucked out and found an Apex 14" model with an integrated DVD player that also has S-video, which is good enough quality for me, so my retro consoles are now covered.

If--like me--you are satisfied with the quality of S-video and will only be hooking retro consoles up to your analog CRT, congratulations: you're done! If, however, you are a super-picky "videophile" and you think S-video is only fit for unwashed plebs and/or you want to hook your PC up to your CRT, there's more to consider:

THE MANY FACES OF RGB

Within the RGB family, there are about a million different subsets that each serve their own purpose. For TVs in the USA/NTSC world, we have "component" video (terrible, vague name, btw), which is also referred to by the color space it occupies, YPbPr. For PCs, we have VGA, which uses the familiar--typically blue--15-pin connector. For European/PAL-land TVs, we have 21-pin SCART.

Note: Europeans are lucky enough to have SCART as a standard input for CRT televisions, and many retro consoles--SNES, for example--can output this standard directly. This is a pure RGB signal and will provide the cleanest, most crisp analog picture around. HOWEVER!!, Japanese SCART (also known as JP-21 pin) and European SCART have a different pinout and, as such, are not compatible, even though they have the same connector. If you want to use a Japanese/NTSC JP-21 pin cable with a European/PAL TV with a Euro-SCART input, you will need a pin converter like this one. The aforementioned XRGB-Mini, as a Japanese device, does not require such a converter.

Aside from SCART, it's generally pretty difficult to get RGB from retro consoles, but it's usually possible if you're determined enough.

Now, even though all of these signals and connectors are technically RGB, they are incompatible with each other due to differing sync methods and signal frequencies, which means you'll need a display that is compatible with the signal and has jacks available. This brings us to:

15 KHZ VS 31 KHZ DISPLAYS

One of the major limiting factors in a CRT is the horizontal scan rate, which is the frequency at which a display can move the electron gun from the left side of the display to the right and back again. CRT monitors, like the kind you would find attached to a crummy old Packard Bell computer, have a high horiz. scan rate of 31 kHz, while NTSC TVs have a comparatively low scan rate of 15 kHz. Furthermore, devices that expect the high scan rate of 31 kHz displays and send a high-resolution signal are not compatible with--and can actually damage--displays with the lower scan rate if connected. On the other hand, 31 kHz monitors can be coaxed into displaying a "240p" signal using driver hacks like CRT_EmuDriver or xrandr and/or custom xorg.conf modelines (for some excellent info on getting 240p in Windows, see Monroe88's comments after the post). This will produce the highest-quality image possible with an emulator:


The drawback to this setup is that each system you want to emulate needs to render in exactly its native resolution or else it looks like shit, with misshapen pixels and inconsistent scrolling everywhere. The specialized Groovy Arcade distro automates some of this, but you may still have to use your monitor's hardware calibration controls to get the image to fit/center properly. I found the constant tweaking to be a tremendous pain in my ass and not really worth it.

If you're in linux, here's how you can force your monitor to act like an NTSC TV (type into a terminal from an X-session desktop):
xrandr -q
This will tell you which display you're using and which modes are available by default. My display was hooked up to DVI-0 via a DVI-to-VGA adapter.
xrandr --newmode "240p" 5.979 320 332 368 380 240 242 246 263 +CSync
xrandr --addmode DVI-0 240p
(replace DVI-0 with whatever your card reports)
xrandr --output DVI-0 --mode 240p
Some older video cards (like my Radeon X600 pictured below) for PCs will have an S-video output next to their conventional VGA and/or DVI outputs, which allows them to connect directly to a standard 15 kHz TV with S-video input:

This is very convenient, but it comes at a price: the card presents an 800x600 resolution to the PC and then crunches that down to 480i (that is, a standard NTSC signal), and it *cannot* be convinced to do anything else under any circumstances (AFAIK). This output looks pretty good, but it's not nearly as crisp as the VGA 240p 31 kHz image, obviously:
On the other hand, it is only slightly worse than a direct S-video connection from console to 15 kHz TV:
While S-video will always be slightly blurrier than RGB, the 15 kHz display is simply not capable of producing an image as high-quality as the 31 kHz display's due to its lower resolution and larger, chunkier phosphors. If you have a TV with component/YPbPr jacks, you can use a VGA-to-component transcoder box--like this one--to keep a clean RGB signal from your PC to the TV. Since it's a 'transcoder,' you shouldn't suffer any signal degradation, ideally.

UPDATE (11/14/14): Here's a pic of a PC hooked up to a 15 kHz display (an arcade monitor, to be specific) via RGB:
The photo kinda sucks and doesn't really do it justice, but you can see that the space between scanlines is much less pronounced vs the 31 kHz monitor. There's also no NTSC color changes like you see in the S-Video shots, for better or for worse. Anyway, back to the original post...

Sometimes you want to use your actual retro consoles rather than emulating on a PC--particularly in cases where emulation quality is still relatively poor, such as Sega Saturn or Dreamcast--but you still want to get the highest quality possible, which brings us to:

BROADCAST MONITORS

Broadcast monitors are high-resolution CRTs that were used by video professionals, such as broadcasters and video editors, to preview high-quality signals during the production process. They cost thousands of dollars new but are now cheap as dirt (relatively), since those professions have moved on to digital/HD signals and formats. Sony's PVM and BVM series of monitors are the most well-known and sought-after among retro gamers and, as such, often command a higher price than some similar products from other manufacturers. Nevertheless, the *VMs and other similar broadcast monitors tend to come with a variety of high-quality inputs, including one or more RGB equivalents (though often with separate sync, which can require conversion from, say, SCART). Another nice thing about these monitors is that they tend to come with nice, flat sides, unlike most TVs, which allows them to be rolled onto their sides easily for TATE mode games, like shooters.

Broadcast monitors are available in sizes up to 30" or so, though models that large are extremely hard to find and tend to be quite expensive, even now, due to their rarity. They are also very expensive to ship, due to their weight, which means many of the auctions on eBay are local-pickup-only (and tend to be in California...). The smaller models of 20" or less are much more common, and can usually be had for between $200 and $300 dollars at the time of this writing. A direct RGB connection from a console to one of these monitors should produce a picture as glorious as the aforementioned PC-VGA-to-240p-31-kHz setup, only without the hassles of modelines, hacked drivers, etc. Unfortunately, I don't have such a monitor, so I can't share any pictures :(

In the cases of either the 31 kHz or broadcast monitors, I personally find the image to be a bit sterile and actually prefer the 15 kHz option. I have opted to use the S-video-out on my video card for the convenience it provides, and the quality degradation is only about as bad as choosing bilinear vs nearest neighbor scaling in an emulator (i.e., fine for me, unbearable for perfectionists and pixel-lovers).

UPDATE (4/13/2015): I recently picked up a PVM 20M2U 20" monitor and posted some closeup shots on this page. The picture is indeed awesome and actually sits somewhere between regular SD/CGA displays and high-res 31 kHz monitors in "sterility" and how crisp the scanlines render.

Anyway, here are some more PC-VGA-to-240p-31-kHz pics :D



Good detail shot of the scanlines and the black gaps visible between.
This is what happens to SNES pseudo-hires transparency (bsnes) for some reason :/








Some other considerations that I will add to this post soon: CRTs for 480p and higher consoles (PS2, Dreamcast, 360, etc.), 31 kHz at 1024x768 (shaders vs the real thing), I plan to add a decision-making flowchart with approximate costs at some point, as well.

Friday, March 21, 2014

Repairing/Replacing N64 Analog Stick

I recently purchased a small CRT TV and have been hooking my old consoles up to it, and I noticed the analog stick on my N64 controller was in pretty rough shape. The deadzone was gigantic and it was affecting my performance in some games, so I decided to look into repairing or replacing it with a new stick.

I settled on this replacement stick, available for $11 from Amazon at the time of this writing.

The replacement process is very easy and takes only a few minutes, with no special tools required other than a small philips-head screwdriver, though a flathead screwdriver and some needlenose pliers will make the job easier.

To start, just flip over the controller and remove the 7 large screws on the back, then remove the 2 small screws next to the memory card / rumble slot (they're easy to miss/forget):
You should then be able to lift the back panel off, which should reveal something like this:
The circuit board and rubber membrane for the Z-button are held down with little plastic clips on the sides of the analog stick assembly, so unclip the board and set the rubber membrane somewhere safe.
The R and L buttons are just sitting in their homes, held in by a tiny plastic peg-in-hole system, so you may wish to remove them at this time, as well, just to get them out of your way:
Next, remove the 4 small screws that hold the analog stick assembly in place (in my case, 3 silver screws on the sides and and bottom, and 1 black screw in the middle) and lift the assembly out. It will still be connected to the PCB by a connector, which you should be able to slide out (pictured below):

Mine was very stubborn and required holding the connector housing in place with my fingers while prying with a flathead screwdriver, alternately loosening the sides until it popped out.

Once it's out, you just do the steps in reverse. The connector assembly was the biggest hassle and required some squeezing with my needlenose pliers before it would snap into place. The wires on the connector are pretty small, so make sure you don't accidentally damage them while squeezing, and don't rip the connector housing off of the PCB!

I had an additional screw left over (the middle black one from the analog stick assembly; it's actually part of the OEM stick assembly), but I just stuck it into the hole they left in the new analog stick, even though it doesn't thread into anything.

And here's the finished product:
This stick is more like a Gamecube or Xbox 360 analog stick than the OEM N64 sticks, and as such feels much sturdier. The movement is also largely frictionless, unlike the OEM sticks, which makes it superior for games like Mario Party that really wear out the OEMs (and your palms). On the other hand, the sensitivity is really high and it's difficult to do precise aiming on games like Goldeneye and Perfect Dark, as the reticle tends to jump around a bit when you try to zero in on a small target (like a head...). For this reason, I will likely keep at least 1 controller with the OEM-style stick around for that sort of thing.