Main Menu
Main Page
Forums
Recent changes
Random page
Help

Databases
GlitchDex
AttackDex
ItemDex
TrainerDex
TypeDex
UnownDex
More

Major Glitches
Trainer escape glitch
Old man trick
Celebi trick
Select glitches (Japan)
SRAM glitch
CoolTrainer♀ corruption
LOL glitch
Rival LOL glitch
Super Glitch
ZZAZZ glitch
Pomeg corruption glitch (Glitzer Popping)
Tweaking
Elite Four door glitch (Japan)
Pokémon merge glitch
Pokémon cloning
Time Capsule exploit
Arbitrary code execution
Coin Case glitch
More

Other Glitch Categories
Glitches by generation
Glitches between two generations
Japan-only/language specific glitches
Music glitches
Natural glitches
Non-core series glitches
Non-Pokémon glitches
Officially acknowledged glitches
Recurring glitches
Dead glitches

References
Pokémon GameShark codes
The Big HEX List
Glitch Pokémon cries
GB programming
Curiosities
Debugging features
Easter eggs
Error traps
Glitch areas
Glitch myths
Non-glitch exploits
Placeholder texts
Pokémon glitch terminology
Unused content and prerelease information

Useful Tools
8F Helper
GBz80 to Items
Old man trick name generator
PATH (Prama's Advanced Tweaking Heaven)
Save file editors
Special stat/Pokémon converter
Trainer escape Trainer Pokémon finder

Affiliates
Legendary Star Blob 2 (Hakuda)
Pokémon Speedruns wiki
PRAMA Initiative
Become an affiliate!

Search Wiki

 

Search Forums

 

Author Topic: Emulating the Mobile Adapter GB  (Read 10874 times)

0 Members and 1 Guest are viewing this topic.

ravioli

  • 🤔
  • GCLF Member
  • *
  • Offline Offline
  • Gender: Male
  • ur a big guy
    • View Profile
    • 42chan
Re: Emulating the Mobile Adapter GB
« Reply #15 on: July 23, 2017, 07:18:00 am »
I know that GCF has such a reputation for having an excellent and eagerly helpful community when it comes to this kind of stuff, but I would like to see if anybody can/help me in making a legitimate emulator that connects to DION or any homebrew server we chose.

It shouldn't be so difficult right? The Dolphin team emulated the SP1 Broadband board quite successfully iirc.

Also, does the mobile phone adapter still work in 2017? As in, if I edited the rom of Crystal and the Mobile Trainer to not connect to gameboy.datacenter.ne.jp but instead to our own server, would it work?

MissingNo

  • A003 KEY SEQUENCE IS NOT VALID
  • Oldbie
  • *
  • Offline Offline
  • Gender: Male
  • is your local kotaKat
    • View Profile
    • Me!
Re: Emulating the Mobile Adapter GB
« Reply #16 on: July 23, 2017, 06:30:13 pm »
Thoughts I wanna throw out there from my limited Japanese phone system knowledge:

AFAIK, the PHS network allowed for the use of "personal" cells that interconnected to the Japanese PTSN (eg, to use your PHS phone as a cordless home phone). PHS phone + DDI PHS adapter + PHS base station + Asterisk magic(?)/dial up server/email system for comms = "real life" Mobile Adapter GB emulation?

SatoMew

  • Member+
  • *
  • Offline Offline
  • Gender: Female
    • View Profile
Re: Emulating the Mobile Adapter GB
« Reply #17 on: July 31, 2017, 08:23:03 am »
There is already an emulator that supports the Mobile Adapter GB.

https://github.com/shonumi/gbe-plus

ravioli

  • 🤔
  • GCLF Member
  • *
  • Offline Offline
  • Gender: Male
  • ur a big guy
    • View Profile
    • 42chan
Re: Emulating the Mobile Adapter GB
« Reply #18 on: August 05, 2017, 07:33:19 pm »
There is already an emulator that supports the Mobile Adapter GB.

https://github.com/shonumi/gbe-plus

I can't find any documentation on that.

Torchickens

  • Administrator
  • *****
  • Online Online
  • Gender: Female
    • View Profile
Re: Emulating the Mobile Adapter GB
« Reply #19 on: August 06, 2017, 06:57:12 am »
There is already an emulator that supports the Mobile Adapter GB.

https://github.com/shonumi/gbe-plus

There is already an emulator that supports the Mobile Adapter GB.

https://github.com/shonumi/gbe-plus

I can't find any documentation on that.

Wow that's news to me too. How do you use it on Windows and get Pokémon Mobile System GB to work with it?
« Last Edit: August 06, 2017, 08:41:34 am by Torchickens »
Hello. I actually identify as gender questioning, but nowadays feel more firmly that I identify as female. My sex is male but I like to express myself as female.  She/her pronouns, please.


Thank you Aeriixion for the cute sprite above! :) Roelof also made different variations of the sprite (which I animated).

Contact:

Email Youtube Twitter
Skype: Torchickens
Bulbapedia Starfy Wiki

