Whilst working with some SVG (Scalable Vector Graphics) images in my latest project, I experienced some strange behavior that took a bit of debugging to figure out. I needed to setup the image so that it would dynamically adjust its size if the browser window was resized, and also retain its aspect ratio whilst doing this.

After exploring my options I found that a few things needed to be done in order for this to work:

  1. Set the “viewBox” dimension attribute on the SVG element in the DOM.
  2. Remove the “width” and “height” attributes from the root SVG element, in the SVG data file itself.
  3. Add in the “preserveAspectRatio” attribute to the SVG element in the DOM, with a value of “xMinYMin meet”

Some more detail on these properties can be seen on Stackoverflow here.

The first example I created worked correctly, however when I implemented this in my project the scaling was still broken. The “preserveAspectRatio” attribute was definitely being set on the SVG element, but it was only taking effect after I manually removed and re-added it via Developer Tools….

It turns out that the problem was due to setting the attribute using jQuery, as the .attr() function will convert properties to lowercase before assigning them. One solution is simply to use standard DOM functions for this: e.g.
document.getElementsByTagName("svg")[0].setAttribute("preserveAspectRatio", "xMinYMin meet").

Alternatively you can add in a small fix that I found on StackOverflow here. This fix simply overrides the default hook for jQuery.attr() so that it uses the correctly capitalised version of the property name:

I love a good RPG, especially the old ones on the Super Nintendo/Super Famicom, but unfortunately a lot of the better games were never released in English which makes playing these text heavy games rather difficult. There are fan translations available online, but a lot of these games use special enhancement chips that can’t easily be emulated. You can get flash carts that support these special chips, but as they are priced at upwards of $200/£150, it doesn’t really make sense to buy one just so that you can play a select few games. You can see a list of the SNES games which use enhancement chips here.

Japanese Star Ocean Cart

Star Ocean is one of the few games that can’t be played in English on an emulator due to the audio decompression chip used. Today I’ll be creating my own copy by following the guide over at MMMonkey’s website. I’ve tried to include as much detail and clarify things I thought were unclear where possible, but please leave feedback in the comments if there’s anything I missed. This mod uses a fairly standard list of components; the only items I didn’t already have were the EEPROM chip for the MaskROM and a Voltage Regulator. You can find most of them on eBay, but the MaskROM is slightly harder to get hold of – buyICNow.com has them at a decent price, and will program the chips for an extra $.50 each.

Components needed:

  1. English translated ROM of Star Ocean
  2. Software to split the ROM file
  3. Japanese copy of Star Ocean
  4. Small Gamebit Screwdriver
  5. 29L3211 EEPROM
  6. Pin to remove existing MaskROM
  7. 3.3v Voltage Regulator (SOT-223)
  8. 100nf capacitor
  9. Kynar wire
  10. (optional) glue gun/tape
  11. (optional) NTSC cartridge shell

Before going forward, please note that you should only be using this information to produce reproductions of Star Ocean for PERSONAL USE. This guide should NOT BE USED FOR COMMERICAL PURPOSES IN ANY WAY! A lot of people have been creating reproductions of expensive carts (e.g. Earthbound or Chrono Trigger) and then selling them as authentic on eBay for sky-high prices, so please be vigilant. Star Ocean doesn’t suffer from this problem to the same degree as there was never an official western release, but there are still a fair number of unscrupulous people making money from this.
Continue reading

Whilst creating my Pokemon Yellow SNES cart, I noticed that the music sounded a bit strange, but not enough to immediately cause concern – once I compared it to the original played on a GameBoy, I was sure I had made a mistake connecting stuff up – the sound was just too high pitched, and even the gameplay felt slightly off. In fact, it turns out that the speed of the clock isn’t exactly the same as the original Gameboy – this is due to the Super Game Boy (SGB) using a value derived from the clock speed of the SNES itself, rather than its own internal one:

The original Super Game Boy is known to play the game program and its audio 2.4% faster than other Game Boy hardware. This is due to the use of the Super NES’s clock speed divided by 5, which ends up being 4.295 MHz instead of 4.194 MHz.[4] The timing issue can be rectified by adding an appropriate crystal to the Super Game Boy and disconnecting the Super NES’s clock source.

Wikipedia article

Here’s a YouTube video highlighting the difference in speed between the two. This issue has been fixed in the Super Game Boy 2, however these were only released in Japan and are normally quite difficult to find for a reasonable price (at least in the UK!). Knowing this, I got to work modifying my SGB to run at the right speed. Required components are as follows:

  1. Super GameBoy cartridge.
  2. Small Gamebit screwdriver.
  3. Small Philips Screwdriver.
  4. 1x 4.194304 MHz Crystal Oscillator.
  5. 2x 15-33pf Capacitors (I used caps with a value of 22 picofarads).
  6. 1x 1M Ohm Resistor.
  7. Kynar wire for connecting the components to the SGB PCB – this is helpful as the pins on the SGB-CPU1 are very small. I used some light equipment wire from Maplin for the ground connection as it was a different colour, but Kynar should work fine as well.
  8. Hot glue and/or electrical tape for securing everything together.
  9. (optional) Small piece of Strip/Breadboard to assemble components on. You could also solder them directly onto the SGB PCB, but this puts more pressure on the chip legs, and we don’t want them breaking off!

Continue reading

Recently I’ve started dabbling in the fine art of console modification, and I saw this post – it inspired me to create my own copy of Pokemon Yellow in SNES format! I had a really grubby Super Game Boy cartridge lying around that wasn’t being used, so quickly ordered a copy of Pokemon Yellow from eBay and got to work. I followed the instructions from the Imgur album here.

You’ll need the following:

  1. Gamebit screwdriver
  2. Electrical tape
  3. Wirecutters
  4. Small pliers
  5. Solder Sucker or Desoldering Pump (preferably a heated one like this)
  6. Super Game Boy cartridge
  7. Game Boy cartridge you want to convert
  8. Donor SNES cart shell to fit the completed bits into – PAL or NTSC should both work fine
  9. Stanley Knife/Box Cutter/Scalpel (anything sharp to cut away excess plastic shell in the donor cart)
  10. Any old wire to solder the two PCBs together – I used 10 strand/0.1mm copper equipment wire from Maplins.

Continue reading