{"id":510,"date":"2010-01-06T11:44:43","date_gmt":"2010-01-06T02:44:43","guid":{"rendered":"http:\/\/www.codedojo.com\/?p=510"},"modified":"2010-01-06T14:35:08","modified_gmt":"2010-01-06T05:35:08","slug":"development-diary-dink-on-iphone-dmod-support","status":"publish","type":"post","link":"https:\/\/www.codedojo.com\/?p=510","title":{"rendered":"Development Diary: Dink on iPhone &#8211; DMOD support"},"content":{"rendered":"<p>More Dink stuff.\u00a0 I&#8217;ve been focusing on the more technical parts, especially dmod support.<\/p>\n<p>Please ignore the ugly temporary GUI I&#8217;ve got going now.<\/p>\n<h2>\n<p><div id=\"attachment_528\" style=\"width: 490px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0002.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-528\" class=\"size-full wp-image-528\" title=\"IMG_0002\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0002.png\" alt=\"\" width=\"480\" height=\"320\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0002.png 480w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0002-300x200.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><p id=\"caption-attachment-528\" class=\"wp-caption-text\">Day\/night mode added!  Just kidding, just some palette glitch.<\/p><\/div><\/h2>\n<h2><strong>The .dmod format<\/strong><\/h2>\n<p>When Dink was developed, I didn&#8217;t give too much thought to how add-ons would work.\u00a0 Here is what it had:<\/p>\n<ul>\n<li>Each dmod gets its own directory name<\/li>\n<li>A readme.txt with a lot of info that I don&#8217;t think anybody uses, unsure<\/li>\n<li>A text dmod.diz file would include the name, a line for copyright, a url, and a description. (starting with Mystery Island?)<\/li>\n<li>preview.bmp that nobody uses (Actually, I think this was added by redink\/Merlin for the 1.08 release, not me)<\/li>\n<\/ul>\n<p>So yeah, very basic.<\/p>\n<p>Also missing was a way to package and install them.\u00a0 The first DMOD&#8217;s (Search For Milli Vanilli and Mystery Island) were packaged with .exe based installers that would locate the dink directory (in the ugliest way possible) and create a directory there.<\/p>\n<p>By the way, <a href=\"http:\/\/www.dinknetwork.com\/file\/the_search_for_milli_vanilli\/\">Search For Milli Vanilli<\/a> has a 4.6 rating?? Come on!! First DMOD ever, giant heads, awesome music, and eerily predicting the future mean nothing?! (The map.dat is dated 10\/15\/1997 .. yeah, not even I would be in poor enough taste to do the dmod AFTER what happened)<\/p>\n<p>So I thought everybody would create a windows-centric .exe for each add-on?\u00a0 Dumb idea, especially back before the era of nice free install makers.\u00a0 So we ended up with a bunch of zips\/rars\/lha&#8217;s or whatever without a real standard.<\/p>\n<p>Then, an enterprising lad from the Dink community by the name of Merlin created DFArc, a utility to help install and manage dmods.<\/p>\n<p>He invented the &#8220;.dmod&#8221; file extension.\u00a0 (I think?)\u00a0 This is basically the above but compressed as tar.bz2.\u00a0 (Grr, I only support .zip in my game framework!)<\/p>\n<p>Then, the dink community went through the laborious task of converting existing dmods to .dmod format making everybody&#8217;s life easier.<\/p>\n<h2><strong>Tar.bz2?!<\/strong><\/h2>\n<p>If I want to make the DMOD experience smooth and take advantage of the currently 301\u00a0 add-ons (some as big as Dink itself), I need to allow you to download and install the original .dmod files.\u00a0 No porting, no special iPhone versions.\u00a0 No repackaging.<\/p>\n<p>First I improved my net code to handle redirects and allow in-game downloading by URL: (there will be an easier way too, but this &#8220;manual&#8221; download way will remain, useful for testing or just installing any dmod you feel like)<\/p>\n<div id=\"attachment_533\" style=\"width: 490px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0007.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-533\" class=\"size-full wp-image-533\" title=\"IMG_0007\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0007.png\" alt=\"\" width=\"480\" height=\"320\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0007.png 480w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0007-300x200.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><p id=\"caption-attachment-533\" class=\"wp-caption-text\">Enter any URL your heart desires.  It just better be a .dmod.<\/p><\/div>\n<p>I searched in vain for a small and portable tar.bz2 unarchiving class so ended up writing one using the bzip2 library.<\/p>\n<p>Tar is a dead simple format, especially when you can ignore stored file permissions and the like.<\/p>\n<p>I force all files to be lower-case when writing, helps with the case-sensitivity issue.<\/p>\n<div id=\"attachment_534\" style=\"width: 490px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0008.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-534\" class=\"size-full wp-image-534\" title=\"IMG_0008\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0008.png\" alt=\"\" width=\"480\" height=\"320\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0008.png 480w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0008-300x200.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><p id=\"caption-attachment-534\" class=\"wp-caption-text\">Single pass un-bzip2&#39;ing and un-tar&#39;ing.  Quite zippy.<\/p><\/div>\n<p>After it&#8217;s finished, it will kick back to the scrollable DMOD management screen:<\/p>\n<div id=\"attachment_532\" style=\"width: 490px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0006.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-532\" class=\"size-full wp-image-532\" title=\"IMG_0006\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0006.png\" alt=\"\" width=\"480\" height=\"320\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0006.png 480w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0006-300x200.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><p id=\"caption-attachment-532\" class=\"wp-caption-text\">Basic, but functional.  I will add more text and probably icons for the readme and url if applicable.<\/p><\/div>\n<p>And finally:<\/p>\n<div id=\"attachment_529\" style=\"width: 490px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_00021.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-529\" class=\"size-full wp-image-529\" title=\"IMG_0002\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_00021.png\" alt=\"\" width=\"480\" height=\"320\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_00021.png 480w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_00021-300x200.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><p id=\"caption-attachment-529\" class=\"wp-caption-text\">Ta-da!  You&#39;re now playing a user made add-on from the comfort of the train and\/or bathroom!<\/p><\/div>\n<div id=\"attachment_530\" style=\"width: 490px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0003.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-530\" class=\"alignnone size-full wp-image-530\" title=\"IMG_0003\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0003.png\" alt=\"\" width=\"480\" height=\"320\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0003.png 480w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2010\/01\/IMG_0003-300x200.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><p id=\"caption-attachment-530\" class=\"wp-caption-text\">Incorrect aspect ratio and no midi music yet, but hey, it&#39;s playable.<\/p><\/div>\n<h2><strong><strong>What next?<\/strong><\/strong><\/h2>\n<p>Well, most of the technical issues are out of the way so it&#8217;s time to move on to interface and better audio.\u00a0 At first I was thinking I wouldn&#8217;t need to support midi because I was going to remaster the whole dink audio track, but now I see midi support is a must for dmods.<\/p>\n<p>So do I want to spend $500 to license fmod for iPhone? (I used this for Prey Invasion, so I&#8217;m already familiar with it&#8230; that would also give .mod\/.xm support.\u00a0 iiiiinteresting.)<\/p>\n<p>Is there anything with similar functionality that is cheaper?\u00a0 Hurrumph.<\/p>\n<p>Thanks to magicman, Ex-D, and scratcher from the <a href=\"http:\/\/www.dinknetwork.com\">Dink Network<\/a>&#8216;s chat for helping me out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>More Dink stuff.\u00a0 I&#8217;ve been focusing on the more technical parts, especially dmod support. Please ignore the ugly temporary GUI I&#8217;ve got going now. The .dmod format When Dink was developed, I didn&#8217;t give too much thought to how add-ons would work.\u00a0 Here is what it had: Each dmod gets its own directory name A [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,12],"tags":[],"class_list":["post-510","post","type-post","status-publish","format-standard","hentry","category-development","category-dink"],"_links":{"self":[{"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/posts\/510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=510"}],"version-history":[{"count":28,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/posts\/510\/revisions"}],"predecessor-version":[{"id":554,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/posts\/510\/revisions\/554"}],"wp:attachment":[{"href":"https:\/\/www.codedojo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}