Skip to content

Instantly share code, notes, and snippets.

@jaames
Last active January 5, 2024 14:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaames/daa7c92ae97d5de446cf87605abd5f55 to your computer and use it in GitHub Desktop.
Save jaames/daa7c92ae97d5de446cf87605abd5f55 to your computer and use it in GitHub Desktop.
Nintendo DSI Shop reverse-engineering notes

ECommerceInterface

This API provides access to information and features related to ecommerce. Such as providing a list of installed titles, etc

Setup

First it's necessary to create an instance of the ECommerceInterface class, the instance is used to interact with the API.

Nintendo create a single instance and store it globally as ec:

var ec = new ECommerceInterface();

Methods

getSessionValue(key)

setSessionValue(key, value)

getDeviceInfo()

Returns an object with

country
region
isParentalControlEnabled
userAge
language
accountId
deviceId
serial

getTitleInfos()

Returns a title list object containing details for every installed title. This function is slow, so it should only be called once and then be cached. The title list object can be iterated through like so:

var titleList = ec.getTitleInfos()
if (typeof(titleList) === "object") {
  // loop through title list
  for (i = 0; i < titleList.length; ++i) {
    // get title item by index
    var title = titleList.get(i);
    // get title ID
    var titleId = title.titleId;
    // etc
  }
}

DSi shop filters out some results from this. It will only show titles that follow some specific rules:

  • The title ID must begin with 0001 (a Nintendo Partner ID) or 0003.
  • The title ID cannot begin with 00010005; these are data titles.
  • The title must have a personalised ticket; the deviceId value returned by getTicketInfos(titleId) cannot be 0.

getTicketInfos(titleId)

setWebSvcUrls(ecsUrl, iasUrl)

Set the SOAP endpoint urls for e-commerce and identity authentication.

In DSi Shop, ecsUrl = https://ecs.t.shop.nintendowifi.net/ecs/services/ECommerceSOAP and iasUrl = https://ias.t.shop.nintendowifi.net/ias/services/IdentityAuthenticationSOAP

setContentUrls(ccsUrl, ucsUrl)

In DSi Shop, ccsUrl = http://ccs.cdn.t.shop.nintendowifi.net/ccs/download and ucsUrl = https://ccs.t.shop.nintendowifi.net/ccs/download

getProgress()

cancelOperation()

checkDeviceStatus()

refreshCachedBalance()

checkParentalControlPassword(password)

getWeakToken()

getDeviceInfo()

Returns object with:

  • country
  • region
  • isParentalControlEnabled
  • userAge
  • language
  • accountId
  • deviceId
  • serial

ECTimeout

Unsure what this timeout does exactly, its constructor takes an integer value eg var timeout = new ECTimeout(60000)

Kong API

DSi Shop also provides a general JavaScript interface via the Kong API, this API includes things such as page transitions, playing sound effects, detecting button input and some other neat features.

First it's necessary to create an instance of the Kong constructor (a reference to Donkey Kong, I suppose?), the instance is used to interact with the API.

Nintendo create a single instance and store it globally as gkong (probably short for "global kong"), so we'll be doing the same:

var gkong = new Kong;

Now the following methods will be available on gkong:

Methods

print

Restart

ReturnToMenu

SetUpUrl

Load a URL with the top screen window

SetDownUrl

Load a URL with the bottom screen window

PlaySe

var TWL_SHOP_SE_ONMOUSEDOWN   =  16; // #define TWL_CMN_SE_TOUCH        16 // 16 // 20
var TWL_SHOP_SE_ONCLICK       =  17; // #define TWL_CMN_SE_DECIDE       17 // 17 // 19
var TWL_SHOP_SE_TRANSIT       =  37; // #define TWL_SHP_SE_LOADED       37 // 35 // 17
var TWL_SHOP_SE_INVALID       =  23; // #define TWL_CMN_SE_INVALID      23 // 23 // NEW
var TWL_SHOP_SE_WARNING       =  36; // #define TWL_SHP_SE_WARNING_PAGE 36 // 34 // NEW

SetTransition

first arg is upper screen transition, second arg is lower screen

//----------------------------------------
//-- define : wipe animation types of transition (see Kong::SetTransition)

var WIPE_ANIM_NONE        = 0;
var WIPE_ANIM_TRANS       = 1;
var WIPE_ANIM_TRANS_LEFT  = 2;
var WIPE_ANIM_TRANS_RIGHT = 3;
var WIPE_ANIM_LEFT        = 4;
var WIPE_ANIM_RIGHT       = 5;
var WIPE_ANIM_DOWN        = 6;
var WIPE_ANIM_UP          = 7;
var WIPE_ANIM_OVER_LEFT   = 8;
var WIPE_ANIM_OVER_RIGHT  = 9;

SetManualTransition

SetTransitionRangeOnce

StartManualTransition

GetMessage

var JMS_shop_error_title = 0;
var JMS_shop_error_code  = 1;
var JMS_shop_menu        = 2;
var JMS_shop_reset       = 3;
var JMS_shop_ok          = 4;
var JMS_shop_title       = 5;
var JMS_shop_menu_02     = 6;
var JMS_shop_reset_02    = 7;
var JMS_shop_yes         = 8;
var JMS_shop_no          = 9;

GetErrorCode

GetErrorMessage

KbdActive

//----------------------------------------
//-- define : keyboard kinds & types of field (see Kong::KbdActive)

var KBD_KIND_TEN          = 0;
var KBD_KIND_QWERTY       = 1;
var KBD_KIND_NO_JAPANESE  = 2;
var KBD_KIND_JAPANESE     = 3;

var KBD_FIELD_NORMAL      = 0;
var KBD_FIELD_4444        = 1;

ShowDialog

ShowClickEffect

takes x and y args

ShowLoadingIcon

HideLoadingIcon

ShowUpWindowScrollButton

ShowDownWindowScrollButton

takes 4 args

HideUpWindowScrollButton

HideDownWindowScrollButton

ShowProgressBar

UpdateProgressBar

IsProgressBarAnimFinished

HideProgressBar

StartRepeatScroll

StopRepeatScroll

LeftScroll

ScrollUpWindow

ScrollDownWindow

GetUpDocumentHeight

GetDownDocumentHeight

JumpToSystemUpdate

CreateSaveData

IsSaveDataCreating

FinishDownload

IsBatterySufficient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment