About Adam Patridge

patridgedev.com is my writing outlet for all things nerdy. You can read more on the About Me page.

Play Japanese Famicom games with your US Nintendo Switch Online account

If you’re looking for more retro gaming than the NES games that come free with your Nintendo Switch Online subscription, you might be interested in playing some Japanese Famicom games. Turns out you can do this without any additional cost. I’m not suggesting you load an emulator on your Switch, though that seems like an option these days. It’s not totally straightforward, but it’s not too challenging either. And it definitely won’t leave your Switch in a state where you’re afraid to let it update.

Famicom games app launch screen on a US-based Nintendo Switch

One warning, though. The ads on your Switch home screen now have the ability to show up in either English or Japanese.

Why would you want the Famicom app?

You might just want it because you can. (It’s me!) If you were a Nintendo Switch Online subscriber in Japan, the free retro gaming app is what you would get by default with your subscription is the Famicom app. (And you’d be looking for the reverse instructions to play NES games.) It has all the appropriate cover art images, some of which are just awesome. So, maybe the cover art could sell you on it.

There were also several games that were slightly different when released outside of Japan, whether different difficulty or different parts of games. It also has a few games that aren’t available in the US. Joy Mech Fight is one such game, and supposedly the Mario 3 release in Japan was harder than what hit the US and Europe.

With just a tiny bit of work, you can try out all the Famicom games on your non-Japan Switch.

Get the Famicom app

While there are instructions out there allowing you to get the app downloaded to your Switch entirely from your computer, they require using third-party VPN software that will allow you to bounce your web requests through Japan before they get to Nintendo. I’m not a fan of installing random VPN software, and I’m too lazy to do it in a slightly safer way. (I’m nerdy enough that I would set up a virtual machine with a clean install of Windows just to avoid any potential danger from unknown VPN software installs.)

Fortunately, there’s an alternative. If you use a Nintendo account with its location set to Japan on your Switch, you can download the Famicom Nintendo Switch Online app.

Create and use a Japanese Nintendo Account

  1. Create a Nintendo account with a different email than your account with a Nintendo Switch Online subscription, setting the location set to Japan.

    Screenshot of the Nintendo account creation form showing the country field set to Japan

    You can set the rest of the account to whatever you want. Most likely, you’ll rarely use this account again. Just make sure you save the new password in LastPass or wherever; you’ll need it in the next part.

  2. Now, on your Switch console, go to the System Settings app (the gear [“sun”] icon on the home screen).

  3. Open up the Users tab on the left and scroll to the bottom of the user list and click Add User.
  4. Set your console user’s icon and nickname to whatever you want.
  5. When prompted, link your new device account to a Nintendo Account using the email and password you used on the Nintendo website. (You saved that password, right?)
  6. Open the Nintendo eShop app from the home screen (the bag [“suitcase”] icon on the home screen).
  7. When asked which user is using the eShop, select your new Japan-based account.

    If your Switch is set to English, you’ll be prompted that the Japanese eShop can’t be shown in your system language, but you can just continue. Just know, your going to be using the eShop in Japanese for the next steps.

  8. For this first launch, you’ll also be asked if you want to enter the password for this new account every time you launch the eShop. If you don’t want to enter it every time, check the checkbox above the button right button.

  9. Lastly, click the button to log in with your new Nintendo Account password. (Still need that password!).

Download the app from the eShop