Beyond all philosophies are the things that go best for you; what makes you feel content. It's important to always follow your heart, so unless you feel perfectly happy about it don't just follow something because it is popular, fits a style or is conventional. Sometimes you may reach a point you're not sure who you are, but as things settle I'm convinced things do work out in time.

Wack0

  • Coder, reverser, beta collector [BetaArchive staff]
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • cBRH - Doing nothing since 2k7
    • View Profile
Re: Emulating the Mobile Adapter GB
« Reply #20 on: August 06, 2017, 08:44:12 am »
I looked at the code, the emulation there is incomplete, and seems only there to get Mobile Trainer to work.
C H E C K E D . B U I L D S . A R E . A W E S O M E N E S S

BetaArchiveSoftHistory Forumsirc.rol.im #galaxy,#softhistory

Also known as The Distractor.

Shane, please stop telling children that there's a Mew outside under the delivery trucks. - Management

Pokémon: arbitrary code execution 1996-2016

Torchickens

  • Administrator
  • *****
  • Online Online
  • Gender: Female
    • View Profile
Re: Emulating the Mobile Adapter GB
« Reply #21 on: August 06, 2017, 08:47:54 am »
I looked at the code, the emulation there is incomplete, and seems only there to get Mobile Trainer to work.

I see, thanks.  :) That's a shame. :/

A little later I found a Windows download link on the Emu Gen wiki, but I still don't know how to get Mobile Trainer to work on it.

http://emulation.gametechwiki.com/index.php/GBE%2B
Hello. I actually identify as gender questioning, but nowadays feel more firmly that I identify as female. My sex is male but I like to express myself as female.  She/her pronouns, please.


Thank you Aeriixion for the cute sprite above! :) Roelof also made different variations of the sprite (which I animated).

Contact:

Email Youtube Twitter
Skype: Torchickens
Bulbapedia Starfy Wiki

Beyond all philosophies are the things that go best for you; what makes you feel content. It's important to always follow your heart, so unless you feel perfectly happy about it don't just follow something because it is popular, fits a style or is conventional. Sometimes you may reach a point you're not sure who you are, but as things settle I'm convinced things do work out in time.

XOlifreX

  • GCLF Member
  • Offline Offline
  • Gender: Male
  • Olifre from Mario Kart World
    • View Profile
    • Youtube Channel
Re: Emulating the Mobile Adapter GB
« Reply #22 on: August 10, 2017, 04:27:04 pm »
Fantastic that this is being worked on!
I would love to see the Mobile Adapter GB being fully emulated, not only for Pokémon, but for other games aswell!

I, myself, would love to see the GBA game Mario Kart Super Circuit work with the Mobile Adapter. The game only used the platform for time trail rankings & exchanging ghosts.

PokeAcer549

  • GCLF Member
  • Offline Offline
  • CHARIZRAD 'M ROXORX or is it.
    • View Profile
Re: Emulating the Mobile Adapter GB
« Reply #23 on: August 11, 2017, 06:23:13 am »
It'd be cool to see the actual web servers this used brought back; a null-modem cable could be constructed using the real Mobile Adapter GB, which could then plug into a PC for actual Internet connection.
(Or, find a way to make one that works with newer phones using USB-OTG on Android devices)

ravioli

  • 🤔
  • GCLF Member
  • *
  • Offline Offline
  • Gender: Male
  • ur a big guy
    • View Profile
    • 42chan
Re: Emulating the Mobile Adapter GB
« Reply #24 on: August 12, 2017, 09:25:10 pm »
I am going to begin working on this to connect to the actual internet. I would like someone like Hacky who has an actual mobile gb adapter too.

I made a discord for people who would like to help!

https://discord.gg/DFkW5KU

Háčky

  • Distinguished Member
  • *
  • Offline Offline
  • Pick which packet as an error?
    • View Profile
Re: Emulating the Mobile Adapter GB
« Reply #25 on: August 13, 2017, 01:59:33 am »
I have actually been working on this occasionally over the past several months, but never found the time to compile my notes into something coherent.

I’ve figured out how the HTTP authentication scheme is supposed to work (an essential prerequisite for creating a server), and have also mostly documented the Pokémon News system. I need to put together a video to show that off, which I should do tomorrow.

I have some design plans for a server and client, but haven’t implemented anything. I might start on that this week, although I’m torn on whether to do that first or decipher the Battle Tower system.

Also, does the mobile phone adapter still work in 2017? As in, if I edited the rom of Crystal and the Mobile Trainer to not connect to gameboy.datacenter.ne.jp but instead to our own server, would it work?

The adapter still works for peer-to-peer communication (Pokémon Cable Club) as long as the handsets are able to receive service. The last PDC network shut down in March 2012, and the original frequency allocation for CDMA service in Japan was changed in July 2012, so it is likely that only DDI Pocket handsets still work, as their service continues under the Y!mobile brand.

