<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Need to go around char requirement. File from datafile.</title>
		<link>http://www.allegro.cc/forums/view/589562</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 16 Jan 2007 01:15:02 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, so I have a Mappy map file (FMP format) stored in my datafile for a tanks game. I need to call this function to load the map:</p><p>int MapLoad(char * mapname)</p><p>I currently do not have any knowledge of how I can bypass this dumb char requirement. It would be unfortunate if I wouldn&#39;t be able to store my map file in the datafile...Can anybody help me out?</p><p>Would be great if I could somehow use: data[MAP3_FMP].dat (as in accessing the map file from my datafile).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (XcronZ3X)</author>
		<pubDate>Sun, 14 Jan 2007 09:43:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Unfortunately I am not aware of a method to do that since MapLoad expects a path and as far as the datafile is concerned it&#39;s binary data.  One solution would be to dump the binary data in data[MAP3_FMP].dat to a file then use MapLoad to load that file <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> but then you aren&#39;t really getting anywhere <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Sun, 14 Jan 2007 09:57:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>really? well...I think that would be just fine. Because the point of the datafile is to both reduce the number of files that have to be managed and get them away from users of the game. So uhm...how would I essentially extract the FMP file from the datafile (with regards to code) and then would it be possible to get rid of the file before the ending of the program? Essentially like a temporary file or something..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (XcronZ3X)</author>
		<pubDate>Sun, 14 Jan 2007 10:06:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If Mappy uses Allegro&#39;s packfile routines, you should be able to use &quot;somefile.dat#MAP3_FMP&quot; as the filename (where somefile.dat is the datafile name, and MAP3_FMP is the entry in the datafile for the map).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Sun, 14 Jan 2007 10:08:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m guessing the # character was key in that syntax. Anyone mind explaining how it works? Just for my future reference.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (XcronZ3X)</author>
		<pubDate>Mon, 15 Jan 2007 06:41:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I believe that the # symbol just references a datafile object. For example:</p><p>actual_datafile.dat#objects_name_in_datafile
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ngiacomelli)</author>
		<pubDate>Mon, 15 Jan 2007 06:49:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You&#39;ll need to find another MapLoad function that will take a memory address or stream.  Failing that you should right click your MapLoad library and select Delete.</p><p>If you have the source to the library you could add in your own MapLoad function that takes a memory pointer.  If not, you could set some flag in memory, crack open the libc for the dll file and inject your own fopen that checks for the flag and if set uses the passed char* as an actual data source instead of a filename.</p><p>Mm... that kind of sounds like a fun project now..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ImLeftFooted)</author>
		<pubDate>Mon, 15 Jan 2007 09:24:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Mappy is Allegro-based, and the Mapload() function uses a series of <span class="source-code"><a href="http://www.allegro.cc/manual/pack_fopen" target="_blank"><span class="a">pack_fopen</span></a><span class="k2">(</span><span class="k2">)</span>, <a href="http://www.allegro.cc/manual/pack_fread" target="_blank"><span class="a">pack_fread</span></a><span class="k2">(</span><span class="k2">)</span></span><br />So it natively supports the datafile format.
</p><div class="quote_container"><div class="title">manual said:</div><div class="quote"><p>

The packfile functions also understand several &quot;magic&quot; filenames that are used for special purposes. These are:</p><ul><li><p>`#&#39; - read data that has been appended to your executable file with the exedat utility, as if it was a regular independent disk file.</p></li><li><p>`filename.dat#object_name&#39; - open a specific object from a datafile, and read from it as if it was a regular file. You can treat nested datafiles exactly like a normal directory structure, for example you could open `filename.dat#graphics/level1/mapdata&#39;.</p></li></ul><p>&lt;/li&gt;
</p></div></div><p>
(I checked the sources for the mapalr11.zip  runtime)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Audric)</author>
		<pubDate>Mon, 15 Jan 2007 16:32:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>all you need is a string varable and the string fountion str_c()</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;string&gt;</span>
<span class="k1">using</span> <span class="k1">namespace</span> std<span class="k2">;</span>

string MAP3_FMP <span class="k3">=</span> <span class="s">"themapname"</span><span class="k2">;</span>
MapLoad<span class="k2">(</span>MAP3_FMP.str_c<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (piccolo)</author>
		<pubDate>Mon, 15 Jan 2007 23:20:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>piccolo, did you even read the question? <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kauhiz)</author>
		<pubDate>Mon, 15 Jan 2007 23:50:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /> crap i miss understood it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (piccolo)</author>
		<pubDate>Tue, 16 Jan 2007 01:15:02 +0000</pubDate>
	</item>
</rss>
