Home

Awesome

WARNING: THIS PROJECT HAS MOVED

You can find the most recent version at the mw-mdma-cli GitLab project page. This repository will be kept as is, and will not be updated anymore.

mw-mdma-cli

MegaWiFi MegaDrive Memory Administration (MDMA) interface. This program allows to read and write ROMs from/to MegaWiFi cartridges, using a MegaWiFi programmer. It also allows to upload firmware blobs to the in-cart ESP8266 WiFi module. Starting with version 0.4, the program can also be built with a nice Qt5 GUI (in addition to the command-line interface).

Installing

Pre-built versions for 64-bit Windows 7 (or later), can be found under bin/release/windows directory. Extract the archive and use the mdma.exe program. Note that in Windows you will also need to install the libusb drivers. An easy way to install them under Windows is using Zadig.

Building

Instead of installing the pre-built versions, you can build them yourself. It is possible to build the binary without Qt support (with only the CLI mode available) or with Qt support (both CLI and GUI modes available). The build process has been tested for Linux and Windows. It should also work with macOS, but I have no way of testing it. If you give it a try under macOS, please drop me a line about the process.

Basic CLI

For the basic CLI version, you just need to install libusb-1.0 development packages and the standard development tools. then cd to the path with the sources and call:

$ make -f Makefile-no-qt

If everything goes OK, you should have the mdma binary sitting in the same directory.

Full-featured GUI + CLI

If you want to be able to launch the Qt GUI (in addition to being able to use the program in CLI mode), you will have to install the qt5-base development packages (qt5-default in Ubuntu and derivatives). Then run:

$ qt5-qmake
$ make

If the build process completes successfully, you should be able to run mdma -Q to start the GUI.

Usage

Once you have plugged a MegaWiFi cartridge into a MegaWiFi Programmer (and have installed the driver if using Windows), you can use mdma. You will have to choose between using the Command Line Interface (CLI) or the Graphical User Interface (GUI).

Using the MDMA GUI

To start the MDMA GUI run the program with the -Q switch:

$ mdma -Q

This should start the GUI. If the programmer is plugged and drivers are OK, you should be greeted by a screen like this:

MDMA-GUI

Usage should be self-explanatory, just use the WRITE tab to burn ROMs to the cart, the READ tab to read ROMs from the cart, the ERASE tab to erase the cartridge contents, the WIFI tab to upload firmware blobs to the WiFi module (currently supported only in CLI mode), and the INFO tab to query cartridge and programmer info, and to enter bootloader mode.

If you will be frequently using the MDMA GUI, it is recommended to create a shortcut invoking mdma -Q.

Using the MDMA CLI

The command line application invocation is as follows:

$ mdma [option1 [option1_arg]] […] [optionN [optionN_arg]]

The options (option1 ~ optionN) can be any combination of the ones listed below. Options must support short and long formats. Depending on the used option, and option argument (option_arg) must be supplied. Several options can be used on the same command, as long as the combination makes sense (e.g. it does make sense using the flash and verify options together, but using the help option with the flash option doesn't make too much sense).

OptionArgument typeDescription
--qt-gui, -QN/AUse the Qt GUI (if supported).
--flash, -fR - FilePrograms the contents of a file to the cartridge flash chip.
--read, -rR - FileRead the flash chip, storing contents on a file.
--erase, -eN/AErase entire flash chip.
--sect-erase, -sR - AddressErase flash sector corresponding to address argument.
--range-erase, -AR - FileErase flash memory range.
--auto-erase, -aN/AAuto-erase (use it with flash command).
--verify, -VN/AVerify written file after a flash operation.
--flash-id, -iN/APrint information about the flash chip installed on the cart.
--pushbutton, -pN/ARead programmer pushbutton status.
--gpio-ctrl, -gR - Pin dataManually control GPIO port pins of the microcontroller.
--wifi-flash, -wR - FileUploads a firmware blob to the cartridge WiFi module.
--wifi-mode, -mR - ModeSet WiFi module flash chip mode (qio, qout, dio, dout).
--bootloader, -bN/AEnters DFU bootloader mode, to update programmer firmware.
--dry-run, -dN/APerforms a dry run (parses command line but does nothing).
--version, -RN/APrint version information and exit.
--verbose, -vN/AWrite additional information on console while performing actions.
--help, -hN/APrint a brief help screen and exit.

The Argument type column contains information about the parameters associated with every option. If the option takes no arguments, it is indicated by “N/A” string. If the option takes a required argument, the argument type is prefixed with “R” character. Supported argument types are File, Address and Pin Data:

When using Pin Data arguments, each of the 3 possible parameters takes 6 bytes: one for each 8-bit port on the chip from PA to PF. Each of the arguments corresponds to the row with the same name on table 3. The value parameter is only required when writing to any pin on the ports. It is recommended to specify each parameter using hexadecimal values (using the prefix '0x').

The --pushbutton switch returns pushbutton status on the program exit code (so it is easily readable for programs/scripts using mdma-cli. The returned code uses the two least significant bits:

E.g. if the button is pressed, and keeps being pressed when the program evaluates the --pushbutton function, the returned code will be 0x03 (pushbutton event + button pressed). If immediately called before the button is released, returned code will be 0x01 (no event + button pressed). If the button is released and then the program is called again, returned code will be 0x02 (pushbutton event + no button pressed).

Some more examples of the command invocation and its arguments are:

Authors

This program has been written by Migue/Manveru and doragasu.

Contributions

Contributions are welcome. If you find a bug please open an issue, and if you have implemented a cool feature/improvement, please send a pull request.

License

This program is provided with NO WARRANTY, under the GPLv3 license.