To allow the adapter to connect to the Internet, an alternative to the DION dial-up service would need to be provided. Assuming that were possible, the adapter would need to be reconfigured to dial that service instead of DION; this could be achieved by running a specially-prepared ROM off a flash cartridge, or perhaps through an elaborate arbitrary code execution exploit. But if you could connect to your own dial-up ISP, you wouldn’t need to edit the domain names in the ROM; you could just intercept requests at the ISP end and redirect them to the server of your choice.

If the goal is just to connect a real Pokémon Crystal (or other compatible game) cartridge to a reconstructed server, then a much simpler way to achieve that would be to plug a device directly into the link port and emulate the Mobile Adapter GB in exactly the same way that a PC-based emulator would. (Can a Raspberry Pi bit-bang at 256 Kib/s?)

It'd be cool to see the actual web servers this used brought back; a null-modem cable could be constructed using the real Mobile Adapter GB, which could then plug into a PC for actual Internet connection.

That’s another possibility, but would require knowing the protocol the adapter uses to control the handset (surely it’s documented somewhere?). Also, I doubt the requisite connectors are still manufactured, so some disassembly may be required… :)

Eventually I’ll want to do something like that anyway, in order to test the actual behavior of the adapter and find out what those missing numbers in the command list are for.

Torchickens

  • Administrator
  • *****
  • Online Online
  • Gender: Female
    • View Profile
Re: Emulating the Mobile Adapter GB
« Reply #26 on: August 13, 2017, 06:06:05 am »
I have some design plans for a server and client, but haven’t implemented anything. I might start on that this week, although I’m torn on whether to do that first or decipher the Battle Tower system.

I'd personally love to see a server and client even if it doesn't support the Battle Tower first. :) Though it may be a good idea to make sure the Battle Tower system works first, if online battles/trades work sooner rather than later then it's really exciting and doing a few test battles could be fun, you could release it in a video for people to use, and you could always incorporate the Battle Tower functionality later for a later release.

On the other hand it may be fun to learn how the Battle Tower works.

Up to you of course though, I would feel torn as well.
« Last Edit: August 13, 2017, 08:45:15 am by Torchickens »
Hello. I actually identify as gender questioning, but nowadays feel more firmly that I identify as female. My sex is male but I like to express myself as female.  She/her pronouns, please.


Thank you Aeriixion for the cute sprite above! :) Roelof also made different variations of the sprite (which I animated).

Contact:

Email Youtube Twitter
Skype: Torchickens
Bulbapedia Starfy Wiki

Beyond all philosophies are the things that go best for you; what makes you feel content. It's important to always follow your heart, so unless you feel perfectly happy about it don't just follow something because it is popular, fits a style or is conventional. Sometimes you may reach a point you're not sure who you are, but as things settle I'm convinced things do work out in time.

Parzival

  • The Betrayed, The Cleansed, The Reborn
  • GCLF Member
  • *
  • Offline Offline
  • It begins.
    • View Profile
    • YT Channel
Re: Emulating the Mobile Adapter GB
« Reply #27 on: August 13, 2017, 07:16:44 pm »
Question: If we connect to a server from a client, but it's over Dial-Up, is it still technically considered to be running on an actual adapter and therefore valid in TAS?
Ask me about betrayal.
Ask me about depression.
Ask me about death.
Ask me about destruction.
Ask me about hardship.
I've been through s**t.
If you need to talk to someone, my PM inbox is always open.


Háčky

  • Distinguished Member
  • *
  • Offline Offline
  • Pick which packet as an error?
    • View Profile
Re: Emulating the Mobile Adapter GB
« Reply #28 on: August 15, 2017, 09:38:22 pm »
Okay, “tomorrow” was two days ago, but I have this silly, old-fashioned obsession with factual accuracy and needed to recheck a bunch of things. I guess it would be easier if I posted more often… :)

Question: If we connect to a server from a client, but it's over Dial-Up, is it still technically considered to be running on an actual adapter and therefore valid in TAS?

I think more research is needed to determine accurate timings for the adapter ;D




HTTP authentication scheme
Nintendo’s mobile library will attempt to authenticate the user with the Mobile System GB server only when a POST request is made for http://gameboy.datacenter.ne.jp/cgb/upload or http://gameboy.datacenter.ne.jp/cgb/ranking, and only if the filename at the end of the URI begins with a number indicating a service fee (even if it’s ¥0).

Even when those conditions are met, the library has a bug that can cause it to fail to detect whether authentication is required:

Code: [Select]
; Find the string terminator at the end of the URI
.asm_1112a0
ld a, [hli]
or a
jr nz, .asm_1112a0

; Now back up and find the last slash
; Right now, hl points to the byte *after* the string terminator!
; If that byte happens to be a slash ($2F), this code may
; fail to properly detect whether this is a paid upload.
; There ought to be a “dec hl” here.
.asm_1112a4
ld a, [hld]
cp $2f
jr nz, .asm_1112a4

Since Pokémon Crystal does not erase the last URI in memory before writing the next in a series of requests, it is possible that the residual byte after the string terminator could be a slash if a previous URI was longer than the current one. A careful choice of URIs avoids this issue.

