Mobile Trainer GB Mobile Adapter Server Technical Documentation 0.1
November 05, 2018
Shonumi aka D.S. Baxter

***************************************************
1. Introduction
***************************************************

Mobile Trainer is utility software designed as a configuration tool for the Mobile Adapter GB. It also served as a basic web-browser and email client when connected to the Mobile System GB network. The cartridge came bundled with every Mobile Adapter and was released on January 27, 2001.


***************************************************
2. Server Structure
***************************************************

Mobile Trainer is currently known to access the following URL:

* http://gameboy.datacenter.ne.jp/01/CGB-B9AJ/index.html

Although a few other URLs are present within the ROM, the above is the only ones observed in actual use. Additionally, Mobile Trainer is currently known to access POP3 mail servers on port 110 and SMTP servers on port 25.


***************************************************
3. index.html
***************************************************

This is the "Home Page" for the Mobile Adapter. News and updates published by Nintendo would appear here periodically. Other pages could be accessed if the Home Page had links. Beyond a few screenshots, not much else has been recorded about the content and structure of the Home Page.


***************************************************
4. Web Browser
***************************************************

Mobile Trainer features a barebones web-browser supported a limited subset of HTML. The following HTML elements are known to render:

* <a>		Hyperlinking can be selected with d-pad and A button
* <b>		This turns text red instead of black
* <br>		New line
* <div>		Starts a new line, can use the align="" attribute
* <center>	Centers text. Needs to be inside <html></html> tags to render
* <html>	Not necessary for most elements to render correctly
* <hr>		Works
* <img>		Only accepts 1BPP BMPs. If 404, displays a small "broken image" icon
* <title>	Works
* <li>		Works
* <ol>		Works
* <ul>		Works. Little tiny dot for bullet points

Manual URL input is not possible from the browser. As such, it is restricted to the Home Page and whatever links appear in the index.html file. Bookmarks can be saved, however, and accessed without having to go through the Home Page. Manually editing the save file would allow bookmarks to point to arbitrary URLs.

Accessing the Home Page and associated links is timed, as the Mobile Adapter keeps an active connection to the server, thus a service charge (from the wireless provider) would be applied for the total time spent browsing. Handily enough, there is an option within the browser to cut the connection and freeze the timer.

<img> tags will only work with 1BPP BMP files. There are several additional restrictions:

* Maximum size is 144x96. While the BMP specification allows width and height to be defined as 32-bit integers, any image where the dimensions exceed 8-bit integers is rejected.
* The offset to pixel data in the BMP file header must be a 16-bit integer, despite being 32-bit in the specification.
* The 16-bit value for BPP in the BMP image header must be 0x1 (with the MSB being zero).
* The 16-bit value for planes in the BMP image header must be 0x1 (with the MSB being zero).
* The entire 32-bit integer for compression flags in the BMP image header must be zero.
* The entire 32-bit integer for the number of color maps in the BMP image header must be zero.

Just about everything else in the BMP file and image header is ignored. Most image editors will produce a BMP that works fine with the Mobile Trainer web-browser. Some BMPs may need minor alterations. For example, GIMP may set the number of color maps but otherwise typically produce a valid BMP for Mobile Trainer (in which case, the incorrect bytes can be manually changed in a hex editor).

It appears that the browser is only capable of displaying a single unique image per webpage. That is to say, if a webpage tries to use two different images, only the first one will be displayed. This is likely a means to conserve RAM, as even small 1BPP images, when multiplied, could quickly eat away at the GBC's memory. A single image can be displayed various times on a webpage. The Mobile Trainer browser renders HTML dynamically, so that one image can be stored in RAM and converted into VRAM tiles as often as needed. The browser will make an HTTP request for multiple images on the same page, but based on the URL, it seems to discard any additional images once the first has been loaded.


***************************************************
5. Email
***************************************************

Email could be sent and received by Mobile Trainer. Users would have to register a DION account and would receive their information (email address, password, etc). Other game servers on the Mobile System GB network could send email to this account for various reasons. Pokemon Crystal, for example would send an email if a deposited Pokemon had been traded with another player. The email server itself is essentially a standard POP3 and SMTP server for receiving and sending email. The email format sent follows this format roughly (keep in mind the xxxx and yyyy and zzzz parts are not exactly lengths, consider them variable).

MIME-Version: 1.0
From: xxxx@yyyy.dion.ne.jp (=?ISO-2022-JP?zzzzzzzzzzzzzzzz)
To: [email_address]
Subject: =?ISO-2022-JP?xxxx
X-Game-title: MOBILE TRAINER
X-Game-code: CGB-B9AJ-00
Content-Type: text/plain; charset=iso-2022-jp
[content_of_email]

As the above makes clear, emails are sent using ISO-2022 character encodings. The recepient's email address is not checked or verified by Mobile Trainer. It will blindly hand over the mail to the SMTP server, only showing the user and error if the server reports a problem. It is unknown if there were restrictions on which email addresses the Mobile System GB would service (only other DION email for Mobile Adapter customers, or anyone anywhere?) Email can be sent and received from the same menu. A small animation appears of the player walking to a digital post office and sending mail and receiving any new mail afterwards.

Also of note: there is absolutely no encryption done and any POP or SMTP transfer. While the limited nature, obscurity, and short lifespan of the Mobile System GB network probably prevented any major security concerns from appearing, by modern standards it is a security nightmare. For example, when retrieving mail via the POP3 server, both user ID and password are transmitted in plaintext. Those two pieces of information would be enough to impersonate another user for any other Mobile Adapter compatible game.