Here’s a video showing the rest of the eShop process, but follow along with the directions if you’d rather work through things at your own pace. The hardest part for someone like me, who can’t read more than a couple katakana characters, was translating the text in the Japanese eShop. Fortunately, the Google Translate app did all the heavy lifting for me there.

  1. On the left-hand side, select the search section on the left (with the magnifying glass).
  2. The search page has a typical search field but also has several category/sorting buttons. For this adventure, click the top-right button, which translates roughly to “price range”.

    Screenshot showing a Google Translate interpretation of the shop search page with the top-right category button translated as price range.

  3. Within the price range list, scroll all the way down to the bottom section, which has a header that translates roughly to “free download”. Move the cursor over to the little link below the row of apps that translates to “see all” and click that link.

    Screenshot showing a Google Translate interpretation of the price range category list with the last category translated as free download and a button below it translated as see all.

  4. In the right-hand app list, scroll down until you see a red icon with two Famicom controllers on it. (At the time of writing this, it was the very last game in the list.) The title will translate to “Family Computer [Nintendo Switch Online]” and the price should translate to “free download”. Click that app to see its details.

    Screenshot showing a Google Translate interpretation of the free download apps with the Famicom game translated as family computer Nintendo Switch Online and a label on the game translated as free download.

  5. On the Famicom app details, click the right-hand button; it should have a button label that translates to “free download”.

    Screenshot showing a Google Translate interpretation of the Famicom app details with the right-hand button translated as free download.

  6. On the checkout order details screen, click the bottom right button that translates to “free”.

    Screenshot showing a Google Translate interpretation of the order confirmation screen with the bottom-right button translated as free.

  7. Lastly, you’ll be presented with the order confirmation “thank you” page. Click the left button of the “thank you” page that translates to “ends”. (The other button is to continue shopping in the Japanese eShop.)

    Screenshot showing a Google Translate interpretation of the order confirmation dialog with the left-hand button translated as end and the right-hand button translated as continue you buy things.

  8. You can hit the Home button to return to the home screen or hit the B button repeatedly to exit out of the eShop. (If you exit out, you’ll need to confirm on a dialog with the right-side button that translates to “ends”.)

    Screenshot showing a Google Translate interpretation of the shop exit confirmation dialog with the right-hand button translated as ends.

    If you have parental controls set up on your Switch, you might even get notified of the new app install.

    Screenshot of an iOS notification from the Nintendo Switch parental controls app saying that the Famicom app has been installed

  9. Now, launch the newly-installed Famicom app from the home screen. When asked who is playing, use your normal Switch account.

    Screenshot of the Switch home screen showing the Famicom app next to the NES app

    It will verify that you have a license to play the game, which you get by having a Switch Online subscription, and let you get to the fun.

    This is where you definitely wanted to pick your normal Switch account. If you pick your new Japan-based account, it will likely fail to launch and ask you to subscribe to Nintendo Switch Online.

Launch the Famicom games app

Several of the Famicom games won’t be hard to figure out. In fact, some of them will display different text if run on a system with its language set to English. If you have too much trouble, though, that’s where the Google Translate app can help you out.

Just like the NES app, you press ZL+ZR to bring up the options. The options appear to be identical to the NES app, just displayed in Japanese. The first option returns you to the current game, the second option is Load Suspend Point, then Create Suspend Point, Reset Game, and To Game Selection is the last option.

Switch screenshot assembly of all the Famicom titles in a single image

Fallback variables in `dotnet new` templates

Previously, we created our first custom dotnet new template and added our first input parameter for it. Next, let’s get a little more advanced with our parameters to make our life easier. In this post, we’ll create a template symbol that will function like a coalesce operator, taking a preferred input but falling back to a different input if the preferred value is not found.

This is the third in a collection of posts about creating custom templates for the dotnet new system.

Sample code

This is the third in a series of posts about creating custom templates for the dotnet new system. I’ll be working from the results of the prior blog post, but the approach can be used to add this functionality to any dotnet new template. If you want a starter template project to get you going, you can clone the Git repo from that blog post and start from the prior 2-input-parameters template.

Why a coalesce/fallback symbol?

There are bound to be several great reasons to need a fallback variable, or one that coalesces between multiple potential inputs, but here are a few I’ve run across so far.

Provide a generated value with a manual override

If you remember from the case-changing symbol from the prior post, there are symbols that can be computed in some fashion. In that case, we were adjusting the letter casing of another input to be upper-case, but there are several other type: generated symbol options. If you have a default of generating a template value but want to allow the user to submit an override value, the coalesce generator is perfect.

I’ve used this previously when templating a repo license file to generate the copyright year value but allow for a user-submitted override for existing, older projects. (Yes, that is a NuGet package with dotnet new templates for creating more dotnet new templates.)

Provide a fallback to another user-provided symbol

Alternatively, if you have a template value that might need to be set manually, but should adopt a value from another symbol when the manual value isn’t present. This is also easily accomplished with a generator: coalesce symbol by pointing it to the manual input value for the primary symbol and the back-up input value for the fallback symbol.