An authentication attempt begins by sending an HTTP GET request, to which the server responds with 401 Unauthorized and a WWW-Authenticate: GB00 name="…" header, where the name is an arbitrary 36-byte value encoded in Base64.

The game then sends another GET request, this time with the header Authorization: GB00 name="…", where the name is a concatenation of two separate Base64-encoded values: the first is the first 32 bytes from the WWW-Authenticate name, and the second is a 36-byte value determined by a byzantine procedure:
  • The login password is appended to the 48-character Base64-encoded WWW-Authenticate name, and then this string is hashed with MD5.
  • The 36-byte WWW-Authenticate value is split into two 18-byte values, the first containing all of the even-numbered bits of the original and the second containing all of the odd-numbered bits. The first byte of each two-byte pair fills the most significant bits of each output byte, and the second byte fills the least significant bits. These values are concatenated into a new 36-byte string.
  • The login ID is appended to the MD5 hash from step 1. This string is padded with $FF until it is 35 bytes long, then a $00 is added to make it 36 bytes.
  • The 36-byte strings produced in steps 2 and 3 are xor’d.
  • But that would have been too simple, so then each byte has bits 0, 3, and 6 rotated into bits 3, 6, and 0.
The first step necessitates that the server retains users’ plaintext passwords in order to calculate arbitrary MD5 hashes from them—unless the value in the WWW-Authenticate header is predetermined, which would allow the hash to be precalculated, but would make the rest of this shell game even more pointless as a successful authentication attempt could be replayed.

If the Authorization header is valid, the server responds with 200 OK and a Gb-Auth-ID header which contains an arbitrary string. The game then sends its POST request and includes the same Gb-Auth-ID header.


Pokémon News
A Pokémon News download begins by accessing http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/news/index.txt, a text file containing four URIs which are used to:
  • Download metadata for the current News issue
  • Upload selected data from the save file
  • Upload scores to be added to the rankings, and receive the updated rankings in response
  • Download the current News issue
The cost of Pokémon News was ¥100 per issue. The fourth URI should be tagged with that cost so that it is displayed by the game; the two upload URIs should be tagged with a cost of ¥0 so that the game will authenticate and upload the data.


Metadata
The metadata file is an unstructured hodgepodge of variable-length fields, the boundaries of which can only be determined by parsing each field in its own unique way. In typical Game Freak style, the game makes no effort to validate the data received from the server or protect against buffer overflows. A malformed metadata file can certainly crash the game and corrupt the save file (I’ve done it more than once), and could probably execute arbitrary code.

Unique ID: This is a fixed-width field which, inexplicably, is 12 bytes long. If this ID is the same as the last News that was downloaded, then the download is aborted with the message 「あたらしい ニュースは ありません でした」 There was no new News.

Description: A text string, terminated with $50, that is displayed in the lower text box when the player is asked to confirm whether he or she wants to upload the save data and proceed with the News download.

Rankings save address: This 2-byte field contains the address where the rankings data will be stored in SRAM bank 6. Since the main News data will be written starting at 6:A000, the rankings data should be placed somewhere around 6:B000, such that the News does not overwrite the rankings.

Rankings metadata: This field begins with a 16-bit value denoting the length of the data that follows. The data is a series of 16-bit values, one for each rankings table that will be sent, indicating the width of a record in each rankings table. (For example, if there are 9 different rankings tables and each table contains 26-byte records, this field would be 12 00 1A 00 1A 00 1A 00 1A 00 1A 00 1A 00 1A 00 1A 00 1A 00.)

Save data selection: This is a list of the regions of save data that will be sent to the server. Each region is specified by four bytes: the first byte is an SRAM bank, the second and third are an address, and the fourth is the number of bytes to send. The end of the list is marked with $FF. The requested data is concatenated and uploaded as a binary file.

Rankings data selection: This specifies the data that will be submitted for the rankings. The rankings data is submitted as key–value pairs in the manner of an HTML form submission, with the values encoded in ASCII hexadecimal. Each key is a string literal (in ASCII?) terminated with $50 (ASCII "P"‽). Each value is specified with a bank number, address, and length in the same manner as the save data upload. The list of key–value pairs is terminated with $50 (i.e., an empty string where the name of the next key would be expected).

Although data can technically be read from anywhere in SRAM, there is a block of data at 5:A001–A082 which exists specifically for use in the rankings. With the exception of 5:A016–A017, which doesn’t seem to be referenced at all, this block comprises 2-, 3-, or 4-byte big-endian values which are managed by a series of functions in bank $41. (Except for the Battle Tower win counter, these functions are still called in the English version in the relevant situations, but they’ve been dummied out, and wouldn’t work anyway since SRAM bank 5 doesn’t exist.)

