# Introduction

The Wii Shop Channel was an online software store made for the Wii. As this service shut down most functionality during January 2019, we've chosen to do our best to make our own documentation in hopes that this service could possibly be revived.

## JavaScript

The Wii Shop Channel has several JavaScript APIs exposed to Opera. This allows a webpage to more easily interact with the console, primarily via underlying SDKs.

There are 8 major components of this integration:

* [DL Tasks](/wii-shop-channel/js/dl-tasks)
* [EC](/wii-shop-channel/js/ec)
* [Keyboard](/wii-shop-channel/js/keyboard)
* [Mii](/wii-shop-channel/js/mii)
* [NWC24](/wii-shop-channel/js/nwc24)
* [Shop](/wii-shop-channel/js/shop)
* [SD Card](/wii-shop-channel/js/sd-card)
* [Sound](/wii-shop-channel/js/sound)

## SOAP

EC, short for ECommerce, is a library that assists the console with title management and authentication. Many exposed functions via JavaScript interact with a corresponding EC library function to accomplish their task.

When contacting the configured server, the ECommerce library communicates via SOAP, a [protocol utilizing XML](https://en.wikipedia.org/wiki/SOAP).

There are three separate SOAP services, each handling a separate task:

* [Cataloging SOAP](/wii-shop-channel/soap/cas), abbreviated as CAS
* [Identity Authentication SOAP](/wii-shop-channel/soap/ias), abbreviated as IAS
* [ECommerce SOAP](/wii-shop-channel/soap/ecs), abbreviated as ECS

The majority of requests within the Wii Shop Channel are IAS or ECS. CAS is most heavily used for titles handling DLCs, or video on demand services. As such, documentation for this service type should not be considered as exhaustive.

An example of a [NotifyETicketsSynced](/wii-shop-channel/soap/ecs/notifyeticketssynced) request is as follows. See [Base Format](/wii-shop-channel/soap/base-format) for more information about these values.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                   xmlns:ecs="urn:ecs.wsapi.broadon.com">
<SOAP-ENV:Body>
<ecs:NotifyETicketsSynced xsi:type="ecs:NotifyETicketsSyncedRequestType">
  <ecs:Version>2.0</ecs:Version>
  <ecs:MessageId>ECSHOP-$DeviceId-$MessageId</ecs:MessageId>
  <ecs:DeviceId>$DeviceId</ecs:DeviceId>
  <ecs:DeviceToken>$DeviceToken</ecs:DeviceToken>
  <ecs:AccountId>$AccountId</ecs:AccountId>
  <ecs:Region>$Region</ecs:Region>
  <ecs:Country>$Country</ecs:Country>
  <ecs:Language>$Language</ecs:Language>
  <ecs:SerialNo>$SerialNo</ecs:SerialNo>
  <ecs:ForceSyncTime>0</ecs:ForceSyncTime>
  <ecs:ExtTicketTime>$ExtTicketTime</ecs:ExtTicketTime>
  <ecs:SyncTime>$SyncTime</ecs:SyncTime>
</ecs:NotifyETicketsSynced>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

## Opera

The browser used in the Wii Shop Channel is powered by Opera. The browser is limited to HTML 4.1 and does not support flash. It only takes a 4:3 space in the middle of the screen - or the entire screen if on a 4:3 monitor / TV.

## Improving this documentation

This documentation is beyond incomplete. We'll need to go into more detail about the JS part, as well as include other components that WSC may use.


# EC

A family of objects for interacting with titles and servers

EC, short for ECommerce, is understandably the most crucial part of the Wii Shop Channel. As such, its family of functions and objects comprise most of the JS API and binary within, separated across many separate mechanics. Each object available is listed below.

While every object can be instantiated by itself, data available populated within the majority objects - such as [ECDeviceInfo](/wii-shop-channel/js/ec/ecdeviceinfo) or [ECProgress](/wii-shop-channel/js/ec/ecprogress) - will only be present when returned from a function in [ECommerceInterface](/wii-shop-channel/js/ec/ecommerceinterface). Ensure you read the object's respective documentation for the correct way to utilize one.

## Objects

### Common

These objects provide general functionality for all of the EC interface.

* [ECommerceInterface](/wii-shop-channel/js/ec/ecommerceinterface)
* [ECDeviceInfo](/wii-shop-channel/js/ec/ecdeviceinfo)
* [ECProgress](/wii-shop-channel/js/ec/ecprogress)

### Payment

Payment-related objects provide multiple source of payments - via credit cards, "ECards" (known as a Wii Points Card officially) or the existing account balance. It's additionally possible to work with information about an existing transaction.

* [ECCreditCardPayment](/wii-shop-channel/js/ec/payment-objects/eccreditcardpayment)
* [ECCreditCardEncryptedPayment](/wii-shop-channel/js/ec/payment-objects/eccreditcardencryptedpayment)
* [ECECardPayment](/wii-shop-channel/js/ec/payment-objects/ececardpayment)
* [ECAccountPayment](/wii-shop-channel/js/ec/payment-objects/ecaccountpayment)
* [ECPrice](/wii-shop-channel/js/ec/payment-objects/ecprice)
* [ECTransactionInfo](/wii-shop-channel/js/ec/payment-objects/ectransactioninfo), and [ECTransactionInfos](/wii-shop-channel/js/ec/payment-objects/ectransactioninfo#ectransactioninfo).

### Title

Title-related objects provide functionality for querying title information, ticket information, and title limit information.

* [ECTitleLimit](/wii-shop-channel/js/ec/title-objects/ectitlelimit), and [ECTitleLimits](/wii-shop-channel/js/ec/title-objects/ectitlelimit#ectitlelimits)
* [ECTitleInfo](/wii-shop-channel/js/ec/title-objects/ectitleinfo), and [ECTitleInfos](/wii-shop-channel/js/ec/title-objects/ectitleinfo#ectitleinfos)
* [ECTicketInfo](/wii-shop-channel/js/ec/title-objects/ecticketinfo), and [ECTicketInfos](/wii-shop-channel/js/ec/title-objects/ecticketinfo#ecticketinfos)


# ECommerceInterface

The main interface to interact with EC

You use the ECommerce set of classes when you want to deal with the underlying EC APIs. With EC, you handle things such as [title management](/wii-shop-channel/js/ec/title-objects) and [payment information](/wii-shop-channel/js/ec/payment-objects). And you also have the option to handle components such as [device information](/wii-shop-channel/js/ec/ecdeviceinfo), permitting identification of the console in several ways.

For every page, you'll want to initialize the `ECommerceInterface` type.

```javascript
var ec = new ECommerceInterface();
```

This special type inherits from `ECGenericObject`, an internal C++ type that many others use as a parent. You should only create this specific object type once per page load in JS, as it calls the special function `EC_Init` internally.

Inside of EC, there is a JS "[test mode](#js-test-mode-operations)" that allows modification of objects that are normally not modifiable via JS. It is not possible to enable it beyond binary patching, or editing memory.

## Members

| Member Name                                                                                                                                                                                                                             | Discussion                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ec.getVersion()`                                                                                                                                                                                                                       | Returns the EC library's version number. As of the Wii Shop Channel v21, this is `264192`, or `0x40800`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `ec.setParameter(name, value)`                                                                                                                                                                                                          | <p>Sets multiple internal EC library values.<br><br>Known names are:</p><ul><li><code>TIN</code>: a unique title number within games.</li><li><code>AppId</code>: the current running title ID.</li><li><code>PCPW</code>: Parental Control pin/password.</li><li><code>USE\_NCRS</code>: (unknown, accepts 0/1)</li><li><code>SPACE\_CHECK\_POLICY</code>:with a value of <code>SPACE\_CHECK\_USER\_ONLY</code> or <code>SPACE\_CHECK\_ENTIRE\_FS</code>.</li></ul><p>This calls <code>EC\_SetParameter</code> internally. The Wii Shop Channel does not set a TIN as many games might.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `ec.getSessionValue(name)`                                                                                                                                                                                                              | <p>For the current EC object, get a value for the given <code>name</code> from an internal store.<br><br>This key will persist within the internal store for the duration of the channel's runtime.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `ec.setSessionValue(name, value)`                                                                                                                                                                                                       | Sets the key for `name` to `value` within the internal store.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `ec.getPersistentValue(name)`                                                                                                                                                                                                           | Obtains a value by `name` from `ec.cfg`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `ec.setPersistentValue(name, value)`                                                                                                                                                                                                    | Sets a key by `name` to `value` in `ec.cfg`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `ec.getProgress()`                                                                                                                                                                                                                      | <p>Returns an <a href="/wii-shop-channel/js/ec/ecprogress">ECProgress</a> object on the state of the given operation, or the most recent operation. <br><br>Returns -4007 if no operation is ongoing.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `ec.cancelOperation()`                                                                                                                                                                                                                  | Cancels the current operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| <p><code>ec.purchaseTitle(titleId, itemId, price, payment, limits, downloadContent, taxes, purchaseInfo, discount)</code><br><br><mark style="color:green;">🔒 Requires HTTPS</mark></p>                                                | <p>Formulates and sends a <code>PurchaseTitle</code> request, typically used with payment.<br><br>Parameters are as follows:</p><ul><li><code>titleId</code>: the title ID to purchase, as a string.</li><li><code>itemId</code>: Unknown.</li><li><code>price</code>: An instance of <a href="/wii-shop-channel/js/ec/payment-objects/ecprice">ECPrice</a>.</li><li><code>payment</code>: Any instance of <a href="/wii-shop-channel/js/ec/payment-objects/ececardpayment">ECECardPayment</a>, <a href="/wii-shop-channel/js/ec/payment-objects/ecaccountpayment">ECAccountPayment</a>, or <a href="/wii-shop-channel/js/ec/payment-objects/eccreditcardpayment">ECCreditCardPayment</a>/<a href="/wii-shop-channel/js/ec/payment-objects/eccreditcardencryptedpayment">ECCreditCardEncryptedPayment</a>.</li><li><code>limits</code>: An instance of <a href="/wii-shop-channel/js/ec/title-objects/ectitlelimit#ectitlelimits">ECTitleLimits</a>. It's acceptable to have this be zero in length.</li><li><code>downloadContent</code>: A boolean on whether the title should be downloaded .</li><li><code>taxes</code> (optional): A string seemingly holding the price calculated for taxes. It's unclear on how this would be used.</li><li><code>purchaseInfo</code> (optional): Unknown string value.</li><li><code>discount</code> (optional): Unknown string value.</li></ul>                                                                                                                                                                                    |
| <p><code>ec.purchaseGiftTitle(titleId, itemId, price, payment, limits, identifier, identifierKind, notes, taxes, purchaseInfo)</code><br><br><mark style="color:green;">🔒 Requires HTTPS</mark></p>                                    | <p></p><p>Formulates and sends a <code>PurchaseTitle</code> request, typically used with payment.<br><br>Parameters are as follows:</p><ul><li><code>titleId</code>: the title ID to purchase, as a string.</li><li><code>itemId</code>: Unknown.</li><li><code>price</code>: An instance of <a href="/wii-shop-channel/js/ec/payment-objects/ecprice">ECPrice</a>.</li><li><code>payment</code>: Any instance of <a href="/wii-shop-channel/js/ec/payment-objects/ececardpayment">ECECardPayment</a>, <a href="/wii-shop-channel/js/ec/payment-objects/ecaccountpayment">ECAccountPayment</a>, or <a href="/wii-shop-channel/js/ec/payment-objects/eccreditcardpayment">ECCreditCardPayment</a>/<a href="/wii-shop-channel/js/ec/payment-objects/eccreditcardencryptedpayment">ECCreditCardEncryptedPayment</a>.</li><li><code>limits</code>: An instance of <a href="/wii-shop-channel/js/ec/title-objects/ectitlelimit#ectitlelimits">ECTitleLimits</a>. It's acceptable to have this be zero in length.</li><li><code>identifier</code>: An identifying value for the recipient console, such as its Wii friend code.</li><li><code>identifierKind</code>: The type of identifying value.</li><li><code>notes</code> (optional): Potentially a note for the recipient, unknown.</li><li><code>taxes</code> (optional): A string seemingly holding the price calculated for taxes. It's unclear on how this would be used.</li><li><code>purchaseInfo</code> (optional): Unknown string value.</li><li><code>discount</code> (optional): Unknown string value.</li></ul> |
| <p><code>ec.acceptGiftTitle(titleId, transactionId, accept, reason, downloadContent)</code><br></p><p><mark style="color:green;">🔒 Requires HTTPS</mark></p>                                                                           | <p>Accepts, or rejects, a gifted title.</p><ul><li><code>titleId</code>: the title to accept.</li><li><code>transactionId</code>: The recipient's transaction ID, sent via query parameters in the sent Wii Mail.</li><li><code>accept</code>: Whether this gift was accepted (true) or rejected (false).</li><li><code>reason</code> (optional): Seemingly a string as to why. It's unclear on where this is sent.</li><li><code>downloadContent</code> (optional): Whether to download this title upon acceptance.</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| <p><code>ec.unregister(challenge)</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                 | <p>Performs a request to unregister this console from the server. As part of <code>EC\_Unregister</code>, this may mean NAND titles and tickets are deleted.<br><br>The <code>challenge</code> parameter is typically obtained from issuing a call to <code>ec.sendChallengeReq()</code>, awaiting its completion, and utilizing the result from the server via <code>ec.getChallengeResp()</code>. However, the client does not enforce a challenge is ever called. It is safe to use any value desired.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>ec.deleteOwnership(titleId, ticketId)</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                    | Deletes the local copy of this ticket, and additionally registers with the server that a ticket has been deleted for the given `titleId` and `ticketId`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `ec.syncTickets(type)`                                                                                                                                                                                                                  | <p>Sends a list of local tickets on the console, and reads a list of tickets from the server<br><br>The parameter <code>type</code> is optional, and defaults to zero. It is unknown what other sync types are available.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `ec.checkDeviceStatus()`                                                                                                                                                                                                                | Synchronizes values such as ticket sync times and point balances.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `ec.refreshCachedBalance()`                                                                                                                                                                                                             | Requests the console's current points balance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `ec.getCachedBalance()`                                                                                                                                                                                                                 | Returns the current cached points balance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `ec.getPurchaseInfo()`                                                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `ec.getTransactionInfos()`                                                                                                                                                                                                              | Retrieves transaction history from the server, returning an [ECTransactionInfos](/wii-shop-channel/js/ec/payment-objects/ectransactioninfo#ectransactioninfos) object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>ec.purchasePoints()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `ec.downloadTitle()`                                                                                                                                                                                                                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `ec.checkFirmware()`                                                                                                                                                                                                                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <p><code>ec.generateKeyPair()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                     | Returns -4002 - possibly not implemented, or deprecated?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p><code>ec.confirmKeyPair()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                      | Returns -4002 - possibly not implemented, or deprecated?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `ec.checkRegistration()`                                                                                                                                                                                                                | Makes a request via ECS for the `CheckRegistration` type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| <p><code>ec.register(challenge)</code><br><br><code>ec.register(challenge, extAccountId)</code><br><code>ec.register(challenge, extAccountId, extAccountPassword)</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p> | <p>Performs a request to register this console to the server.<br><br>It is possible to override sent credentials while registering, as during a re-register configured credentials from <code>ec.cfg</code> will be sent.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>ec.transfer()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <p><code>ec.syncRegistration()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                    | Syncs the registration state of this console, seemingly updating token, serial number, friend codes, and other values as appropriate.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <p><code>ec.sendChallengeReq()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                    | Requests a challenge from the configured IAS server.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>ec.getChallengeResp()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                    | Retrieves the returned challenge from the given IAS server.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <p><code>ec.reportCSS()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <p><code>ec.confirmCSS()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `ec.getCSSConfirmation()`                                                                                                                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `ec.getTitleInfo(titleId)`                                                                                                                                                                                                              | Returns an [ECTitleInfo](/wii-shop-channel/js/ec/title-objects/ectitleinfo) for the specified title ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `ec.getTitleInfos()`                                                                                                                                                                                                                    | Returns an [ECTitleInfos](/wii-shop-channel/js/ec/title-objects/ectitleinfo) for all available titles on the console.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `ec.getTicketInfos(titleId)`                                                                                                                                                                                                            | Returns an [ECTicketInfos](/wii-shop-channel/js/ec/title-objects/ecticketinfo#ecticketinfos) for the given title ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `ec.getDeviceInfo()`                                                                                                                                                                                                                    | Returns an object you can use to access information with. See its dedicated page, [ECDeviceInfo](/wii-shop-channel/js/ec/ecdeviceinfo), for more information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>ec.setWebSvcUrls(ecs)</code><br><code>ec.setWebSvcUrls(ecs, ias)</code><br><code>ec.setWebSvcUrls(ecs, ias, cas)</code></p>                                                                                                    | <p>Sets endpoints for usage.</p><ul><li><code>ecs</code>: The ECommerceSOAP endpoint, utilized for requests related to titles and purchases.</li><li><code>ias</code>: The IdentityAuthenticationSOAP endpoint, utilized for identity and registration-related requests.</li><li><code>cas</code>: The CatalogingSOAP endpoint, utilized for listing available titles (such as for DLCs or service titles).</li></ul><p>CAS is not used within the Wii Shop Channel - only used in other ECDK-utilizing titles, such as for DLC content.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p><code>ec.setContentUrls(ccs)</code><br><code>ec.setContentUrls(ccs, ucs)</code></p>                                                                                                                                                  | `ccs` appears to be an `http` URL by default, presumably meaning "cached contents". `ucs` may mean "uncached contents", using an `https` URL.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `ec.checkParentalControlPassword(pin)`                                                                                                                                                                                                  | Validates the given Parental Control PIN/password as a long. If this is disabled, it returns `-4075`, or `-0xfeb`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `ec.launchTitle(titleId, ticketId)`                                                                                                                                                                                                     | Launches the passed title with the given ticket.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `ec.request(requestString)`                                                                                                                                                                                                             | Requests something, with a callback. \*\*TODO\*\*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| <p><code>ec.getWeakToken()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <p><code>ec.startLog()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                            | Creates a new logging buffer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>ec.stopLog()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                             | Destroys the present logging buffer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>ec.getLog()</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p>                                                                                                                                              | Returns a string with the internal held log from buffer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

## JS Test Mode Operations

These following functions **do not function** without the JS test mode being enabled via binary patching. They will log such if called. Do not expect them to work.

| Member Name                                                                                                | Discussion                                                                                                                                                                                                                                                                                                                            |
| ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ec.setLanguage(language)`                                                                                 | Overrides the configured language for this EC object.                                                                                                                                                                                                                                                                                 |
| `ec.setCountry(country)`                                                                                   | Overrides the configured country for this EC object.                                                                                                                                                                                                                                                                                  |
| `ec.setRegion(region)`                                                                                     | Overrides the configured region for this EC object.                                                                                                                                                                                                                                                                                   |
| `ec.setAge(age)`                                                                                           | Overrides the configured age for this EC object.                                                                                                                                                                                                                                                                                      |
| `ec.setAccountId(accountId, deviceToken)`                                                                  | <p>Overrides the configured account ID for this EC object.<br><br>If a constructor parameter is not specified as a string, it will default to the string literal <code>null</code>.</p>                                                                                                                                               |
| `ec.deleteTitleContent(titleId)`                                                                           | Deletes a title's contents from the console.                                                                                                                                                                                                                                                                                          |
| `ec.deleteTitle(titleId)`                                                                                  | Deletes a title's contents and data from the console.                                                                                                                                                                                                                                                                                 |
| `ec.deleteLocalTicket(titleId, ticketId)`                                                                  | Deletes a title's contents, data, and ticket from the console.                                                                                                                                                                                                                                                                        |
| `ec.pubKeyEncrypt(message)`                                                                                | Encrypts a message with the console's public key, returning a base64-encoded string of the encrypted contents.                                                                                                                                                                                                                        |
| `ec.runTests()`                                                                                            | Unknown. Appears to return zero.                                                                                                                                                                                                                                                                                                      |
| <p><code>ec.setOption(option, value)</code><br><br>🔒 <mark style="color:green;">Requires HTTPS</mark></p> | <p>Sets an option within EC.<br><br>Only two options are accepted:</p><ul><li><code>0</code>: Sets the JS test mode, where <code>value</code> is a boolean.</li><li><code>1</code>: Adjusts the log level is adjusted to that of <code>value</code>.</li></ul><p>All other options appear to return -4004, or <code>0xfa4</code>.</p> |


# ECDeviceInfo

Device information, easily accessible

When you need information about the user's device, you call `ECommerceInterface#getDeviceInfo()`. This ranges from storage information to device identifiers.

```javascript
var info = ec.getDeviceInfo();
```

## Properties

| Property Name                    | Discussion                                                                                                                                                              |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `info.isKeyPairConfirmed`        | Always returns true. Related to `ECommerceInterface#generateKeyPair()` and `ECommerceInterface#confirmKeyPair()`, which are not implemented.                            |
| `info.deviceId`                  | Sourced from `ec.cfg`.                                                                                                                                                  |
| `info.serial`                    | The device's serial number, as sourced from `/title/0000001/0000002/data/setting.txt` .                                                                                 |
| `info.accountId`                 | A value returned from the server. TODO: research.                                                                                                                       |
| `info.registrationStatus`        | Set once `ec.checkRegistration()`  is called.                                                                                                                           |
| `info.originalSerial`            | Blank by default. Nintendo can override the Wii's serial number for purposes of the account transferring consoles.                                                      |
| `info.extAccountId`              | Sent by server during `ec.checkRegistration()`.                                                                                                                         |
| `info.region`                    | The device's region, such as `USA`.                                                                                                                                     |
| `info.language`                  | The device's language, such as `en`.                                                                                                                                    |
| `info.country`                   | The device's country, such as `US`. Sourced from the Wii itself.                                                                                                        |
| `info.accountCountry`            | The account's country, such as `US`. Sourced from the response to `ec.checkRegistration()`.                                                                             |
| `info.blockSize`                 | How many bytes a block is. This should always be 16 KiB, or 16,384 bytes.                                                                                               |
| `info.usedBlocks`                | The amount of used blocks on the device.                                                                                                                                |
| `info.totalBlocks`               | The total amount of blocks on the device.                                                                                                                               |
| `info.usedSysBlocks`             | The amount of blocks used up by system data.                                                                                                                            |
| `info.totalSysBlocks`            | The amount of blocks allocated for use to the system.                                                                                                                   |
| `info.usedUserInodes`            | The amount of Inodes available to user data.                                                                                                                            |
| `info.maxUserInodes`             | The cap on Inodes available to the user.                                                                                                                                |
| `info.usedSysInodes`             | The amount of used Inodes by the system.                                                                                                                                |
| `info.maxSysInodes`              | The cap of Inodes available to the system.                                                                                                                              |
| `info.netContentRestrictions`    | Returns an integer, with flags regarding content restriction. TODO: investigate                                                                                         |
| `info.userAge`                   | User age as defined by parental controls. If parental controls are off, defaults to 20.                                                                                 |
| `info.parentalControlFlags`      | Flags regarding restrictions set via parental controls. See also: <https://wiibrew.org/wiki//shared2/sys/SYSCONF#IPL.PC>                                                |
| `info.parentalControlOgn`        | Unknown.                                                                                                                                                                |
| `info.isParentalControlEnabled`  | Boolean on whether parental controls are enabled.                                                                                                                       |
| `info.isNeedTicketSync`          | Boolean value on whether the device needs to sync tickets.                                                                                                              |
| `info.lastTicketSyncTime`        | Timestamp of some sort. A returned value was 1322524844000,                                                                                                             |
| `info.wirelessMACAddr`           | The MAC address for wireless, returned as a string (format XX:XX:XX:XX:XX:XX).                                                                                          |
| `info.bluetoothMACAddr`          | Same format and purpose as above, but for Bluetooth.                                                                                                                    |
| `info.titleId`                   | The app's current title ID. For the Wii Shop Channel, that is "0001000248414241" (as a string).                                                                         |
| `info.freeChannelAppCount`       | The amount of channels currently free the Wii Menu. As each page is 4 columns with 3 rows, and there are 4 pages, there's a potential maximum of 48 channels available. |
| `info.deviceCode`                | Friend code of the device as a string.                                                                                                                                  |
| `info.accountDeviceCode`         | Same as above.                                                                                                                                                          |
| `info.isNeedTicketSyncImportAll` | Whether the device needs to import all tickets from a sync. TBD.                                                                                                        |


# ECProgress

Progress tracking, simplified

`ECProgress` is an object describing an operation's state. You should not instantiate one yourself - instead, for all asynchronous operations, one will be returned by the function.

For example, you may encounter:

```javascript
var progress = ec.checkDeviceStatus();
```

## Properties

| Property Name                | Discussion                                                                                  |
| ---------------------------- | ------------------------------------------------------------------------------------------- |
| `progress.status`            | Integer regarding the internal EC value of operations. -4009 appears to mean "incomplete".  |
| `progress.operation`         | String of the current operation. For the example above, this could be `checkDeviceStatus` . |
| `progress.description`       | Description of the current operation. Typically empty. TODO: find how to set a description. |
| `progress.phase`             | Unknown, typically observed to be 17.                                                       |
| `progress.isCancelRequested` | Boolean regarding if this asyncronous operation should be cancelled.                        |
| `progress.downloadedSize`    | Size currently downloaded. Most useful for a title contents-related operation.              |
| `progress.totalSize`         | Size of the finished contents. Most useful for a title contents-related operation.          |
| `progress.errCode`           | Error code returned from operation.                                                         |
| `progress.errInfo`           | Information about the error. TODO: find how this is set                                     |


# Payment Objects


# ECPrice

A way to describe pricing data

If you want to relay pricing data to the server, you instantiate `ECPrice`.  For example, when you purchase a title via `ec.purchaseTitle` on [ECommerceInterface](/wii-shop-channel/js/ec/ecommerceinterface), you're expected to present a price as a parameter.

## Constructor

ECPrice expects exactly two parameters for its single constructor: `amount`, and `currency`.

```javascript
var price = new ECPrice(amount, currency);
```

For example, let's assume you wish to instantiate a price representing 4.99 USD. Both the amount and the currency are strings.

```javascript
var price = new ECPrice('4.99', 'USD');
```

## Properties

| Property Name    | Discussion                                                                                                                                      |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `price.amount`   | The amount that this ECPrice object represents, as a string. It is not converted to a numerical type for usage.                                 |
| `price.currency` | The currency this ECPrice object represents, as a string. There is no defined list of currencies checked against, so any value may be utilized. |


# ECCreditCardPayment

If you wish to represent a user's credit card whilst purchasing a title, you use ECCreditCardPayment. For example, utilizing an [example credit card number](https://www.paypalobjects.com/en_AU/vhelp/paypalmanager_help/credit_card_numbers.htm):

```javascript
var payment = new ECCreditCardPayment('4012888888881881');
```

### Properties

| Property Name    | Discussion                                                                       |
| ---------------- | -------------------------------------------------------------------------------- |
| `payment.number` | The number set during instantiation. Can be retrieved, or set to another number. |


# ECCreditCardEncryptedPayment

If you wish to represent part of a user's credit card number - for example, one already present on the server - you can use ECCreditCardEncryptedPayment. This object only stores the card's last four digits, and represents it as "encrypted" on the server.

For example, assuming an example credit card number ending in `8431`:

```javascript
var payment = new ECCreditCardEncryptedPayment('8431');
```

### Properties

| Property Name            | Discussion                                                                                        |
| ------------------------ | ------------------------------------------------------------------------------------------------- |
| `payment.lastFourDigits` | The last four digits set during instantiation. Can be retrieved, or set to another set of digits. |


# ECECardPayment

If you wish to represent a gift card to the server as a payment type, you utilize ECECardPayment. If the idea sounds familiar, it may be because Nintendo used them - ECards are officially Wii Points Cards.

For example, assuming every ECard is 16 digits long:

```javascript
var payment = new ECECardPayment('001122334455667788');
```

### Properties

| Property Name    | Discussion                                                                                                      |
| ---------------- | --------------------------------------------------------------------------------------------------------------- |
| `payment.number` | The typically 16 digit card number set during instantiation. Can be retrieved, or set to another set of digits. |


# ECAccountPayment

If you have a balance already available on account - say, Points - you can utilize ECAccountPayment. This allows specification of account information, or utilizes the registered copy on device.

### Constructors

If no constructors are specified, payment will be sourced from the device's configured account ID and device token within `ec.cfg`.

```javascript
var payment = new ECAccountPayment();
```

You may also specify the account ID and token, overriding the device's values:

```javascript
var payment = new ECAccountPayment('123456789', 'aphei7au1ceu8Wei2eec0');
```

Lastly, you may also only specify the account ID. However, this will authenticate with an empty device token, and purchases should be expected to fail.

### Properties

All properties may be retrieved and set. However, if not specified from the constructor, these values will be empty. Population of the configured account ID and token will only take place while formulating SOAP requests.

| Property Name      | Discussion                   |
| ------------------ | ---------------------------- |
| `payment.id`       | The account ID to utilize.   |
| `payment.password` | The device token to utilize. |


# ECTransactionInfo

If you want to query transaction info, you utilize an ECTransactionInfo object. You likely do not want to instantiate one yourself, instead retrieving transactions from the server via [ECommerceInterface](/wii-shop-channel/js/ec/ecommerceinterface):

```javascript
var infos = ec.getTransactionInfos();

// Ensure you check infos.length. In this example, we do not.
var info = infos.get(0);
```

### Properties

This array is considered immutable, and cannot be modified. Properties may only be retrieved.

| Property Name | Discussion                                                                                                                                                                          |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `info.id`     | The ID of this transaction.                                                                                                                                                         |
| `info.date`   | A UNIX timestamp representing when this transaction occurred.                                                                                                                       |
| `info.type`   | <p>A string representing its type, such as <code>PURCHGAME</code>.<br><br>It is unknown what types are available, as the client and frontend do not appear to check this field.</p> |

## ECTransactionInfos

`ECTransactionInfos` manages multiple of an `ECTransactionInfo`. It is regarded as immutable.

```javascript
var infos = ec.getTransactionInfos();
```

### Properties

| Property Name      | Discussion                                                                                                               |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| `infos.length`     | Returns the amount of available transactions in this array.                                                              |
| `infos.get(index)` | Retrieves the [ECTransactionInfo](/wii-shop-channel/js/ec/payment-objects/ectransactioninfo) at the given index.         |
| `infos.set`        | This array is considered immutable. Despite it existing, attempting to call or access this property results in an error. |


# Title Objects


# ECTitleLimit

Easily accessible title limits

If title limits are available on a ticket, it's possible to query them. For example, to retrieve the first limit for the System Menu:

```javascript
var ticket = ec.getTicketInfos("0000000100000002").get(0);
var limit = ticket.limits(0);
```

It is also possible to instantiate one yourself.

```javascript
var limit = new ECTitleLimit(code, limit, consumed);
```

### Properties

| Property Name | Discussion                                     |
| ------------- | ---------------------------------------------- |
| `code`        | A [Limit Type](#limit-types) name as a string. |
| `limit`       | The amount for this limit type.                |
| `consumed`    | Unknown.                                       |

### Limit Types

| Limit Name | Limit Value | Description  |
| ---------- | ----------- | ------------ |
| `PR`       | 0           | Permanent    |
| `TR`       | 1           | Trial        |
| `DR`       | 2           | Demo         |
| `SR`       | 3           | Subscription |
| `LR`       | 4           | Service(?)   |
| `AT`       | 100         | ?            |

## ECTitleLimits

`ECTitleLimits` manages multiple of an `ECTitleLimit`.

You have the ability instantiate one yourself, or have one provided to you via existing metadata.

```javascript
// Instantiation
var limits = new ECTitleLimits(/* up to 8 limits */);
```

```javascript
// Existing metadata
var ticket = ec.getTicketInfos("0000000100000002").get(0);
var limits = ticket.limits;
```

### Properties

| Property Name                    | Discussion                                                                                                                                            |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `limits.length`                  | <p>Returns the length of this limits array.<br><br>You may also set a new length for this array, resizing it.</p>                                     |
| `limits.get(index)`              | <p>Returns the <a href="/wii-shop-channel/js/ec/title-objects/ectitlelimit">ECTitleLimit</a> for this index.<br><br>This property may not be set.</p> |
| `limits.set(index, code, limit`) | <p>Sets the limit at the given index to have a new code and limit.<br><br>This property may not be retrieved.</p>                                     |


# ECTitleInfo

Easily accessible title metadata

ECTitleInfo represents information available about a title in a JavaScript-accessible, read-only method. Some data is sourced from the TMD. Properties may only be retrieved, not set.

You most likely do not want to instantiate this object yourself. Instead, prefer querying one directly from [ECommerceInterface](/wii-shop-channel/js/ec/ecommerceinterface). For example:

```javascript
var info = ec.getTitleInfo('0000000100000002');
```

### Properties

| Property Name             | Discussion                                                                                                                                                                                          |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `info.titleId`            | The title ID this object represents.                                                                                                                                                                |
| `info.isOnDevice`         | <p>Whether this title is present on the console.<br><br>It is unclear on when this may ever be false, as attempting to query a title not present on the console will return <code>-4050</code>.</p> |
| `info.isTmdPresent`       | <p>Whether a TMD is available for this title.<br><br>This may be possible if the user has removed the title, but its ticket is still present - i.e. removed via the System Menu.</p>                |
| `info.version`            | The version of this title.                                                                                                                                                                          |
| `info.occupiedUserBlocks` | The amount of blocks this title uses.                                                                                                                                                               |
| `info.occupiedUserInodes` | The number of inodes taken up by this title.                                                                                                                                                        |
| `info.occupiedSysBlocks`  | The amount of system-reserved blocks this title utilizes.                                                                                                                                           |
| `info.occupiedSysInodes`  | The amount of system-reserved inodes used by this title.                                                                                                                                            |

## ECTitleInfos

`ECTitleInfos` manages multiple of a `ECTitleInfo`. It is intended to be immutable, and cannot be set in any fashion.

Similar to ECTitleInfo, it's undesirable to instantiate one yourself. ECommerceInterface similarly provides a way to acquire one yourself. For example, to acquire title info for all available titles on the console:

```javascript
var infos = ec.getTitleInfos();
```

### Properties

| Property Name      | Discussion                                                                                                               |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| `infos.length`     | The amount of titles within this array.                                                                                  |
| `infos.get(index)` | Returns the [ECTitleInfo](/wii-shop-channel/js/ec/title-objects/ectitleinfo) at the given index.                         |
| `infos.set`        | This array is considered immutable. Despite it existing, attempting to call or access this property results in an error. |


# ECTicketInfo

Easily accessible ticket information

ECTicketInfo handles representing a ticket for a given title ID. It provides usable data about the status of the title on the Wii.

You do not want to instantiate this object yourself. Instead, obtain one via `ec.getTicketInfos(titleId)` and iterate through all [ECTicketInfos](#ecticketinfos) until you find what is desired. This will populate all ECTicketInfo available with usable data.

For example:

```javascript
// Obtains tickets for the System Menu
var infos = ec.getTicketInfos("0000000100000002");

// Ensure you check infos.length. In this example, we do not.
var ticket = infos.get(0);
```

### Properties

| Property Name          | Discussion                                                                                                                  |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `ticket.ticketId`      | The ticket ID of the retrieved ticket.                                                                                      |
| `ticket.titleId`       | The title ID this ticket is intended for.                                                                                   |
| `ticket.nLimits`       | The number of limits available for this ticket.                                                                             |
| `ticket.limits`        | Returns an [ECTitleLimits](/wii-shop-channel/js/ec/title-objects/ectitlelimit#ectitlelimits) object for the current ticket. |
| `ticket.version`       | The file version of this ticket, which should be 0.                                                                         |
| `ticket.deviceId`      | The device ID this ticket is specified for.                                                                                 |
| `ticket.ticketVersion` | The version of this title.                                                                                                  |
| `ticket.licenseType`   | <p>The type of license this ticket represents.<br><br>TODO: determine possible values</p>                                   |
| `ticket.cidxMask`      | <p>A base64-encoded field of some field within the ticket.<br><br>TODO: determine</p>                                       |
| `ticket.reserved`      | <p>A base64-encoded field of some field within the ticket.<br><br>TODO: determine</p>                                       |

## ECTicketInfos

`ECTicketInfos` manages multiple of an `ECTicketInfo`. It is intended to be an immutable array, and its values only be retrived, not set.

### Properties

| Property Name       | Discussion                                                                                                               |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `ticket.length`     | Returns the length of the tracked array.                                                                                 |
| `ticket.get(index)` | Returns the [ECTicketInfo](/wii-shop-channel/js/ec/title-objects/ecticketinfo) at the given index.                       |
| `ticket.set`        | This array is considered immutable. Despite it existing, attempting to call or access this property results in an error. |


# DL Tasks

Banner operations at your fingertips

As part of WiiConnect24, channels have the ability to register "tasks" permitting occasional download of any sort of file. For example, the Forecast Channel uses download tasks to update its information when idle. Historically the Wii Shop Channel changed its banner via download tasks.

You use a `wiiDLTask` object to interface with WC24 and manage tasks directly from JavaScript.

```javascript
var dlTask = new wiiDlTask();
```

## Members

| Member Name                             | Discussion                                                                                                                                                                                                                                              |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dlTask.addDownloadTask(url, interval)` | Adds a task to be downloaded. `url` should point directly to a file within the [WC24 Content](https://wiibrew.org/wiki/WiiConnect24/WC24_Content#WC24_encryption) format. `interval` is an integer given in minutes specifying when to repeat the task. |
| `dlTask.deleteDownloadTask()`           | Requests that one task is deleted. It is unclear how multiple tasks would be handled, if that is even possible.                                                                                                                                         |
| `dlTask.hasDeletedDLTask()`             | Verifies the amount of registered tasks is equal to 0.                                                                                                                                                                                                  |


# Keyboard

More input types than you can dream of

When you want to accept content from the user, you instantiate and interact with `wiiKeyboard`. Utilizing its method, you can specify layouts and options for input that best fit your content.

```javascript
var keyboard = new wiiKeyboard();
```

Note that `wiiKeyboard` will only function on pages loading over HTTPS. You will need to modify the Wii Shop Channel to load your content. Opera (and IOS via EC) only has SSLv3/TLS 1.0 available, so additional modifications to various trust levels may be necessary.

## Members

Unlike other objects, `wiiKeyboard` only exposes one member. Its usefulness is instead via its parameters variants.

| Member Name                                       | Discussion                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `keyboard.call(type)`                             | <p>Invokes a keyboard of the specified <a href="#keyboard-types">type</a>.</p><p></p><p><em>An example of</em> <code>keyboard.call(1)</code><em>.</em></p><p><img src="https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FlXfHAPWVdk8wCsXk7Pou%2FScreen%20Shot%202021-12-04%20at%2018.10.21.png?alt=media&amp;token=fc82d618-046a-4023-a8b8-5aa84c3b8ab0" alt=""></p>                                                                                                                                                                                                                                               |
| `keyboard.call(type, rowLimit)`                   | <p>Invokes a keyboard of <a href="#keyboard-types">type</a> with a limit of the amount of rows available for typing.</p><p></p><p><em>An example of a row limit when invoked as</em> <code>keyboard.call(1, 1)</code><em>. As the text (highlighted red to designate the error) exceeds the first row, it is deleted upon entry.</em></p><p><img src="https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FewaP9pWXh70m6jy4EvdQ%2Fimage.png?alt=media&amp;token=63381d6b-7692-4e5a-8374-188e61072132" alt=""></p>                                                                                                     |
| `keyboard.call(type, rowLimit, isPassword)`       | <p>Instantiates a keyboard of <a href="#keyboard-types">type</a> with <code>rowLimit</code> and whether the entered text <code>isPassword</code>. If true, entered text becomes asterisks after entry or space bar, as pictured beneath.</p><p></p><p><em>An example of</em> <code>keyboard.call(1, 3, true)</code><em>. Note that "text", highlighted red, has not yet converted to asterisks.</em></p><p><img src="https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FIY1NByRmrHsplW10JVuL%2FScreen%20Shot%202021-12-04%20at%2018.05.39.png?alt=media&amp;token=173cbaff-de75-470e-af0c-611bf5c2e50f" alt=""></p> |
| `keyboard.call(type, rowLimit, isPassword, hint)` | <p>Instantiates a keyboard of type with <code>rowLimit</code>, whether the entered text <code>isPassword</code>, and a background text of <code>hint</code>.</p><p></p><p><em>An example of</em> <code>keyboard.call(1, 3, false, 'Text Hint')</code>.</p><p><img src="https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FdxkUWklDa0A2aIuEdxSP%2FScreen%20Shot%202021-12-04%20at%2018.09.35.png?alt=media&amp;token=1b086cad-5b3b-4239-9302-cfb4c1aded47" alt=""></p>                                                                                                                                               |

## Keyboard Types

There are 11 variants of keyboards available. For all examples, the used code to invoke was similar to the following:

```html
<textarea rows="5" style="width: 100%" onmousedown="keyboard.call(1);"></textarea>
```

The 11 variants are as follows:

* [Default](#default)
* [Default (2)](#default-1)
* [Number Pad](#number-pad)
* [Default without Return, Completion, Number Pad](#default-without-return-completion-number-pad)
* [Large Font](#large-font)
* [Default without Return](#default-without-return)
* [Large Font without Return and Number Pad](#large-font-without-return-and-number-pad)
* [Large Number with Decimal](#large-number-with-decimal)
* [Large Number with Decimal (2)](#large-number-with-decimal-1)
* [Friend Code Entry](#friend-code-entry)
* [Default without Return](#default-without-return)

### Default

Type `0`, or defaulted to if any value above 13 is specified. A generic keyboard.

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2F02ssFIqAwl8orgHypmIu%2Fimage.png?alt=media\&token=da116f33-e6f8-4c24-84ad-05432523157c)

### Default (?)

Type `1`. Appears to behave similarly to [Default](#default) on all regions.

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FpcCKLg8d6TgdmXwSTAgg%2Fimage.png?alt=media\&token=c0dbfb0f-2d98-4e3d-9c6b-01133f733ba3)

### Number Pad

Type `2`. Provides a generic number pad, useful for things such as friend code entry.

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FU8WaYVur8Ptm0ca2QOpO%2Fimage.png?alt=media\&token=45a2907b-3229-4844-90b8-23e7904a7b80)

### Default without Completion, Return Key

Type `3`. The same as [Default](#default), but lacking a return key and word completion/suggestion.

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FJg6HLugitlfFF2DOsZZG%2Fimage.png?alt=media\&token=5dd02b2b-8fc2-46c1-a74d-89ec50b3a16c)

### Large Font

Type `4`. Entered text cannot exceed the text field's length.

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FHgEKYCUed32WI7T4o3oJ%2Fimage.png?alt=media\&token=b9902873-252d-4f1a-adcf-db8a12380126)

### Default without Return, Completion, Number Pad

Type `5`. Lacks word completion/suggestion, and the switcher UI between QWERTY and a number pad: <img src="https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FSmI9WuD131zOxkwnPI4R%2FScreen%20Shot%202021-12-04%20at%2018.35.16.png?alt=media&amp;token=c7fdbd80-e77e-49b1-bef8-7d8e8cc076c1" alt="" data-size="line">

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FFR86FJOmJAdJjVVmjaXj%2Fimage.png?alt=media\&token=a52feecc-5c39-4041-b39d-6b92b7de7fdf)

### Large Font without Return and Number Pad

Type `6`. Lacks word completion/suggestion, and the switcher UI between QWERTY and a number pad.

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2Fw9tETuwYEGwkgIbHASVQ%2Fimage.png?alt=media\&token=2736daaa-68cc-41a2-b201-a42565901530)

### Large Number with Decimal

Type `7`. Provides a decimal point alongside numeric entry.

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FSZF8uE9Ox2WnqQkVx9GE%2FScreen%20Shot%202021-12-04%20at%2018.37.59.png?alt=media\&token=050175f2-6f11-466f-abfa-5362c7fbca4e)

### Large Number with Decimal(?)

Type `8`. Appears to operate similarly to [Large Number with Decimal](#large-number-with-decimal) - TODO: Does this function differently in other regions?

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FjWHCTahk0moeve2J51dg%2FScreen%20Shot%202021-12-04%20at%2018.38.08.png?alt=media\&token=c0ddd49d-9289-4615-9057-3b5a8a661935)

### Friend Code Entry

Type `9`. Provides a usable Friend Code entry pad.

<div align="center"><img src="https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FhE6bQBgSmKN0vjSCTMo8%2FScreen%20Shot%202021-12-04%20at%2018.38.22.png?alt=media&amp;token=fcb3eadf-c963-4ec7-b5b7-a2122cb0134c" alt=""></div>

### Default without Return

Type `10`. Unlike [Default without Completion, Return](#default-without-return-key), this type does have completion. It lacks a return key.

![](https://568241064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbN-IqagpwSDYwN1Dj2%2Fuploads%2FaBdqgz7mxxwSdYgczsHd%2FScreen%20Shot%202021-12-04%20at%2018.38.41.png?alt=media\&token=cacd0339-71e3-437a-9280-b2f585f79e58)


# Mii

The best way to display user's Miis

When you want to source Mii imagery from a user, you use a mixture of JavaScript and the `miip` protocol. This is useful for identifying various users to send letters to, with all of its 64x64px action.

```javascript
var mii = new wiiMii();
```

## Members

| Member Name              | Discussion                                                                                                        |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| `mii.getMiiNum()`        | Returns the amount of Miis this console has. Will not exceed 100.                                                 |
| `mii.isValidIcon(index)` | Returns a boolean if the Mii at number *index* exists. This is helpful when looping to access via index from 100. |
| `mii.getMiiName(index)`  | Returns a string with the Mii at *index*'s name.                                                                  |

## Protocol

You have two ways of accessing Miis: via an index ([IDX](#method-idx)), or using the Mii's character ID ([CID](#method-cid)).

Regardless of what method, the `miip://` protocol accepts a basic format:

```
miip://METHOD/IDENTIFER.bmp?bgR=red&bgG=green&bgB=blue&width=64&height=64
```

You need to set a few params in order to use such a URL.

* `METHOD`  must be `IDX` or `CID`.
* `IDENTIFIER` is the value relating to what's mentioned above - be it an index of a Mii, or a friend's character ID.
* `bgR`, `bgG` and `bgB` are the background of the Mii image in integer values. Instead of 0xff in hexadecimal, you would write 255.
* `width` and `height` are the rendered size in pixels of this bmp.

### **IDX**

Nintendo imposes a max of 100 Miis. Due to this, you can iterate an index from 0-99 and call `wiiMii#isValidIcon(index)` to verify its validity.

For example, to show the images of all valid Miis and log names using the functions above:

```javascript
var mii = new wiiMii();

trace("Amount of Miis on console: " + mii.getMiiNum());
for (var i = 0; i < 100; i++) {
    if (!mii.isValidIcon(i)) {
        trace("Mii #" + i + " is not a valid Mii.");
    } else {
        trace("The Mii at index " + i + " has the name of " + mii.getMiiName(i) + ".");
        // Append a new image element for all Miis with a yellow background.
        var elem = document.createElement('img');
        elem.src = "miip://IDX/" + i + ".bmp?width=48&height=48&bgR=255&bgG=205&bgB=0";
        document.body.appendChild(elem);
    }
}
```

### **CID**

Every Mii has a unique ID (known as a Mii ID, character ID, or CID) derived from its creation timestamp and other data. (For more information, read the [WiiBrew article](https://wiibrew.org/wiki/Mii_data#Mii_format).)

When you utilize [NWC24](/wii-shop-channel/js/nwc24) to retrieve the user's friends list, you are able to query a friend's attached Mii and retrieve a usable CID. (For more in-depth information about the friends list, see its [available methods](/wii-shop-channel/js/nwc24#friends-list).) Internally, the CID is converted to a usable index.

For example, to iterate through all available friends and show their respective Miis:

```javascript
var nwc24 = new wiiNwc24();
var friendAmount = nwc24.getFriendNum();

trace("Amount of friends on console: " + friendAmount);

for (var i = 0; i < friendAmount; i++) {
    // Print information about the Mii for reference.
    var cid = nwc24.getFriendInfo(i, "miiImage")
    trace("The friend at index " + i + " has a CID of " + cid + ".");

    // Append a new image element for all Miis with a yellow background.
    var elem = document.createElement('img');
    elem.src = "miip://CID/" + cid + ".bmp?width=48&height=48&bgR=255&bgG=205&bgB=0";
    document.body.appendChild(elem);
}
```


# NWC24

WiiConnect24 functionality, directly within JS

To send mail via WiiConnect24 and query error code strings, you utilize `wiiNwc24`. With mail, you can send normal messages, or gift titles. And via error codes, you can provide a better user experience.

```
var nwc24 = new wiiNwc24();
```

## Methods

| Method Name                                                        | Discussion                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `nwc24.getFriendNum()`                                             | Returns the amount of friends on the user's friends list.                                                                                                                                                                                                                                                                                                                                                                                                           |
| `nwc24.getFriendInfo(num, type)`                                   | Queries information about the given friend list entry at `num`. For all possible `type` values, see [Friends List](#friends-list).                                                                                                                                                                                                                                                                                                                                  |
| `nwc24.sendGiftMailAsync(friendIndex, urlPath, message, miiIndex)` | <p>Sends a mail using the gift design template with a body of the given <code>message</code>. The recipient is specified by <code>friendIndex</code> from the friends list. The sending user adds their Mii via <code>miiIndex</code>. <code>urlPath</code> is the URL this channel opens to when the Start button is clicked.<br><br>Please see <a href="#async-handling">Async Handling</a> for more information about the workflow for handling mail errors.</p> |
| `nwc24.sendReturnMailAsync(friendIndex, message, miiIndex)`        | Similar to the above, however lacking the `url` parameter. The gift return design template is used.                                                                                                                                                                                                                                                                                                                                                                 |
| `nwc24.sendNormalMailAsync(friendIndex, message, miiIndex)`        | Similar to the above. As the name implies, no mail design template is applied.                                                                                                                                                                                                                                                                                                                                                                                      |
| `nwc24.isBusy()`                                                   | Returns whether the internal mail engine is currently processing an operation.                                                                                                                                                                                                                                                                                                                                                                                      |
| `nwc24.dispError(code, type)`                                      | <p>Displays an error with <code>code</code>. There are 3 available types, though they appear ambiguous:</p><ul><li>No type (or no arguments) displays an error screen with "Wii Menu" and "Reset Channel".</li><li>Type <code>2</code> appears to have a "Wii Menu" and "Reset Channel" button, though sometimes it does not.</li><li>Type <code>8</code> appears to only show "Reset Channel".</li></ul>                                                           |
| `nwc24.doLeftBtn()`                                                | Handles function for the button displayed on the left within errors. Depending on the error type, the button either effectively goes to the last loaded page in history, or it resets the channel.                                                                                                                                                                                                                                                                  |
| `nwc24.doRightBtn()`                                               | Called whenever the button on the right within error pages is selected. Depending on the error type, it either loads the initially loaded URL (for example, `/startup`) or resets the channel.                                                                                                                                                                                                                                                                      |

### Friends List

You query information about entries within the user's friends list via `nwc24.getFriendInfo(num, type)`. There are three available query types:

| Query Type | Discussion                                                                                                         |
| ---------- | ------------------------------------------------------------------------------------------------------------------ |
| `name`     | Returns the registered name for this friend as a string.                                                           |
| `userId`   | Returns the registered friend code as a string.                                                                    |
| `miiImage` | Returns a usable character ID for Mii image lookup. For more information, see [CID](/wii-shop-channel/js/mii#cid). |

### Async Handling

Unlike [ECProgress](/wii-shop-channel/js/ec/ecprogress) as utilized within EC, Nintendo chose yet another design. Users are expected to repeatedly query `nwc24.isBusy()` for&#x20;

## Properties (Get)

| Property Name                                                     | Discussion                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `nwc24.myUserId`                                                  | Returns a string with the current console's friend code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>nwc24.errCode</code><br><code>nwc24.mailErrNo</code></p> | Returns a number with the current registered mail error code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `nwc24.errCodeWithLabel`                                          | <p>Returns a string with a formatted error code.<br>For example, assuming a console with its language set to English, one might return "Error code: 123456".</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `nwc24.errMsg`                                                    | Returns a localized string with a description of the error message.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `nwc24.ready`                                                     | <p>Returns a boolean on whether an NWC24 error has been set.<br><br>TODO: Is this fully what the function performs?</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `nwc24.sendable`                                                  | <p>Determines on whether a message can be sent at call time, i.e. if the scheduler is busy.<br><br>TODO: Verify logic</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <p><code>nwc24.leftBtn</code><br><code>nwc24.rightBtn</code></p>  | <p>Returns a localized string to be displayed on the button within the given side of the page.<br><br>The button's string is determined from several factors.<br>For the right button:</p><ul><li><p>Is there a pending NWC24 error?</p><ul><li>If so, and the error is of type 4 or 10, the error is the localization of "Reset".</li><li>Otherwise, the string is the localization of "OK".</li></ul></li></ul><p>For the left button:</p><ul><li><p>Is there a pending NWC24 error?</p><ul><li>If so, and the current error minus seven (?) is greater than 2, or the current error is 10, localize "Try Again".</li></ul></li><li><p>What is the current launch code for the channel?</p><ul><li>If the launch code is 2 or 8, localize "Back".</li><li>Otherwise, localize "Wii Menu".</li></ul></li></ul> |


# SD Card

Easily accessible SD card querying

For all SD card queries, you utilize the `wiiSDCard` object. You use it to query statistics and informaton about the card, and call on it to perform title-related operations.

```javascript
var sdCard = new wiiSDCard();
```

## Members

| Member Name                               | Discussion                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sdCard.checkValidSD(titleId, titleSize)` | <p>Checks whether an SD card is inserted, and whether it is available to be mounted as FAT, similar to <code>isInserted()</code>.</p><p></p><p>Past this, it checks whether the given <code>titleId</code> with the given <code>titleSize</code> is available to be migrated to the SD, depending on a myriad of checks.</p><p></p><p>Returns a negative number if not successful, zero if possible.</p><p></p><p>TODO: Document what error codes in particular.</p> |
| `sdCard.isInserted()`                     | <p>Checks whether an SD card is inserted, and whether it is available to be mounted as FAT.</p><p></p><p>Returns <code>true</code> or <code>false</code>, depending on its state.</p>                                                                                                                                                                                                                                                                                |
| `sdCard.isJournaling()`                   | Checks with the internal SD card manager on whether a journaling task is ongoing.                                                                                                                                                                                                                                                                                                                                                                                    |
| `sdCard.getFreeKBytes()`                  | Returns the number of kilobytes free on the inserted SD card.                                                                                                                                                                                                                                                                                                                                                                                                        |
| `sdCard.getSDBackupSize()`                | Returns the size of the pending SD card backup operation.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `sdCard.setJournalFlag(titleId)`          | Marks the given `titleId` for downloading directly to the inserted SD card.                                                                                                                                                                                                                                                                                                                                                                                          |
| `sdCard.backupToSDCard(titleId)`          | Starts the backup (transfer?) of a title's data to the SD card.                                                                                                                                                                                                                                                                                                                                                                                                      |
| `sdCard.stopBackupToSDCard()`             | Halts the ongoing backup to the SD card. Does not clear copied data.                                                                                                                                                                                                                                                                                                                                                                                                 |
| `sdCard.setCancelJournal()`               | Cancels the ongoing journal operation.                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `sdCard.hasProgressFinished()`            | Returns `true` or `false` on whether a previously registered journaling or backup operation has completed.                                                                                                                                                                                                                                                                                                                                                           |


# Shop

Control the whole channel

When you wish to control the console itself, you utilize `wiiShop`. It is an important (and necessary) object to instanciate, as it controls the flow of the channel - rebooting, errors, options - alongside handling localization.

```javascript
var wiiShop = new wiiShop();
```

## Members

| Member Name                           | Discussion                                                                                                                                                                                                                                                                                                                                                |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `wiiShop.returnToUpdate()`            | Resets the system to the Wii System Update menu available in Settings.                                                                                                                                                                                                                                                                                    |
| `wiiShop.rebootSystem()`              | Resets the system - i.e. restarting the channel. On a Wii U, this appears to go to the Wii U Menu.                                                                                                                                                                                                                                                        |
| `wiiShop.returnToMenu()`              | Exits to the Wii System Menu.                                                                                                                                                                                                                                                                                                                             |
| `wiiShop.jumpToEULAViewer()`          | Resets the system to the EULA agreement channel.                                                                                                                                                                                                                                                                                                          |
| `wiiShop.jumpToManualChannel()`       | On a vWii, opens the [Wii Menu Electronic Manual](https://wiibrew.org/wiki/Wii_Electronic_Manual_\(vWii\)). As this channel is not available by default on normal Wiis, it fails to launch and goes to the Wii System Menu.                                                                                                                               |
| `wiiShop.retry()`                     | <p>First, it checks the current error code, if any.</p><p>If the error is:</p><ul><li>209506</li><li>209509</li><li>209510</li><li>209528</li><li>209535</li><li>209538</li><li>209540</li><li>209546</li></ul><p>the channel simply goes to the previous page.</p><p></p><p>If not, the channel is reset.</p>                                            |
| `wiiShop.beginWaiting()`              | Shows the spinner UI over the currently loaded page.                                                                                                                                                                                                                                                                                                      |
| `wiiShop.endWaiting()`                | Hides the spinner UI for the currently loaded page.                                                                                                                                                                                                                                                                                                       |
| `wiiShop.setWallpaper(type)`          | <p>Changes the image displayed in the borders of the loaded webpage. There are four types, specified by <code>type</code>:</p><ul><li><code>0</code>: Dotted blue lines, default</li><li><code>1</code>: Pure black</li><li><code>2</code>: Pure white</li><li><code>3</code>: Blue vertical lines, as used within the health and safety manual</li></ul> |
| `wiiShop.disableHRP()`                | Disables the HOME menu.                                                                                                                                                                                                                                                                                                                                   |
| `wiiShop.enableHRP()`                 | Enables the HOME menu.                                                                                                                                                                                                                                                                                                                                    |
| `wiiShop.error(errorCode, errorType)` | <p>Displays an error page with <code>errorCode</code>.</p><p></p><p>TODO: Determine what types are available for this section. <code>0</code> and <code>1</code> are known.</p>                                                                                                                                                                           |
| `wiiShop.closeManual()`               | Apparently available to close the shop's manual, it simply returns to the Wii System Menu.                                                                                                                                                                                                                                                                |
| `wiiShop.jumpDataMng()`               | Opens Data Management within the Wii System Menu.                                                                                                                                                                                                                                                                                                         |
| `wiiShop.setSCARank(rank)`            | <p>Changes the appearence of Mario in the download screen:<br><br>- <code>0</code>: Small Mario<br>- <code>1</code>: Star Mario<br>- <code>2</code>: Mario running against Bullet Bills<br>- <code>3</code>: Fire Mario<br><br>Anything above <code>3</code> will display Fire Mario.</p>                                                                 |

## Properties (Get)

| Property Name              | Discussion                                                                                                                                                                                                                              |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `wiiShop.errMsg`           | <p>Returns a localized string for the current error message.</p><p></p><p>TODO: Determine how this is set, and why error code 209658 is handled differently.</p>                                                                        |
| `wiiShop.errCode`          | Returns the current error code registered as a string.                                                                                                                                                                                  |
| `wiiShop.title`            | Returns a localized string of the channel. In English, this is "Wii Shop Channel".                                                                                                                                                      |
| `wiiShop.retryBtn`         | Returns a localized string for the retry button, such as "Try Again" in English.                                                                                                                                                        |
| `wiiShop.menuBtn`          | <p>If launched normally, returns a localized string for "Wii Menu".</p><p></p><p>If launched as a manual viewer, returns a localized string for "Back" .</p>                                                                            |
| `wiiShop.wiiUMenuBtn`      | Returns a localized string for "Wii U Menu".                                                                                                                                                                                            |
| `wiiShop.eulaBtn`          | Returns a localized string for "Proceed".                                                                                                                                                                                               |
| `wiiShop.eulaMsg`          | Returns a localized paragraph pleading for the user to agree to the Wii Network Services Agreement.                                                                                                                                     |
| `wiiShop.manualBtn`        | Returns a localized string for "Continue".                                                                                                                                                                                              |
| `wiiShop.connecting`       | <p>Returns a localized string for "Connecting. Please wait..."</p><p></p><p>This string is extremely important and must be accessed on each page load. Please see <a href="#undefined">Connecting example</a> for more information.</p> |
| `wiiShop.isCompatibleMode` | <p>Appears to always return 0, as nothing accesses what it reads from at 0x803607f9.</p><p></p><p>TODO: Verify</p>                                                                                                                      |
| `wiiShop.launchCode`       | <p>Returns some variant of a launch code, which is also referenced to check if the channel was launched to be a manual viewer.</p><p></p><p>TODO: Determine possible codes</p>                                                          |

### Connecting Example

It is important that `wiiShop.connecting` variable is accessed once per page load, as it stops an internal timer. It is additionally important that its value is set to a variable and not cast away, as it being accessed is what cancels the timer.

If the timer is not cancelled, error 209601 is displayed after 100 seconds.

The following code block provides an example of the bare minimum required to prevent an error thrown:

```javascript
var wiiShop = new wiiShop();
const unused = wiiShop.connecting;
```

## Properties (Set)

| Property Name                        | Discussion                                                                                                                                                                           |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `wiiShop.getLogUrl = stringVariable` | <p>Sets a log URL to the given string.</p><p></p><p>TODO: where and how is this used otherwise? It seemingly cannot be queried, and nothing accesses the URL throughout runtime.</p> |
| `wiiShop.fadeColor = integerValue;`  | <p>Sets a color to fade to when exiting from the Mario downloading animation.</p><p></p><p>TODO: Is this correct?</p>                                                                |

## Test Variables (Get/Set)

It's unclear on what these are used for: the channel never utilizes set values throughout operation, nor does the Nintendo-provided Wii Shop Channel. Their values persist unmodified throughout the current channel's launch, making them the numerical equivalent to a cookie, at best. One can assume that they were most likely included for testing purposes with the C++ <-> JS runtime bindings for Opera. Nonetheless, they are included.

| Property Name | Discussion                                                                                                              |
| ------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `wiiShop._a_` | General-purpose [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type. |
| `wiiShop._b_` | General-purpose [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type. |
| `wiiShop._c_` | General-purpose [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type. |
| `wiiShop._d_` | General-purpose [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type. |


# Sound

Life's better with sound

When you want to play sound effects or start background music, you do so via the `wiiSound` object.

```javascript
var sound = new wiiSound();
```

## Members

| Member Name            | Discussion                                                                                        |
| ---------------------- | ------------------------------------------------------------------------------------------------- |
| `sound.playSE(effect)` | Plays the sound effect designated by `effect`. See [Effects](#undefined) for further information. |
| `sound.playBGM()`      | Plays the Wii Shop Channel's well-known theme.                                                    |

## Effects

There are 13 available sound effects to play. You specify an effect index as the `effect`.

The effect names are derived from their listing within `IplSound.brsar`, such as `WIPL_SE_CHAR_DELETE_ERROR`.

<table><thead><tr><th width="150" data-type="number">Index</th><th>Sound Effect</th><th>Discussion</th></tr></thead><tbody><tr><td>1</td><td>"Push"</td><td>Seemingly silent.</td></tr><tr><td>2</td><td>Hover/Target</td><td>The sound played when hovering over buttons.</td></tr><tr><td>3</td><td>"Decide"/Select</td><td>A success-like sound, played upon button selection.</td></tr><tr><td>4</td><td>Cancel</td><td>A sound played when pressing the Back button.</td></tr><tr><td>5</td><td>Choice Change</td><td>The sound played when selecting another option in a ratio menu.</td></tr><tr><td>6</td><td>Error</td><td>A short sound designating an error. Internally called <code>WIPL_SE_CHAR_DELETE_ERROR</code>, it appears to be the same effect from the Wii's keyboard.</td></tr><tr><td>7</td><td>Add Point</td><td>An effect played upon successful point addition.</td></tr><tr><td>8</td><td>Copy Finished</td><td>A success sound played upon download completion.</td></tr><tr><td>9</td><td>Small Mario Jump</td><td>A small jump effect.</td></tr><tr><td>10</td><td>Large Mario Jump</td><td>A larger jump sound effect.</td></tr><tr><td>11</td><td>Fire Ball</td><td>The expected fire ball effect.</td></tr><tr><td>12</td><td>Coin</td><td>A coin hit effect.</td></tr><tr><td>13</td><td>Hit Block</td><td>The hit block sound effect from various Mario games.</td></tr><tr><td>14</td><td>Copying</td><td>Something very close to the existing Mario jump sounds.</td></tr><tr><td>15</td><td>Loading</td><td>The loading sound displayed with the spinner.</td></tr></tbody></table>


# Base Format

Throughout all SOAP requests


# IAS


# CheckRegistration


# GetRegistrationInfo


# SyncRegistration


# GetChallenge


# Register


# Unregister


# ECS


# AcceptGiftTitle


# ConfirmCSS


# CheckAccountBalance


# CheckDeviceStatus


# DeleteETickets

...or DeleteTitleETickets

TODO(spotlightishere): confirm


# GetECConfig


# GetETickets


# GiftTitle


# ListETickets


# ListPurchaseHistory


# MigrateETickets


# MigratePoints


# NotifyETicketsSynced


# PurchaseTitle


# PurchasePoints


# RedeemAllSCATitles


# CAS


# GetCountryAttributes


# ListContentSets


# ListContentSetGroups