On a recent project involving a content management system, pages had several YAML values. One value for content would be the full-length title to display at the top of the content page, but there was also a shortened title available for lengthier titles to display in width-constrained locations. If you didn’t need a special shortened variant of the title, you could omit that value and it would simply use the full-length title for both YAML values.

Create a coalesce symbol

At its core, a coalesce symbol has two parameter values: sourceVariableName and fallbackVariableName. These two values can point to any other symbols you have defined, whether they are other input parameters or generated values or a mix of the two.

   "copyrightYear": {
       "type": "parameter"
   },
   "copyrightYearGenerated": {
       "type": "generated",
       "generator": "now",
       "parameters": {
           "format": "yyyy"
       }
   },
   "copyrightYearReplacer": {
       "type": "generated",
       "generator": "coalesce",
       "parameters": {
         "sourceVariableName": "copyrightYear",
         "fallbackVariableName": "copyrightYearGenerated"
       },
       "replaces": "{copyrightYear}"
   },

In this example from the repo license template example mentioned previously, we have a copyrightYear parameter optionally provided by the person generating content. Then, we have a generated four-digit year symbol (e.g., “2018”). Last, there is a coalesce symbol that points its sourceVariableName to the provided parameter but uses the generated value via the fallbackVariableName when a value isn’t provided. The result of this source-plus-fallback coalesce is then used to replace any instances of {copyrightYear} in the template content.

Check your work

If you got lost along the way or need something to compare to, look in the 3-coalesce-parameters folder of the sample Git repo with the resulting templates from following along with this blog post series.

You can now start introducing coalesce, or fallback, variables into your dotnet new templates. As always, there’s so much more that can allow you to do even more advanced things with your templates, some of which I hope to cover in more posts. If there’s something cool that I need to cover, though, reach out to me on Twitter: @patridgedev.

Add variables to your custom `dotnet new` template

Previously, I covered creating your first custom dotnet new template. Now, let’s work on customizing the content our template generates based on inputs provided via the command line. I’ll be working from the same custom template from that post, which is just a dotnet new console output with its own .template.config setup. If you want a starter template project to get you going, use the template from the 1-custom-template folder from the Git repo from that blog post.

This is the second in a collection of posts about creating custom templates for the dotnet new system.

Your first input parameter

When you are generating content from a template, your first parameter for controlling things is built in to the SDK. There are two variables used to decide where to put the generated content: --output and --name. If you provide a path via --output "some/path", the content will be generated in that location. If, in your template’s template.json file, you set "preferNameDirectory": true, you can set the same path via --name "some/path". (If you have the preferNameDirectory variable set to true and provide both an output and name variable, it will use the output value.) Without either command-line parameter, the new content will be generated in the current directory.

Passing in more useful data for your template requires some additional changes to the template.json configuration.

Taking inputs for generating content

To start consuming inputs to alter your generated content, add a new object to the template configuration JSON in template.json.

{
    "$schema": "http://json.schemastore.org/template",
    ...
    "symbols": {
        "helloMessage": {
            "type": "parameter",
            "replaces": "Hello from a new template!"
        }
    }
}

This sets up your template to take a helloMessage parameter via the command line like this.

dotnet new console-awesome --helloMessage "Hello from a command line override!"

The resulting Program.cs file will have a call using our custom parameter.

Console.WriteLine("Hello from a command line override!");

If we don’t pass in that helloMessage parameter, the substitution is made with the value set in a symbol’s defaultValue field.

When the content is generated, it will process the template files and replace all instances of “Hello from a new template!“ with the provided parameter value. We only have one instance here, but you could have several if your template requires it.

Making the output more predictable

Since the template system does a find-and-replace on our symbols defining a replaces value, I want to make sure it doesn’t accidentally find any other instances I didn’t intend for it to replace. To do that, I will typically use a placeholder string that is always replaced, like a template token.

Most template examples I have looked over seem to put default data in the file to be processed and replace that value with the replaces value. I tend to use a placeholder string and a defaultValue within the symbol instead. They both result in the same generated content, so let your own preferences guide you here. I feel like I’m less likely to have identical text elsewhere that will get accidentally replaced as a “false positive” when I use replacement tokens than with actual content.