AddressLengthDescription
A0014Play time when last entered the Hall of Fame (2 bytes hours, 1 byte minutes, 1 byte seconds)
A0054Step count when last entered the Hall of Fame
A0093Number of times the party was healed when last entered the Hall of Fame
A00C1Extraneous byte copied from 5:A03C when last entered the Hall of Fame
A00D3Number of battles when last entered the Hall of Fame
A0104Step count
A0142Number of Battle Tower wins
A0183Number of times TMs and HMs have been taught
A01B3Number of battles
A01E3Number of wild Pokémon battles
A0213Number of Trainer battles
A0243Unused
A0273Number of Hall of Fame inductions
A02A3Number of wild Pokémon caught
A02D3Number of hooked Pokémon encounters
A0303Number of Eggs hatched
A0333Number of Pokémon evolved
A0363Number of Berries and Apricorns picked
A0393Number of times the party is healed
A03C3Number of times Mystery Gift is used
A03F3Number of trades
A0423Number of uses of field move Fly
A0453Number of uses of field move Surf
A0483Number of uses of field move Waterfall
A04B3Number of times the player whited out
A04E3Number of Lucky Number Show prizes won
A0513Number of Phone calls made and received
A0543Unused
A0573Number of Colosseum battles
A05A3Number of times player’s Pokémon used Splash
A05D3Number of tree Pokémon encounters
A0603Unused
A0633Number of Colosseum wins
A0663Number of Colosseum losses
A0693Number of Colosseum ties
A06C3Number of times player’s Pokémon used SelfDestruct or Explosion
A06F2Current streak of consecutive slot machine wins
A0712Longest streak of consecutive slot machine wins
A0734Total coins won from slot machines
A0774Total money earned from battles (including Pay Day)
A07B2Largest Magikarp measured
A07D2Smallest Magikarp measured
A07F2Bug-Catching Contest high score
A0812Bytewise checksum of A001–A080

There are functions which would increment the three-byte values at 5:A024, 5:A054, and 5:A060, but these functions don’t appear to be referenced even in the Japanese version.

5:A039 is incremented when the party is healed at a Pokémon Center, by the machine in Elm’s Lab, by Mr. Pokémon after giving the Mystery Egg, by Lance in the Rocket Hideout, by the old woman on Route 26, by resting in the bed on the S.S. Aqua, or before a Battle Tower or mobile Colosseum battle. It is not incremented when the party is healed after whiting out, by using a Sacred Ash, after winning or losing the first rival battle in Cherrygrove City, or after defeating the last Rocket Grunt in Slowpoke Well, Sailor Stanly on the S.S. Aqua, Lance at the Pokémon League, or Red at Mt. Silver.

The value from 5:A039 is then copied into 5:A009 when entering the Hall of Fame, but 4 bytes are copied rather than 3, so the high byte of the number of times Mystery Gift was used is copied into 5:A00C. (That byte will still always be $00, because Mystery Gift can’t be used more than 65535 times before the SRAM battery runs out. ;))

5:A05A and 5:A06C are incremented when the effect of the move is executed during the player’s turn, regardless of whether it was chosen by the player, chosen by a disobedient Pokémon, or called through Metronome, Mirror Move, or Sleep Talk.

Save data upload
The game uploads the save data as specified in the metadata file. The body of the server’s response is of no consequence.

Rankings upload
The game uploads the rankings data as specified in the metadata file. The server responds with the updated rankings tables. The game saves that data to the address specified in the metadata file. Each table begins with a 12-byte header:

OffsetLengthDescription
$04Number of ranked players (big-endian)
$42Unknown
$64Player’s rank (big-endian; will be treated as unranked if this value is greater than the number of ranked players)
$A2Number of entries in the table (big-endian)

The number of ranked players may be greater than the number of entries in the table; e.g., 1000 players might be given ranks (shown only to themselves) even though the table only lists the top 10 (shown to everyone).

Each entry in the table is of the length specified in the metadata file. The first 24 bytes follow a fixed format and the remaining bytes (up to 4?) are the score value.

OffsetLengthDescription
$007Trainer name
$071Prefecture (values assigned in gojūon order from $01 = Aichi-ken to $2F = Wakayama-ken)
$082Unknown
$0A1Age
$0B1Gender ($00 = male, $01 = female)
$0C12Message (six two-byte little-endian easy chat words)
$18?Score (big-endian)

News download
The game downloads the News issue, stores it at 6:A000, and then executes it.

Based on the historical accounts of Pokémon News (particularly Kakeru’s transcripts of the last seven issues), which describe various quizzes, minigames, and rewards (including, of course, the GS Ball), it can be surmised that the News involves a scripting language with many different commands. Without access to any of the original News downloads, it could be quite a challenge to determine how the data is packaged and what the available commands are, and then reconstruct something resembling a News issue.



Good news, everyone! Game Freak left us some samples in ROM bank $7D.

There are three unused functions in that bank which each copy a different block of data to 6:A000. If a News issue has already been downloaded, these functions overwrite it with data from the ROM. (If no News had been downloaded, the game will say 「まえの ニュースが ありません!」 “There is no old NEWS…” when attempting to view it. This can be manually overridden by setting 5:AA72 to $01.)

This data in the ROM does not include any of the metadata or rankings tables, only the main News download. (This means we don’t know what data from the save file would be requested by the server, or what message would be displayed before downloading the News.) Also, dispointingly, none of the text of these News issues was translated in Vietnamese Crystal.

