en-us pt-br

Creating a Gmail filter for GitHub

banner

If you’re part of a GitHub project with massive activity, probably you already noticed that your inbox (or dedicated folder/label, if you’re a well-organized person) will be flooded.

And of course, this will make hard to find any mentions to your username (like mention in pull requests, code reviews, etc) or new notifications in issues you’re involved.

The way to fix this is to create 2 filters in Gmail:

  1. The Others filter: this filter will mark as read GitHub notifications that are not addressed to you and move them to the proper folder/label.

  2. The You filter: it will just move notifications that are addressed to you to this folder (i.e, they’ll be unread).

So, let’s assume these:

  • you know how to handle labels/folders and filters in Gmail
  • your GitHub account email is you@example.com
  • you have a label/folder in Gmail named Proj GitHub to receive all notifications
  • this GitHub project has 3 repositories: repo1, repo2 and repo3

Others filter

The first filter will match all the repositories names, avoid your email and mark all matching messages as read:

Matches: subject:([repo1] OR [repo2] OR [repo3]) -{cc:(you@example.com)}
Do this: Skip Inbox, Mark as read, Apply label "Proj GitHub"

As Gmail filters do not accepts wildcards, you have to include all the repositories in this filter (like above, I’ve include repo1, repo2 and repo3).

You filter

The second filter will be similar but with 2 small changes: it’ll match your email and it’ll not mark messages as read.

Matches: subject:([repo1] OR [repo2] OR [repo3]) cc:(you@example.com)
Do this: Skip Inbox, Apply label "Proj GitHub"

Any better idea?

I know, this is not the smartest way to solve this, but it’s effective. If you find any better way, please, share! :)


Retro journey with Sega Master System

banner

In the past, I had several game consoles, but, for an unknown reason, the only one I miss is Master System, the Sega 8 bits console, which was popular in Brazil, Europe and some countries in Asia.

So, I thought: well, let me get one to play some games I’ve played in the past, and several others that I missed. Plug on room TV and be happy!

I wish it was that easy…

I faced 2 major issues:

  1. Old videogames produces horrible images in modern TVs. And I’m not talking about the low resolution: the image is dark with a lot of artifacts, similar to a poorly compressed JPG image.

  2. In Brazil there are several models of Sega Master System (aka SMS) produced by local manufacturer, TecToy. Not just this: TecToy still produces SMS!

So, basically you have to choose between get an old CRT (tube) TV or make some modifications (mods) to your game console to get the best video signal to plug in modern TVs.

Another problem: most tutorials are old, have some non precise info and they’re focused on European devices, using SCART as output plug, uncommon in Americas, which I’ll cover later.

During this process, I learned a lot, and I’ll try to share all the info. So, this post will be huge. Take a seat, please, and grab a coffee!

A lot of technical details about the SMS hardware for the models available here (in Brazil) were provided/fixed by Esrael Neto, whom I thank for several hardware tips!

Why image is so poor?

Because it was made focusing on old tubes TV: low resolution with low image quality (for current standards).

Additionally, keep in mind that an analogic image is made of the following signals: three signals for colors (red, green, blue, acronym RGB), a vertical synchronization signal and a horizontal synchronization signal.

The SMS VDP (video display processor), delivers exactly this: RGB and a synchronization signal called CSync, which has both horizontal and vertical synchronization signals.

These signals, plus audio (which was produced in the VDP too), will be delivered to the encoder chip, which will prepare them to be displayed in the old TVs.

On that time, we had the following alternatives to plug a video device in a TV (of course, both analogic), starting by the poorest to the best quality:

