<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Breaking Eggs And Making Omelettes &#187; Game Hacking</title>
	<atom:link href="http://multimedia.cx/eggs/category/game-hacking/feed/" rel="self" type="application/rss+xml" />
	<link>http://multimedia.cx/eggs</link>
	<description>Topics On Multimedia Technology and Reverse Engineering</description>
	<lastBuildDate>Thu, 26 Jan 2012 18:47:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Samples RSS And Flashback Samples</title>
		<link>http://multimedia.cx/eggs/rss-and-flashback-samples/</link>
		<comments>http://multimedia.cx/eggs/rss-and-flashback-samples/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 07:06:46 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3648</guid>
		<description><![CDATA[There is now a RSS feed for our vast samples repository-- stay up to date; also, samples from 2 games (Flashback and Mario Teaches Typing)]]></description>
			<content:encoded><![CDATA[<p>I made good on <a href="http://multimedia.cx/eggs/the-new-samples-regime/">my claim that I would create an RSS feed</a> for the samples repository. </p>
<p><strong><a href="http://samples.mplayerhq.hu/samples-rss.xml">Here is the link to the samples RSS feed [ http://samples.mplayerhq.hu/samples-rss.xml ].</a></strong> Also, <a href="https://github.com/multimediamike/multimedia-samples-rss">here is the Python source code I threw together</a> for the task.</p>
<p><em>I just want to check: I&#8217;m not the only person who still relies on RSS these days, right? The tech press has been cheerfully proclaiming its demise for some time now. But then, they have been proclaiming the same for Adobe Flash as well.</em></p>
<p>I&#8217;m no expert in RSS. If you have any suggestions for how to improve the features presented in the feed, please let me know. And, of course, keep the samples coming. This script should help provide more visibility for a broader audience.</p>
<p><strong>Mario and Flashback Samples</strong><br />
<a href="http://multimedia.cx/eggs/more-cinepak-madness/#comment-178856">Thanks to LuigiBlood</a> who sent in some samples that allowed me to test out my new script for automatically syncing the repositories and updating the samples RSS feed. First, there are <a href="http://samples.mplayerhq.hu/game-formats/flashback/">CPC multimedia files</a> from the Japanese 3DO port of <a href="http://www.mobygames.com/game/flashback-the-quest-for-identity">Flashback: The Quest for Identity</a>. Then, there is an Interplay MVE file on the CD version of <a href="http://www.mobygames.com/game/mario-teaches-typing">Mario Teaches Typing</a> in which the video doesn&#8217;t decode correctly.</p>
<p>LuigiBlood also sent in another file from the latter game. It&#8217;s big and has the extension .AV. It could be a multimedia file as it appears to have a palette and PCM audio inside. But there&#8217;s no header and I&#8217;m a bit unsure about how to catalog it.</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/rss-and-flashback-samples/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Space Adventure CD-ROM</title>
		<link>http://multimedia.cx/eggs/space-adventure-cd-rom/</link>
		<comments>http://multimedia.cx/eggs/space-adventure-cd-rom/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 05:55:46 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3586</guid>
		<description><![CDATA[Multimedia format archaeology featuring a 1993 CD-ROM title named Space Adventure]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://games.multimedia.cx/acquisition-log-starcraft-ii/">acquired a CD-ROM</a> entitled <a href="http://www.mobygames.com/game/dos/space-adventure">Space Adventure</a> by Knowledge Adventure (I like these people; they make decent, entertaining educational games). The physical media displays a copyright date of 1993, very early in the multimedia era.</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2011/09/space-adventure-space-movie.png" alt="" title="Space Adventure: Space Movies menu" width="477" height="307" class="aligncenter size-full wp-image-3590" /><br />
</center></p>
<p>This 1993 CD-ROM makes proud use of multimedia files. What kind? There&#8217;s a movies/ directory with 17 .mov files. It would be way too simple if these were QuickTime files, though. These represent a custom format, and video-only since a separate sounds/ directory contains .snd files with filenames corresponding to the .mov files. The .snd files are actually <a href="http://wiki.multimedia.cx/index.php?title=Creative_Voice">Creative Voice (a.k.a. VOC) files</a>. As for this MOV format, <a href="http://wiki.multimedia.cx/index.php?title=Space_Adventure_MOV">wiki page</a> and <a href="http://samples.mplayerhq.hu/game-formats/space-adventure-mov/">samples</a>.</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2011/09/space-adventure-saturn-fly-by.jpg" alt="" title="Space Adventure: movie of Saturn fly-by" width="500" height="333" class="aligncenter size-full wp-image-3593" /><br />
</center></p>
<p>I was also surprised to find the binary ultrasnd.exe file among the drivers on the disc. <a href="http://multimedia.cx/eggs/ode-to-the-gravis-ultrasound/">The Gravis UltraSound</a> was released in 1992. The sound setup utility does not have an option for the GUS, however. No matter since DOSBox has great SB/Pro/16 emulation.</p>
<p>I&#8217;m also a bit puzzled about why the DOSBox screenshots are 720 x 480 (posted here are various cropping and resizings).</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/space-adventure-cd-rom/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Metal Gear Solid VP3 Easter Egg</title>
		<link>http://multimedia.cx/eggs/mgs-vp3-easter-egg/</link>
		<comments>http://multimedia.cx/eggs/mgs-vp3-easter-egg/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 05:19:13 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3510</guid>
		<description><![CDATA[Metal Gear Solid: The Twin Snakes uses VP3; here's something weird I found in one of the videos]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mobygames.com/game/gamecube/metal-gear-solid-the-twin-snakes">Metal Gear Solid: The Twin Snakes for the Nintendo GameCube</a> is very heavy on the cutscenes. Most of them are animated in real-time but there are a bunch of clips &#8212; normally of a more photo-realistic nature &#8212; that the developers needed to compress using a conventional video codec. What did they decide to use for this task? On2 VP3 (forerunner of Theora) in a custom transport format. This is only the second game I have seen in the wild that uses pure On2 VP3 (<a href="http://multimedia.cx/eggs/vp3-in-the-wild/">first was a horse game</a>). Reimar and I <a href="http://wiki.multimedia.cx/index.php?title=Metal_Gear_Solid_VP3">sorted out most of the details</a> sometime ago. I sat down today and wrote a <a href="http://ffmpeg.org/">FFmpeg</a> / <a href="http://libav.org/">Libav</a> demuxer for the format, mostly to prove to myself that I still could.</p>
<p>Things went pretty smoothly. We suspected that there was an integer field that indicated the frame rate, but 18 fps is a bit strange. I kept fixating on a header field that read <code>0x41F00000</code>. Where have I seen that number before? Oh, of course &#8212; it&#8217;s the number 30.0 expressed as an IEEE 32-bit float. <a href="http://wiki.multimedia.cx/index.php?title=4xm_Format">The 4XM format</a> pulled the same trick.</p>
<p><strong>Hexadecimal Easter Egg</strong><br />
I know I finished the game years ago but I really can&#8217;t recall any of the clips present in <a href="http://samples.mplayerhq.hu/game-formats/mgs1-vp3/">the samples directory</a>. The file mgs1-60.vp3 contains a computer screen granting the player access and illustrates this with a hexdump. It looks something like this:</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2011/08/metal-gear-solid-hexdump.jpg" alt="" title="Metal Gear Solid: Hexdump" width="320" height="240" class="aligncenter size-full wp-image-3512" /><br />
</center></p>
<p>Funny, there are only 22 bytes on a line when there should be 32 according to the offsets. But, leave it to me to try to figure out what the file type is, regardless. I squinted and copied the first 22 bytes into a file:</p>
<pre>
 1F 8B 08 00   85 E2 17 38   00 03 EC 3A   0D 78 54 D5
 38 00 03 EC   3A 0D
</pre>
<p>And the answer to the big question:</p>
<pre>
$ file mgsfile
mgsfile: gzip compressed data, from Unix, last modified: Wed Oct 27 22:43:33 1999
</pre>
<p>A gzip&#8217;d file from 1999. I don&#8217;t know why I find this stuff so interesting, but I do. I guess it&#8217;s no more and less strange than writing playback systems like this.</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/mgs-vp3-easter-egg/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Multimedia Exploration Journal: The Past Doesn&#8217;t Die</title>
		<link>http://multimedia.cx/eggs/mmjournal-the-past-doesnt-die/</link>
		<comments>http://multimedia.cx/eggs/mmjournal-the-past-doesnt-die/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 05:51:18 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3483</guid>
		<description><![CDATA[Custom Cyclemania video format spread across multiple file types; Interplay ACMP files which might have ACOMP audio data]]></description>
			<content:encoded><![CDATA[<p><a href="http://games.multimedia.cx/acquisition-log-strategic-acquisition/">New haul of games</a>, new (old) multimedia formats.</p>
<p><strong>Lords of Midnight</strong><br />
Check out the <a href="http://www.mobygames.com/game/dos/lords-of-midnight/cover-art/gameCoverId,29530/">box copy scan for Lords of Midnight</a> in MobyGames. In particular, I&#8217;d like to call your attention to this little blurb:</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2011/07/lords-of-midnight-box-copy.jpg" alt="" title="Lords of Midnight puzzling CD-ROM box blurb" width="197" height="164" class="aligncenter size-full wp-image-3485" /><br />
</center></p>
<p>Ahem, &#8220;Journey through an immense world &#8212; the equivalent of 8 CD-ROMs.&#8221; Yet, when I procured the game, it only came on a single CD-ROM. It&#8217;s definitely a CD-ROM (says so on the disc) and, coming from 1995, certainly predates the earliest DVD-ROMs (which can easily store 8 CD-ROMs on a disc). Thus, I wanted to jump in a see if they were using some phenomenal compression in order to squeeze so much info into 600 or so megabytes.</p>
<p>I was surprised to see the contents of the disc clocking in at just under 40 megabytes. An intro movie and an outro movie account for 75% of that. Format? None other than that curious ASCII anomaly, <a href="http://wiki.multimedia.cx/index.php?title=ARMovie">ARMovie/RPL</a> with <a href="http://wiki.multimedia.cx/index.php?title=Escape_122">Escape 122 codec data</a>.</p>
<p><strong>Cyclemania</strong></p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2011/07/cyclemania-cover.jpg" alt="" title="Cyclemania jewel case cover" width="225" height="222" class="aligncenter size-full wp-image-3488" /><br />
</center></p>
<p><a href="http://www.mobygames.com/game/dos/cyclemania">Cyclemania</a> is one of those FMV backdrop action games, but with a motorcycle theme. I had a good feeling I would find some odd multimedia artifacts here and the game didn&#8217;t disappoint. The videos are apparently handled using 3-4 discrete files per animation. I&#8217;ve documented my cursory guesses and linked some samples <a href="http://wiki.multimedia.cx/index.php?title=Cyclemania_Video">at the new MultimediaWiki page</a>.</p>
<p><strong>Interplay ACMP</strong><br />
This is unrelated to this particular acquistion, but I was contacted today about audio files harvested from the 1993 DOS game <a href="http://www.mobygames.com/game/dos/star-trek-judgment-rites">Star Trek: Judgment Rites</a>. The files begin with the ASCII signature &#8220;Interplay ACMP Data&#8221;. This reminds me of <a href="http://wiki.multimedia.cx/index.php?title=Interplay_MVE">Interplay MVE</a> files which begin with the similar string &#8220;Interplay MVE File&#8221;. My theory is that these files use the <a href="http://drdobbs.com/database/184408798">ACOMP</a> compression format, though I&#8217;m still trying to make it fit.</p>
<p><a href="http://wiki.multimedia.cx/index.php?title=Interplay_ACMP">Wiki and samples</a> are available as usual if you&#8217;d like to add your own research.</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/mmjournal-the-past-doesnt-die/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SNES Hardware Compression</title>
		<link>http://multimedia.cx/eggs/snes-hardware-compression/</link>
		<comments>http://multimedia.cx/eggs/snes-hardware-compression/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 07:01:43 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3440</guid>
		<description><![CDATA[A survey of hardware compression schemes supported by various SNES coprocessors]]></description>
			<content:encoded><![CDATA[<p>I was browsing the source code for some <a href="http://en.wikipedia.org/wiki/Super_Nintendo_Entertainment_System">Super Nintendo Entertainment System (SNES)</a> emulators recently. I learned some interesting things about compression hardware. I had previously uncovered <a href="http://multimedia.cx/eggs/nes-compression/">one compression algorithm used in an SNES title</a> but that was implemented in software.</p>
<p>SNES game cartridges &#8212; being all hardware &#8212; were at liberty to expand the hardware capabilities of the base system by adding new processors. The most well-known of these processors was the <a href="http://en.wikipedia.org/wiki/Super_FX">Super FX</a> which allows for basic polygon graphical rendering, powering such games as <a href="http://www.mobygames.com/game/star-fox_">Star Fox</a>. It was by no means the only such add-on processor, though. <a href="http://en.wikipedia.org/wiki/List_of_Super_NES_enhancement_chips">Here is a Wikipedia page of all the enhancement chips used in assorted SNES games.</a> A number of them mention compression and so I delved into the emulators to find the details:</p>
<ul>
<li>The Super FX is listed in Wikipedia vaguely as being able to decompress graphics. I see no reference to decompression in emulator source code.</li>
<li>DSP-3 emulation source code makes reference to LZ-type compression as well as tree/symbol decoding. I&#8217;m not sure if the latter is a component of the former. Wikipedia lists the chip as supporting &#8220;Shannon-Fano bitstream decompression.&#8221;</li>
<li>Similar to Super FX, the SA-1 chip is listed in Wikipedia as having some compression capabilities. Again, either that&#8217;s not true or none of the games that use the chip (notably <a href="http://www.mobygames.com/game/super-mario-rpg-legend-of-the-seven-stars">Super Mario RPG</a>) make use of the feature.</li>
<li>The S-DD1 chip uses arithmetic and Golomb encoding for compressing graphics. Wikipedia refers to this as the ABS Lossless Entropy Algorithm. Googling for further details on that algorithm name yields no results, but I suspect it&#8217;s unrelated to anti-lock brakes. The algorithm is alleged to allow <a href="http://www.mobygames.com/game/snes/star-ocean">Star Ocean</a> to smash 13 MB of graphics into a 4 MB cartridge ROM (largest size of an SNES cartridge).</li>
<li>The SPC7110 can decompress data using a combination of arithmetic coding and <a href="http://en.wikipedia.org/wiki/Z-order_curve">Z-curve/Morton curve</a> reordering.</li>
</ul>
<p>No, I don&#8217;t plan to implement codecs for these schemes. But it&#8217;s always comforting to know that I <em>could</em>.</p>
<p>Not directly a compression scheme, but still a curious item is <a href="http://byuu.org/snes/msu1/">the MSU1 concept</a> put forth by the <a href="http://byuu.org/bsnes/">bsnes</a> emulator. This is a hypothetical coprocessor implemented by bsnes that gives an emulated cartridge access to a 4 GB address space. What to do with all this space? Allow for the playback of uncompressed PCM audio as well as uncompressed video at 240x144x256 colors @ 30 fps. According to the docs and the source code, the latter feature doesn&#8217;t appear to be implemented, though; only the raw PCM playback.</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/snes-hardware-compression/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Cracking Aztec Game Audio</title>
		<link>http://multimedia.cx/eggs/cracking-aztec-game-audio/</link>
		<comments>http://multimedia.cx/eggs/cracking-aztec-game-audio/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 06:01:24 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3407</guid>
		<description><![CDATA[A quick game hacking challenge]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a mild multimedia-related reverse engineering challenge for you. It&#8217;s pretty straightforward for those skilled in the art.</p>
<p><strong>The Setup</strong><br />
One side effect of running this ridiculously niche interest blog at the intersection of multimedia, reverse engineering, and game hacking is that people occasionally contact me for assistance on those very matters. So it was when one of my <a href="http://mobygames.com/">MobyGames</a> peers asked if I can help to extract some music from a game called <a href="http://www.mobygames.com/game/windows/aztec-wars">Aztec Wars</a>. The game consists of 2 discs, each with a music.xbe file that contains multiple tunes and is hundreds of megabytes large.</p>
<p><center><br />
<a href="http://www.mobygames.com/game/windows/aztec-wars"><img src="http://multimedia.cx/eggs/wp-content/uploads/2011/06/aztec-wars-cover.jpg" alt="" title="Aztec Wars cover" width="120" height="166" class="aligncenter size-full wp-image-3408" /><br />
</a></center></p>
<p>That&#8217;s all the data I received from the first email. At first I&#8217;m wondering what makes people think I have some magical insight into cracking these formats with such little information. Ordinarily, I would need to have the entire data file to work with and possibly the game binaries. But I didn&#8217;t want to ask him to upload hundreds of megabytes of data and I didn&#8217;t feel like downloading it; commitment issues and all.</p>
<p>But then I gathered a little confidence and remembered that the .xbe files are probably just Game Resource Archive Formats (GRAF) which are, traditionally, absurdly simple. I asked my colleague to send me a hexdump of the first kilobyte of one of the .xbe GRAFs (<code>'hexdump -C -n 1024 music.xbe &gt; file'</code>) as well as the total file size of the GRAF.</p>
<p><strong>The Hexdump</strong><br />
The first music.xbe file is 192817376 bytes large. These are the first <strike>1024</strike> <em>144</em> bytes (more than enough):</p>
<pre>
00000000  01 00 00 00 60 04 00 00  14 00 00 00 01 00 00 00  |....`...........|
00000010  0d 00 00 00 48 00 00 00  94 39 63 01 1c a4 21 03  |....H....9c..¤!.|
00000020  7a d2 54 04 04 28 ad 05  d8 88 fd 06 d8 88 fd 06  |zÒT..(­.Ø.ý.Ø.ý.|
00000030  2a 6e 46 08 2a 6e 46 08  2a 6e 46 08 2a 6e 46 08  |*nF.*nF.*nF.*nF.|
00000040  50 13 2f 0a e0 28 7e 0b  52 49 46 46 44 39 63 01  |P./.à(~.RIFFD9c.|
00000050  57 41 56 45 66 6d 74 20  10 00 00 00 01 00 02 00  |WAVEfmt ........|
00000060  44 ac 00 00 10 b1 02 00  04 00 10 00 64 61 74 61  |D¬...±......data|
00000070  fc 13 63 01 00 00 00 00  00 00 00 00 00 00 00 00  |ü.c.............|
00000080  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
</pre>
<p><strong>The Challenge</strong><br />
Armed with only the information in the foregoing section, figure out a method for extracting all the audio files in that file and advise on their playback/conversion. Ideally, this method should require minimal effort from both you and the person on the other end of the conversation.</p>
<p><strong>The Resolution</strong><br />
The reason I ask is because I came up with a solution but knew, deep down, that there must be a slightly easier way. How would you solve this?</p>
<p><a href="http://www.youtube.com/playlist?p=PL4165E0DB23EA9865">The music files in question are now preserved on YouTube</a> (until they see fit to remove them for one reason or another).</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/cracking-aztec-game-audio/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Revisiting Nosefart and Discovering GME</title>
		<link>http://multimedia.cx/eggs/nosefart-and-gme/</link>
		<comments>http://multimedia.cx/eggs/nosefart-and-gme/#comments</comments>
		<pubDate>Mon, 30 May 2011 05:30:49 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3373</guid>
		<description><![CDATA[Methods for playing old video game music]]></description>
			<content:encoded><![CDATA[<p>I found the following screenshot buried deep in an old directory structure of mine:</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2011/05/knosefart.png" alt="" title="Knosefart -- proposed KDE frontend to the Nosefart player" width="308" height="253" class="aligncenter size-full wp-image-3375" /><br />
</center></p>
<p>I tried to recall how this screenshot came to exist. Had I actually created a functional KDE frontend to Nosefart yet neglected to release it? I think it&#8217;s more likely that I used some designer tool (possibly <a href="http://kdevelop.org/">KDevelop</a>) to prototype a frontend. This would have been sometime in 2000.</p>
<p>However, this screenshot prompted me to revisit Nosefart.</p>
<p><strong>Nosefart Background</strong><br />
<a href="http://nosefart.sourceforge.net/">Nosefart is a program</a> that can play <a href="http://en.wikipedia.org/wiki/NES_Sound_Format">Nintendo Sound Format (NSF) files</a>. NSF files are files containing components that were surgically separated from Nintendo Entertainment System (NES) ROM dumps. These components contain the music playback engines for various games. An NSF player is a stripped down emulation system that can simulate the NES6502 CPU along with the custom hardware (2 square waves, 1 triangle wave, 1 noise generator, and 1 limited digital channel).</p>
<p>Nosefart was written by <a href="http://baisoku.org/">Matt Conte</a> and eventually imported into <a href="http://nosefart.sourceforge.net/">a Sourceforge project</a>, though it has not seen any development since then. The distribution contains standalone command line players for Linux and DOS, a GTK frontend for the Linux command line version, and plugins for Winamp, XMMS, and CL-Amp.</p>
<p>The Sourceforge project page notes that Nosefart is also part of XBMC. Let the record show that Nosefart is also incorporated into <a href="http://www.xine-project.org/">xine</a> (I did that in 2002, I think).</p>
<p><strong>Upgrading the API</strong><br />
When I tried running the command line version of Nosefart under Linux, I hit hard against the legacy audio API: OSS. Remember that?</p>
<p>In fairly short order, I was able to upgrade the CL program to use PulseAudio. The  program is not especially sophisticated. It&#8217;s a single-threaded affair which checks for a keypress, processes an audio frame, and sends the frame out to the OSS file interface. All that was needed was to rewrite open_hardware() and close_hardware() for PA and then replace the write statement in play(). The only quirk that stood out is that including &lt;pulse/pulseaudio.h&gt; is insufficient for programming PA&#8217;s simple API. &lt;pulse/simple.h&gt; must be included separately.</p>
<p>For extra credit, I adapted the program to ALSA. The program uses the most simplistic audio output API possible &#8212; just keep filling a buffer and sending it out to the DAC.</p>
<p><strong>Discovering GME</strong><br />
I&#8217;m not sure what to do with the the program now since, during my research to attempt to bring Nosefart up to date, I became aware of a software library named <a href="http://www.fly.net/~ant/libs/audio.html">Game Music Emu, or GME</a>. It&#8217;s a pure C++ library that can essentially play any classic video game format you can possible name. Wow. A lot can happen in 10 years when you&#8217;re not paying attention.</p>
<p>It&#8217;s such a well-written library that I didn&#8217;t need any tutorial or documentation to come up to speed. Just a quick read of the main gme.h header library enabled me in short order to whip up a quick C program that could play NSF and SPC files. Path of least resistance: Client program asks library to open a hardcoded file, synthesize 10 seconds of audio, and dump it into a file; ask the FLAC command line program to transcode raw data to .flac file; use ffplay to verify the results.</p>
<p>I might develop some other uses for this library.</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/nosefart-and-gme/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Tele-Arena Lives On</title>
		<link>http://multimedia.cx/eggs/java-based-tele-arena-engine/</link>
		<comments>http://multimedia.cx/eggs/java-based-tele-arena-engine/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 06:53:41 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3187</guid>
		<description><![CDATA[Before widespread internet and web, there was the BBS; before WoW, there was Tele-Arena]]></description>
			<content:encoded><![CDATA[<p>Readers know I have a peculiar interest in <a href="http://multimedia.cx/eggs/category/game-hacking/">taking apart video games</a> and that I would rather study a game&#8217;s inner workings than <a href="http://games.multimedia.cx/">actually play it</a>. I take an interest on others&#8217; efforts in this same area. It&#8217;s still in my backlog to take a closer look at <a href="http://clone2727.blogspot.com/">Clone2727&#8242;s body of work</a>. But I wanted to highlight <a href="http://tdod.org/ether/">my friend&#8217;s work on re-implementing</a> a game called <a href="http://en.wikipedia.org/wiki/Tele-Arena">Tele-Arena</a>.</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2011/02/tele-arena.png" alt="" title="Tele-Arena operating via telnet" width="561" height="114" class="aligncenter size-full wp-image-3192" /><br />
</center></p>
<p><strong>Back In The Day</strong><br />
As some of you are likely aware, there was a dark age of online communication that predated the era of widespread internet access. This was known as &#8220;The BBS Age&#8221;. People dialed into these BBSes using modems that operated at abysmal transfer speeds and would communicate with other users, upload and download files, and play an occasional game.</p>
<p>BBS software evolved and perhaps the ultimate (and final) evolution was <a href="http://en.wikipedia.org/wiki/The_Major_BBS">Galacticomm&#8217;s MajorBBS (MBBS)</a>. There were assorted games that plugged into the MBBS, all rendered in glorious color ANSI graphics. One of the most famous of these games was Tele-Arena (TA). TA was a multiplayer fantasy-themed text adventure game. Perhaps you could think of it as World of Warcraft, only rendered as interactive fiction instead of a rich 3D landscape. (Disclaimer: I might not be qualified to make that comparison since I have never experienced WoW firsthand, though I did play TA on and off about 17 years ago).</p>
<p>TA was often compared to multi-user dungeons &#8212; or MUDs &#8212; that were played by telneting into internet servers hosting games. Such comparisons were usually unfavorable as people who had experience with both TA and MUDs were sniffy elitists with internet access who thought they were <em>sooooo much better</em> than those filthy, BBS-dialing serfs.</p>
<p>Sorry, didn&#8217;t mean to open old wounds.</p>
<p><strong>Modern Retelling of A Classic Tale</strong><br />
Anyway, my friend Ron Kinney is perhaps the world&#8217;s biggest fan of TA. So much so that he has <a href="http://tdod.org/ether/">re-implemented the engine in Java under the project name Ether</a>. He&#8217;s in a similar situation as the <a href="http://www.scummvm.org/">ScummVM project</a> in that, while the independent, open source engine is fair game for redistribution, it would be questionable to redistribute the original data files. That&#8217;s why he created an AreaBuilder application that generates independent game data files.</p>
<p>Ironically, you can also telnet into a server on which Ron hosts an instance of Tele-Arena (ironic in the sense that the internet/BBS conflict gets a little blurry).</p>
<p>I hope that one day Ron will regale us with the strangest tales from the classic TA days. My personal favorite was &#8220;Wrath of a Sysop.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/java-based-tele-arena-engine/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Studying A Game Wave Disc</title>
		<link>http://multimedia.cx/eggs/studying-a-game-wave-disc/</link>
		<comments>http://multimedia.cx/eggs/studying-a-game-wave-disc/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 06:25:06 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=3033</guid>
		<description><![CDATA[Studying the contents of a Game Wave system disc]]></description>
			<content:encoded><![CDATA[<p>I picked up a used copy of game called Gemz &#8212; a rather flagrant Bejeweled clone &#8212; for a game console called <a href="http://en.wikipedia.org/wiki/Game_Wave_Family_Entertainment_System">Game Wave Family Entertainment System</a>. Heard of it? Neither had I. But the game media is optical, so I had to get it and study it.</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/11/game-wave-gemz-case-and-game-disc.jpg" alt="" title="Game Wave - Gemz - Game case and disc" width="400" height="251" class="alignnone size-full wp-image-3037" /><br />
</center></p>
<p>When mounted in Linux (as UDF), the disc is reported to contain 2.8 GB of data, so it has to be a DVD. 810 MB of that is dedicated to the movies/ directory. Multimedia format? Just plain, boring MPEG files (very YouTube-friendly&#8211; <a href="http://www.youtube.com/watch?v=XUgVzzztGQY">here&#8217;s the opening animation</a>). Deeper digging reveals some more subdirectories called movies/ that, combined, occupy the lion&#8217;s share of the disc space. Additionally, there are several single-frame .m2v files in a directory called iframes/ which are used to encode things like load screens.</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/11/gemz-loading-screen.jpg" alt="" title="Gemz loading screen" width="400" height="267" class="alignnone size-full wp-image-3034" /><br />
</center></p>
<p>There are more interesting data files including .zbm files for images and fonts, and .zwf files for audio. I suspect that these stand for zipped bitmap and zipped wave file, respectively. They can&#8217;t be directly unzipped with &#8216;gunzip&#8217;. Some of the numbers at the start of some files lead me to believe they can be easily decompressed with standard zlib facilities.</p>
<p>Based on the binary files on the Gemz disc, I couldn&#8217;t find any data on what CPU this system might use. A little Googling led me <a href="http://www.videogameconsolelibrary.com/pg00-zapit.htm">to this page at the Video Game Console Library</a> which pegs the brain as a Mediamatics 6811. Some searching for <em>that</em> leads me to a <a href="http://www.national.com/analog/dvd">long-discontinued line of hardware from National Semiconductor</a>.</p>
<p>The Console Library page also mentions that the games were developed using the Lua programming language. Indeed, there are many Lua-related strings in the game&#8217;s binaries (&#8216;zlib&#8217; also makes an appearance).</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/studying-a-game-wave-disc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dreamcast Anniversary Programming</title>
		<link>http://multimedia.cx/eggs/dreamcast-anniversary-programming/</link>
		<comments>http://multimedia.cx/eggs/dreamcast-anniversary-programming/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 06:53:58 +0000</pubDate>
		<dc:creator>Multimedia Mike</dc:creator>
				<category><![CDATA[Game Hacking]]></category>
		<category><![CDATA[Sega Dreamcast]]></category>

		<guid isPermaLink="false">http://multimedia.cx/eggs/?p=2869</guid>
		<description><![CDATA[Join me as a reminisce about how to program this fascinating bit of video gaming history]]></description>
			<content:encoded><![CDATA[<p>This day last year saw a lot of <a href="http://www.engadget.com/2009/09/09/segas-dreamcast-turns-10-inspires-us-to-find-that-vmu-and-fini/">nostalgia posts</a> on the internet regarding the Sega Dreamcast, launched 10 years prior to that day (on 9/9/99). Regrettably, none of the retrospectives that I read really seemed to mention the homebrew potential, which is the aspect that interested me. On the occasion of the DC&#8217;s 11th anniversary, I wanted to remind myself how to build something for the unit and do so using modern equipment and build tools.</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/09/3-dreamcast-consoles.jpg" alt="" title="3 Dreamcast consoles in a row" width="450" height="111" class="aligncenter size-full wp-image-2870" /><br />
</center></p>
<p><strong>Background</strong><br />
Like many other programmers, I initially gained interest in programming because I desired to program video games. Not content to just plunk out games on a PC, I always had a deep, abiding ambition to program actual video game hardware. That is, I wanted to program a purpose-built video game console. The Sega Dreamcast might be the most ideal candidate to ever emerge for that task. All that was required to run your own software on the unit was the console, a PC, some free software tools, and a special connectivity measure.</p>
<p><strong>The Equipment</strong><br />
Here is the hardware required (ideally) to build software for the DC:</p>
<ul>
<li>The console itself (I happen to have 3 of them laying around, as pictured above)</li>
<li>Some peripherals: Such as the basic DC controller, the DC keyboard (flagship title: <a href="http://www.mobygames.com/game/dreamcast/typing-of-the-dead"><em>Typing of the Dead</em></a>), and the visual memory unit (VMU)<br />
<center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/09/dreamcast-peripherals.jpg" alt="" title="Sega Dreamcast peripherals: controller, keyboard, and VMU" width="350" height="276" class="aligncenter size-full wp-image-2874" /><br />
</center>
</li>
<li>VGA box: The DC supported 480p gaming via a device that allowed you to connect the console straight to a VGA monitor via 15-pin D-sub. Not required for development, but very useful. I happen to have 3 of them from different third parties:<br />
<center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/09/dreamcast-vga-boxes.jpg" alt="" title="3 Dreamcast VGA boxes" width="350" height="245" class="aligncenter size-full wp-image-2876" /><br />
</center>
</li>
<li>Finally, the connectivity measure for hooking the DC to the PC.<br />
<span id="more-2869"></span> There are 2 options here. The first is rare, expensive and relatively fast: A DC broadband adapter. The second is slower but much less expensive and relatively easy to come by&#8211; the DC coder&#8217;s cable. This was a DB-9 adapter on one end and a DC serial adapter on the other, and a circuit in the middle to monkey with voltage levels or some such; I&#8217;m no electrical engineer. I procured this model from the notorious <a href="http://en.wikipedia.org/wiki/Lik_Sang">Lik Sang</a>, well before that outfit was sued out of business.<br />
<center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/09/dreamcast-coders-cable.jpg" alt="" title="Dreamcast coder&#039;s cable from Lik Sang" width="300" height="209" class="aligncenter size-full wp-image-2877" /><br />
</center>
</li>
</ul>
<p><strong>Dealing With Legacy</strong><br />
Take a look at that coder&#8217;s cable again. DB-9? When was the last time you owned a computer with one of those? And then think farther back to the last time to had occasion to plug something into one of those ports (likely a serial mouse).</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/09/belkin-usb-to-db9-converter.jpg" alt="" title="Belkin USB to DB-9 converter" width="350" height="228" class="aligncenter size-full wp-image-2879" /><br />
</center></p>
<p>A few years ago, someone was about to toss out this Belkin USB to DB-9 serial converter when I intervened. I foresaw the day when I would dust off the coder&#8217;s cable. So now I can connect a USB serial cable to my <a href="http://multimedia.cx/eggs/i-really-like-my-new-eeepc/">Eee PC</a>, which then connects via converter to a different serial cable, one which has its own conversion circuit that alters the connection to <em>yet another</em> type of serial cable.</p>
<p>Bits is bits is bits as far as I&#8217;m concerned.</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/09/belkin-converter-dc-coders-cable.jpg" alt="" title="The Belkin serial converter connected to the DC coder&#039;s cable" width="300" height="278" class="aligncenter size-full wp-image-2880" /><br />
</center></p>
<p><strong>Putting It All Together</strong><br />
Now to assemble all the pieces (plus a monitor) into one development desktop:</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/09/dreamcast-development-desktop.jpg" alt="" title="Sega Dreamcast Development Desktop" width="450" height="232" class="aligncenter size-full wp-image-2881" /><br />
</center></p>
<p>The monitor says &#8220;dcload 1.0.3, idle&#8230;&#8221;. That&#8217;s a custom boot CD-ROM that is patiently waiting to receive commands, code and data via the serial port.</p>
<p><strong>Getting The Software</strong><br />
Back in the day, homebrew software development on the DC revolved around these components:</p>
<ul>
<li><a href="http://www.gnu.org/software/binutils/">GNU binutils</a>: for building base toolchains for the Hitachi SH-4 main CPU as well as the ARM7-based audio coprocessor</li>
<li><a href="http://gcc.gnu.org/">GNU gcc/g++</a>: for building compilers on top of binutils for the 2 CPUs</li>
<li><a href="http://sourceware.org/newlib/">Newlib</a>: a C library intended for embedded systems</li>
<li><a href="http://cadcdev.sourceforge.net/">KallistiOS</a>: an open source, real-time OS developed for the DC</li>
</ul>
<p>The DC was my first exposure to building cross compilers. I developed some software for the DC in the earlier part of the decade. Now, I am trying to figure out how I did it, especially since I think I came up with a few interesting ideas at the time.</p>
<p><strong>Struggling With the Software Legacy</strong><br />
The source for KallistiOS has gone untouched since about 2004 but is still around thanks to Sourceforge. The instructions for properly building the toolchain have been lost to time, or would be were it not for the Internet Archive&#8217;s copy of a site called <a href="http://web.archive.org/web/*/http://www.hangar-eleven.de/en/devdc-index.html">Hangar Eleven</a>. Also, KallistiOS makes reference to a program called &#8216;dc-tool&#8217; which is needed on the client side for communicating with dcload. I was able to find this binary at <a href="http://www.boob.co.uk/devtools.html">the Boob! site</a> (well-known in DC circles).</p>
<p>I was able to build the toolchain using binutils 2.20.1, gcc 4.5.1 and newlib 1.18.0. Building the toolchain is an odd process as it requires building the binutils, then building the C compiler, then newlib, <em>and then</em> building the C compiler again along with the C++ compiler because the C++ compiler depends on newlib.</p>
<p>With some effort, I got the toolchain to build KallistiOS and most of its example programs. I documented most of the tweaks I had to make, several of them exactly the same as <a href="http://multimedia.cx/eggs/resurrecting-scd/">this one that I recently discovered while resurrecting</a> a 10-year-old C program (common construct in C programming of old?).</p>
<p><strong>Moment of Truth</strong><br />
So I had some example programs built as ELF files. I told dc-tool to upload and run them on the waiting console. Unfortunately, the tool would just sort of stall, though some communication had evidently taken place. It has been many years since I have seen this in action but I recall that something more ought to be happening.</p>
<p><strong>Plan B (Hardware)</strong><br />
This is the point that I remember that I have been holding onto one rather old little machine that still has a DB-9 serial port. It&#8217;s not especially ergonomic to set up. I have to run it on my floor because, to connect it to my network, I need to run a 25&#8242; ethernet cable that just barely reaches from the other room. The machine doesn&#8217;t seem to like USB keyboards, which is a shame since I have long since ditched any PS/2 keyboards. Fortunately, the box still has an old Gentoo distro and is running sshd, a holdover from its former life as a headless box.</p>
<p><center><br />
<img src="http://multimedia.cx/eggs/wp-content/uploads/2010/09/dreamcast-last-resort.jpg" alt="" title="Last hardware resort for getting this Dreamcast programming to work" width="400" height="259" class="aligncenter size-full wp-image-2883" /><br />
</center></p>
<p>Now when I run dc-tool, both the PC and DC report the upload progress while pretty overscan bars oscillate on the DC&#8217;s monitor. Now I&#8217;m back in business, until&#8230;</p>
<p><strong>Plan C (Software)</strong><br />
None of these KallistiOS example programs are working. Some are even reporting catastrophic failures (register dumps) via the serial console. That&#8217;s when I remember that gcc can be a bit fickle on CPU architectures that are not, shall we say, first-class citizens. Back in the day, gcc 2.95 was a certified no-go for SH-4 development. 3.0.3 or 3.0.4 was called upon at the time. As I&#8217;m hosting this toolchain on x86_64 right now, gcc 3.0.4 can&#8217;t even be built (predates the architecture).</p>
<p>One last option: As I searched through my old DC project directories, I found that I still have a lot of the resulting binaries, the ones I built 7-8 years ago. I upload a few of those and I finally see homebrew programming at work again, including <a href="http://multimedia.cx/dc-yuv2rgb.c">this old program</a> (<a href="http://multimedia.cx/yuv-3d-rgb.txt">described in detail here</a>).</p>
<p><strong>Next Steps</strong><br />
If I ever feel like revisiting this again, I suppose I can try some of the older 4.x series to see if they build valid programs. Alternatively, try building an x86_32-hosted 3.0.4 toolchain which ought to be a known good. And if that fails, search a little bit more to find that there are still <a href="http://www.dcevolution.net/index.php">active Dreamcast communities</a> out there on the internet which probably have development toolchain binaries ready for download.</p>
]]></content:encoded>
			<wfw:commentRss>http://multimedia.cx/eggs/dreamcast-anniversary-programming/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