In the previous example, I would replace the WriteLine parameter in C# with something like Console.WriteLine(”{helloMessage}”) and configure the symbol like this.

{
    "$schema": "http://json.schemastore.org/template",
    ...
    "symbols": {
        "helloMessage": {
            "type": "parameter",
            "replaces": "{helloMessage}",
            "defaultValue": "Hello from a new template!"
        }
    }
}

You will end up creating a symbol for each input you want to accept from the command line, and several more advanced steps. You will also create symbols for some of the processing you wish to do to other inputs, for example changing the letter casing of a provided value.

Changing input parameter casing

There are lots of things we can do to incoming parameter values, but we’ll start with a simple one: forcing something to all uppercase or lowercase. If you’re taking in an input from a user of your template, you can’t always rely on them providing the expected input. For example, if you expect an ID field in your template to have letters in uppercase only, you will want to set it up to enforce that when the templated content is generated.

We add this string modification as a second symbol that will derive a modified value from the original, keeping the original also available if you need it. To do so, return to your .template.config > template.config file.

In the symbols section of the config file, add a new symbol to capitalize the existing helloMessage symbol; I don’t know if there’s a best practice, but I try to name my modifier symbols after what they do. So, in this case, name your new symbol helloMessageUpper. Let’s see what that will look like.

"symbols": {
   "helloMessage": {
       "description": "",
       "type": "parameter",
       "replaces": "{helloMessage}",
       "defaultValue": "Hello from a new template!"
   },
   "helloMessageUpper": {
       "type": "generated",
       "generator": "casing",
       "parameters": {
         "source": "helloMessage",
         "toLower": false
       },
       "replaces": "{helloMessageUpper}"
   }

}

First, we still have our input symbol, helloMessage. Then, we add our new helloMessageUpper symbol. To tell the system we are making a computed symbol, we set the type of our symbol to generated. We then need to tell it what kind ofgeneratorto use:casing` in this case, to tell the system we are going to modify the casing on some other symbol.

When you use a generator symbol, you often require some additional configuration, which is done with a parameters configuration object. In this case, you provide a source symbol, the input to our casing generator, and the direction to adjust the letter casing in a toLower boolean value.

The toLower boolean value doesn’t have any sort of toUpper equivalent. As you might expect, if you set it to true, it will result in a lowercase symbol you can use. What may not be as obvious, though, is that setting toLower to false will result in an uppercase symbol.

With the generator configured, we simply add a replaces value again to tell it what gets our new uppercase-transformed input in the template output.

To test our output, let’s add another line in the template C# source.

Console.WriteLine("{helloMessage}");
Console.WriteLine("{helloMessageUpper}");

Now, we need to install or modified template and generate content from it. From your template directory, make sure you have the latest installed.

dotnet new --install .

If we generate a project from our modified template without any command-line parameters, we get the default symbol value. That default is also fed into the generated symbol for it’s upper-case equivalent.

This command…

dotnet new console-awesome --output TestRunNoParameter

…results in a TestRunNoParameter/Program.cs containing these calls. (Remember, the output parameter will generate the content in a folder with that name, used here to keep our test output organized.)

Console.WriteLine("Hello from a new template!");
Console.WriteLine("HELLO FROM A NEW TEMPLATE!");

And when we provide our own command-line parameter, it substitutes the provided value as above and also passes that value into the upper-case generator.

This command…

dotnet new console-awesome --helloMessage "Hello from a command line override!" --output "TestRunParameterOverride"

…results in these calls in Program.cs.

Console.WriteLine("Hello from a command line override!");
Console.WriteLine("HELLO FROM A COMMAND LINE OVERRIDE!");

Check your work

You can now start introducing variables into your dotnet new templates. If you want to compare your work to a template created by following along, check out the 2-input-parameters folder of the GitHub repo created for this blog post series.

There’s so much more that can allow you to do even more advanced things with your templates, some of which I hope to cover in more posts. If there’s something cool that I need to cover, though, reach out to me on Twitter: @patridgedev.