Outputs RF, A/V (Video, L and R Audio), S-Video

  1. RF: the antenna cable plug. All the video signals (RGB, CSync and audio) carrying in only one single cable, the same cables still used by cable TV companies;

  2. A/V: the RCA output with 2 cables (yellow for video, white for mono audio). While audio was separated, video cable still carrying all the signals. For this reason, it’s called too as Composite Video. A bit better than RF;

  3. S-Video: as known as Super Video, it splits the video signal in two ways: one for colors (called Chroma or C), other for luminosity and synchronization (Luma or Y). The output plug was a 4 pin mini DIN. Audio was plugged in the TV using a separated RCA cable. Quality is a way better than A/V;

  4. RGB + CSync: best scenario, because it has one way for each video signal, i.e., 4 ways only for video (R, G, B, CSync). The problem: there was not a standard plug to use it. We’ll learn more about it ahead.

As at the SMS times, nobody had a TV with S-Video (at least here in Brazil), the better output that we could find in the game consoles was RF or A/V. Fortunately, some SMS models, the encoder already has ready-to-use signals in S-Video and RGB format.

So, let’s check the SMS models.

Models

In most countries (including USA and Europe countries), there was 2 SMS versions: the original (in USA known as Power Base), and the second model, SMS 2.

SMS Power Base Master System Power Base

SMS II Master System II

But, like I told you, here we had several models. So, which one to take? Well, it depends on what kind of TV you want to play it.

Let’s take a look on them and see the differences:

1. Master System and Master System II

TecToy SMS Master System I

While the form factor is exactly like the first SMS produced in other countries, the hardware has some differences.

Let’s start by the video encoder chip: here the encoder used to this SMS model was a Motorola MC1377P, instead of Sony V7040 (most of times) or Sony CXA-1145.

This encoder (Motorola MC1377P) has no RGB output, so if you want to get the RGB, you’ll have a hard time trying to get directly from the VDP (SEGA 315-5124) and build a dedicated circuit to amplify the signal. You’ll be able to perform this only if you’re able to read schematics and know electronics.

Additionally, for some bizarre reason, the video output socket used in international versions was used to plug the power adapter in the Brazilian version. Video was plugged using RF cable or RCA (A/V) cables.

TecToy SMS hear outputs TecToy Master System hear outputs

So, if you’re planning to buy international cables to use it in modern TVs (like HDRetrovision ones), give up, they’ll not work.

It comes with Safari Hunt and Hang On in the memory.

Brazilian SMS I and II (which are the “Power Base” models) are the only ones with the 3D glasses input.

As it already has the RCA plugs (removed in some of the next versions), it’s perfect for old CRT TVs. Additionally, the 3D glasses will only work on this kind of TV.

Get it if: you want to use 3D glasses in an old TV. While it still can receive the S-Video mod, the RGB mod (the one used to get the best picture quality in modern TVs) is very, VERY complicated.

2. Master System III Compact

TecToy SMS III Master System III Compact

Compact version, released by Sega in USA and Europe as SMS II. While smaller and lighter, it lost the RCA outputs (it has just RF) and 3D glasses input.

It had 2 internal different versions in Brazil: the first one is the only version released in Brazil using the same hardware as international SMSs, using as encoder the Sony CXA-1145.

The second version uses a Fujitsu MB3514 as video encoder.

Both versions were release containing Alex Kidd in Miracle World or Sonic The Hedgehog in memory.

While both have only RF output, they’re are easy to modify it to include RCA output and S-Video. But only the first version (using the Sony CXA-1145) is easy to modify to receive RGB output (due the number of available tutorials). If you’re good to read schematics and know to handle electronics, Fujitsu MB3514 has RGB output too (according its manual), but you’ll need to figure by yourself.

The issue here is very hard to find external differences between them. Usually the Sony CXA-1145 version is a way more heavyweight, and the bottom fuse is red (black in the other version). But the only way to make sure is opening the console.

Additionally, there was a third bundle for this version (hard to find): with Hang On and Safari Hunt, and the Light Phaser. Oddly, this version uses the Power Base VDP (video processor), but the Sony CXA-1145 encoder.

Get it if: you have plans to make mods like to plug in modern TVs, get the one with Sony CXA-1145.

3. Master System Super Compact / Girl

