Kuwanger.net

Plugin2GBA

Plugin2GBA is a binary patcher to allow for Pogoshell plugins to be used without Pogoshell. This was specifically created because many flash carts of today (like the EZ-Flash IV) are not Pogoshell compatible. While it would be hypothetically possible to mold Pogoshell to all these flash carts, Pogoshell is mainly oboslete--the main reason for Pogoshell was to more effectively use SRAM and most newer flash carts using massive memory cards for SRAM saves.

This leaves many people migrating from Pogoshell-compatible flash carts to non-Pogoshell-compatible flash carts without acccess to some of the nicer features of Pogoshell. One of those nice features are Pogoshell plugins, applications launched from Pogoshell with reference to a file to use.

Plugin2GBA Downloads

Usage

First, one needs to download and install Python, if one hasn't already. Next one needs a basic understanding of the command-line. Then one needs to navigate to where plugin2gba was extracted. Now, one needs to understand a little bit about how Pogoshell functions. There are two types of plugins available: binary and multiboot. Without going into how they work, binary plugins tend to end in .gba or .bin while multiboot plugins tend to end in .mb, .mbz, or .mbap. On rare occassion, this doesn't hold, but always in that plugins that appear to be binary plugins are actually multiboot plugins.

One also has to understand a little about how plugins work. Some plugins try to verify that Pogoshell is being used. Some will even look into the Pogoshell filesystem for things like fonts which they'll use. While in the future work might be done to better support plugins which need a legitimate Pogoshell filesystem, as it stands Plugin2GBA is designed to fake a legitimate Pogoshell filesystem for plugins that only use a cursory check.

Finally, one needs to understand a little about Python and Windows (if one is using Windows). Under the Windows command-line, passing wildcards to an application causes them to be passed literally to a program. That leaves it up to the program, to do the expansion of the wildcard itself. Python allows wildcard expansion through a function called glob() (for those interested in the history, globs predate the use of wildcards under DOS and this is likely the reason the name was chosen for Python). But, Python doesn't attempt to sort the expansion. This can be both a good thing and a bad thing, depending on whether you want the expansion sorted or not. In short, sorting of the files list was added for Windows users, just in case.

Actual usage options follow:

Grittier Details

Binary plugins are ones that run from the ROM memory space. In simple terms, that means that Pogoshell passes control to a binary plugin by pushing the binary plugin to the start of the ROM memory space and running it as if it were the only thing on the flash cart. In doing so, Pogoshell also passes some file pointers and filenames in a special place in RAM. Plugin2GBA patches the first instruction of a binary plugin to jump to a mini-pogoshell to simulate the passing of file pointers and filenames by copying the appropriate data to the same special place in RAM that Pogoshell would.

Multiboot plugins are ones that are run from RAM, specially external work ram. Pogoshell copies a multiboot plugin to RAM then passes some file pointers and filenames in a special place in RAM. Plugin2GBA does the same thing, including a legitimate romheader as some multiboot plugins were never designed to be run as a binary.

While patching can quite possibly break a binary plugin, it's nearly impossible for the same to be true with a multiboot plugin as no patching to the plugin itself is done. Instead, a multiboot plugin is wrapped on both sides with the functions to recreate the function of Pogoshell. With binary plugins, this is impossible; adding to the front would shift addresses. Thankfully, for very few plugins does this seem relevant.

Backgrounds

Using Plugin2GBA for a while, you might notice that as much as you just love the existing background, you'd like to create one of your own. Doing so is relatively easy. The first step is downloading grit, a tool to convert images into GBA (and NDS) compatible data. Extract and copy grit.exe to the directory where you put plugin2gba.

Next, create an 240x160 image with at most 223 colors. Most paint programs allow you to choose to convert an image into an indexed image with an optimized palette of a set number, so this part should be easy. Save your image into the directory where you put plugin2gba.

Now it's as simple as running grit, replacing <your_image> with the name of your image (in doublequotes, if you used spaces in the filename) and <your_converted_image> with the name you want to use with plugin2gba.py:

This produces a collection of <your_converted_image>.*.bin files. These are the image data files used by plugin2gba.py in creating an ouptut.gba. Just be sure to pass --background=<your_converted_image> to plugin2gba.py. Also, remember to not make your image too bright, or it'll be distracting when reading the menu.

Links

Projects

Gameboy Advance

GamePark 32

Python

DOS

Other Things

Kuwanger.altervista.org - Sort of like stag beetles in tubes.