Here’s a video showing each of the News issues found in the ROM.


Trainer Rankings
A News issue entitled 「トレーナーランキング」 Trainer Rankings appears at 7D:5C6B in the Japanese ROM and at 7D:5DB4 in the localized ROMs. The function to copy this data into SRAM is at 7D:5C56 in the Japanese ROM and at 7D:5D9F in the localized ROMs.

This is the simplest News issue found in the ROM, having no features other than the rankings. It matches the screenshots on pages 25–26 of the Pocket Monsters: Crystal Version: Mobile Guide (ポケットモンスター クリスタルバージョン モバイルのてびき) packaged with the Mobile Adapter GB.

The main menu has four options:
NameDescription
ランキング を みる
View Rankings
いろいろな ランキングが みれます
View the different rankings.
ランキング の せつめい
Rankings Description
ランキングの せつめいです
A description of the rankings.
ランキング の こうしん
Update Rankings
さいしんの ランキングを ダウンロード します
Download the latest rankings.
やめる
Quit
ニュースを みるのを やめます
Quit viewing the News.

The background music for these menus is “Elm Pokémon Lab”.

Quit (or pressing B) returns to the News Machine menu. Update Rankings downloads the News metadata from the server, and then proceeds to submit the save data and rankings again only if the unique ID of the News issue has not changed. The description of the rankings says:

Quote
3つの テーマで ランキング!
いま おくった レポート からも
なにかが ランキングに はいって
いるかも しれません!

Rankings in three categories!
Now something from the save file you sent could be in the rankings!

View Rankings brings up a submenu to select from three ranking categories:
  • コロシアムで かった かいすう Number of Colosseum wins
  • むしとりたいかい こうとくてん Bug-Catching Contest high score
  • つった コイキングの おおきさ Size of caught Magikarp
In each category, there are three rankings:
  • ぜんこく の ランキング National ranking
  • とどうふけん の ランキング Prefectural ranking
  • ゆうびんばんごう の ランキング Postal code ranking
The latter two rankings would depend on the prefecture and the three-digit prefix of the postal code entered in the Mobile Profile. If the player has opted not to enter a postal code, it’s treated as 000 (no actual Japanese postal code starts with 000).

The first of the downloaded rankings tables is expected to contain the national ranking for Colosseum wins, the second one the prefectural ranking for the same, the fourth one the national ranking for the Bug-Catching Contest, et cetera.

Selecting any ranking shows the top 10 entries; for each entry, the trainer name, score, gender, age, prefecture can be seen, as well as the message they set in the Mobile menu. At the bottom of each top-10 ranking, the player can see their own current score (read from the corresponding address in SRAM: 5:A063 for the Colosseum, 5:A07F for the Bug-Catching Contest, and 5:A07B for the largest Magikarp) and ranking (as of the last rankings download, so not necessarily consistent with the score read from SRAM). If the player is not ranked, their score is followed by the message 「ランクイン しなかった… ざんねん…」 You were not ranked… Sorry…

The message 「ランキングデータが ありません[。] ランキングの こうしんを するば みることが できます」 There is no rankings data. You can see it by updating the rankings. appears in this News data (and all the other ones, too), but I don’t know what circumstances would cause it to appear.

In the Japanese ROM only, there is a near-identical copy of this News data at 7E:4000. (In the localized ROMs, bank $7E instead contains data for the offline Battle Tower and Odd Egg event.) The only difference is that the copy at 7E:4000 is missing four bytes at offset $002. Two of these missing bytes represent the length of the remaining data and the other two bytes are a bytewise checksum of that data. Since the checksum fails, the game refuses to load this version of the data, saying 「ニュースの データが こわれています[。] よみこみ なおして ください」 “The NEWS data is corrupted. Please download the NEWS again.”


Trainer Rankings (bis)
Another News issue entitled 「トレーナーランキング」 Trainer Rankings appears at 7D:4015 in the Japanese ROM and 7D:4018 in the localized ROMs. The corresponding function to copy this data into SRAM is at 7D:4000 in the Japanese ROM and 7D:4003 in the localized ROMs.

The most obvious difference between this News issue and the other one is that the main menu has an additional option called 「ポケモンなきごえクイズ」 Pokémon Cries Quiz, with the description 「ポケモンの なきごえを あててね!」 Guess the Pokémon cries!. The quiz has ten Pokémon to choose from: Suicune, Clefairy, Spearow, Gastly, Togepi, Zubat, Jynx, Espeon, Mewtwo, and Dunsparce. For each one, the player can listen to three different cries and guess which one is the correct cry for that Pokémon. There’s no scoring and no reward for guessing correctly. The background music for the quiz is “Hurry Along 2”.

The rankings menus have several changes:

The Update Rankings option has been…updated…to give some feedback after the download: If successful, 「ランキングの こうしんを しました!」 Rankings update done! If the news ID has changed, 「ランキングの こうしんに しっぱい… あたらしい ニュースを よみこんで ください」 Rankings update failed… Please load the new News. If cancelled by the user (or an error occurs?), 「ランキングの こうしんを やめました」 Rankings update cancelled.

The category Number of Colosseum wins has been replaced by 「バトルタワーで かった かいすう」 Number of Battle Tower wins. Notably, this ranking tries to read the player’s score from the unused location 5:A016, rather than the correct address 5:A014.

The local rankings now have the player’s prefecture and postal code in the title of the rankings (e.g., mine are called 「とうきょうと の ランキング」 and 「〒000 の ランキング」 because I set my prefecture to Tōkyō-to and didn’t set a postal code).

Selecting a blank entry in the top 10 now displays the message 「ここには だれも ランクイン してません」 No one is ranked here.

If the player’s score in any ranking is checked using the 「[player’s name] の じゅんい」 option and the player is #1 in that ranking, this message is displayed:

Quote
ランキングで トップを とった
あなたに…
すてきな プレゼントが あります
おたのしみに!

For earning the top spot in the ranking…
Here is a wonderful gift! Enjoy!

This triggers the GS Ball event; the player will receive the GS Ball upon leaving the PokéCom Center.


Pokémon News Debug Starting Issue
A News issue entitled 「ポケモンニュース デバッグかいしごう」 Pokémon News Debug Starting Issue appears only in the Japanese ROM at 7D:4DD0.  The function to copy this data into SRAM is at 7D:4DBB.

The main menu options are:
NameDescription
トレーナーランキング
Trainer Rankings
いろいろな ランキングが みれます
View the different rankings.
ポケモンなきごえクイズ
Pokémon Cries Quiz
ポケモンの なきごえを あててね!
Guess the Pokémon cries!
ゲーフリからのメッセージ
Message from Game Freak
ゲームフリークからの メッセージです
A message from Game Freak.
やめる
Quit
ニュースを みるのを やめます
Quit viewing the News.

Trainer Rankings leads to a submenu identical to the first Trainer Rankings news data. The Pokémon Cries Quiz is identical to the one in the second Trainer Rankings news data. The Message from Game Freak could probably be translated better by someone who knows what they’re doing, but I’ll give it a shot:

Quote
さわやかな あきかぜが ふきぬける
きょう このごろですが
みなさま いかが おすごしで
いらっしゃいますでしょうか

われわれ クリスタルチームは
まいにち みぎてに マウス
ひだりてに こぶしを にぎりしめ
ねむくなれば おたがいを なぐり
かんせいに むけて はげんでおります

この ニュースは デバッグように
つくられて おります

ですので なきごえクイズなどでも
『ずかんにない ポケモンが!
…という ごしんぱいは
ごむようで ございます

それでは ひきつづき ニュースの
デバッグを よろしく おねがいします

もちろん ほかのところも
よろしく おねがいします
……… ……… ………

As the refreshing autumn breeze now blows through, is everyone getting along well?

Every day our Crystal Team is striving to finish the game, with our right hands holding our mice, and our left hands clenched in fists to hit each other if we get sleepy.

We made this News for debugging use.

Thus, in the Cries Quiz for example, you don’t need to worry about things like, “That Pokémon’s not in the Pokédex!”

That said, we ask that you continue with debugging the News.

Of course, we’d like you to work on other things as well…

This message seems to be directed at Nintendo’s product testers, which suggests it may have been deliberately included in the final build that Game Freak submitted for testing. The background music for the message is “National Park”.


Pokémon News First Issue
In the localized ROMs, the Pokémon News Debug Starting Issue is replaced by an entirely different issue entitled 「ポケモンニュース そうかんごう」 Pokémon News First Issue, found at 7D:4DD3. The function to copy this data into SRAM is at 7D:4DBE.

The fact that it appears in the localized ROMs and not the Japanese ROM suggests it may have been developed after the Japanese ROM was finalized. The name implies that it could be the actual first issue of Pokémon News that was published when the Mobile System GB launched in January 2001. However, I don’t think it is, because it contains the same script as the second Trainer Rankings data for awarding the GS Ball to a player who is #1 in any ranking, and I’m not aware of any documentation that the GS Ball was actually distributed in this manner.

The main menu options are:
NameDescription
ニュースガイド
News Guide
よみこんだ ニュースを かんたんに せつめいします
A brief description of the loaded News.
トレーナーランキング
Trainer Rankings
3つの テーマで ランキングを します!
Rankings in three categories!
ポケモンカルト
Pokémon Cult
これまでの ぼうけんを どこまで おもいだせるか テストします!
Test how well you remember your adventure so far!
やめる
Quit
ニュースを みるのを やめます
Quit viewing the News.

The News Guide says:

Quote
ポケモンニュース そうかんごうでは
トレーナーランキングと
ポケモンカルトクイズで
おたのしみ ください!

あなたの ランキングの せいせきは
ランキングの こうしんを すれば
なんどでも かきかえられるので
がんばれば トップに なれるかも!