TecToy SMS Super Compact Master System Super Compact

It’s a kind of wireless SMS, a portable unit which can transmit the video signal to the TV antenna or using cables. It has embedded buttons and a gamepad port.

The Girl version is pink and has different game in memory.

I don’t like it: you have to handle the entire console (while it’s compact). And interestingly, using using it by wireless, it’ll produce noise to the neighbors TV signals.

Get it if: you hate your life. Or your neighbors.

4. Master System Handy / Portable

TecToy SMS Portable Master System Portable

How the Compact version could get worst? Well, removing the cartridge slot! And voilá, we have the Handy and Portable versions. Handy has few games in memory (8 but just Alex Kidd and Black Belt are the good ones). Portable version has around 30 games (again, most are crappy games). The wireless antenna connection was removed too.

Get it if: you hate your money.

5. Master System Collection 74, 105, 112

TecToy SMS III Collection Master System Collection with 105 games

Released in white color, these versions are no more the original hardware: it uses an all-in-one chip, which will present some sound problems with some games. It was release with version including 74 games (later with 105 and 112 games). Around 1/3 of the games are good. But, at least, it includes a lot of the classics.

It has A/V output only. The controller is similar to the MegaDrive/Genesis, with 6 buttons.

Get it if: you have no plans to buy cartridges (or buy few ones) and no plans to plug it in modern TVs, because sound will be defective in some cartridge games and no mods can be performed.

6. Master System Collection 131 and Evolution

TecToy SMS Evolution Master System Evolution

Following the Super Compact to Handy changes, this version lost the cartridge slot. But it has an interesting form factor design. The Evolution version is still produced and has a Sonic nice sticker in the shell.

Get it if: if you like the Sonic sticker, has no plans to buy cartridges and no plans for mods.

Summary

Get a SMS model I or II if you want to play in old TVs and use 3D glasses and the gun (Light Phaser). Get the model III Compact with the Sony CXA-1145 encoder if you want to add mods to play on new TVs.

Easiest retro gaming path: get an old TV

CRT TV Really exciting, not?

Well, to make sure I was clear: if you want to enjoy all the 8 bits glory in an easy way, get an old CRT TV. You can probably get one for free. All the SMS versions have at least RF output, if not A/V.

Additionally, only in an old TV the 3D glasses and Light Phaser will work.

Right. Now, stop reading and go play. You already have all you need… be happy!

Modern TVs: first attempt (S-Video)

Well, I was not happy. Really not happy with the idea about get an old CRT. I was really focused in to get the console working with modern TVs.

I really don’t care about the ugly resolution in big screens: I had an Atari, so I don’t care about big blocks!

I don’t care about the 3D glasses games too. They were too few (only 8) and I played some of them in the old times, not impressive in current days.

Additionally, some day the old TVs will die, and they’re getting hard to find (ones in a good shape).

I really want to see all the sharpen and crispy big blocks in a new and powerful LED TV.

So, the solution was to find a better video input than RF or Composite Video.

First problem: most of mod tutorials are focused in use a SCART plug, which was common in Europe.

scart A parallel port cable? No, SCART!

But SCART was not common in Americas. S-Video was the common improved input here. So, I found that Sony CXA-1145 encoder has output for S-Video, and its image quality is very good.

First problem solved: let’s use S-Video.

S-Video A glorious S-Video cable!

Second problem: for the sound, I still would need to use RCA (which is ok). But, I don’t know why, most tutorials will tell you to get sound directly from the video/audio processor, the Sega 315-5246 (Sega 315-5124 in Brazilian SMS I and II, the “Power Base” ones). This chip is a bit hard to get the correct pin (pin 15 at the middle of the chip, which has a zig zag format and it’s a bit small, see below zoomed picture). Sony CXA-1145 already has a sound output and even Sega uses sound directly from its pin 9 on MegaDrive/Genesis. I tested: no difference, so I’ll follow the manufacturer steps and get it from the easiest chip.

