Thursday, February 21, 2008

Jade Empire: The Installer.

I recently tried to install Jade Empire. So far it has taken over 2 hours. The most annoying part of it is that a majority of the time it is doing nothing! Absolutely Zero processor usage! It’s as if the programmers decided it was a good idea to add a few random calls to wait/sleep. This makes me angry, I don’t sit down after a long day at work and say “what game do I want to watch install today?” I remember my dad once said playing games is a waste of time, so far Jade Empire has proven him right.

Update: It was the DVD drive I used that Jade Empire did not like.

Tuesday, February 19, 2008

Creating Unions in C#

Here is a Small trick to create a C/C++ like union in C#.

          You have to use the StructLayout attribute applied to the class. the StructLayout attribute needs to be passed the parameter LayoutKind.Explicit. This makes it so you can declare the exact offset in the number of Bytes each field will have. Naturally you will need to use another attribute for each of the fields to specify this offset; the name of this attribute is FieldOffset. Both of these Attributes are in the System.Runtime.InteropServices namespace.



Here is an example where 2 32bit integers will share the same memory address as a 64bit integer.


using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Explicit)]
public
struct PairID
{
[FieldOffset(0)]
public
long Id;
[FieldOffset(0)]
public
int LowId;
[FieldOffset(sizeof(int))]
public
int HighId;
}

Decided to Create a Blog.

I have decided that I should finally make a blog, though I don’t really have time to maintain one. People around me have started to show signs that I annoy them with my ideas, so I decided to see if the internet that is comprised of complete and utter strangers will care about my random thoughts.