In the Pokémon News First Issue, please enjoy Trainer Rankings and the Pokémon Cult Quiz!

Your rankings can be updated as many times as you like; try your best and you might reach the top!

The Trainer Rankings submenu is pretty much the same as the second Trainer Rankings data (including the GS Ball reward), except that the player’s score for Number of Battle Tower wins is read from the correct address, 5:A014. The menu items have been rearranged and most of the descriptions rewritten:

NameDescription
ランキング を みる
View Rankings
いろいろな ランキングが みれます
View the different rankings.
ランキング の こうしん
Update Rankings
ランキングを よみこみなおします
あなたの せいせきも かわります
Reloads the rankings. Your results will also change.
ランキング の せつめい
Rankings Description
こんかいの ランキングの テーマに ついて せつめいします
Describes the current rankings categories.
やめる
Quit
さいしょの ページに もどります
Return to the first page.

The Rankings Description is more descriptive:

Quote
バトルタワーで かった かいすうは
40ばんどうろの バトルタワーで
あなたが これまでに なんにんの
トレーナーとの しょうぶに かったか
にんずうで きそいます

コイキングの おおきさは
いかりのみずうみに いる
つりめいじんに はかってもらった
コイキングの うち いちばん
おおきかった もので きそいます

むしとりたいかい こうとくてんは
しぜんこうえんで おこなわれる
むしとりたいかいで これまでに
とった いちばん たかい
てんすうで きそいます

“Number of Battle Tower wins” is ranked by the number of trainers you’ve won battles against so far in the Battle Tower on Route 40.

“Size of caught Magikarp” is ranked by the largest Magikarp measured by the Fishing Guru at Lake of Rage.

“Bug-Catching Contest high score” is ranked by the highest score earned so far in the Bug-Catching Contest held in the National Park.

The Pokémon Cult Quiz, unlike the cries quiz, is a proper quiz with scoring. Ten multiple-choice questions are presented in sequence, varying from mildly obscure (Is Mom’s specialty a Cinnabar Volcano bakemeat burger, curry, or yakisoba?) to incredibly obscure (How many times did Earl spin around before he entered the Pokémon Academy?). After you’ve answered all of the questions, Professor Oak evaluates your performance, although he doesn’t give any reward. The background music during the quiz is “Goldenrod Game Corner”, and the music for the evaluation is “Pokégear Radio: Professor Oak’s Pokémon Talk”.


News data structure
While I haven’t yet endeavored to write my own fake news, I have done some basic analysis of the structure of the existing data:

Header
The data has a six-byte header; the first two bytes are 00 A0, the next two bytes are a bytewise checksum of the data (excluding the header), and the final two bytes are the length of the data (excluding the header). As mentioned above, the duplicate News data at 7E:4000 in the Japanese ROM omits these checksum and length values, and therefore doesn’t work in the final game.

Screen data
Data for the opening screen of the News issue begins immediately after the header. Other screens use the same data structure, which may be placed anywhere in the file and called using script command $01.

LengthDescription
1Background music ID
1Number of custom palettes
Custom palette data. Four two-byte color values. Repeat × number of custom palettes.
1Number of boxes to draw
Box data. The first two bytes are origin x and y coordinates, the next two bytes are length and width, the fifth byte is the border type, and the sixth byte is the palette. Repeat × number of boxes to draw.
1Number of strings to print
Position to print a string, expressed as an offset into the screen buffer, followed by the string itself ($50-terminated). Repeat × number of strings to print.
12Menu origin x and y coordinates, number of columns and rows, column width and row height, plus six more bytes of menu parameters?
16Offsets to script data for each of the eight joypad buttons (A B Select Start ← → ↑ ↓). These offsets are relative to the start of the current screen data. The value $FFFF is used for a button which has no script.
1Number of menu items.
4Position to print menu descriptions, expressed as an offset into the screen buffer, and width and height of the area to be blanked before printing a description. (The blanked area begins one row above the given text position, to account for diacritics.)
1If not $00, loads the rankings table specified in 0:CD62. (That address should have been set by a script on the prior screen.)
Pointer to the name of each menu item. Repeat × number of items.
Pointer to script data for each menu item. Repeat × number of items.
Pointer to description text for each menu item. Repeat × number of items.

If anyone wants to have a go at documenting the News script commands, they’re in Jumptable17d72a in pokecrystal’s misc/mobile_5f.asm. Also of interest is the text character $15, which invokes another, smaller scripting language within a text string; this is used extensively in the Pokémon News data to insert variables into strings. Those commands are defined by the jumptable in Function17f047.
« Last Edit: August 15, 2017, 09:45:18 pm by Háčky »

ravioli

  • 🤔
  • GCLF Member
  • *
  • Offline Offline
  • Gender: Male
  • ur a big guy
    • View Profile
    • 42chan
Re: Emulating the Mobile Adapter GB
« Reply #29 on: August 16, 2017, 09:48:30 am »
Cool! I've backed up all your documentation on http://42chan.org/mgb/gb.html. I always have a server if you need it for emulating the GB adapter..