315-5246 This is the Sega 315-5246: don’t need to use it for audio!

Second problem solved: get sound from Sony CXA-1145 pin 9.

Sony CXA-1145 We’ll use Sony CXA-1145 for audio too!

Third problem: most of S-Video tutorials are incomplete. The S-Video Luma signal produced by Sony CXA-1145 need to be amplified (if not, we’ll see weird colors in some games, like green letters in the Alex Kidd in Miracle World opening screen).

So I made a mod to include RCA and S-Video like this:

S-Video mod schematics S-Video mod schematics

And the results:

SMS with S-Video SMS with S-Video and A/V

It worked well in a TV with a S-Video port.

The problem: only Standard Definition TVs (aka HDTVs, 720p resolution) will have a S-Video port. All new Full HD or 4k TVs no more have this port.

Modern TVs: second attempt (LKV363A upscaler)

I’ve made the S-Video, tested in a HDTV and it worked like charm. But I gone home and realized that my current TV (LED) has no S-Video input (it was the previous one, a Plasma HD that had it).

The solution was try an upscaler: a device to get the low definition signal and produce a digital full HD image with HDMI output.

After quickly take a look in few reviews (not focused in games), I found one reasonable with S-Video: LKV363A, from Lenkeng. It automatically works with NTSC/PAL-M signals, saves last used configuration, etc.

LKV363A upscaler LKV363A AV/S-VIDEO to HDMI converter

The problem: while the image was really good, I’ve found a problem while playing. It has noticeable lag. While this is fine to play RPG games, like Phantasy Star, for action games is a blocker, as the image you’re watching on TV is few milliseconds older than the one getting out of the game console. Enough to die in most action games.

So I started to search for the perfect upscaler for old videogames.

Modern TVs: third attempt (X-RGB Mini)

So, the ideal upscaler would be able to produce a nice image, have S-Video input, and lag close to zero.

I found 2 alternatives:

  • the Open Source Scan Converter upscaler, which is a do-it-yourself FPGA-based video processor developed by a single person, Markus Hiienkari, from Finland, which doesn’t handle sound. It’s fast, not that expensive (as FPGA is now accessible), but it’ll required know how with FPGA. And that your TV can receive sound from a different source than the HDMI input.

OSSC upscaler OSSC upscaler

  • Micomsoft X-RGB Mini Framemeister (usually called only Framemeister or X-RGB Mini): a bit overkill, but simply the best. With lag close to 0, RGB and S-Video inputs, a remote control, video configurations for every setting you can imagine, firmware upgrade and downgrade, SD card reader to save settings, it includes even options to produce scanlines, like emulators. And, the scanlines are configurable in all aspects too.

Framemeister Micomsoft Framemeister

In the past, in order to get the best picture while working with the SMS, Framemeister required some special tunning, but today the last firmwares are able to work with no additional configuration. Just plug and play.

Sounds perfect, right? Almost… it’s very expensive! More than US$ 300… and made in Japan. So, you need to find someone to get it for you. Or pay importing taxes over its expensive price. A online store recommended by several friends is Solaris Japan.

Well, I keep searching in the local eBay and found one after some months! Still expensive, but less than import it and pay taxes!

Sounds like we’re close to an end, right? Not yet…

The problem: After all this journey, I found that Framemeister support for S-Video was only for NTSC color pattern (used in Japan and USA). Micomsoft support sent me an updated firmware, with a work in progress for PAL-M, but it was very bad (at least this can work in the future).

The solution: change the PAL-M crystal to a NTSC (hard to find) or use the RGB input in Framemeister.

Getting the RGB from Master System

Like I previously told you, RGB is the best video signal we can get from an analogic video system. It consists of separated channels for each primary color (Red, Green, Blue) plus a additional signal to provide the video synchronization.

It’s similar to VGA (the same connector used in computer displays), but VGA uses 2 signals for video synchronization, vertical and horizontal, while RGB uses one signal for both.

