{"id":9674,"date":"2012-10-25T09:00:15","date_gmt":"2012-10-25T13:00:15","guid":{"rendered":"http:\/\/mith.umd.edu\/?p=9674"},"modified":"2020-10-08T16:00:54","modified_gmt":"2020-10-08T20:00:54","slug":"preserving-virtual-snes-games","status":"publish","type":"post","link":"https:\/\/mith.umd.edu\/preserving-virtual-snes-games\/","title":{"rendered":"Preserving Virtual SNES Games"},"content":{"rendered":"<p>I had originally planned to use this post\u00a0 to log my adventures in desoldering the CPU from the Nintendo Entertainment System (NES), but, alas, the campus couriers are holding the all-important <a href=\"http:\/\/en.wikipedia.org\/wiki\/Desoldering#Desoldering_pump\">solder sucker<\/a> hostage.\u00a0 Instead, I&#8217;ll talk a little bit about the work we&#8217;ve done with the Super Nintendo Entertainment System (SNES), which involves significantly less molten metal.<\/p>\n<p>One goal of the <a href=\"http:\/\/mith.umd.edu\/research\/pvwii\/\">Preserving Virtual Worlds 2<\/a> (PVW2) project is to provide videogame curators with information and tools to make their job easier.\u00a0 One small but important step in any digital preservation workflow is auditing the files&#8211;making sure that the bitstream you have in your repository is the same as the bitstream on the original media (or, down the line, making sure that the bitstream in the repository is the same as the bitstream you originally ingested). This is sometimes referred to as an integrity check, and with files stored and accessed on ordinary media is a relatively trivial matter of calculating a <a href=\"http:\/\/www.iasa-web.org\/tc04\/integrity-and-checksums\">checksum<\/a> at ingest and\u00a0 checking that the same number is still derived when the same algorithm is applied to the bitstream at regular intervals.\u00a0 When data is being migrated into a new format, it is also wise to make sure nothing is lost when accessing the file in\u00a0 the new format, which is why you&#8217;ll find color strips in the toolkit of digitization QCers.<\/p>\n<p>When we migrate SNES games to a media neutral format, we&#8217;re taking code that was originally burned into a read-only chip (ROM) and creating a digital file. We then access that digital file using a software emulator instead of proprietary hardware designed to do nothing but read those cartridges. This raises two questions:<\/p>\n<ul>\n<ul>\n<ol type=\"1\">\n<li>How do we know that the file we save matches the file originally burned on the ROM?<\/li>\n<li>How do we know that the emulator is correctly interpreting the ROM?<\/li>\n<\/ol>\n<\/ul>\n<\/ul>\n<p>To answer these questions, we&#8217;re using a nifty device called the <a href=\"http:\/\/www.retrode.org\/about\/\">Retrode2<\/a>.\u00a0 The Retrode allows you to play SNES cartridges with original SNES controllers through an emulator on your computer. As a side effect, it also allows you to extract ROM files and savegames (SRAM) and to write new files to the SRAM. The following workflow is based on the assumption that<\/p>\n<ul>\n<ul>\n<ol type=\"1\">\n<li>A ROM file which will read an original savegame\u00a0 from an SNES cartridge is likely an accurate representation of the game.<\/li>\n<li>An emulator which produces a savegame which can be loaded by the game on the original cartridge likely presents an accurate representation of gameplay.<\/li>\n<\/ol>\n<\/ul>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>Setting up the Retrode2<\/h3>\n<p><img class=\"alignnone size-blog-medium wp-image-9682\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/PVW2Retrode_boxcontents-320x202.jpg\" alt=\"Retrode2 device, miniUSB cord, instruction booklet\" width=\"320\" height=\"202\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/PVW2Retrode_boxcontents-320x202.jpg 320w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/PVW2Retrode_boxcontents-700x441.jpg 700w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/PVW2Retrode_boxcontents.jpg 800w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/p>\n<p>The Retrode box contains the Retrode unit, a Mini-USB cable, and a simple sheet of instructions. SNES cartridges are inserted in the rear slot, facing backwards. Controllers are plugged into the side ports.<\/p>\n<p>Before using the Retrode, it is necessary to flash the firmware (the firmware it ships with is known to have some errors with SNES controllers). The latest firmware, along with some basic instruction, are available <a href=\"http:\/\/www.retrode.org\/documentation\/firmware\/\">here<\/a>. If you\u2019re using Windows and have difficulty with FLIP, try running it as Administrator.<\/p>\n<p>Once you\u2019ve successfully updated the firmware and reset the device, open up the Retrode in a file manager. Note the datestamp&#8211;files on the Retrode will a<strong>lways<\/strong> display this datestamp, even if you have updated them (when the device has been reset after any file changes).<\/p>\n<p style=\"text-align: center;\"><img class=\"alignnone size-full wp-image-9684\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/retrode-explorer.png\" alt=\"File-listing for the Retrode2\" width=\"650\" height=\"170\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/retrode-explorer-200x52.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/retrode-explorer.png 650w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>Open the file <a href=\"http:\/\/www.retrode.org\/documentation\/the-retrode-cfg-file\/\">RETRODE.CFG<\/a> in a text editor. Your filenames may include a number after the game title. If you\u2019d like to disable this, change the value on <strong>line 15<\/strong> for <span style=\"font-family: Courier,monospace;\"><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 hundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"background-color: rgba(255,255,255,0);background-position: center center;background-repeat: no-repeat;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-bottom: 0px;margin-top: 0px;border-width: 0px 0px 0px 0px;border-color:#eae9e9;border-style:solid;\" ><div class=\"fusion-builder-row fusion-row\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last fusion-column-no-min-height\" style=\"margin-top:0px;margin-bottom:0px;\"><div class=\"fusion-column-wrapper fusion-flex-column-wrapper-legacy\" style=\"background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding: 0px 0px 0px 0px;\">[filenameChksum]<\/span> from <strong>1<\/strong> to <strong>0<\/strong>. In order to write savegames to the cartridge, it is also necessary to change the value for <span style=\"font-family: Courier,monospace;\">[sramReadonly]<\/span> on <strong>line 17<\/strong> from <strong>1<\/strong> to <strong>0<\/strong>. <em>Only<\/em> change this value if and when you are writing a savegame to the cartridge. Leaving it on provides some small security against accidentally corrupting your save file. Save. If for some reason saving the config file fails, refer to procedures for writing an SRAM (save) file \u00a0to the cartidge.<\/p>\n<ol>\n<li>; Retrode .17g &#8211; Config<\/li>\n<li>; Remove any line to revert setting to factory default<\/li>\n<li>[HIDMode] 1 ; 0: Off; 1: 4Joy+Mouse; 2: 2Joy; 3: KB; 4: iCade<\/li>\n<li>; Hex codes for KB mode (in this order):<\/li>\n<li>; SNES gamepad: B Y SEL STA ^ v &lt; &gt; A X L R<\/li>\n<li>; In NES mode: A B SEL STA ^ v &lt; &gt; x x x x<\/li>\n<li>; SEGA gamepad: B A MOD STA ^ v &lt; &gt; C Y X Z<\/li>\n<li>; See usb.org\/developers\/devclass_docs\/Hut1_11.pdf (pp.53ff)<\/li>\n<li>[kbL] 06 1b 28 2c 52 51 50 4f 09 07 04 16<\/li>\n<li>[kbR] 10 11 05 19 33 37 36 38 0e 0d 0a 0b<\/li>\n<li>[nesMode] 0 ; 1: NES gamepads; 0: SNES<\/li>\n<li>[filenameChksum] 0 ; checksum in filename? 0,1<\/li>\n<li>[detectionDelay] 5 ; how long to wait after cart insertion\/removal<\/li>\n<li>[sramReadonly] 0 ; write protect SRAM?<\/li>\n<li>[segaSram16bit] 0 ; use 16bit words for SRAM?<\/li>\n<li>[sramExt] srm<\/li>\n<li>[snesRomExt] sfc<\/li>\n<li>[segaRomExt] bin<\/li>\n<li>; Override autodetect:<\/li>\n<li>[forceSystem] auto<\/li>\n<li>[forceSize] 0<\/li>\n<li>[forceMapper] 0<\/li>\n<li>; Optional plug-ins:<\/li>\n<li>[atariRomExt] a26<\/li>\n<li>[tg16RomExt] huc<\/li>\n<li>[vbRomExt] vbr<\/li>\n<li>[n64RomExt] n64<\/li>\n<li>[gbRomExt] gb<\/li>\n<li>[gbaRomExt] gba<\/li>\n<\/ol>\n<p>Here it is, set up and running Super Mario Kart:<\/p>\n<p style=\"text-align: center;\"><img class=\"alignnone wp-image-9683\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/mariokart-splash-707x980.jpg\" alt=\"Mario Kart running on an emulator through the Retrode2\" width=\"324\" height=\"450\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/mariokart-splash-144x200.jpg 144w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/mariokart-splash-707x980.jpg 707w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/mariokart-splash.jpg 721w\" sizes=\"(max-width: 324px) 100vw, 324px\" \/><\/p>\n<h3>Setting up an Emulator<\/h3>\n<p>SNES9x is an emulator available for all major platforms. To run it, simply extract the contents of the zipfile to a directory of your choice.<\/p>\n<p>The SNES game pad must be setup as the input device within the emulator. To do this, select <strong>Input-&gt;Input Configuration<\/strong> in the top menu or press <strong>Alt+F7<\/strong>. Click your mouse in the \u201cUp\u201d textbox, and then press the corresponding buttons on the SNES controller until all buttons have (J0) or (J1) values. Ignore the \u00a0buttons after the R-button.<\/p>\n<p style=\"text-align: center;\"><img class=\"alignnone wp-image-9681 size-full\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/snes9x-input.png\" alt=\"SNES9x's Input Configuration Screen\" width=\"514\" height=\"493\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/snes9x-input-52x50.png 52w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/snes9x-input-200x192.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/snes9x-input.png 514w\" sizes=\"(max-width: 514px) 100vw, 514px\" \/><\/p>\n<p><strong>Select File-&gt;Load Game<\/strong> or type <strong>Ctrl+O<\/strong> and navigate to the Retrode directory. Open the <strong>*.sfc<\/strong> file; opening the <strong>*.srm<\/strong> (save) file will just cause the emulator to hang. When you play the game, it should reflect any data currently stored in the cartridge\u2019s SRAM. The *.sfc file can be copied to SNES9x\u2019s <strong>\u00a0Roms<\/strong> directory for later play without the Retrode.<\/p>\n<h3>Extracting and Injecting Battery Saves<\/h3>\n<p>To extract a save file, simply copy the *.srm file to a local directory (for instance, SNES9x\u2019s Saves directory).<\/p>\n<p>Ensure that <span style=\"font-family: Courier,monospace; font-size: 10pt;\">[sramReadonly]<\/span> on <strong>line 17<\/strong> is set to <strong>0<\/strong> in RETRODE.CFG. If you get \u201cAccess denied.\u201d or a similar error message when attempting to inject a save, this value is set to 1.<\/p>\n<p>Some command-line work is necessary to inject a new savefile onto the SRAM. In Windows, type \u201c<strong>cmd<\/strong>\u201d in the Start Menu, right click the program that shows up, and select \u201cRun as Administrator.\u201d On other platforms, use the Terminal. Note the location of the NEW save file as well as the drive letter\/location of the Retrode. The new save file must have the same name as the file you are replacing. Case is important. In this example we will be placing a new save file onto a Super Mario Kart cartridge. At the command line (in Windows), type:<\/p>\n<p><span style=\"font-family: Courier, monospace; font-size: 10pt;\">type C:PathtoNewSaveGame.srm &gt; D:SaveGame.srm<\/span><\/p>\n<p>so, for Super Mario Kart<\/p>\n<p style=\"background: cccccc; font-family: Courier,monospace; font-size: 10pt;\">type \u00a0Z:DocumentsMITHPVWSNESsnes9xSavesSuperMarioKart.srm &gt; D:SuperMarioKart.srm<\/p>\n<p>\u00a0on Mac\/Linux you can either use<\/p>\n<p style=\"background: cccccc; font-family: Courier,monospace; font-size: 10pt;\">cat \/path\/to\/New\/SaveGame.srm &gt; \/path\/to\/SaveGame.srm<\/p>\n<p>or<\/p>\n<p style=\"background: cccccc; font-family: Courier,monospace; font-size: 10pt;\">dd if=\/path\/to\/New\/SaveGame.srm of=\/path\/to\/SaveGame.srm<\/p>\n<p>\u00a0When you look at the Retrode in a file manager, the srm file should now reflect today\u2019s date. After the Retrode has been reset, <em>even if you were successful<\/em>, the datestamp will revert to the standard 1990 date. To see if the transfer was successful, clear out any files in SNES9x\u2019s Save directory (it has a tendency to privilege local save files) and open the *.sfc file from the Retrode. The game data should now reflect the new savegame rather than whatever was originally on the cartridge. The easiest way to check this in Super Mario Kart is to look at Time Trials.<\/p>\n<p>If for some reason you get a CHKSUM error and SNES9x hangs, fear not! Playing the game with an original SNES console should fix the problem. This is most likely to happen if you use the OS\u2019s GUI copy command rather than writing over the file at the command line.<\/p>\n<div id=\"attachment_9686\" style=\"width: 511px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-9686\" class=\"wp-image-9686 size-full\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/MK-battsave.png\" alt=\"Mario Kart Time Trial Data (Original Save)\" width=\"501\" height=\"428\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/MK-battsave-200x171.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/MK-battsave.png 501w\" sizes=\"(max-width: 501px) 100vw, 501px\" \/><p id=\"caption-attachment-9686\" class=\"wp-caption-text\">The save data originally on the cartridge.<\/p><\/div>\n<div id=\"attachment_9685\" style=\"width: 514px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-9685\" class=\"wp-image-9685 size-full\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/MK-newbattsave.png\" alt=\"Mario Kart Time Trial Data (New Save)\" width=\"504\" height=\"424\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/MK-newbattsave-200x168.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/MK-newbattsave.png 504w\" sizes=\"(max-width: 504px) 100vw, 504px\" \/><p id=\"caption-attachment-9685\" class=\"wp-caption-text\">The new save data.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>The drawback to this workflow is that it only works with SNES cartridges that support saving. It also depends on the battery which powers those saves being live, though it is easy to replace that battery with a little technical know-how. It does, however, give us a way to audit a fair subset of SNES games and it&#8217;s a lot of fun!<div class=\"fusion-clearfix\"><\/div><\/div><\/div><\/div><style type=\"text\/css\">.fusion-fullwidth.fusion-builder-row-1 { overflow:visible; }<\/style><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had originally planned to use this post\u00a0 to log my adventures in desoldering the CPU from the Nintendo Entertainment System (NES), but, alas, the [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[66],"tags":[165,167],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Preserving Virtual SNES Games &ndash; Maryland Institute for Technology in the Humanities<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mith.umd.edu\/preserving-virtual-snes-games\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Preserving Virtual SNES Games &ndash; Maryland Institute for Technology in the Humanities\" \/>\n<meta property=\"og:description\" content=\"I had originally planned to use this post\u00a0 to log my adventures in desoldering the CPU from the Nintendo Entertainment System (NES), but, alas, the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mith.umd.edu\/preserving-virtual-snes-games\/\" \/>\n<meta property=\"og:site_name\" content=\"Maryland Institute for Technology in the Humanities\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/UMD.MITH\" \/>\n<meta property=\"article:published_time\" content=\"2012-10-25T13:00:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-10-08T20:00:54+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/PVW2Retrode_boxcontents-320x202.jpg\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mith.umd.edu\/#website\",\"url\":\"https:\/\/mith.umd.edu\/\",\"name\":\"Maryland Institute for Technology in the Humanities\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/mith.umd.edu\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/mith.umd.edu\/preserving-virtual-snes-games\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2012\/10\/PVW2Retrode_boxcontents-320x202.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mith.umd.edu\/preserving-virtual-snes-games\/#webpage\",\"url\":\"https:\/\/mith.umd.edu\/preserving-virtual-snes-games\/\",\"name\":\"Preserving Virtual SNES Games &ndash; Maryland Institute for Technology in the Humanities\",\"isPartOf\":{\"@id\":\"https:\/\/mith.umd.edu\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/mith.umd.edu\/preserving-virtual-snes-games\/#primaryimage\"},\"datePublished\":\"2012-10-25T13:00:15+00:00\",\"dateModified\":\"2020-10-08T20:00:54+00:00\",\"author\":{\"@id\":\"https:\/\/mith.umd.edu\/#\/schema\/person\/f8c8e2113745d484e247c91fd8058d09\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mith.umd.edu\/preserving-virtual-snes-games\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/mith.umd.edu\/#\/schema\/person\/f8c8e2113745d484e247c91fd8058d09\",\"name\":\"Rachel Donahue\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/mith.umd.edu\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ff91d1095a49991c68108b9f500c6433?s=96&d=mm&r=g\",\"caption\":\"Rachel Donahue\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/posts\/9674"}],"collection":[{"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/comments?post=9674"}],"version-history":[{"count":1,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/posts\/9674\/revisions"}],"predecessor-version":[{"id":21176,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/posts\/9674\/revisions\/21176"}],"wp:attachment":[{"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/media?parent=9674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/categories?post=9674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/tags?post=9674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}