Zumi's Scratchpad

Tale of my first GBS rip


95% of this post was written on 2020-09-14 - a few days after Pokémon Picross GBC leaked along with the rest of the GB lotcheck, this was touched up at time of publishing.

The Leak™

A new set of unreleased Game Boy ROMs had leaked onto /ppg/ (the Pokémon prototype general threads on 4chan /v/) alongside the source code of Pokémon Platinum. It's all under newroms.7z, and if you're scouring through it, here are all of the game listings. Highlights of which are ECE-0 a.k.a. the official English localization of X, named "Lunar Chase", as well as AKVJ a.k.a the unreleased Pokémon Picross from the 90s. The latter is particularly interesting (Of course, it's /ppg/)

GBC Pokémon Picross seems to be pretty much complete, even going through this lot check. I wonder if this iteration of Picross is kind of a Star Fox 2 moment... going through all the dev work only to then be canned at the last minute. Either way, it's Picross. With Ash, Misty, and Pikachu. Has some of the locations we know in Pokémon Red/Blue and you catch 'em all by playing Picross.

If you've never played Picross before, basically you have a grid, where, to the top of the first row you have all the revealable stuff on every column, and to the side of the first column is vice versa. You're gonna want to guess which one of every tile on the grid can be revealed, and if you get it wrong, that's a point loss.

The Music

Just like the game itself, it's a trove alright. Compared to Jupiter's other games (notably Mario's Picross) it sounds rather simplistic. Most tracks here are 3 channels only and mono. Someone figured out a sound test cheat and someone else promptly dumped most of the soundtrack.

As for me, I made a small incision to the game to figure out how the music is laid out. That incision is at address 7e:4f18 (in BGB-speak). My findings thus far is that it's the kind of engine that puts a pitch byte and then how long to hold the note. It's laid out kind of like the main Pokémon games - note and length on a single byte. Some asides: poking 28:440f lets you change the title screen music (in GBC only), and that you can freeze RAM addresses df57 and df58 to disable the title demo timer.

The Ripping

I wanted to rip this thing to a proper GBS, but where to start? I tried finding where the game updates sound (and inits it). Usually a Game Boy program would update sound on V-blank, so I figured it might be there. Then I would need to follow the trail for the init, etc.

As Sanqui pointed out that the game was made by the same devs who worked on Mario Picross, they suggested I should go take a look at that. Engine similarities. So I did just that for some reference. The GBS had the engine identifier of DSEQ. I noticed that Pokémon Picross has one of DSEQLITE. After some mindless tracing, I thought, for shits and giggles, why not just try copying the GBS-specific code from Mario Picross onto a new Pokémon Picross GBS? I copied the headers from Mario Picross up to 0x80, and pasted the contents of bank 7e on to there. I didn't expect anything to work, but suddenly I was hearing sound. Holy shit. What?

As it turns out, it worked because the layout for interfacing with the sound engine is really similar. At the beginning of the bank (0x4000) is a jump to init the sound engine and load a song. After that, is a jump to the sound update routine. This is done so that the routines in V-blank don't have to jump to different locations for each bank. Also, that bank 7e was even one entirely dedicated to music and sound effects. The DSEQLITE signature should tell me all.

There was some additional data in Mario Picross's GBS code to sort out the tracks and such. As a result, this preliminary Pokémon Picross GBS had the wrong track order. Because I wanted to quickly post, I just hacked in a sequential 01 02 03 04... in place of the existing track order. After I did that, posted my findings to /ppg/ and a few friends. Thanks to a discussion I had with FCAndChill some time ago (during the gigaleaks) I was reminded that HCS64 exists, and I knew where to upload it.

Then I found out there was another bank dedicated to music, so my rip was really incomplete. I decided to forgo the hex editing route and go straight to source. I took what I need from my pokecrystal-gbs repo (the GBS main file and the Makefile) and modified some stuff. I wrote up a replacement ASM that would not only play music, but also make the SFX accessible. From both banks, and the bankswitching is pretty standard. From there, I might as well call it a day and upload there. Or will I?

The Tags

Every rip on HCS64/joshw archives follows a certain format. In case of GBS rips, it should be a 7z with the game code (e.g. DMG-AKVJ-JPN) as the GBS name. And there's also a bunch of M3U's that should also follow these formats:

I don't feel like editing all of these myself, so I made a JSON file that would represent the necessary elements, and then just use Python to bring it together.

Long story short, I made a tool to get whatever metadata is on the JSON and generate a "proper" directory structure from it. I used py7zr to make it spit out a usable 7z right from the getgo. Put it in my Makefile. Although I can't really name the file according to specs since the Makefile would choke on it.

During this, I have also asked FCAndChill a ton of questions, even registering at the forums (and then the Discord). I asked them about the technicalities of a rip, what to add, and reviewing it in general. I was really nervous at the time.

They hooked me up with ppltoast who logged a complete run of the game, obviously something I couldn't save time, invest effort, or bother with myself. I was pretty anxious, thinking I'm just gonna get spit out and I even considered him for the tagging credits (since the conventions don't really have any room for comments). Got them to try recognizing some tracks I didn't have context for other than the ones from the YouTube rip, no dice. Though I did get context for the two other staff roll tracks using his completed save file.

I eventually uploaded to HCS64, then to /ppg/. However I realized after the fact that labelling it as a (Prototype) would be wrong since it was in the lot check with finished games, and there indeed is an (Unreleased) tag here. After being informed of it, I headed to the forums to issue a rename request, although now I'm under the impression that the Discord is more active so... idk

The Results

So that's a rip.

Here it is: https://mega.nz/folder/dHBG1A6I#J0WM_BOxY8ud7HcUOd70Lw

Update, it's on joshw/hcs64 right now! Though it hasn't been renamed yet. Oh well, we still have cool music.

I also have source code for my GBS rip - you do need to have the original ROM for it to build though.