But There is one interesting detail that I described in the beginning: RGB doesn’t have a standard plug to use. Some old RGB monitors uses BNC connectors.

BNC connector A BNC connector

In Europe, people will use a SCART plug, because it was popular and TVs, until few years ago, still have this input (similar to S-Video, which is no more present in new TVs).

Framemeister comes with a SCART adapter, but it uses the Japan pinout (aka JP21), which uses a different pattern for the pins. So, if you’ll use SCART, you’ll need to either solder the pins in the SMS using the Japanese pattern; or buy a Framemeister euro SCART adapter.

In the other hand, some tutorials will advice you to use any plug you want and are easy to find, like VGA plug or even a DB-9 plug.

VGA connector VGA connector

DB9 connector DB9 connector

As my goal was to use with the Framemeister RGB input, I used the simplest approach: build RGB using the same input it provides, a 8 pin mini DIN, replacing the RF output.

8 Mini DIN connector 8 Mini DIN socket (to replace RF)

This is the Framemeister pinout:

Framemeister pinout Framemeister pinout

Another weird detail in tutorials: all tutorials I read about the RGB mod told me to use, as video synchronization source, the Composite Video signal (Sony CXA-1145 pin 20). Ok, it’ll work. But Sony CXA-1145 has a dedicated pin for synchronization, pin 11. Which produces a much better signal, of course, as it provides the pure synchronization signal.

So, this is the schematics I’ve made for RGB using a 8 pin mini DIN:

SMS to 8 Mini DIN SMS to 8 Mini DIN schematics

Final results:

My SMS with all the new outputs My SMS with all the new outputs

As you can see in the above schematics, sounds is included, so we can use just one 8 ways cable with male 8 pin mini DIN in both sides:

8 Mini DIN cable 8 Mini DIN cable

I plugged into the SMS and Framemeister and… it worked! Finally!

But… the last problem: for some reason, the video had some vertical waves coming from the bottom to the top. Like a noisy signal.

Vertical waves Some noise producing vertical waves (see inside the red rectangle)

Solving the vertical waves

A simple workaround was enable the noise filter in the TV configuration. But, of course, I started to search how to properly fix this issue.

With some help of other retro gamers, I found the root for the noise: the Framemeister power adapter. A power adapter using poor components or providing less power than required.

Not fault from Micomsoft: in Japan, Framemeister is sent to the stores with no power adapter. You’ll get it with no power adapter or the seller to other countries will include a power adapter.

Framemeister requires a 5V adapter providing at least 2.3A. But, in my case, the seller included a 2A power adapter, causing the noise in the video.

So I bought a 2.5A power adapter in the same plug dimension (4.0mm x 1.7mm) and the vertical waves disappeared!

You can get a power adapter with this specification and using this plug size, which I found only in AliExpress, or get any 5V 2.5A power adapter with a different plug size and ask to an electronics store to adapt a plug in required dimension, 4.0mm x 1.7mm.

Power adapter The new power adapter with required specification

Now enjoy!

Well, finally… time to seat in the couch…

R-Type photo R-Type on a 47” TV (picture from mobile)

OutRun photo Zoom in Out Run, scanlines enabled (picture from mobile)

Alex Kidd in Miracle World in 1080p (sorry for the street noising)

Bonus

I got a SMS gamepad with a 3 meters power cord, made by TecToy for some of their karaoke devices:

3 meters power cord gamepad 3 meters power cord gamepad

And I made some additional mods to my SMS: power LED indicator and a piano black painting. Take a look:

My piano black SMS

That’s it!


Configuring a Wiimote as a classic gamepad

banner

The Nintendo Wii Remote (aka wiimote) is one of my preferred gamepad to play old console emulators.

Why? Well, it uses bluetooth, probably you already have one (if you had a Wii), and if you hold it in the landscape position, it mimics a 8-bit gamepad. And additionally to the side buttons 1 and 2, it offers buttons like A, B, Home, + and -. Perfect to play NES, Sega Master System, Sega Genesis, NeoGeo and others that do not require more buttons than that.

