<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Game crashes on friend&#39;s PC</title>
		<link>http://www.allegro.cc/forums/view/590174</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 21 Feb 2007 08:01:56 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I almost finished my game and&#39;m talking to the guy who&#39;s going to take care of the music (current music&#39;s copyrighted by Nintendo, so not usable). The game runs fine on my comp, and has been tested and works fine on a couple of friends&#39; comps. Only issue I&#39;ve noticed, is that it tends to crash when starting up if you&#39;re playing music.</p><p>The composer friend tried the game out, but all he gets, is a quick flash of a window, and it&#39;s gone again. It simply doesn&#39;t work for him. I have no idea what the problem may be.</p><p>Any help on figuring this out is well appreciated. I&#39;ve attached the game with source and all relevant files.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raf Vermeulen)</author>
		<pubDate>Wed, 21 Feb 2007 05:56:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Make your program log things and do more stringent error checking, and make your friend run a debug version through gdb.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Wed, 21 Feb 2007 06:06:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, log and error checking... dunno how much that&#39;d do. The moment the game starts up and initiazed Allegro, it checks if high.txt is made, and if not, it makes that. Even that&#39;s not the case for my friend, so it must be something there. My bet&#39;s at a missing DLL or so.</p><p><b>Edit:</b> Made a build which pauzes after every initialization part, with command-shell output.
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Okay, it stops after &#39;Timer installed&#39; and this time I get the error message:<br />&quot;Error initialising sound system&quot;<br />&quot;Failed to init digital sound driver&quot;
</p></div></div><p>

Looking further into it... Might just be something with his comp, as he&#39;s not playing any music, but&#39;s said to have had a weird issue with his speakers earlier today.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raf Vermeulen)</author>
		<pubDate>Wed, 21 Feb 2007 06:27:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Well, log and error checking... dunno how much that&#39;d do.
</p></div></div><p>
It would let you find the error, instead of blathering nonsense about missing DLLs.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Wed, 21 Feb 2007 06:44:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>well its not a dll you seem to have every thing. I recommend getting the stats of the computer it crashed on. and test on a similar computer. <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (piccolo)</author>
		<pubDate>Wed, 21 Feb 2007 06:55:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How friendly, Gnolam.</p><p>Anyways, looked further into the speaker issue.
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Them: The thing is; I had this weird issue with my speakers earlier today, so it might as well be that<br />Me: What was that issue?<br />Them: They made this loud hissing sound which went away after some time<br />Me: That&#39;s the hardware. Shouldn&#39;t affect the software<br />Them: I have no clue what caused it. And I&#39;m not sure it was (just) the hardware<br />Me: You can play the midi-file and hear it outside of the game, right?<br />Them: Yes
</p></div></div><p>
If he can play the midi-file and hear it outside the game, then it&#39;s not his comp, but something with the game. There&#39;s something wrong with the sound initialization there.</p><p>The code that does this, is this:
</p><div class="source-code snippet"><div class="inner"><pre>   <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/install_sound" target="_blank"><span class="a">install_sound</span></a><span class="k2">(</span>DIGI_AUTODETECT, MIDI_AUTODETECT, NULL<span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> <span class="k2">{</span>
      <a href="http://www.allegro.cc/manual/allegro_message" target="_blank"><span class="a">allegro_message</span></a><span class="k2">(</span><span class="s">"Error initialising sound system\n%s\n"</span>, <a href="http://www.allegro.cc/manual/allegro_error" target="_blank"><span class="a">allegro_error</span></a><span class="k2">)</span><span class="k2">;</span>
      <span class="k1">return</span> <span class="n">1</span><span class="k2">;</span>
   <span class="k2">}</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raf Vermeulen)</author>
		<pubDate>Wed, 21 Feb 2007 06:55:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>i do not think log files will help in this case but they are good to have.</p><p>Edit:
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If he can play the midi-file and hear it outside the game, then it&#39;s not his comp, but something with the game. There&#39;s something wrong with the sound initialization there.
</p></div></div><p> nope nothing wrong with game itself you tested it on other computers. there is some thing wrong with his computers config.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (piccolo)</author>
		<pubDate>Wed, 21 Feb 2007 06:57:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is there a way to catch the sound initialization error and get it going anyways?</p><p>Computer reboot didn&#39;t fix the issue, btw.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raf Vermeulen)</author>
		<pubDate>Wed, 21 Feb 2007 07:03:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre> <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/install_sound" target="_blank"><span class="a">install_sound</span></a><span class="k2">(</span>DIGI_AUTODETECT, MIDI_AUTODETECT, NULL<span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> <span class="k2">{</span>
      <a href="http://www.allegro.cc/manual/allegro_message" target="_blank"><span class="a">allegro_message</span></a><span class="k2">(</span><span class="s">"Error initialising sound system\n%s\n"</span>, <a href="http://www.allegro.cc/manual/allegro_error" target="_blank"><span class="a">allegro_error</span></a><span class="k2">)</span><span class="k2">;</span>
      <span class="k1">return</span> <span class="n">1</span><span class="k2">;</span>
   <span class="k2">}</span>
