Close

Motivation and Initial Investigations

A project log for SNES Mario Paint Art Extractor

Transfer works of art from a Mario Paint cartridge onto an SD card

ansbaradigeidfranansbaradigeidfran 07/29/2023 at 21:531 Comment

A short while ago, I bought a copy of Mario Paint (plus SNES mouse) as a birthday gift for my budding young artist. I'd not played this title when I was young, so this was my first exposure to it too.

They had a play around with it, and having drawn their first artwork, they asked me to print it off for them. The explanation that it couldn't be printed off the TV, and the fact that only one picture could be saved, didn't cut the mustard.

I'd learned that the image was compressed and saved onto an SRAM chip inside the cartridge. Wiring up a microcontroller to read the contents of the SRAM chip (with a suitable connector for the cartridge) would be straight-forward, but the challenge lay in interpreting the compressed data and extracting the image.

Initial searches online turned up a partial disassembly of the Mario Paint ROM, which didn't include the portions for saving and loading images. I am passingly familiar with 6502 assembly (the little brother to the SNES' processor), but wading into a full ROM disassembly didn't appeal.

The music composer of Mario Paint (and the in-game music) has a bit of a cult following. B00daW collected some findings on reverse engineering the music composer on a NesDev forum thread. He credits HertzDevil for identifying the compression algorithm as a combination of LZ77 and Huffman encoding, and attached a Lua script to decompress and extract the music from an SRAM dump.

However...

Mario Paint saves both the image and music (and animations) when prompted by the user. If they are saved and compressed at the same time, it would be sensible to compress them together to maximise the compression ratio.

On running the Lua script on a sample .srm file, I was greeted with a 47kB output file, far larger than needed for the music alone. Using B00daW's notes I identified the region where the music was stored, leaving lots of space for the image to be hiding in. Armed with a SNES emulator and some spare time, I started creating images and searching the decompressed data with a hex editor to search for my simplistic works of art.

Discussions

nodiva1245 wrote 01/05/2024 at 08:45 point

I like your post. Motivation is the driving force behind our actions, fueling our aspirations and perseverance. It's the inner spark that propels us towards our goals, pushing us through challenges and setbacks See https://sumitmotivation.com/2023/12/27/profit-motivators/ .Whether sparked by ambition, passion, or necessity, motivation empowers us to conquer obstacles and pursue our dreams with unwavering determination.

  Are you sure? yes | no