XWiimote

In the past, Linux (mainly Ubuntu) offered several ways to support wiimote, all using custom event handling: CWiiD, Wiiuse, WiiCan and others.

Some of them are a bit abandoned, and do not rely on Linux event handling.

It’s where XWiimote comes to the rescue. According the official page:

XWiimote is an open-source linux device driver for Nintendo Wii / Wii U Remotes … that tries to supercede cwiid, wiiuse and others by integrating the driver into existing linux infrastructure.

xf86-input-xwiimote

The problem: XWiimote is a raw driver. It doesn’t care about how you want to use the wiimote. I.e: if you want to use the wiimote as a classic gamepad, it’ll not work.

For this purpose, we’ll use xf86-input-xwiimote, which is a X.Org input driver for the wiimote based on the XWiimote.

Install

We can find both programs available in default Ubuntu 16.04 (Xenial) install.

Unfortunatelly, on 14.04 (Trusty) package xwiimote is an old version and xf86-input-xwiimote is not available (because it relies on xwiimote version 2). I tried to compile xwiimote (version 2) and xf86-input-xwiimote, but the later didn’t work (always crashing).

So, if you’re using 16.04 (Xenial) install both with:

sudo apt-get install xwiimote xserver-xorg-input-xwiimote

Configuration

Now we’ll configure the wiimote to fire some keyboard keys while buttons are pressed. This will make it work in every program that supports keyboard as control.

Using sudo (or root) edit /usr/share/X11/xorg.conf.d/60-xorg-xwiimote.conf file, adding all below lines in the Identifier "Nintendo Wii Remote" section:

        Option "MapLeft" "KEY_DOWN"
        Option "MapRight" "KEY_UP"
        Option "MapUp" "KEY_LEFT"
        Option "MapDown" "KEY_RIGHT"
        Option "MapA" "KEY_A"
        Option "MapB" "KEY_B"
        Option "MapPlus" "KEY_EQUAL"
        Option "MapMinus" "KEY_MINUS"
        Option "MapHome" "KEY_ESC"

Save it.

Your 60-xorg-xwiimote.conf file should be now similar to this:

# X11 xorg xf86-input-xwiimote config
# Load correct xwiimote driver for all connected Nintendo Wii Remotes.
# Overwrite previous blacklist.
# We do not load the driver on unsupported extensions. This currently includes
# independent extension like classic-controller and pro-controller. Instead, the
# evdev driver is loaded (there is no way to negate InputClass Match* rules..)

Section "InputClass"
        Identifier "Nintendo Wii Remote"
        MatchProduct "Nintendo Wii Remote"
        MatchDevicePath "/dev/input/event*"
        Option "Ignore" "off"
        Driver "xwiimote"
        Option "MapLeft" "KEY_DOWN"
        Option "MapRight" "KEY_UP"
        Option "MapUp" "KEY_LEFT"
        Option "MapDown" "KEY_RIGHT"
        Option "MapA" "KEY_A"
        Option "MapB" "KEY_B"
        Option "MapPlus" "KEY_EQUAL"
        Option "MapMinus" "KEY_MINUS"
        Option "MapHome" "KEY_ESC"
EndSection

Section "InputClass"
        Identifier "Nintendo Wii Remote Classic Controller Whitelist"
        MatchProduct "Nintendo Wii Remote Classic Controller"
        MatchDevicePath "/dev/input/event*"
        Option "Ignore" "off"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "Nintendo Wii Remote Pro Controller Whitelist"
        MatchProduct "Nintendo Wii Remote Pro Controller"
        MatchDevicePath "/dev/input/event*"
        Option "Ignore" "off"
        Driver "evdev"
EndSection

Restart X.org

You’ll need to restart your X.org to get all changes working. Usually in Ubuntu, a logout/login is enough.


See all