<?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>Linux Game Publishing Blog</title>
	<atom:link href="http://blog.linuxgamepublishing.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.linuxgamepublishing.com</link>
	<description>Commercial gaming for Linux</description>
	<lastBuildDate>Sat, 28 Aug 2010 09:06:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Patches available for X³: Reunion, X²: The Threat, Sacred: Gold and Jets&#8217;n&#039;Guns</title>
		<link>http://blog.linuxgamepublishing.com/2010/08/24/patches-available-for-x%c2%b3-reunion-x%c2%b2-the-threat-and-sacred-gold/</link>
		<comments>http://blog.linuxgamepublishing.com/2010/08/24/patches-available-for-x%c2%b3-reunion-x%c2%b2-the-threat-and-sacred-gold/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 19:12:44 +0000</pubDate>
		<dc:creator>Eskild Hustvedt (Community Manager and Junior Developer)</dc:creator>
				<category><![CDATA[Official Announcements]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=444</guid>
		<description><![CDATA[Today we have released patches for X³: Reunion, X²: The Threat,  Sacred: Gold and Jets&#8217;n'Guns, to address issues with sound, and issues with some Linux kernel changes. These patches also fix the problem mentioned in the last customer service update. Use the lgp_update tool to update your games. Other games will be receiving patches as they [...]]]></description>
			<content:encoded><![CDATA[<p>Today we have released patches for <a href="http://www.linuxgamepublishing.com/info.php?id=35&amp;">X³: Reunion</a>, <a href="http://www.linuxgamepublishing.com/info.php?id=23&amp;">X²: The Threat</a>,  <a href="http://www.linuxgamepublishing.com/info.php?id=37&amp;">Sacred: Gold</a> and <a href="http://www.linuxgamepublishing.com/info.php?id=39">Jets&#8217;n'Guns</a>, to address issues with sound, and issues with some Linux kernel changes. These patches also fix the problem mentioned in the last <a href="http://blog.linuxgamepublishing.com/2010/08/18/customer-services-update-for-august-2010/">customer service update</a>. Use the lgp_update tool to update your games. Other games will be receiving patches as they become available.</p>
<p><em>Updated 26th of August: Patch for Jets&#8217;n'Guns released</em></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2010%2F08%2F24%2Fpatches-available-for-x%25c2%25b3-reunion-x%25c2%25b2-the-threat-and-sacred-gold%2F&amp;linkname=Patches%20available%20for%20X%C2%B3%3A%20Reunion%2C%20X%C2%B2%3A%20The%20Threat%2C%20Sacred%3A%20Gold%20and%20Jets%26%238217%3Bn%27Guns"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2010/08/24/patches-available-for-x%c2%b3-reunion-x%c2%b2-the-threat-and-sacred-gold/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Upcoming community event</title>
		<link>http://blog.linuxgamepublishing.com/2010/08/19/upcoming-community-event/</link>
		<comments>http://blog.linuxgamepublishing.com/2010/08/19/upcoming-community-event/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 20:56:27 +0000</pubDate>
		<dc:creator>Eskild Hustvedt (Community Manager and Junior Developer)</dc:creator>
				<category><![CDATA[Community]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=431</guid>
		<description><![CDATA[Right, so, obviously this is long overdue, and I take the blame for that, been too easily distracted. But now it&#8217;s time. identi.ca/twitter giveaways was obviously the most popular choice at 65% of the votes, so that&#8217;s what we&#8217;re going to do. For those of you that don&#8217;t already follow us, now would be a [...]]]></description>
			<content:encoded><![CDATA[<p>Right, so, obviously this is long overdue, and I take the blame for that, been too easily distracted. But now it&#8217;s time. identi.ca/twitter giveaways was obviously the most popular choice at 65% of the votes, so that&#8217;s what we&#8217;re going to do. For those of you that don&#8217;t already follow us, now would be a great time to do so. We&#8217;re <a href="http://identi.ca/LGP">LGP on identi.ca</a> and <a href="http://twitter.com/L_G_P">L_G_P on twitter</a>. We&#8217;re going to be running a retweet giveaway this following Monday, the 23rd, ending on Wednesday the 25th at around 18:00 CET. We will draw one random winner that will be given a free copy of a downloadable LGP game of his or her choice (our current downloadable titles are: <a href="http://www.linuxgamepublishing.com/info.php?id=23&amp;">X²: The Threat,</a> <a href="http://www.linuxgamepublishing.com/info.php?id=35&amp;">X³: Reunion</a>, <a href="http://www.linuxgamepublishing.com/info.php?id=37&amp;">Sacred: Gold</a>, <a href="http://www.linuxgamepublishing.com/info.php?id=39&amp;">Jets&#8217;N'Guns</a>, <a href="http://www.linuxgamepublishing.com/info.php?id=13&amp;">Ballistics</a>, <a href="http://www.linuxgamepublishing.com/info.php?id=8&amp;">Majesty: Gold</a>, <a href="http://www.linuxgamepublishing.com/info.php?id=41&amp;">Shadowgrounds</a> and <a href="http://www.linuxgamepublishing.com/info.php?id=40&amp;">Shadowgrounds: Survivor</a>).</p>
<p><em>If you have any input, suggestions or questions for me, feel free to ask them here in the comments, on IRC (Zero_Dogg in #lgp on irc.freenode.net), via <a style="color: #b85b5a; text-decoration: none;" href="http://identi.ca/LGP">identi.ca</a>/<a style="color: #b85b5a; text-decoration: none;" href="http://twitter.com/L_G_P">twitter</a> or via e-mail (to eskild at the domain linuxgamepublishing dot com).</em></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2010%2F08%2F19%2Fupcoming-community-event%2F&amp;linkname=Upcoming%20community%20event"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2010/08/19/upcoming-community-event/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Customer Services Update for August 2010</title>
		<link>http://blog.linuxgamepublishing.com/2010/08/18/customer-services-update-for-august-2010/</link>
		<comments>http://blog.linuxgamepublishing.com/2010/08/18/customer-services-update-for-august-2010/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 20:07:50 +0000</pubDate>
		<dc:creator>Eskild Hustvedt (Community Manager and Junior Developer)</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=428</guid>
		<description><![CDATA[Welcome to a issue 3 of the LGP customer services report for the LGP Blog.
Update: Patches are now available for X² and X³, the workarounds for these games are no longer needed. Ballistics might still need it.
Ballistics, X2 &#38; X3: Problems starting on Ubuntu 10.04
Several users have contacted us concerning problems starting Ballistics, X²: The [...]]]></description>
			<content:encoded><![CDATA[<p style="font-size: 1,05em;">Welcome to a issue 3 of the LGP customer services report for the LGP Blog.</p>
<p style="font-size: 1,05em;"><strong>Update:</strong> <a href="http://blog.linuxgamepublishing.com/2010/08/24/patches-available-for-x³-reunion-x²-the-threat-and-sacred-gold/">Patches are now available</a> for X² and X³, the workarounds for these games are no longer needed. Ballistics might still need it.</p>
<p style="font-size: 1,05em;"><strong><span style="text-decoration: underline;">Ballistics, X2 &amp; X3: Problems starting on Ubuntu 10.04</span></strong></p>
<p style="font-size: 1,05em;">Several users have contacted us concerning problems starting Ballistics, X²: The Threat and X³: Reunion.The problem is due to Ubuntu changing their system for managing ld.so paths and the games not handling it like they are suppose to. A patch will be released soon which addresses this problem, meanwhile you can use the following workarounds to play the games. Instead of just using the &#8220;ballistics&#8221;, &#8220;x2&#8243; or &#8220;x3&#8243; commands, use one of these to launch the game instead:</p>
<p style="font-size: 1,05em;"><strong><em>Ballistics:</em></strong></p>
<p style="font-size: 1,05em;"><code>ballistics --withgl $(\tail -n 1 /etc/ld.so.conf.d/GL.conf)</code></p>
<p style="font-size: 1,05em;"><strong><em>X²: The Threat:</em></strong></p>
<p style="font-size: 1,05em;"><code>x2 --withgl $(\tail -n 1 /etc/ld.so.conf.d/GL.conf)</code></p>
<p style="font-size: 1,05em;"><strong><em>X³: Reunion:</em></strong></p>
<p style="font-size: 1,05em;"><code>x3 --withgl $(\tail -n 1 /etc/ld.so.conf.d/GL.conf)</code></p>
<p style="font-size: 1,05em;">
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2010%2F08%2F18%2Fcustomer-services-update-for-august-2010%2F&amp;linkname=Customer%20Services%20Update%20for%20August%202010"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2010/08/18/customer-services-update-for-august-2010/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Which community events do you want?</title>
		<link>http://blog.linuxgamepublishing.com/2010/04/05/which-community-events-do-you-want/</link>
		<comments>http://blog.linuxgamepublishing.com/2010/04/05/which-community-events-do-you-want/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 14:50:32 +0000</pubDate>
		<dc:creator>Eskild Hustvedt (Community Manager and Junior Developer)</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[PenguinPlay]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=412</guid>
		<description><![CDATA[We have been hard at work on our unannounced ports the last couple of months, and I know some of you get rather impatient waiting for news. So, to help pass the time we&#8217;d like to see if there are any particular community events that you&#8217;d like to see. If you have other good ideas, [...]]]></description>
			<content:encoded><![CDATA[<p>We have been hard at work on our unannounced ports the last couple of months, and I know some of you get rather impatient waiting for news. So, to help pass the time we&#8217;d like to see if there are any particular community events that you&#8217;d like to see. If you have other good ideas, feel free to suggest them in a comment. Please vote only for events that you&#8217;d be likely to attend, you may select up to three.</p>
Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.
<p><em>If you have any input, suggestions or questions for me, feel free to  ask them here in the comments, on IRC (Zero_Dogg in #lgp on  irc.freenode.net), via <a href="http://identi.ca/LGP">identi.ca</a>/<a href="http://twitter.com/L_G_P">twitter</a> or via e-mail (to eskild at the domain linuxgamepublishing dot com).</em></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2010%2F04%2F05%2Fwhich-community-events-do-you-want%2F&amp;linkname=Which%20community%20events%20do%20you%20want%3F"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2010/04/05/which-community-events-do-you-want/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Getting gcc to warn you when you mess up stdargs</title>
		<link>http://blog.linuxgamepublishing.com/2010/01/20/getting-gcc-to-warn-you-when-you-mess-up-stdargs/</link>
		<comments>http://blog.linuxgamepublishing.com/2010/01/20/getting-gcc-to-warn-you-when-you-mess-up-stdargs/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 12:02:48 +0000</pubDate>
		<dc:creator>Michael Simms (CEO and head of Development)</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[printf]]></category>
		<category><![CDATA[stdargs]]></category>
		<category><![CDATA[warnings]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=405</guid>
		<description><![CDATA[Sometimes, you may write functions in C that do things in the same way as printf, using stdargs.
An example of this would be something like this short debug function
int ptf(const char *fmt,...)
{
  va_list varlist;
  FILE *fp=fopen("/tmp/debug","a");
  va_start(varlist,fmt);
  vfprintf(fp,fmt,varlist);
  va_end(varlist);
  fclose(fp);
}
This function isn&#8217;t rocket science, it just simply appends your [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, you may write functions in C that do things in the same way as printf, using stdargs.</p>
<p>An example of this would be something like this short debug function</p>
<pre>int ptf(const char *fmt,...)
{
  va_list varlist;
  FILE *fp=fopen("/tmp/debug","a");
  va_start(varlist,fmt);
  vfprintf(fp,fmt,varlist);
  va_end(varlist);
  fclose(fp);
}</pre>
<p>This function isn&#8217;t rocket science, it just simply appends your string into a file. It is a simple time saver utility.</p>
<p>However, using it can be a problem. You can do something like this</p>
<pre>int x=1;
ptf("Error %s\n",x);</pre>
<p>And gcc will say &#8217;sure, no problem&#8217;.</p>
<p>But running the code will always crash. It tries to interpret the integer as a string.</p>
<p>This is the kind of thing that should be picked up on by the compiler. And in fact it can be, quite easily.</p>
<p>In your prototype for the function, you would have something like</p>
<pre>extern int ptf(const char *,...);</pre>
<p>This is pretty standard, and no surprises there. However, gcc has the capability to be given a hint as to how this function should be handled. You can instead prototype the function using</p>
<pre>extern int ptf(const char *,...) __attribute__ ((format (printf, 1, 2)));</pre>
<p>This tells gcc to treat the parameters 1 and 2 as the parameters to printf (which it knows how to check for errors). It will then check parameter 1 (the format string) against what is passed in starting at parameter 2 (the &#8230;). If an incorrect data type is used, this will now be detected and flagged up as a warning, in exactly the same way as an incorrect type used in a printf.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2010%2F01%2F20%2Fgetting-gcc-to-warn-you-when-you-mess-up-stdargs%2F&amp;linkname=Getting%20gcc%20to%20warn%20you%20when%20you%20mess%20up%20stdargs"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2010/01/20/getting-gcc-to-warn-you-when-you-mess-up-stdargs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Becoming an LGP reseller</title>
		<link>http://blog.linuxgamepublishing.com/2010/01/14/becoming-an-lgp-reseller/</link>
		<comments>http://blog.linuxgamepublishing.com/2010/01/14/becoming-an-lgp-reseller/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 09:50:59 +0000</pubDate>
		<dc:creator>Michael Simms (CEO and head of Development)</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[reseller]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=394</guid>
		<description><![CDATA[We get a lot of emails about becoming a reseller for LGP. So, after dozens of individual answers to people, I&#8217;ve decided to write it all up into a blog article, so that the customer service guys can just point people here instead. Also, I thought it may prove interesting to those who are thinking [...]]]></description>
			<content:encoded><![CDATA[<p>We get a lot of emails about becoming a reseller for LGP. So, after dozens of individual answers to people, I&#8217;ve decided to write it all up into a blog article, so that the customer service guys can just point people here instead. Also, I thought it may prove interesting to those who are thinking &#8216;what can I do to help the awareness and spread of Linux games&#8217;.</p>
<p>We have tried to make it as easy as possible to become a reseller, and we encourage any company or individual who is interested to apply. You do not need to be rich to start a store, we have resellers that started with no advance money needed.</p>
<p><strong><span style="text-decoration: underline;">The different types of reseller</span></strong></p>
<p>When you decide to become an LGP reseller, you have a number of different options open to you.</p>
<ol>
<li><span style="text-decoration: underline;">Traditional reseller</span><br />
This kind of reseller operates in the time honoured tradition of buying stock from us at a discount, and reselling it to their customers. The same kind of reselling that has been going on for centuries in all industries. We offer these resellers a discount of around 40%, and we ask that they buy at least 10 games at a time. Not a huge amount, we like to set the barriers  to entry low.<br />
Of course, for the bigger buyer, there is incentive to buy more and get bigger discounts. The more games that you buy at once, the bigger your discount.</li>
<li><span style="text-decoration: underline;">Dropship reseller</span><br />
This kind of reseller is the type with the lowest barriers to entry. If you have a website and would like to sell LGP games, you can simply list all our games, right now if you like, and if you get any orders, simply have us ship them to your customers. You simply login to your reseller account, and buy the game with your credit card, and leave the rest to us.<br />
This system was set up specifically for those who want to &#8216;give it a try&#8217;, and who don&#8217;t want to spend money buying games they aren&#8217;t sure they will sell. Of course, with less risk is less profit. The discount for this kind of reselling method is around 30% instead of the 40% we offer for standard resellers.</li>
<li><span style="text-decoration: underline;">Download resellers</span><br />
This is, as many of you will know, our newest method of game distribution. We offer the ability, with some of our games, to buy a downloadable version of the game. The system for this works a little differently.<br />
When you sell a downloadable copy of a game, it is the responsibility of the reseller to supply the download to the customer. Whether that be as a disc image (which is how we supply the data to the resellers), an RPM, or any other method, that is up to the reseller. The reseller also needs to supply a key to unlock the game.<br />
The keys are the bit that you as the reseller would pay for. The discounts on keys are similar to the discounts for standard resellers, but they work a little differently. Instead of asking resellers to buy keys in advance (which they may of course do if they wish), we offer them the ability to buy &#8216;key credit&#8217; and then buy they keys in real time when a customer orders a game.<br />
The simple web-based system involves sending a request to our webserver, and if you have purchased enough key credit, then a new key is returned, and you can then provide that key to the customer.</li>
<li><span style="text-decoration: underline;">Private groups</span><br />
While not quite a reseller, private groups are also welcome to apply for discounts. Examples of such groups would be Linux User Groups, or companies that run Linux desktops who want to buy lots of copies of games for internal use.<br />
Private groups receive the same benefits as traditional resellers. The same discounts, but just aren&#8217;t listed on the website as places to buy our games (for obvious reasons). If you are part of a group that would like to buy games for your group at a discount, you should set up the standard reseller account with us.</li>
</ol>
<p>So, now you know what the options are, lets get into the mechanics of how.</p>
<p>The task of creating an account is actually very simple. You simply go to our <a href="http://www.linuxgamepublishing.com">website</a> and follow the &#8216;Account&#8217; link that you will see on every page of the site. From here, you can follow the correct path, and apply for an account.</p>
<p>Once accounts are created, we check them out, and authorise genuine resellers or groups. We are happy for anyone to apply, but if you are an online reseller, we ask that you have some kind of web infrastructure available for us to examine before you create your account. We generally do not open accounts for people who &#8216;will make a website soon&#8217;. Accounts that are authorised are generally authorised within 24 hours, or we will send you an email to let you know why they have been rejected (which happens rarely).</p>
<p>Each account is capable of any of the resale options described above, you do not have to open a type of account for downloads or for dropship. Just a reseller account.</p>
<p>So, now you know what is available, and how to do it. The last thing to know is why would you.</p>
<p>For three reasons:</p>
<ol>
<li><span style="text-decoration: underline;">For You</span><br />
If you own an online or physical store already, our products make a good addition to the lineup, and with the dropship system, you can add them at no risk.<br />
Even if you don&#8217;t, then starting reselling LGP games as a part time website owner, or even to your local Linux using friends, is a nice second income, and probably better than all these &#8216;get rich quick through Google&#8217; ads that you see all over the place.</li>
<li><span style="text-decoration: underline;">For Us</span><br />
Simply, because LGP needs as many resellers as we can get. We need as many people talking about our products as possible. The more games we sell, the more games we can make, and the more games we can make, the better it is for you, us, and everyone.</li>
<li><span style="text-decoration: underline;">For the Community</span><br />
Because games are, without doubt, the big block to Linux adoption on the desktop. Do you want everyone running Linux? So do we, and games help to make that happen.</li>
</ol>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2010%2F01%2F14%2Fbecoming-an-lgp-reseller%2F&amp;linkname=Becoming%20an%20LGP%20reseller"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2010/01/14/becoming-an-lgp-reseller/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Some gotchyas in porting from Visual C++ to g++</title>
		<link>http://blog.linuxgamepublishing.com/2009/12/03/some-gotchyas-in-porting-from-visual-c-to-g/</link>
		<comments>http://blog.linuxgamepublishing.com/2009/12/03/some-gotchyas-in-porting-from-visual-c-to-g/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 18:17:04 +0000</pubDate>
		<dc:creator>Michael Simms (CEO and head of Development)</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[forceinline]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[g++]]></category>
		<category><![CDATA[inline]]></category>
		<category><![CDATA[malloc]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[visual c++]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=385</guid>
		<description><![CDATA[Todays technical article is going to go into a couple of issues that we have run across porting from Visual C++ to g++.
I will say right now that I am an application developer, I don&#8217;t know the fine details of how the inner workings of the compilers work, so some of this is merely an [...]]]></description>
			<content:encoded><![CDATA[<p>Todays technical article is going to go into a couple of issues that we have run across porting from Visual C++ to g++.</p>
<p>I will say right now that I am an application developer, I don&#8217;t know the fine details of how the inner workings of the compilers work, so some of this is merely an educated guess as to WHY the problem happens, but the effect and solution is correct.</p>
<p>The first issue for today is a fairly rare situation where g++, upon hitting a certain piece of code that builds fine under Visual C++, gives the helpful error message:</p>
<pre><em>some/source/file.cpp:172: sorry, unimplemented: called from here</em></pre>
<p>Now, I don&#8217;t know about you, but I find that error message singularly unhelpful. It took some time to run this one down the first time. It seems  that g++ and VC++ perform some symbol resolution in different passes to each other. Because what this message is saying is that &#8216;at line 172, you have tried to use __forceinline, or something you reference has a member function that has __forceinline in it, but I do not know what the thing is, so I cannot inline it&#8217;.</p>
<p style="padding-left: 30px;"><span style="color: #ff6600;">EDIT: g++ does not have the __forceinline keyword. There is an equivalent which does the same job however</span></p>
<pre style="padding-left: 30px;"><span style="color: #ff6600;">#define __forceinline inline __attribute__((always_inline))</span></pre>
<p>As VC++ has no problem with the same calls, the only real answer must be a compiler difference that allows VC++ to get away with something that g++ doesn&#8217;t. The simple solution is to just change __forceinline to inline and let the compiler inline as it sees fit. Otherwise, you will need to hunt down the exact problem and resolve the order of events for g++</p>
<p>The second issue I thought I would raise today is one that actually happens quite commonly on porting from Windows to Linux. This is the case of bad memory management.</p>
<p>On Windows, the way memory is allocated allows for a certain sloppiness in code. While HIGHLY unrecommended, this is the sort of thing that happens in Windows code all the time. The following is a highly simplified example of the problem.</p>
<pre>char *str;
str=(char *)malloc(6)
strcpy(str,"hello");
free(str)
switch (str[0])
{
  ...
}</pre>
<p>Now, as you can see here, the application uses the variable str right after it has been free()&#8217;d. On Windows it seems that this kind of thing can be gotten away with. The memory manager on Windows is highly unlikely to either assign this memory address somewhere else, or to mark it as unavailable. On Linux however, you will often find that this kind of code leads immediately to a segmentation fault.</p>
<p>The example above is highly simplified, but illustrates what some of the more complex segmentation faults we have seen boil down to.  If you see an error like this, which works on Windows and not on Linux, check your order of accessing. I know it sounds obvious, but it happens so often in commercial code that I feel it is worth stressing &#8211; <strong>free memory only when you have REALLY finished with it</strong>.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2009%2F12%2F03%2Fsome-gotchyas-in-porting-from-visual-c-to-g%2F&amp;linkname=Some%20gotchyas%20in%20porting%20from%20Visual%20C%2B%2B%20to%20g%2B%2B"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2009/12/03/some-gotchyas-in-porting-from-visual-c-to-g/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Playing well with distros</title>
		<link>http://blog.linuxgamepublishing.com/2009/11/24/playing-well-with-distros/</link>
		<comments>http://blog.linuxgamepublishing.com/2009/11/24/playing-well-with-distros/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 13:51:57 +0000</pubDate>
		<dc:creator>Eskild Hustvedt (Community Manager and Junior Developer)</dc:creator>
				<category><![CDATA[Developer]]></category>
		<category><![CDATA[deb]]></category>
		<category><![CDATA[distro]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[packaging]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[tar.gz]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=155</guid>
		<description><![CDATA[We often get a question similar to &#8220;why don&#8217;t you create native packages?&#8221;. I&#8217;m going to make an attempt at answerring that.
Current Linux distros primarily use either RPM or DEB (and a load of other less common ones that are only used by a distro or two). Most deb distros are somewhat compatible, as most [...]]]></description>
			<content:encoded><![CDATA[<p>We often get a question similar to &#8220;why don&#8217;t you create native packages?&#8221;. I&#8217;m going to make an attempt at answerring that.</p>
<p>Current Linux distros primarily use either RPM or DEB (and a load of other less common ones that are only used by a distro or two). Most deb distros are somewhat compatible, as most of those are in one way or another based upon Debian. However, on the RPM side we&#8217;ve even got two completely different development trees of rpm itself, and a load of distros that are not compatible with each other. Last I checked (feel free to correct me here), most RPM distros let you install a 32bit package on a 64bit system, but last I tried I couldn&#8217;t do the same on a deb system. So now we&#8217;re up to three packages. One 32bit RPM, one 32bit DEB and one 64bit DEB. But now we&#8217;re assuming that all people have one of those two, but the fact is that they don&#8217;t (yes I know RPM is part of LSB, that doesn&#8217;t really guarantee that it is always present, nor properly set up). So we&#8217;re going to need another one anyway. We could go with a tarball, which at least gentoo and slackware will be used to, and possibly others, but for the others, well, we&#8217;ll either have to provide a lengthy technical README, or an installer. So, that&#8217;s five.</p>
<p>Now, consider that many of our games are several gigabytes, it is completely impossible for us to package all of them on the DVD. As far as I know, neither RPM nor DEB can have their payload as a separate and compatible file. Things could be copied in post-install hooks, but then we&#8217;re just about back to square one, as we&#8217;re pretty much bypassing the package manager anyway. As the installer could be made to use the tarball, we&#8217;ll need four full-size packages, and all of this is assuming that the package formats will stay compatible.</p>
<p>So to sum it up, not only would it be a lot of work to test and document it all, we&#8217;d still have to provide the packages we&#8217;re providing now to keep it accessible to everyone, but it would also take roughly four times the space, and I for one would not pay extra for a game to have four install DVDs containing the same game, just in several different installation formats, when one would suffice (yes yes, I know it would provide you with backups, but with the new copy protection system we have added you get free downloads of your game anyway, so that&#8217;s not a valid argument:).</p>
<p><em>If you have any input, suggestions or questions for me, feel free to ask them here in the comments, on IRC (Zero_Dogg in #lgp on irc.freenode.net), via <a href="http://identi.ca/LGP">identi.ca</a>/<a href="http://twitter.com/L_G_P">twitter</a> or via e-mail (to eskild at the domain linuxgamepublishing dot com).</em></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2009%2F11%2F24%2Fplaying-well-with-distros%2F&amp;linkname=Playing%20well%20with%20distros"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2009/11/24/playing-well-with-distros/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>argv and argc, and just how to get them</title>
		<link>http://blog.linuxgamepublishing.com/2009/10/12/argv-and-argc-and-just-how-to-get-them/</link>
		<comments>http://blog.linuxgamepublishing.com/2009/10/12/argv-and-argc-and-just-how-to-get-them/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 04:38:56 +0000</pubDate>
		<dc:creator>Michael Simms (CEO and head of Development)</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[argv]]></category>
		<category><![CDATA[assembler]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[constructor]]></category>
		<category><![CDATA[proc]]></category>
		<category><![CDATA[shared objects]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=353</guid>
		<description><![CDATA[argv and argc. They are vital parts of many programs. For the uninitiated, in many programming languages, they are the variables that hold the values typed into the commandline by the user. This article is about a particular problem we ran into trying to use them in a way that wasn&#8217;t really forseen. It really [...]]]></description>
			<content:encoded><![CDATA[<p>argv and argc. They are vital parts of many programs. For the uninitiated, in many programming languages, they are the variables that hold the values typed into the commandline by the user. This article is about a particular problem we ran into trying to use them in a way that wasn&#8217;t really forseen. It really only applies to C and C++</p>
<p>Now most C/C++ programmers are probably thinking &#8216;what is so hard, you get them when you start main, right&#8217;&#8230;</p>
<pre>int main(int argc,char **argv,char **envp)</pre>
<p>That&#8217;s true, and in virtually all cases, you can store these values, either in a class, a global variable, a function, whatever your programming style uses. And from then on, you can simply access them from anywhere in the program. Its really simple, and something that most programmers know how to do in their sleep.</p>
<p>But what do you do before main happens? Or what about if you don&#8217;t have a main()</p>
<p>I know, you always have a main and nothing runs before it.</p>
<p>But that is very not true. Lets take two examples</p>
<p>Firstly, in C++</p>
<pre>class gamedata
{
public:
  gamedata()
  {
    commandline=get_argv();
  }
  char **commandline;
}

static gamedata datastore;

int main(int argc,char **argv)
{
   set_argv(argv);
   ...
}</pre>
<p>To start, this looks OK. Sure, Ive missed out a whole bunch of things, assumed what the user functions set_argv and get_argv do. But it looks fine. Until you look again. That static class instantiation will run its constructor before main runs. How on earth can you POSSIBLY get argv at this stage??</p>
<p>Lets look at an example in C now</p>
<p>If you are creating a shared object, you will very often need to initialise it to ensure that its state is known for the first call into the objects functions.</p>
<pre>static char **commandline;

void __attribute__ ((constructor)) localinit()
{
  commandline=get_argv();
}</pre>
<p>Again, you try this, and you get a big nothing. This function is called before main runs, before you ever have access to the values.</p>
<p>So, what is the answer?</p>
<p>The answer is, unfortunately, ugly. There is, in Linux, no good way of doing this. There are two perfectly good symbols inside libc which do the job perfectly, __libc_argv and __libc_argc, which are defined way before the program gets to any user-created code. Unfortunately they are declared private and you as a user are not permitted to see them. So, another way is needed.</p>
<p>We came up with two ways to make it work. Neither are portable, and one of them, while it works just fine, does make me go ewww. I&#8217;ll leave it to your imagination which one makes me go ewww the most.</p>
<pre>char **get_argv()
{
  static char **preset_argv=NULL;

  if (!preset_argv)
  {
    FILE *fp;
    fp=fopen("/proc/self/cmdline","r");
    if (fp)
    {
      //Your implimentation to take the commandline as typed from this
      //file and turn it into argv. Its fairly basic
    }
  }
  return preset_argv;
}</pre>
<pre>char **get_argv()
{
  static char **preset_argv=NULL;

  if (!preset_argv)
  {
    extern char **environ;
    char ***argvp;
    void *p;
    asm ("mov %%esp, %0" : "=r" (p));
    argvp = p;
    while (*argvp != environ)
      argvp++;
    argvp--;
    preset_argv = *argvp;
  }
  return preset_argv;
}</pre>
<p>So, a little explaination</p>
<p>The first example relies on /proc, the part of the filesystem that you can get all sorts of interesting information from. /proc/self/cmdline is always an exact duplicate of the command typed to execute the application, or the exact value passed in from the menu option you clicked to get it working. I haven&#8217;t bothered to create the bit of code to separate out the commandline parts onto their components. Partly because that code is fairly straightforwards, and partly because it is quite long and dull (remember it isn&#8217;t just a case of separating by spaces, you have to take into account things grouped in quotes, and other fun stuff). This is not portable beyond Linux, and people keep telling me that not all Linux distros have /proc either.</p>
<p>The second example requires a tiny bit of assembler knowledge. It is portable across most unix flavours, but I expect trying it outside of unix will cause you much pain. It relies on the fact that a unix standard is to push the argc and argv values right onto the top of the stack when a program starts. The example reads from the top of the stack until it finds the environ value (which is globally available at all times), and then reads back one value to get the pointer to argv. This way has the advantage that the values are correctly parsed for quotes and the like already. It makes the assumption that environ is the next thing on the stack after argv. I have seen many reports claiming this is always true, but I cannot find the location of an authoritative piece of documentation saying that it is specified true and will not change in future.</p>
<p>It isn&#8217;t often that you will need to do this. Most of the time, argv and argc are perfectly usable in the way you will probably have been using them for years. Even the examples above can be &#8216;worked around&#8217; using initialisers called immediately after main() starts. But if one day, you come up against a problem where you need your argv where you usually don&#8217;t have access, I hope you find this post useful.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2009%2F10%2F12%2Fargv-and-argc-and-just-how-to-get-them%2F&amp;linkname=argv%20and%20argc%2C%20and%20just%20how%20to%20get%20them"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2009/10/12/argv-and-argc-and-just-how-to-get-them/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Give a name to the new addition to LGP</title>
		<link>http://blog.linuxgamepublishing.com/2009/10/05/give-a-name-to-the-new-addition-to-lgp/</link>
		<comments>http://blog.linuxgamepublishing.com/2009/10/05/give-a-name-to-the-new-addition-to-lgp/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 01:35:19 +0000</pubDate>
		<dc:creator>Michael Simms (CEO and head of Development)</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[poll]]></category>

		<guid isPermaLink="false">http://blog.linuxgamepublishing.com/?p=357</guid>
		<description><![CDATA[Just under two weeks ago, the LGP office had a visitor.

It seems that she has adopted us, as she spends pretty much all of her time in the office, and is a constant disruption to work. At every opportunity she loves to sit on keyboards &#8211; especially when typing is going on, and she is [...]]]></description>
			<content:encoded><![CDATA[<p>Just under two weeks ago, the LGP office had a visitor.</p>
<p><img class="alignnone size-full wp-image-362" title="Keyboard Cat" src="http://blog.linuxgamepublishing.com/wp-content/uploads/2009/10/kitten.jpg" alt="kitten" width="423" height="317" /></p>
<p>It seems that she has adopted us, as she spends pretty much all of her time in the office, and is a constant disruption to work. At every opportunity she loves to sit on keyboards &#8211; especially when typing is going on, and she is very insistent when she wants some attention, as you can see from the picture above when she decided to sit on my keyboard and demand my time.</p>
<p>I decided we weren&#8217;t going to name her until she had stuck around for a couple of weeks, afterall, she could have just wandered off again. But it does seem she is here to stay.</p>
<p>So, we have a few ideas for names, but we can&#8217;t quite decide which, if any, of them are right. So, I thought, lets get a bit of community involvement, and set up a name poll.</p>
<p>So, add your votes below, and if you have suggestions for a better name that isn&#8217;t on the list, add a comment, an if we like it, we&#8217;ll add it to the poll! You can choose multiple answers if you like.</p>
<p style="padding-left: 30px;">EDIT Oct 8th: Well, the poll has been going for just under 4 days now, and you can&#8217;t leave a cat without a name for too long! We will now be taking the top three, Qwerty, Switch, and CatMonster, and over the next week we&#8217;ll see which one seems to fit her best. The one that works best, we&#8217;ll name her, and update this post with the final result! Thanks everyone for your contribution, and I&#8217;m sorry I never got around to adding some of the new suggestions to the poll!</p>
<p style="padding-left: 30px;">EDIT Oct 16th: After a weeks trialling, one name is clearly a winner based on her personality and attitude and what comes naturally when talking to her. CatMonster! It is great as an all-purpose name that can have its start changed, so when she meows a lot she is a NoiseMonster, when she&#8217;s asleep she can sometimes be the SnoozeMonster. And when she sneezed a while ago she was the SnotMonster. All in all, CatMonster wins!</p>
Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.
<p>A bit of explanation as to some of these names&#8230;</p>
<ul>
<li>CatMonster: A bit like KateMonster from Avenue Q</li>
<li>Ceefer: Ceefer Cat. Say it aloud, you&#8217;ll get it.</li>
<li>Natasha: The whole Boris and Natasha thing, and she likes eating spiders (Boris the spider). Its a bit convoluted, but made the list</li>
<li>Piper: She&#8217;s a mouser. So from the Pied Piper. Also has a nice link in to the &#8216;Charmed&#8217; TV show</li>
<li>Quark: She loves having her ears scratched, so a Ferengi name was needed!</li>
<li>Qwerty: She is a keyboard cat. Obvious really</li>
<li>Splodge: I mentioned the new addition to my mother on the phone a week or so ago, and she insisted this be the new name.</li>
<li>Spot: Another Star Trek reference. Data&#8217;s cat.</li>
<li>Switch: Her favourite place to sit is on the office gigabit switch. Its warm and by the window. Also a Matrix tie-in</li>
<li>UsrBin: /usr/bin/cat. OK so cat is usually in /bin but you can&#8217;t call a cat just Bin</li>
</ul>
<table border="0">
<tbody>
<tr>
<td><img class="alignnone size-full wp-image-372" style="margin-left: 2px; margin-right: 2px;" title="cat on switch" src="http://blog.linuxgamepublishing.com/wp-content/uploads/2009/10/cat11.jpg" alt="cat11" width="240" height="320" /></td>
<td><img class="alignnone size-full wp-image-373" title="cat and mouse" src="http://blog.linuxgamepublishing.com/wp-content/uploads/2009/10/cat2.jpg" alt="cat2" width="240" height="320" /></td>
</tr>
</tbody>
</table>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.linuxgamepublishing.com%2F2009%2F10%2F05%2Fgive-a-name-to-the-new-addition-to-lgp%2F&amp;linkname=Give%20a%20name%20to%20the%20new%20addition%20to%20LGP"><img src="http://blog.linuxgamepublishing.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.linuxgamepublishing.com/2009/10/05/give-a-name-to-the-new-addition-to-lgp/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>