</pre></div></div><p>
return 1; is end the loop when the error happens tack out the return 1;<br />but you dont want to make any sound calls if the sound got and error at initialising.</p><p>so do some thing like this.
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td>&#160;</td></tr><tr><td class="number">2</td><td><span class="k1">extern</span> <span class="k1">bool</span> sound_on<span class="k3">=</span><span class="k1">true</span><span class="k2">;</span></td></tr><tr><td class="number">3</td><td>&#160;</td></tr><tr><td class="number">4</td><td><span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/install_sound" target="_blank"><span class="a">install_sound</span></a><span class="k2">(</span>DIGI_AUTODETECT, MIDI_AUTODETECT, NULL<span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">5</td><td>      <a href="http://www.allegro.cc/manual/allegro_message" target="_blank"><span class="a">allegro_message</span></a><span class="k2">(</span><span class="s">"Error initialising sound system\n%s\n"</span>, <a href="http://www.allegro.cc/manual/allegro_error" target="_blank"><span class="a">allegro_error</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td>      sound_on<span class="k3">=</span><span class="k1">false</span><span class="k2">;</span></td></tr><tr><td class="number">7</td><td>   <span class="k2">}</span></td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td><span class="c">//do this to all your sound calls</span></td></tr><tr><td class="number">10</td><td><span class="k1">if</span><span class="k2">(</span> sound_on<span class="k3">=</span><span class="k3">=</span><span class="k1">true</span><span class="k2">)</span></td></tr><tr><td class="number">11</td><td><span class="k2">{</span></td></tr><tr><td class="number">12</td><td><span class="c">//play your museic</span></td></tr><tr><td class="number">13</td><td><span class="k2">}</span></td></tr><tr><td class="number">14</td><td>&#160;</td></tr><tr><td class="number">15</td><td><span class="k1">if</span><span class="k2">(</span> sound_on<span class="k3">=</span><span class="k3">=</span><span class="k1">true</span><span class="k2">)</span></td></tr><tr><td class="number">16</td><td><span class="k2">{</span></td></tr><tr><td class="number">17</td><td><span class="c">//play your sample</span></td></tr><tr><td class="number">18</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (piccolo)</author>
		<pubDate>Wed, 21 Feb 2007 07:31:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Alright. Thanks for the help:) We&#39;ll see if this gets the game working.</p><p>Problem&#39;s still there:-/ Time to put more checks in it to follow the flow.</p><p>Now it crashes here:
</p><div class="source-code snippet"><div class="inner"><pre>    <a href="http://www.allegro.cc/manual/set_color_depth" target="_blank"><span class="a">set_color_depth</span></a><span class="k2">(</span><span class="n">16</span><span class="k2">)</span><span class="k2">;</span>
      cout <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="s">"Colour depth set\n"</span><span class="k2">;</span>
      <a href="http://www.delorie.com/djgpp/doc/libc/libc_802.html" target="_blank">system</a><span class="k2">(</span><span class="s">"pause"</span><span class="k2">)</span><span class="k2">;</span>
    
    <span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span> GFX_AUTODETECT_WINDOWED, SCR_WIDTH, SCR_HEIGHT, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">)</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_298.html" target="_blank">exit</a><span class="k2">(</span><span class="n">1</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
Colour depth set is the last message he gets, so it&#39;s a problem with set_gfx_mode this time.</p><p>Bit odd that it&#39;s at another autodetect.</p><p><b>Edit (Nth):</b> Ahh, problem solved. Friend was testing a friend of his&#39; website out and had his comp in 800x600, which&#39;s also the resolution of the game. Seems like it didn&#39;t like that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raf Vermeulen)</author>
		<pubDate>Wed, 21 Feb 2007 07:34:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>you should had something like what you had for sound  allegro_message(&quot;Error initialising sound system\n%s\n&quot;, allegro_error);
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (piccolo)</author>
		<pubDate>Wed, 21 Feb 2007 07:58:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So catching it and changing SCR_HEIGHT and SCR_WIDTH accordingly? Will see if I can add that:)</p><p>It all works like a charm now. Thanks alot for all the help:)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raf Vermeulen)</author>
		<pubDate>Wed, 21 Feb 2007 08:01:56 +0000</pubDate>
	</item>
</rss>
